Make subroutine independent of fields

This commit is contained in:
2025-09-09 22:52:11 +02:00
parent e58b96cacf
commit 251cf22aad

View File

@@ -39,12 +39,10 @@ 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.
@@ -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.