From a3459dc5493403c74a57a40c222bd79d928fbe2b Mon Sep 17 00:00:00 2001 From: Jali Date: Sun, 4 Jan 2026 16:59:06 +0100 Subject: [PATCH] Use a counter to determine the end of the field --- src/sudoku.s | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sudoku.s b/src/sudoku.s index 6659aa4..ae1033e 100644 --- a/src/sudoku.s +++ b/src/sudoku.s @@ -104,8 +104,10 @@ PUTLN: PUSHJ P,OUTSTR ;Calls the OUTSTR subroutine ;The contents of the field is expected in FIELD PFIELD: PUSH P,A ;Save the A register. PUSH P,B ;Save the contents of register B. + PUSH P,C ;Save the contents of register C. PUSH P,X ;Save the contents of the index register. PUSH P,Y ;Save the contents of the Y register + MOVE C,033 ;Set a counter. MOVE X,[440400,,FIELD] ;Store a bytepointer in X. PFIELN: .IOT CHTTYO,[^M] ;Print a carriage return. .IOT CHTTYO,[^J] ;Print a new line. @@ -117,7 +119,7 @@ PFIELN: .IOT CHTTYO,[^M] ;Print a carriage return. PFIENO: MOVEI B,020 ;Print a space. .IOT CHTTYO,B ILDB B,X ;Load the next field. - JUMPE B,PFIEEX ;Exit, if no more elements are read. + SOJE C,PFIEEX ;Exit, if no more elements are read. ADDI B,060 ;Convert number into char. .IOT CHTTYO,B ;Print the number. .IOT CHTTYO,[ ] ;Print a space. @@ -127,6 +129,7 @@ PFIENO: MOVEI B,020 ;Print a space. PFIEEX: POP P,Y ;Restore the Y register. POP P,X ;Restore the index register. + POP P,C ;Restore the C register. POP P,B ;Restore the B register. POP P,A ;Restore the A register. POPJ P, ;Return from the subroutine.