Commodore PET User Manual page 344

Table of Contents

Advertisement

The PET BASIC interpreter can be used to locad an assembly language
program into the selected area of memory. The process is a rudimentary one.
consisting of POKEing the decimal equivalents of the 6502 machine
language instructions. To get the instructions in decimal. vou can write vou pro-
gram in 6502 assembly language (reference manuals are listed in an appendixl.
hand code it into hexadecimal. and then convert the hexadecimal codes to
decimal. Commodore's Terminal Interface Monitor (available on cassette from
Commodore if it is not built into your PET) stores the hexadecimal codes directly.
However, with the Monitor vou must load the assembly language routine sepa-
rately from the BASIC program, whereas by POKEing vou can load the assembly
language routine as part of executing the main program written in BASIC. (The
PET is suitable for implementing only small portions of the program in assembly
language.) DATA statements are used to define the machine language codes.
which can be subsequently READ into the program and passed to a POKE loop.
Control is transferred to an assembly language program in one of two
ways: the SYS command or the USR function. They are more or less in-
terchangeable. but SYS is geared to turning control over to an assembly language
program. whereas USR is a true function reference that allows a value to be sent
to the called assembly language routine and a value returned by it to the main
program.
The assembly language program must return control back to BASIC via
a Return-From-Subroutine (RTS) instruction.
SYS
SYS is a system function that transfers program control to an independent
subsystem.
Format:
SYS (add ress)
where:
address
is a numeric constant. variable. or expression
representing the starting addess at which ex-
ecution of the subsystem is to begin. The value
must be in the range 0
~
address
~
65535.
Unlike other functions. SYS can be specified alone in a direct or program
statement.
331

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents