Radio Shack TRS-80 Trsdos & Disk Basic Reference Manual page 108

Micro computer system
Hide thumbs Also See for TRS-80:
Table of Contents

Advertisement

DISK BASIC
ROM
Calls
CALL OA7FH
JP
0A9AH
Puts the
USR
argument
into
the
HL
register pair;
H
contains
msb,
L
contains
lsb.
This
CALL
should
be
the
first
instruction
in
your
USR
routine.
Use
this
JUMP
to return to
BASIC;
the
integer
in
HL
becomes
the
output of
the
USR
call.
If
you
don't care
about
returning
HL,
then execute
a
simple
RETurn
instruction instead
of
this
JUMP.
Examples:
Listed
below
is
an assembled machine-language
routine that
will
accept the
argument from
the
USR
call
in
BASIC,
left-shift
it
one
position,
and
return the
result
to
BASIC.
00100
.;
08110
i
SHIFT FUNCTION
00120
i
00130
.;
MACHINE CODE PROGRAM TO
1
LEFT SHIFT
£i8140
.;
RN ARGUMENT SENT FROM BR SIC AND RETURN
00150
.;
THE RES ULT BACK TO
BR!
SIC
80160
.;
7D00
00170
00180
J
ORG
7D88H
00190
;
EQUATES RND ENTRV POINTS
00200
i
8A7F
00210 GETARG
EQU
8R7FH
;GET
ARGUMENT FROM BASIC
8A9A
00220
00230
PUTRNS
EQU
8R9RH
;
RETURN ANSWER TO BASIC
7D00 CD7F8A
00240 SHIFT
CALL
GETflRG
;GET NUMBER FROM BASIC
7D83 CB15
00250
RL
L
;
SHIFT
L
7D05 CB14
88260
RL
H
;
SHIFT
H -
ANSWER
IN
HL
7D07 C39A8A
00270
00280
JP
PUTRNS
i
RETURN TO BASIC
W
ANSWER
7D00
08298
END
SHIFT
The
following
program
includes the
decimal
code
for
the
SHIFT
routine.
The
code
is
POKEd
into
RAM
and
then accessed
as a
USR
routine.
RUN
the
program;
to stop, enter a value
of
zero.
Note:
The
following
two
BASIC
programs
require that
you
reserve
memory
addresses
above
31999
for
the
USR
Code.
(Answer
MEMORY
SIZE?
with 31999.)
7-22

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents