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.

                  ; Memory test program for the RC-3 relay computer 
                  ; Rev 1		15 Aug 11 

 0000                   CPU     "GCMRL16.TBL"   ;PROCESSOR TABLE 
 0000                   HOF     "INT8"    ;HEX FORMAT, 8 bits 
 0000             	TITL    "RC-3 HANDY DEMOS" 
 0000                   PAGE    0 

                  ; Set 256 byte block (00 - 7F) to test in data switches  
                  ; before running. Program halts to allow entry of number 
                  ; of locations to test (01-FF). Reset data switches with 
                  ; number of locations to test, and press RESTART. 

 8000                     ORG	8000H 

 8000 C055AA      START:  LI	55AAH	; load test pattern into M 
 8003 A0                  MOV16	XY,M	; save it in XY 
 8004 AC                  LDSW	A	; get memory block to test 
 8005 08                  MOV8	B,A	; 
 8006 8E                  NOT	D	; invert to check the msb 
 8007 F0800B              BNEG	BLKSET	; ok if msb now set 
 800A 00                  CLR	A	; default to zero if block not valid 
 800B 20          BLKSET: MOV8	M1,A	; set MSB of memory address 
 800C 2D                  CLR	M2	; set LSB of memory address 
 800D AE                  HALT		; wait for test count 

                  ; ***************************************************** 
                  ; THEN RESTART 
                  ; ***************************************************** 

 800E AC                  LDSW	A	; get the count 
 800F 08                  MOV8	B,A	; 
 8010 8F                  SHL	D	; ALU inst to set condition codes 
 8011 E28015              BNZ	CNTSET	; ok if count not zero 
 8014 68                  LIN	B,8	; default to 8 if count not valid 
 8015 8E          CNTSET: NOT	D	; invert count 
 8016 0B                  MOV8	B,D	;    and 
 8017 8A                  INC	D	; convert to negative number 

                        		; initialization now complete 

 8018 16          LOOP:   MOV8	C,X	; get first test byte (AAH) 
 8019 9A                  STORE	C	; write it [M]<-C 
 801A 91                  LOAD	B	; read it back into B 
 801B 85                  XOR	A	; compare 
 801C E28031              BNZ	FAILA	; any difference indicates error 
 801F 17          GOTO5:  MOV8	C,Y	; get second test byte (55H) 
 8020 9A                  STORE	C	; write it [M]<-C 
 8021 91                  LOAD	B	; read it back into B 
 8022 85                  XOR	A	; compare 
 8023 E28035              BNZ	FAIL5	; any difference indicates error 
 8026 0B          NEXT:   MOV8	B,D	; fetch the count 
 8027 8A                  INC	D	; increment it 
 8028 E48039              BZ	GOOD	; finished if zero 
 802B 0D                  MOV8	B,M2	; fetch current memory location 
 802C 82                  INC	A	; increment it 
 802D 28                  MOV8	M2,A	; put it back in M for next iteration 
 802E E68018              JUMP	LOOP	; go around again 

 8031 AE          FAILA:  HALT		; failed test pattern A 
                        		; note address of failure, then RESTART 
 8032 E6801F              JUMP	GOTO5	; continue testing with pattern 5 
 8035 AE          FAIL5:  HALT		; failed test pattern 5 
                        		; note address of failure, then RESTART 
 8036 E68026              JUMP	NEXT	; continue to increment steps 
 8039 AE          GOOD:   HALT		; all locations test OK if stopped here 
                        		; reset block to test in data switches 
                        		; and RESTART to continue testing 
 803A E68000              JUMP	START

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.

                  ; 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	;

Hello World

