From 251cf22aadb72a5784305c7a813a906ed59f6fa9 Mon Sep 17 00:00:00 2001 From: Jali Date: Tue, 9 Sep 2025 22:52:11 +0200 Subject: [PATCH] Make subroutine independent of fields --- src/SUDOKU.MID | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/SUDOKU.MID b/src/SUDOKU.MID index 688157d..db98373 100644 --- a/src/SUDOKU.MID +++ b/src/SUDOKU.MID @@ -39,13 +39,11 @@ START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack. PUSHJ P,GETJCL ;Read the command line. MOVE A,[BPTR,,LOADING] ;Print the loading message PUSHJ P,OUTSTR - MOVEI A,001 ;Swtich to SIXBIT - MOVEM A,PFLAGS ;Reset the print flag - MOVE A,[BPTR,,FNAME1] ;Read the parameter. - PUSHJ P,OUTSTR ;Print the file name - MOVE A,[BPTR,,FNAME2] ;Print the second file name. - PUSHJ P,PUTLN - + MOVEI A,FNAME1 ;Store the first file name in A + MOVEI B,FNAME2 ;Store the second file name in B + MOVEI C.FIELD ;Store the address of field in C + PUSHJ P,IMPRTF ;Load the file + JRST DONE ;Jump to the end of the program. ;Subroutine to read the JCL from DDT and get the command line parameters. @@ -103,14 +101,12 @@ PUTLN: PUSHJ P,OUTSTR ;Calls the OUTSTR subroutine POPJ P, ;before returning. ;Subroutine that reads the contents of the file into the buffer at FIELD -IMPRTF: PUSH P,A ;Save the A register. - .CALL [SETZ ? SIXBIT/OPEN/ [.UAI,,CHDSKI] ? FNAME1 ? FNAME2 ((SETZ))] +IMPRTF: .CALL [SETZ ? SIXBIT/OPEN/ [.UAI,,CHDSKI] ? A ? B ((SETZ))] .LOSE %LSFIL ;Handle errors after opening the file - .CALL [SETZ ? SIXBIT/SIOT/ [,,CHDSKI] ? [BPTR,,FIELD] ? [,,33] ((SETZ))] + .CALL [SETZ ? SIXBIT/SIOT/ [,,CHDSKI] ? [BPTR,,C] ? [,,33] ((SETZ))] .LOSE %LSFIL .CALL [SETZ ? SIXBIT/CLOSE/ [,,CHDSKI] ((SETZ))] .LOSE %LSFIL - POP A ;Restore the A register. POPJ P ;Return from the input subroutine, DONE: .LOGOUT 2, ;Exit point for the program. WELCOME:ASCIZ /SUDOKU SOLVER v0.1/ ;Text of the welcome banner.