Commodore 128 Programmer's Reference Manual page 213

Hide thumbs Also See for 128:
Table of Contents

Advertisement

n
i i
MIXING MACHINE LANGUAGE AND BASIC
203
n
} '
Management Unit (MMU). For detailed information, refer to the sections on the
Registers of the Memory Management Unit (specifically, the discussion of the Configu-
P|
ration Register) in Chapter 13.
WHERE TO PLACE MACHINE LANGUAGE ROUTINES
H
IN CONJUNCTION WITH
BASIC
! !
Within BASIC, the operating system takes care of the mapping in and out of ROM and
^
RAM. The C128 operating system provides sixteen (default) memory configurations.
They each contain different values in the Configuration Register; therefore, each has a
different configuration. This gives you sixteen different configurations of memory to
choose from. Figure 7-2 lists the sixteen default memory configurations available under
the control of the BASIC language.
s
BANK
0
1
2
1
3
4
5
6
7
8
9
10
11
12
13
14
15
CONFIGURATION
RAM(O) only
RAM(l) only
RAM(2) only
RAM(3) only
Internal ROM, RAM(O), I/O
Internal ROM, RAM(l), I/O
Internal ROM, RAM(2), I/O
Internal ROM, RAM(3), I/O
External ROM, RAM(O), I/O
External ROM, RAM(l), I/O
External ROM, RAM(2), I/O
External ROM, RAM(3), I/O
Kernal and Internal ROM (LOW), RAM(O), I/O
Kernal and External ROM (LOW), RAM(O), I/O
Kernal and BASIC ROM, RAM(O), Character ROM
Kernal and BASIC ROM, RAM(O), I/O
_.
Figure 7-2. Bank Configuration Table
If you want to place a machine language subroutine in memory while the BASIC
""]
language is running, put the subroutine in a bank that contains RAM, preferably bank 0
|
since this bank is composed entirely of RAM. If you place the machine language
subroutine in a bank other than 0, not all of the RAM is available for pro-
n
grams, since ROM overlays some of the RAM. You must check the value of the
Configuration Register within that bank to see which addresses within these banks
contain ROM. Check the value of the Configuration Register within each of the sixteen
configurations and compare the value with the table in Figure 13-5 to see exactly where
"]
ROM maps in.
.
r> A cm
Follow this procedure when calling machine language subroutines from BASIC:

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents