EasyManua.ls Logo

Radio Shack TRS-80 Model 3 - Page 201

Radio Shack TRS-80 Model 3
276 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
USR(x)
This function lets
you
call a machine-language subroutine and then continue
execution
of
your
BASIC program.
"Machine
language" is the low-level language used internally by your Computer.
Itconsists
of
Z-80
microprocessorinstructions. Machine-language subroutines are
useful for special applications (things you
can't
do in BASIC) and simply because
they can do things very fast (like white-out the Display).
Writing
such
routines requires familiarity with assembly-language programming
and with the
Z-80
instruction set.
For
more information on this subject, see the
Radio
Shack
book,
TRS-80Assembly-Language Programming,
by
William Barden,
Jr.,
and
the instruction manual for Radio
Shack's
EDITOR-ASSEMBLER (26-2002).
Gettingthe USR routine into memory
1.
You
shouldfirst reserve the area in high memory where the routine will be
located. This is
done
immediately afterpower-up by answering the MEMORY
SIZE?
question with the address preceding the
start
addressofyour USR
routine.
For
example,
if
your
routine starts at 32700, then type 32699 in
response to
MEMORY SIZE?
2.
Then
load the routine into memory.
A.
Ifit
is stored
on
tape in the SYSTEM format (created with
EDITOR-ASSEMBLER),
you
must load
it
viathe SYSTEM
command,
as
describedin
Chapter
2. Afterthe tape has loadedpress
(BREAK)
to return to
the
BASIC immediate mode.
B.
If
itis a shortroutine, you may simply want to POKE it into high memory.
Telling BASIC where theUSR routine starts
Beforeyou
can
make
the USR call, you have to tell BASIC the entry address to the
routine. Simply
POKE the two-byte address into memory locations 16526-16527:
leastsignificantbyte
(LSB) into 16526, mostsignificant byte (MSB) into 16527.
For
example,
if
the entry point is at 32700:
32700
decimal = 7FBC hexadecimal
LSB = BC hexadecimal = 188 decimal
MSB = 7F hexadecimal = 127 decimal
Souse the statements:
POKE 16526, 188
POKE 16527, 127
totell BASIC thatthe USR routine entry is at 32700.
8/7

Related product manuals