home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 5
/
005.d81
/
p_p_s#9
< prev
next >
Wrap
Text File
|
2022-08-26
|
3KB
|
138 lines
PEEKs, POKEs, and SYSes -- Part 9
by Jimmy Weiler
======================================
Location: 43-44 Hexadecimal: $002B-2C
Official Label: TXTTAB Type: RAM
Useful BASIC commands: PEEK, POKE
These two bytes contain the address of
the start of the BASIC program in
memory. Their normal value is $0801
(that's $08 in 44, and $01 in 43).
By messing with TXTTAB you can make
your Commodore load BASIC programs
anywhere in memory you want them.
Among the tricks you can perform
are: using one program as a
subroutine of another; hiding a
tiny program in cassette input buffer;
or moving TXTTAB to the middle of your
program to make high-numbered routines
run faster.
Just use this formula to load a
program beyond the end of the program
presently in memory:
clr:poke43,peek(45):poke44,peek(46):
poke peek(43)+peek(44)*256-1,0
Then load the program from disk as
usual. To reconnect to the original
program, poke 43,1:poke 44,8.
WARNING!!! Do NOT save the first
program after you restore it. If you
do you will save ALL the programs you
had in memory at once.
======================================
Location: 45-46 Hexadecimal: $002D-2E
Official Label: VARTAB Type: RAM
Useful BASIC commands: PEEK, POKE
VARTAB tells you where in memory you
find the variables your program has
used. This is significant, 1: because
it just is, and 2: because I say so.
You can use VARTAB indirectly with
TXTTAB (43-44) to find the size of
the program in memory [size = peek(46)
*256+peek(45)-peek(44)*256-peek(43)].
You can also use it to directly PEEK,
to read, or POKE to modify variables.
(This is more commonly done in
machine language routines than with
BASIC PEEKS and POKES.)
======================================
Location:160-2 Hexadecimal: $00A0-A2
Official Label: TIME Type: RAM
Useful BASIC commands: PEEK, POKE, ti$
This is the real time jiffy clock.
160 increments every 18 minutes, 8
seconds. 161 increments every 4.26
seconds. 162 increments 60 times per
second.
The reserved variables ti$ and ti
are developed from the TIME counter.
You can set the time counter to
whatever value you want by setting ti$
to the equivalent value (hhmmss), or
by POKEing 160-162 with the desired
values.
Just remember that 160-162 is the
actual count of elapsed jiffies
(60th's of a second), and ti$ must
be set to a six character string.
(ti$="012500" means time =1:25)
-------- continued in PART 10 --------