SYS(826)
55 SYS(826)
126 SYS(A+14)
Examples:
ln immediate mode transfer control of the
system
to
the 6502 machine language
program beginning at memory location
826 (the 2nd cassette buffer).
Same
as
above
but
executed in program
mode. On return, execution proceeds
with
the first statement
in
sequence
following
the
SYS
statement.
Transfer control of the system
to
the com-
puted address
A+14.
SYS
is
the assembly language subroutine equivalent to a GOSUB but
with
the
important
difference
that
the safeguards
built
in
to
PET
BASIC to protect the
system from user program errors are no longer operable once control has been
released by execution
of
a
SYS
(or
USR).
The system
will
tend
to
crash even more
frequently debugging assembly language programs than it does debugging
BASIC program.
Values can
be
passed between the BASIC program and the
SYS
subroutine
using
PEEKs
and
POKEs
(for the BASIC program) to known memory locations.
USR
USR
is
a system function
that
passes a parameter to a user-written assem-
bly language subroutine whose address
is
contained in memory locations 1 and 2
and fetches a return parameter from the subroutine.
Format:
USR(arg)
where:
Examples:
arg
is
the parameter value passed to the subroutine.
?USR(60) Prints in immediate mode the value returned by
the
USR
subroutine when passed a value of 60.
105 A=USR(60) Same
as
above
but
in
program mode.
210
IF
USR(X)<4
GOT050
510 SM=USR(XA)+USR(3.4)+SQR(Y)+7T
Before making a USR reference. the beginning addess
of
the assembly
language subroutine must be placed into memory locations 1 and 2. For ex-
ample. if the subroutine
is
located in the cassette
#2
area. vou
would
include the
instructions:
10
POKE
1,58
20
POKE
2.3
Low High
since 8261O=033A16.
3A16=581O
and
0316=310.
332