From 7aa07cdf9a4b63e0e2c7e407cda3ee287235c103 Mon Sep 17 00:00:00 2001 From: Jali Date: Mon, 4 Aug 2025 00:18:09 +0200 Subject: [PATCH] Create an output routine --- src/SUDOKU.ASM | 35 ----------------------------------- src/SUDOKU.MAC | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 src/SUDOKU.ASM create mode 100644 src/SUDOKU.MAC diff --git a/src/SUDOKU.ASM b/src/SUDOKU.ASM deleted file mode 100644 index 9681c50..0000000 --- a/src/SUDOKU.ASM +++ /dev/null @@ -1,35 +0,0 @@ -;-*-MIDAS-*- - TITLE SUDOKU SOLVER - -;Define the accumulators -A=1 ;The primary accumulator. -B=2 ;Other ACs. -C=3 -X=4 ; X and Y are used for indexing -Y=5 ; loops etc. - -;Set up the stack -P=17 -PDLLEN==20 ;Size of the stack. -PDL: BLOCK PDLLEN ;Reserve the stack memory. - -BPTR==440700 ;Define a byte pointer. -CHTTYO==1 ;Define a channel for TTY output. - -START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack. - .CALL [SETZ ? SIXBIT/OPEN/ - [.UAO,,CHTTYO] ? [SIXBIT/TTY/] ((SETZ))] - .LOSE %LSFIL ;Gobble up error messages. - MOVE A,[BPTR,,HELLO] ;Load A with a byte pointer to HELLO. - JRST DONE ;Jump to the end of the program. -OUTSTR: HRLI A,BPTR ;Ensure, A is a byte pointer. -OUT: ILDB B,A ;Load the next byte from A. - JUMPE B,OUTEX ;Exit the routine, if all bytes are done. - .IOT CHTTYO,B ;Print a character. - JRST OUT ;Jump back to print the next character. -OUTEX: .IOT CHTTYO,[^M] ;Print carriage return and - .IOT CHTTYO,[^J] ;newline characters. - POPJ P, ;Return from the subroutine. -DONE: ;Exit point for the program. -HELLO: ASCIZ /HELLO WORLD/ ;Define example string. -END START diff --git a/src/SUDOKU.MAC b/src/SUDOKU.MAC new file mode 100644 index 0000000..7682ae6 --- /dev/null +++ b/src/SUDOKU.MAC @@ -0,0 +1,35 @@ +;-*-MIDAS-*- + TITLE SUDOKU SOLVER + +A=1 ;Define ACs as universal registers +B=2 ;from A to E +C=3 +D=4 +E=5 +X=10 ;X and Y are used for indexing +Y=11 ;loops etc. +P=17 ;Define P as the stack pointer. + +PDLLEN==20 ;Set the size of the stack to 20 words. +PDL: BLOCK PDLLEN ;Reserve the stack memory +BPTR==440700 ;Define a byte pointer. + +CHTTYO==1 ;Define a channel for TTY output. + +START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack. + .OPEN CHTTYO,[.UAO,,'TTY] ;Open an output channel on the TTY. + .LOSE %LSFIL ;Gobble up any errors. + MOVE A,[BPTR,,HELLO] ;Load A with a byte pointer to HELLO. + PUSHJ P,OUTSTR ;Print the out string. + JRST DONE ;Jump to the end of the program. +OUTSTR: HRLI A,BPTR ;Ensure, A is a byte pointer. +OUT: ILDB B,A ;Load the next byte from A. + JUMPE B,OUTEX ;Exit the routine, if all bytes are done. + .IOT CHTTYO,B ;Print a character. + JRST OUT ;Jump back to print the next character. +OUTEX: .IOT CHTTYO,[^M] ;Print carriage return and + .IOT CHTTYO,[^J] ;newline characters. + POPJ P, ;Return from the subroutine. +DONE: .LOGOUT 2, ;Exit point for the program. +HELLO: ASCIZ /HELLO WORLD/ ;Define example string. +END START