Interpretation of initialization and SEP handlers in BASIC/ROM board Herb Johnson, Marcel van Tongeren updated Mar 26 2025, Apr 16 2025 cold start LBR HF000 ;0000-C0 F0 00 back to ELF II ROMs GHI R0 ;0003-90 SKP ;0004-38 GLO R0 ;0005-80 PLO RF ;0006-AF RF.0 as index into RAM page R0007 B4 R0007 ;0007-37 07 loop on /EF4 input LDI 00CH ;0009-F8 0C PLO R3 ;000B-A3 register initialization 000c f8 00 LDI 000H ;000C-F8 00 000e b3 PHI R3 ;000E-B3 000f d3 SEP R3 ;000F-D3 R3 is program counter 0010 b4 PHI R4 ;0010-B4 R4 is call register 0011 b5 PHI R5 ;0011-B5 R4 is retn register 0012 b7 PHI R7 ;0012-B7 R7 is a routine register 0013 b8 PHI R8 ;0013-B8 R8 is another routine register 0014 f8 5e LDI 05EH ;0014-F8 5E 0016 a4 PLO R4 ;0016-A4 R4=005E CALL handler 0017 f8 70 LDI 070H ;0017-F8 70 >p< 0019 a5 PLO R5 ;0019-A5 R5=0070 RETN handler 001a f8 7f LDI 07FH ;001A-F8 7F 001c a7 PLO R7 ;001C-A7 R7=007F SEP R7 handler 001d f8 89 LDI 089H ;001D-F8 89 001f a8 PLO R8 ;001F-A8 R8=0089 SEP R8 handler 0020 8f GLO RF ;0020-8F RF.0 = 0 cold start, !=0 warm start 0021 c2 13 e5 LBZ J13E5 ;0021-C2 13 E5 COLD start 0024 c0 15 33 LBR J1533 ;0024-C0 15 33 WARM start 0027 d8 J0027 SEP R8 ;0027-D8 SEP R8 call 0028 05 DB 05 ;0028-05 next 2 bytes as word indexes to / from 0029 0d DB 0DH ;0029-0D 002a d8 SEP R8 ;002A-D8 ditto 01 to 03 002b 01 DB 01 ;002B-01 002c 03 DB 03 ;002C-03 002d d8 SEP R8 ;002D-D8 ditto 03 to 0B 002e 03 DB 03 ;002E-03 002f 0b DB 0BH ;002F-0B 0030 d8 SEP R8 ;0030-D8 ditto 03 to 26 0031 03 DB 03 ;0031-03 0032 26 DB 26H ;0032-26 0033 d7 SEP R7 ;0033-D7 SEP R7 read byte from 26 0034 26 DB 26H ;0034-26 0035 bf PHI RF ;0035-BF 0036 0d LDN RD ;0036-0D next byte from 27 0037 af PLO RF ;0037-AF stored as address in RF 0038 f8 00 LDI 000H ;0038-F8 00 003a 5f STR RF ;003A-5F zero out addressed location 003b c4 NOP ;003B-C4 003c c4 NOP ;003C-C4 .... J003D LDI 0FFH ;003D-F8 FF PLO R2 ;003F-A2 R2 will be RAM page address register ; start of loop by RA.0 R0040 CALL S009B ;0040-D4 00 9B read 05/6/7/8 into RB/RA R0043 SEP R7 ;0043-D7 DB B8H ;0044-B8 read byte at 0B8H CALL S00AE ;0045-D4 00 AE evaluating, testing MSB SKP ;0048-38 R0049 INC RA ;0049-1A GLO RA ;004A-8A SMI 0B8H ;004B-FF B8 loop from 00 to 0B8H? BZ R0040 ;004D-32 40 R004F CALL S11F9 ;004F-D4 11 F9 on 0B8H STR RA ;0052-5A SMI 00DH ;0053-FF 0D BZ R00D2 ;0055-32 D2 exit on 0DH SMI 072H ;0057-FF 72 72H+0DH = 7FH BZ R00CA ;0059-32 CA exit on 7FH BR R0049 ;005B-30 49 else loop back for more ;below are support routines for SEP operations R4 through R8 routine at 005E (R4) - SCRT CALL 005d d3 R005D SEP R3 ;005D-D3 < - R3 as pgrm counter, calls routine 005e bf PHI RF ;005E-BF <-- entry, save acc. in RF.1 005f e2 SEX R2 ;005F-E2 point to stack 0060 86 GLO R6 ;0060-86 return addr R6 pushed on R2 stack 0061 73 STXD ;0061-73 0062 96 GHI R6 ;0062-96 0063 73 STXD ;0063-73 0064 83 GLO R3 ;0064-83 move R3 return addr to R6 0065 a6 PLO R6 ;0065-A6 0066 93 GHI R3 ;0066-93 0067 b6 PHI R6 ;0067-B6 0068 46 LDA R6 ;0068-46 get value at addr R6 0069 b3 PHI R3 ;0069-B3 onto R3 (called routine) 006a 46 LDA R6 ;006A-46 006b a3 PLO R3 ;006B-A3 006c 9f GHI RF ;006C-9F recover D from RF.1 006d 30 5d BR R005D ;006D-30 5D and complete CALL via R3 routine at 0070 (R5) - SCRT RETN 006f d3 R006F SEP R3 ;006F-D3 ;R3 as pgrm counter, return to caller of routine 0070 bf PHI RF ;0070-BF <-- entry, save D in RF.1 0071 e2 SEX R2 ;0071-E2 point to stack 0072 96 GHI R6 ;0072-96 return addr in R6 0073 b3 PHI R3 ;0073-B3 0074 86 GLO R6 ;0074-86 0075 a3 PLO R3 ;0075-A3 return address in R3 0076 12 INC R2 ;0076-12 advance stack 0077 42 LDA R2 ;0077-42 0078 b6 PHI R6 ;0078-B6 0079 02 LDN R2 ;0079-02 007a a6 PLO R6 ;007A-A6 007b 9f GHI RF ;007B-9F ;recover acc. from RF.1 007c 30 6f BR R006F ;007C-30 6F and complete RETN via R3 routine at 007F (SEP R7) byte value follows byte is index into table at R2.1 page at top of RAM, accum has BYTE value, X=RD -> next table byte, 007e d3 R007E SEP R3 ;007E-D3 R3 pgm counter, return to R7 caller 007f 43 LDA R3 ;007F-43 <-- entry, get 1st byte from caller 0080 ad PLO RD ;0080-AD ... into RD.0 0081 c4 NOP ;0081-C4 ?? 0082 92 GHI R2 ;0082-92 RAM page addr 0083 bd PHI RD ;0083-BD ... into RD.1 as addr into RAM 0084 4d LDA RD ;0084-4D table value into accum, incr RD 0085 ed SEX RD ;0085-ED X -> next byte in table 0086 30 7e BR R007E ;0086-30 7E and return Routine at 0089H (SEP R8) 2-byte value follows top-of-RAM at R2.1. table read of WORD into RF, from first-byte RAM index into second-byte RAM index 0088 d3 R0088 SEP R3 ;0088-D3 <-- return to R8 caller 0089 43 LDA R3 ;0089-43 <--entry, get 1st byte after SEP R8 008a ad PLO RD ;008A-AD into RD.0 008b c4 NOP ;008B-C4 008c 92 GHI R2 ;008C-92 RAM page addr 008d bd PHI RD ;008D-BD now page for RD 008e 4d LDA RD ;008E-4D get word from RAM into RF 008f bf PHI RF ;008F-BF high byte / low byte order 0090 0d LDN RD ;0090-0D (no incr of RD) 0091 af PLO RF ;0091-AF 0092 43 LDA R3 ;0092-43 get 2nd byte after SEP R8 0093 ad PLO RD ;0093-AD as 2nd index into RAM via RD 0094 9f GHI RF ;0094-9F store RF word at 2nd index 0095 5d STR RD ;0095-5D 0096 1d INC RD ;0096-1D 0097 8f GLO RF ;0097-8F 0098 5d STR RD ;0098-5D RF still has word from 1st index 0099 30 88 BR R0088 ;0099-30 88 .. and return Summary of register usage R2 points to RAM at high-memory page, R2.1 changes to index into RAM R3 program counter, supported by SCRT CALL and RETN R4 SCRT CALL register R5 SCRT RETN register R6 returning address from CALL to RETN R7 SEP R7 retrieves byte at R2.1+index into accum, X->RD points to index+1 R8 SEP R8 retrieves word at R2.1+index1 into RF, copies to R2.1+index2 -- RD points to R2.1+index2 RD used by SEP R7, R8 RF used by many routines, save & pass accumulator from CALL to RETN ;called by 0040H S009B CALL S00A2 ;009B-D4 00 A2 read word from 05 into RB CALL S00A8 ;009E-D4 00 A8 read word from 07 into RA RETN ;00A1-D5 SEP R5 S00A2 SEP R7 ;00A2-D7 read byte from 05H DB 05H ;00A3-05 PHI RB ;00A4-BB LDN RD ;00A5-0D read next byte PLO RB ;00A6-AB put word in RB RETN ;00A7-D5 SEP R5 S00A8 SEP R7 ;00A8-D7 read byte from 07H DB 07H ;00A9-07 PHI RA ;00AA-BA LDN RD ;00AB-0D read next byte PLO RA ;00AC-AA put word in RA RETN ;00AD-D5 SEP R5 ;called by 0045H S00AE LDN RD ;00AE-0D ANI 07FH ;00AF-FA 7F reading 7 bit value CALL S11F4 ;00B1-D4 11 F4 call to evaluate? LDA RD ;00B4-4D test MSB ANI 080H ;00B5-FA 80 MSB not set, loop routine BZ S00AE ;00B7-32 AE RETN ;00B9-D5 SEP R5 return when MSB set