Commodore 128 Programmer's Reference Manual page 195

Hide thumbs Also See for 128:
Table of Contents

Advertisement

!
i
t
1
)
i
HOW TO ENTER MACHINE LANGUAGE PROGRAMS INTO THE COMMODORE 128
185
pressing the X key and
RETURN
. This places you back within the control of the
BASIC language. Next, issue the SYS command and reference the starting address in
decimal as follows:
BANK 15
SYS 6144
This SYS command is the same as the GO command (G F1800) example above.
The BANK 15 command and the leading F in the 5-digit hexadecimal number F1800
^
specify memory configuration 15. The Kernal, BASIC and other ROM code are
P|
resident in this configuration. The only difference is that it executes the machine
i \
language routine from BASIC, instead of within the monitor.
The machine language routine given below clears the text screen. Starting at
p
location 1024 ($0400), the value 32 ($20) is stored in each screen location. The
] j
character string value 32 is the space character, which blanks out each character position
on the screen. When finished, an RTS instruction returns control to BASIC. Here's the
main BASIC program and the machine language screen-clear subroutine as it appears in
I
the machine language monitor.
I
j
10 FOR 1= 1 TO 25
I
20 PRINT"FILL THE SCREEN WITH CHARACTERS"
30 NEXT
40 PRINT:PRINT
50 PRINT"NOW CALL THE MACHINE LANGUAGE"
I
60 PRINT" ROUTINE TO CLEAR THE SCREEN"
J
70 SLEEP 5
! *
80 SYS DEC("1800")
90 PRINT"THE SCREEN IS NOW CLEARED"
READY.
MONITOR
PC
;
FB000
.
01800
.
01802
.
01804
.
01807
.
0180A
.
0180D
.
01810
.
01811
.
01813
SR
00
A2
A9
9D
9D
9D
9D
E8
DO
60
AC
00
00
20
00
00
00
E7
Fl
XR
00
04
05
06
06
YR
SP
00 F8
LDX
LDA
STA
STA
STA
STA
INX
BNE
RTS
#$00
#$20
$0400,X
$0500,X
$0600,X
$06E7,X
$1804
In this sample program, the SYS command executes the subroutine to clear the
text screen. Once the text screen is cleared, control of the microprocessor is returned to
BASIC by the RTS instruction, and the READY prompt is displayed.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents