diff --git a/src/sudoku.s b/src/sudoku.s index d67ab54..4218c02 100644 --- a/src/sudoku.s +++ b/src/sudoku.s @@ -64,13 +64,26 @@ GETJCL: PUSH P,A ;Save the register A. MOVE A,[JCL] MOVE A,[BPTR,,JCL] ;Load the command parameters into A. MOVE B,[BPTR,,FNAME1] ;Pointer to the first file name. - PUSHJ P,TOSIXB ;Transfer the first word into FNAME1 + PUSHJ P,CPSTR ;Transfer the first word into FNAME1 MOVE B,[BPTR,,FNAME2] ;Pointer to the second file name. - PUSHJ P,TOSIXB ;Transfer the second word into FNAME2 + PUSHJ P,CPSTR ;Transfer the second word into FNAME2 POP P,B ;Restore the B register. POP P,A ;Restore the A register. POPJ P, ;Return from routine. +;Subroutine to copy a string. Takes a bytepointer in A and B +;where A is the source and B is the destination. It will stop copying, if +;the end of the string is reached, or a whitespace is encounterd, +CPSTR: PUSH P,D ;Store the contents of register D. +CPSTLP: ILDB D,A ;Load the next character from A. + JUMPE D,CPSTEN ;Exit the loop. + CAIN D,40 ;If the character is whitespace + JUMPA CPSTEN ;exit the loop. + IDPB D,B ;Deposit the charcter at destination. + JRST CPSTLP ;Repeat with the next character +CPSTEN: POP P,D ;Restore the D register. + POPJ P, ;Return from function. + ;Subroutine to convert an ASCII string into SIXBIT. Takes a byte ;pointer in A and B, where A is the source and B is the destination. TOSIXB: PUSH P,D ;Store the contents of register D.