CARDTRAN Syntax

CARDTRAN Interpreter

Pseudo CARDTRAN command syntax described here is likely the first ever pseudo language developed for an 1802 like system. It runs on a FRED1 which uses the SYSTEM 00 prototype CPU which is a simplified 1801.

TV Display is divided in 3 areas, TV(0) and TV(1) which can be used by the CARDTRAN program and TV(2) which is used by the interpreter:

TV(0)  TV(1)
TV(2)

CONTROL codes

F0
Load program mode @ M[200]. Cardtran interpreter will wait for for a 4 digit word which will be stored at location M[200] next word at M[202] etc. TV(2) position will show the 4 digit instruction after 4 digits are received.
F1
Execute CARDTRAN program at M[200]
F2
Input aa, DDDD after which DDDD is stored at M[2aa]
F3
Show value of DR on TV(2) display position
F4
Input aa after which 4 digit word stored on M[2aa] is shown on TV(2) display position
F5
Halt execution (except 70/71)
F6
Resume execution
F7
Execute next instruction only

Example CARDTRAN code

This program (included in the cardtran.bin file) will wait for two four digit numbers, when the numbers are given it will multiply them and show a counter counting up to the result. At the end it will wait for two new numbers. If no input is given I think some random numbers are chosen.

This info is also available online on the Emma 02 site.

Definitions

aa 2 digits hexadecimal value. This is used to indicate an address in hexadecimal range of 0200-02C7. Note that the original CARDTRAN code uses a 2 digit decimal value to indicate a decimal 'line' number referring to the 0200-02C7 address range by multiplying the value aa with 2 and adding hexadecimal value of 200
DR 4 digits decimal register for use in CARDTRAN program. Value is stored on address 02E0/02E1.
. Not used, value doesn't matter
1..9 Decimal digits

CARDTRAN Syntax

40aa ADD [2aa], DR
2aa, DR
M[2aa] + DR -> M[2aa], 000C -> DR
70aa DISP0 [2aa]
2aa
Display word on M[2aa] on TV(0) display position
71aa DISP1 [2aa]
2aa
Display word on M[2aa] on TV(1) display position
10aa INPUT [2aa]
2aa
Wait for 4 digit word input and store word -> M[2aa]
22aa JNZ 2aa
DR, 2aa
Jump to 2aa if DR != 0
20aa JP 2aa JumP to 2aa
21aa JZ 2aa
DR, 2aa
Jump to 2aa if DR = 0
60aa LD [2aa], DR
2aa, DR
DR -> M[2aa]
30aa LD DR, [2aa]
DR, 2aa
M[2aa] -> DR
90aa LDD [2aa], DR
2aa, DR
LSD of DR -> LSD of M[2aa]
0... SKIP Skip
50aa SUB [2aa], DR
2aa, DR
M[2aa] - DR -> M[2aa], 000B -> DR
80aa RSH [2aa]
2aa
Ring SHift M[2aa] right 1 digit