Commodore 128 Programmer's Reference Manual page 210

Hide thumbs Also See for 128:
Table of Contents

Advertisement

200
COMMODORE 128
U
u
The second example, in C64 mode, uses a FOR. . . NEXT loop to
enter the data. This requires you to know how many data items are in the data
list. You can add an IF ... THEN statement to check for a terminator value
| j
like -999, as in the first example. However, this method illustrates a different
jj
way of accomplishing the same thing.
5.
The final step in entering machine language subroutines through BASIC is
| ,
executing the subroutine with the SYS command. Add line 90 to your BASIC
M
routines above as follows:
90 SYS 8192
i t
I
This command executes the machine language routine that you POKEd into
LJ
memory starting at location 8192.
Although the DATA statement in the example in Step 4 does not show it, all
|J
machine language subroutines must end with an RTS instruction so you can return to
BASIC. The decimal code for an RTS machine language instruction is 96. Your last
decimal data item in the final data statement in your program must be 96, unless you use
a terminator like -999; then -999 will be your last decimal data item.
^
Figure 7-1 shows a step-by-step translation from the machine language screen-
clear routine as it appears in the monitor and a complete program that mixes the clear
I j
screen routine with the BASIC program that POKEs in the data and executes the
LJ
machine language subroutine. It only operates in the 40-column (VIC) screen.
u
u
u

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents