; I just saw your post on SCRT. I wrote an assembly program for A18 to ; implement the SCRT process as described in the RCA 1800 User Manual. It ; duplicates Example 5. I thought this might be useful to you as you ; create macros for A18. ; ; In the attached code, the only source code used stores byte values in ; the area DATA. My intent was to ensure that I had properly implemented ; SCRT and that all the routines were executed as expected. Upon ; execution, you should see under DATA the list of values 01, 11, 02, 21, ; 12, 22, 07. I hope this is of some use to you. ; ; Regards, ; Bob Smith, Mar 21 2016 ; ; note from Herb: I've added some comments. TITL "SCRT Call Routine" CPU 1802 ORG $0000 START: LOAD 2, $00FF ;set stack pointer LOAD 3, MAIN ;set program pointer LOAD 4, CALL ;pointer to 'CALL' LOAD 5, RETURN ;pointer to 'RETURN' LOAD 7, DATA ;pointer to output data SEX 2 ; X -> R2 SEP 3 ; PC-> R3 at next location MAIN: LDI $01 STR 7 ;output to data INC 7 SEP 4 ;subroutine as jump to CALL, ;address & 1 data byte follows BYTE HIGH SUB1 ;address of SUB1 BYTE LOW SUB1 BYTE $11 ;data passed to SUB1 LDI $02 ;return from subr here STR 7 ;output to DATA INC 7 SEP 4 ;subrtn jump to CALL BYTE HIGH SUB2 ;address of SUB2 BYTE LOW SUB2 BYTE $21 ;data passed to SUB2 LDI 7 ;return from subr here STR 7 ;output to DATA BR EXIT ;end of test program ; ; subroutines ; SUB1: LDA 6 ;retrieve passed data STR 7 ;output to Data INC 7 SEP 5 ;jump to RETURN ; SUB2: LDA 6 ;retrieve passed data STR 7 ;output to DATA INC 7 SEP 4 ;jump to CALL BYTE HIGH SUB1 ;address of SUB1 BYTE LOW SUB1 BYTE $12 ;data passsed to SUB1 LDI $22 STR 7 ;output to DATA INC 7 SEP 5 ;jump to RETURN ; ; support for call EXITC: SEP 3 ;exit from CALL CALL: SEX 2 ;CALL routine GHI 6 STXD GLO 6 STXD GHI 3 PHI 6 GLO 3 PLO 6 LDA 6 PHI 3 LDA 6 PLO 3 BR EXITC ; ; support for return EXITR: SEP 3 ;exit from RETURN RETURN: GHI 6 ;RETURN routine PHI 3 GLO 6 PLO 3 SEX 2 INC 2 LDXA PLO 6 LDX PHI 6 BR EXITR DATA: BLK 10 ;space for output data EXIT: END START