Machine Language Programming - RCA COSMAC Operator's Manual

Microkit
Hide thumbs Also See for COSMAC:
Table of Contents

Advertisement

MACHINE LANGUAGE PROGRAMMING
With an understanding of the details of the
COS~~C
CPU
and the material provided thus far, the reader is pre-
pared to begin using the Microkit in an elementary way.
For example, it is now possible to understand and pos-
sibly modify the time-out test program presented earlier
in this document.
However, virtually any hexadecimal
(machine language) test program which the user may want
to write will require some I/O facilities (e.g., use of
the I/O typewriter).
In this connection, we present
here some initial examples of how internal features of
UT2 can be utilized to reduce the user's programming
burden.
A more detailed description of the calling se-
quences of the various UT2 routines which may be of use
to the user are provided later.
To read a character from the I/O typewriter, the user
program should transfer control to READ* (in UT2), at
location 813E, making sure that R2 is pointing at a free
RAM location (say, 0000).
After the typed character is
read, the UT2 routine will return by setting P to 5,
i.e., by executing the instruction D5 (making it most
convenient if the P of the calling routine were 5 to
begin with).
The ASCII code for the input character
(with a
a
parity bit) will be in RF.I and also in D.
The memory location pointed at by R2 as well as registers
RE, RF, X and DF will have been changed in value (not
preserved over the call).
The READ routine normally uses R3 as its program counter,
so it is most convenient to branch to READ via a D3
instruction.
R3.0 will also return with a modified value.
All other register contents will not be changed by the
call.
Since the READ routine uses the values in registers
RC and RE which it has previously initialized, it is
essential that the user refrain from using these registers.
To cause a character to be typed onto the I/O typewriter,
the user program should transfer control, to TYPE5D (in UT2),
at location 8l9C, via a D3
instruction~
again making sure
that R2 is pointing at a free RAM location.
As discussed
earlier, the calling P value should be
5
and, for this case,
the ASCII code for the output character should be an
immediate byte (i.e., the byte after the D3 call).
After
typing the character, UT2 will advance R5 past the argument
byte and again return
vi~
a D5 execution.
M(R2), as well
as registers RE, RF, X, D, DF and R3.0 will return altered.
All other register values will be preserved.
(For the
reasons mentioned earlier, the user should again refrain
from using registers RC and RE.)
* A list of key UT2 symbolic locations and their corresponding
absolute memory addresses appears in Table 2 on p.30, where
UT2 calling sequences are discussed in greater detail.
- 13 -

Advertisement

Table of Contents
loading

Table of Contents