From 3a887ef05c22d25b210fb17686a4821c32c531ff Mon Sep 17 00:00:00 2001 From: Jali Date: Sat, 2 Aug 2025 21:56:42 +0200 Subject: [PATCH] Add print routine for TTY --- src/SUDOKU.MAC | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/SUDOKU.MAC b/src/SUDOKU.MAC index 558e150..e71fda5 100644 --- a/src/SUDOKU.MAC +++ b/src/SUDOKU.MAC @@ -1,2 +1,32 @@ TITLE SUDOKU SOLVER +P=17 ;Defines AC 17 as the stack pointer. +A=1 ;Define two accumulators +B=2 ;A and B +CHTTYO==1 ;Output channel number + +PDLLEN==100 ;Length of push down stack +PDL: BLOCK PDLLEN ;Storage for push down stack + +START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack + .CALL [SETZ ? SIXBIT/OPEN/ ;Open the TTY channels + [.UAI,,CHTTYO] ? [SIXBIT/TTY/] ((SETZ))] + .LOSE %LSFIL + + +L: HRRI A, HELLO ;Load the address of the string into A + PUSHJ P, OUTSTR ;Print the string. + JRST L ;Keep looping + +;Subroutine to output the ASCIZ which starts in the word +;whose address is in A. Clobbers A. +OUTSTR: HRLI A, 440700 ;Make A into a byte pointer to fetch a string +OUTST1: ILDB B, A ;Fetch the next character of string into B + JUMPE B, CPOPJ ;If it is the terminator, return + .IOT CHTTYO,B ;Else output the character + JRST OUTST1 ;and loop around. + +CPOPJ: POPJ P, ;Return + +HELLO: ASCIZ /HELLO WORLD/ + END START