
PROGRAMMING
Programs for the RC-3 can be prepared using the Cross-32 cross assembler running in a Windows environment, configured by an RC-3-specific data table, GCMRL16.TBL. Test code source for the assembler is in EGCMRL16.asm, with its output listing in EGCMRL16.LST. The comment field for each instruction shows the expected compiled value.
Note that some assembler mnemonics differ from the hardware name for instructions. This was done for programmer convenience and to more closely align the mnemonics with current assembly language practice, although in most instances the original hardware name can be used as well. Here are some examples:
-
LIN (Load Immediate Nibble) = SetAB – loads 5-bits from op-code into register A or B
-
LI (Load Immediate) = SetM – loads the M register with a 16-bit value
-
MOVB (Move Byte) = MOV8 – 8-bit move, a substitution made by the RPTXT directive
-
MOVL (Move Long) = MOV16 – 16-bit move, a substitution made by the RPTXT directive
-
CLR (Clear) – clears are performed by moving a register to itself
Memory Test
The following program will execute a test on SRAM memory. It starts at a 256-byte block selected by the value in the data entry switches when the program is started, defaulting to starting block 0 if the block number is invalid. It pauses after reading the starting block location to accept a number of blocks to test, also entered using the data entry switches.
If the test is good, the program halts with 803Ah in the Program Counter. Restarting from the halt causes the program to jump back to the beginning. Two patterns are used for the test. If a write/read fails on the AAh pattern, the program stops with 8032h in the PC and the failing address in Register M. Likewise for a write/read failure on the 55h pattern, the program stops with 8036h in the PC and the failing address in Register M.
This program was loaded into the EEPROM, so its starting address was ORG’d to 8000h, the first address in PROM space.
;******************************************************
; Simple counter program for the RC-3 relay computer
; Rev 1 15 Aug 11
;******************************************************
;
8100 ORG 8100H
; Set number to count to in data switches before running
; Defaults to 8 if zero
8100 AC START2: LDSW A ; get the desired max count
8101 08 MOV8 B,A ;
8102 8F SHL D ; ALU inst to set condition codes
8103 E28107 BNZ CNTST2 ; ok if count not zero
8106 68 LIN B,8 ; default to 8 if count not valid
8107 8E CNTST2: NOT D ; invert count
8108 0B MOV8 B,D ; and
8109 8A INC D ; convert to negative number
810A 00 CLR A ;
810B 12 CLR C ;
; initialization now complete
810C 08 LOOP2: MOV8 B,A ; get displayed count
810D 82 INC A ; increment and display in A
810E 10 MOV8 C,A ; also display in
C 810F 0B MOV8 B,D ; get loop counter
8110 8A INC D ; increment it
8111 E48117 BZ DONE ; finished if zero
8114 E6810C JUMP LOOP2 ; go again
8117 AE DONE: HALT
; put new loop count in data switches
; and RESTART to continue
8118 E68100 JUMP START2 ;
Simple Counter
This program counts the A and C registers up to the value entered into the data entry switches when the program starts. If the data entry switches are set to zero, the count defaults to 8. Restarting from the halt at the end of the program jumps to the beginning and runs it again. This demo program was also installed in EEPROM, so was ORG’d to starting location 8100h.
;******************************************************
; Hello world demo for the RC-3 relay computer
; Rev 3 17 Apr 18
;******************************************************
8400 ORG 8400H
8400 C0001C HELLO: SETM LEN ; length of msg
8403 0D MOV8 B,M2 ;
8404 E78500 CALL NEGATE ; loop count in D
8407 00 CLR A ; zero the offset
8408 C08A00 HCONT: SETM MESG ; get base of msg array
840B 28 MOV8 M2,A ; insert offset
840C 91 LOAD B ; get a char
840D B1 PRINT ; print it
840E 08 MOV8 B,A ; get offset
840F 82 INC A ; increment it
8410 0B MOV8 B,D ; get loop counter
8411 8A INC D ; increment it
8412 E28408 BNZ HCONT ; finished?
8415 AC LDSW A ; yes, check should stop
8416 08 MOV8 B,A ;
8417 8E NOT D ; double invert to test
8418 0B MOV8 B,D ;
8419 8E NOT D ;
841A E48400 BZ HELLO ; don't stop
841D AE HALT ; yes
841E E68400 JUMP HELLO ; release halt to repeat
8A00 ORG 8A00H
8A00 48656C6C6F20 MESG: DFB "Hello "
8A06 776F726C6421 DFB "world!"
8A0C 0D DFB 0DH
8A0D 0D DFB 0DH
8A0E 52432D3320 DFB "RC-3 "
8A13 686572652E DFB "here."
8A18 0D DFB 0DH
8A19 0D DFB 0DH
8A1A 0D DFB 0DH
8A1B 0D DFB 0DH
001C = LEN: EQU $-MESG
;******************************************************
; Negate subroutine for the RC-3 relay computer
; Rev 1 18 Sep 11
; Input: 0-255 in B
; Output: 2's complement of B in D
;******************************************************
8500 ORG 8500H
8500 8E NEGATE: NOT D ; complement B to D
8501 0B MOV8 B,D ; move it back to B
8502 8A INC D ; add one
8503 A5 RETURN
0000 END
Contributions from our sponsors and volunteers may be seen in Acknowledgments.