Commodore 128 Programmer's Reference Manual page 212

Hide thumbs Also See for 128:
Table of Contents

Advertisement

202
COMMODORE 128
U
Here is the corresponding program in C64:
L->
u
10 ALPHA=8192
20
FOR
1=0 TO
19
40
:
READ A
50
:
POKE ALPHA+I,A
60
NEXT
80
PRINT"ALL DATA IS NOW IN MEMORY"
85
FOR 1=1 TO 2500:NEXT
90
SYS
8192
1000 DATA 162,0,169,32,157,0,4,157,0,5,157,0,6,157,231,6
2000 DATA 232,208,241,96
WHERE TO PLACE MACHINE
LANGUAGE PROGRAMS IN MEMORY
The Commodore 128 has 128K of RAM memory, divided into two 64K RAM banks.
Much of the 128K of RAM is overlaid by ROM, but not at the same time. The
Commodore 128 memory is layered, so RAM is beneath the overlaid ROM. The
designers of the Commodore 128 have managed to squeeze 28K of ROM and 128K of
RAM into 128K of address space. Only one bank is available or mapped in at a time,
since the highest address an 8-bit microprocessor can address is 65535 ($FFFF).
However, because the C128 is capable of banking RAM and ROM in and out so fast, it
may seem as though 128K is always available.
In the portions of memory shared by RAM and ROM, a read operation returns a
ROM data value and a write operation "bleeds through" to the RAM beneath the
layered ROM. The data is stored in the RAM memory location. If the data in RAM
beneath the ROM is a program, the ROM on top must be switched out before the
program in RAM can be executed. The RAM and ROM layout in memory is all
regulated and controlled through the Configuration Register (CR) of the Memory-
U
When you run this program, the computer READs the DATA, POKEs it into
I
memory, and executes the machine language, clear-screen subroutine with the SYS
U
command. After you RUN the program, enter the machine language monitor (assuming
you are currently in C128 mode) and disassemble the code in the range $2000 through
j j
$2015 with this command:
[J
D 2000 2015
Notice that the subroutine you POKEd in through BASIC is the same as the
I
subroutine that appears in Figure 7-1. The two different methods accomplish the same
^
goal—programming in 8502 machine language.
u
u
LJ

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents