home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 2
/
002.d81
/
p_p_s#3
< prev
next >
Wrap
Text File
|
2022-08-26
|
3KB
|
161 lines
PEEK/POKE/SYS -- Part 3
==== ==== === ==== =
======= Continued from Part 2 ========
As an example of modifying BASIC,
copy BASIC to RAM as described in Part
2. Don't switch in the RAM BASIC yet.
Now do the following:
READY.
POKE 41848, ASC("H")
READY.
POKE 41849, ASC("O")
READY.
POKE 41850, ASC("W")
READY.
POKE 41853, ASC("!")
READY.
Finally, switch in the RAM BASIC with
POKE 1, PEEK(1) AND 254. The RAM BAS-
IC's "READY." prompt has been changed
to "HOWDY!" Now re-enable the normal
ROM version of BASIC with POKE 1, PEEK
(1) AND 254 OR 1. The prompt changes
back to "READY."
A more significant change can be
made by POKE 46991, 5. This modifies
the RAM BASIC's ASC() function so that
instead of causing an ?ILLEGAL QUANTI-
TY ERROR if the argument evaluates to
a null (empty) string, it simply re-
turns a value of 0. With this change
made, you no longer need to do an A =
ASC(A$ + CHR$(0)), just an A = ASC(A$)
to get the ASCII value of A$, no mat-
ter what value A$ is. This is really
handy when reading files from disk or
tape, since the GET# statement changes
an incoming CHR$(0) to a null string!
Of course, a null string isn't really
an ASCII NUL (CHR$(0)) byte, and that
is why Commodore made the ASC function
the way it is, but sometimes getting
an ?ILLEGAL QUANTITY ERROR over a null
string can really wreck your day!
LORAM can also be used to allow o-
ther languages to exist without BASIC
just sitting there taking up space.
If the HIRAM bit is set to 0, the
Kernal ROM is replaced by RAM at $E000
-$FFFF. Since BASIC needs the Kernal
to operate, it makes no sense to leave
the BASIC ROM on, so it is switched
out as well. If both HIRAM and LORAM
are set to 0, then the 4K space at
$D000-$DFFF normally taken up by the
I/O chips is also replaced by RAM, re-
sulting in a true 64K RAM machine. Of
course, without I/O chips, the compu-
ter is blind, deaf and (almost) dumb.
The most it can do is display text on
the screen, but it can't even specify
the color of the text! (The text may
thus be invisible!) So generally,
this RAM is used only for routines and
buffers that are used briefly and need
no I/O. CHAREN has no effect on the
$D000-$DFFF space when the I/O chips
are de-activated in this manner.
LORAM and HIRAM can do other things
as well, if there is a device plugged
into the Expansion (Cartridge) slot.
Devices using this slot have access to
two other lines, called GAME and EXROM
which, in combination with LORAM and
HIRAM, allow 8 different memory con-
figurations of the 64. See the sec-
tion 'Memory Management on the Commo-
dore 64' of Chapter 5, 'BASIC to Ma-
chine Language' , pages 260 - 267 of
the 'Commodore 64 Programmer's Refer-
ence Guide' for more information.
-------------<continued>--------------
<x to exit>