RCA COSMAC Operator's Manual page 21

Microkit
Hide thumbs Also See for COSMAC:
Table of Contents

Advertisement

MEMORY
LOCATION
01
02
04
06
09
OC
OF
12
15
18
19
lA
lD
IE
IF
21
23
25
26
27
HEX CODE
STORED
90
B2 A2
B5 B6
F8 81 B3
F8 3E A7
F8 9C B7
F8 26 A6
F8 16 A5
D5
87 A3
D3
56
87 A3 D3
E6
F7
3B 23
9F 56
97 A3
D3
00
30 16
COMMENTS
Clear D. (Since RO.l is assumed to be 0.)
Clear R2.
M(O) is the free RAM location.
Also clear upper halves of local pointers.
Initialize upper half of I/O call program
counter.
Lower half of READ entry (' 3E') saved in R7.0.
Lower half of TYPE entry ('9C') saved in R7.l.
R6 now points to 0026 (the immediate TYPE byte).
RS, now initialized to 0016, is ready to be the
new local program counter.
Switch P from 0 to 5
Call READ.
Input character to D and to RF.l.
Save first char in immediate byte location.
READ second character to D and to RF.l.
X now points to first character.
D - M(R(X))
~
D.
Subtract first from second.
Exit to print the first character if it is
largest.
Second character to output argument location.
R3 now points to TYPESD (at 8l9C).
Call TYPE.
Output byte in next location (0026).
Immediate byte argument and save location.
Loop for another pass.
FIG. 2 Elementary Hexadecimal Program Example
- 15 -

Advertisement

Table of Contents
loading

Table of Contents