No computer would be complete without a “Hello world” program. This demo shows the complexities involved in using the Robot Printer for printed output, as well as subroutine calls. The program was installed in EEPROM starting at address 8400h.

                  ; Hello world demo for the RC-3 relay computer 
                  ; Rev 1		18 Sep 11                         

 8400                     ORG	8400H 

 8400 C00019       HELLO: SETM	LEN	; length of msg 
 8403 0D                  MOV8	B,M2	; 
 8404 E7E107              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 E7E100              CALL	CHROUT	; print it 
 8410 08                  MOV8	B,A	; get offset 
 8411 82                  INC	A	; increment it 
 8412 0B                  MOV8	B,D	; get loop counter 
 8413 8A                  INC	D	; increment it 
 8414 E28408              BNZ	HCONT	; finished? 
 8417 AE                  HALT		; yes 
 8418 E68400              JUMP	HELLO	; release halt to repeat 

 8A00                     ORG	8A00H 

 8A00 48656C6C6F20 MESG:  DFB	"Hello " 
 8A06 776F726C6421        DFB	"world!" 
 8A0C 0D                  DFB	0DH 
 8A0D 52432D3320          DFB	"RC-3 " 
 8A12 686572652E          DFB	"here." 
 8A17 0D                  DFB	0DH 
 8A18 0D                  DFB	0DH 
 0019 =            LEN:   EQU	$-MESG

                  ; Print subroutine for the RC-3 relay computer 
                  ; Rev 1		18 Sep 11 

                  ;   Input:    ASCII char in B 
                  ;   Output:   print code in B 
                  ;   Output:   print pulse 
                  ;   Modified: register M                         

 E100                     ORG	0E100H 

 E100 C0E000      CHROUT: LI	CHRTBL	; load base of table 
 E103 29                  MOV8	M2,B	; load offset 
 E104 91                  LOAD	B	; look up print code 
 E105 B1                  PRINT		; send to printer 
 E106 A5                  RETURN 

                  ; 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                       

 E107 8E          NEGATE: NOT	D	; complement B to D 
 E108 0B                  MOV8	B,D	; move it back to B 
 E109 8A                  INC	D	; add one 
 E10A A5                  RETURN 

                  ; Robot Printer lookup table for the RC-3 relay computer 
                  ; Rev 1		18 Sep 11                         

 E000             CHRTBL: ORG	0E000h 

 E000 00          t000:   DFB	0 
 E001 00          t001:   DFB	0 
 E002 00          t002:   DFB	0
 E003 00          t003:   DFB	0
 E004 00          t004:   DFB	0 
 E005 00          t005:   DFB	0
 E006 00          t006:   DFB	0 
 E007 00          t007:   DFB	0 
 E008 35          t010:   DFB	35h 
 E009 0A          t011:   DFB	0ah 
 E00A 3D          t012:   DFB	3dh 
 E00B 3D          t013:   DFB	3dh 
 E00C 00          t014:   DFB	0 
 E00D 00          t015:   DFB	0 
 E00E 00          t016:   DFB	0 
 E00F 00          t017:   DFB	0 
 E010 00          t020:   DFB	0 
 E011 00          t021:   DFB	0 
 E012 00          t022:   DFB	0 
 E013 00          t023:   DFB	0 
 E014 00          t024:   DFB	0 
 E015 00          t025:   DFB	0 
 E016 00          t026:   DFB	0 
 E017 00          t027:   DFB	0 
 E018 00          t030:   DFB	0 
 E019 00          t031:   DFB	0 
 E01A 00          t032:   DFB	0 
 E01B 00          t033:   DFB	0 
 E01C 00          t034:   DFB	0 
 E01D 00          t035:   DFB	0 
 E01E 00          t036:   DFB	0 
 E01F 00          t037:   DFB	0 
 E020 3F          t040:   DFB	3fh 
 E021 49          t041:   DFB	49h 
 E022 76          t042:   DFB	76h 
 E023 59          t043:   DFB	59h 
 E024 61          t044:   DFB	61h 
 E025 69          t045:   DFB	69h 
 E026 79          t046:   DFB	79h 
 E027 36          t047:   DFB	36h 
 E028 55          t050:   DFB	55h 
 E029 5D          t051:   DFB	5dh 
 E02A 4D          t052:   DFB	4dh 
 E02B 6D          t053:   DFB	6dh 
 E02C 27          t054:   DFB	27h 
 E02D 65          t055:   DFB	65h 
 E02E 2F          t056:   DFB	2fh 
 E02F 37          t057:   DFB	37h 
 E030 1D          t060:   DFB	1dh 
 E031 09          t061:   DFB	09h 
 E032 11          t062:   DFB	11h 
 E033 19          t063:   DFB	19h 
 E034 21          t064:   DFB	21h 
 E035 29          t065:   DFB	29h 
 E036 31          t066:   DFB	31h 
 E037 39          t067:   DFB	39h 
 E038 0D          t070:   DFB	0dh 
 E039 15          t071:   DFB	15h 
 E03A 5F          t072:   DFB	5fh 
 E03B 15          t073:   DFB	15h 
 E03C 00          t074:   DFB	0 
 E03D 2D          t075:   DFB	2dh 
 E03E 00          t076:   DFB	0 
 E03F 77          t077:   DFB	77h 
 E040 51          t100:   DFB	51h 
 E041 59          t101:   DFB	59h 
 E042 6C          t102:   DFB	6ch 
 E043 5C          t103:   DFB	5ch 
 E044 5B          t104:   DFB	5bh 
 E045 62          t105:   DFB	62h 
 E046 63          t106:   DFB	63h 
 E047 6B          t107:   DFB	6bh 
 E048 73          t110:   DFB	73h 
 E049 56          t111:   DFB	56h 
 E04A 7B          t112:   DFB	7bh 
 E04B 4F          t113:   DFB	4fh 
 E04C 57          t114:   DFB	57h 
 E04D 7C          t115:   DFB	7ch 
 E04E 74          t116:   DFB	74h 
 E04F 5E          t117:   DFB	5eh 
 E050 66          t120:   DFB	66h 
 E051 52          t121:   DFB	52h 
 E052 6A          t122:   DFB	6ah 
 E053 5A          t123:   DFB	5ah 
 E054 72          t124:   DFB	72h 
 E055 4E          t125:   DFB	4eh 
 E056 64          t126:   DFB	64h 
 E057 5A          t127:   DFB	5ah 
 E058 54          t130:   DFB	54h 
 E059 79          t131:   DFB	79h 
 E05A 4C          t132:   DFB	4ch 
 E05B 00          t133:   DFB	0 
 E05C 00          t134:   DFB	0 
 E05D 00          t135:   DFB	0 
 E05E 71          t136:   DFB	71h 
 E05F 25          t137:   DFB	25h 
 E060 00          t140:   DFB	0 
 E061 19          t141:   DFB	19h 
 E062 2C          t142:   DFB	2ch 
 E063 1C          t143:   DFB	1ch 
 E064 1B          t144:   DFB	1bh 
 E065 22          t145:   DFB	22h 
 E066 23          t146:   DFB	23h 
 E067 2B          t147:   DFB	2bh 
 E068 33          t150:   DFB	33h 
 E069 16          t151:   DFB	16h 
 E06A 3B          t152:   DFB	3bh 
 E06B 0F          t153:   DFB	0fh 
 E06C 17          t154:   DFB	17h 
 E06D 3C          t155:   DFB	3ch 
 E06E 34          t156:   DFB	34h 
 E06F 1E          t157:   DFB	1eh 
 E070 26          t160:   DFB	26h 
 E071 12          t161:   DFB	12h 
 E072 2A          t162:   DFB	2ah 
 E073 1A          t163:   DFB	1ah 
 E074 32          t164:   DFB	32h 
 E075 0E          t165:   DFB	0eh 
 E076 24          t166:   DFB	24h 
 E077 1A          t167:   DFB	1ah 
 E078 14          t170:   DFB	14h 
 E079 3A          t171:   DFB	3ah 
 E07A 0C          t172:   DFB	0ch 
 E07B 00          t173:   DFB	0 
 E07C 00          t174:   DFB	0 
 E07D 00          t175:   DFB	0 
 E07E 00          t176:   DFB	0 
 E07F 00          t177:   DFB	0

Contributions from our sponsors and volunteers may be seen in Acknowledgments.