Commodore 128 Programmer's Reference Manual page 214

Hide thumbs Also See for 128:
Table of Contents

Advertisement

204
COMMODORE 128
U
1.
Place the subroutine, preferably in bank 0, either through the monitor or by
LJ
POKEing in the code through BASIC. If the Kernal, BASIC, and I/O are
required, execute your program from configuration (BASIC Bank) 15. If you
\ I
enter the subroutine through the monitor, place the routine in bank 0 by
[J
placing the digit 0 before the 4-digit hexadecimal address where the instruc
tions are stored. If you are POKEing the codes in through BASIC (not the
,
preferred method), issue the BANK 0 command within your program, assum-
i j
ing you are placing the routine into BANK 0; then POKE in the decimal data
for the opcodes and operands. The recommended memory range to place
machine language routines in conjunction with BASIC is between $1300 and
j j
$1BFF. The upper part of BASIC text is also available, provided your BASIC
LJ
program is small and does not overwrite your routine.
2.
Now, to process the rest of your BASIC program, return to bank 15 (the
ri
default bank) with this command:
!
BANK 15
3.
Now call the subroutine with the SYS command. SYS to the start address
| j
where the first machine language instruction of your program is stored in
LJ
memory. In this case, assume the subroutine starts at hex location $2000
(assuming the VIC bit map screen is not used) and enter:
| |
SYS 8192
U
The RAM in configuration 0 in Figure 7-2 is the same RAM that appears in configura
tions (BANKS) 4, 8, 12, 13, 14, and 15. For example, you can enter programs into
I f
BANK 15, but you must make sure that no ROM overlays your program area.
LJ
NOTE: If you plan to return to BASIC, make sure your subroutine ends
with an RTS instruction.
WHERE TO PLACE MACHINE LANGUAGE
i j
ROUTINES WHEN BASIC IS DISABLED
U
When you are programming in machine language and you don't require the services of
i s
the BASIC ROM, you can disable BASIC by mapping out the BASIC ROMs. Do this
by placing certain values into the Configuration Register in your own machine language
routines as follows:
LDA #$0E ;Set up the Configuration Register value
j |
STA $D501
;Write to Preconfiguration Register A
^
STA $FF01
;Write to LCR A to change value of CR
You can use this sequence:
j j
LDA #$0E
^
STA $FF00
When you switch out BASIC, the sixteen default configurations no longer exist
U
u

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents