From 58b2147e44b5cc911306f6202e38cd8a76e62104 Mon Sep 17 00:00:00 2001 From: Jali Date: Tue, 5 Aug 2025 17:32:40 +0200 Subject: [PATCH] Parse command line --- src/SUDOKU.MID | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/SUDOKU.MID b/src/SUDOKU.MID index 82fcd2a..48e08dd 100644 --- a/src/SUDOKU.MID +++ b/src/SUDOKU.MID @@ -15,10 +15,10 @@ PDL: BLOCK PDLLEN ;Reserve the stack memory BPTR==440700 ;Define a byte pointer. CHTTYO==1 ;Define a channel for TTY output. -CHTTYI==2 ;Define a channel for TTY input. JCL: BLOCK 30 ;Reserve space for the command line. -BUF: BLOCK 30 ;A buffer to park the string. +FNAME1: BLOCK 15 ;The first part of the file name. +FNAME2: BLOCK 15 ;The second file name. START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack. SETZM JCL ;Zero out the JCL @@ -34,8 +34,20 @@ START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack. JRST DONE ;Jump to the end of the program. ;Subroutine to read the JCL from DDT and get the command line parameters. -;Clobbers B. +;Clobbers B, C and D. GETJCL: .BREAK 12,[..RJCL,,JCL] ;Get the JCL + MOVE B,[BPTR,,JCL] ;Load the command parameters. + MOVE C,[BPTR,,FNAME1] ;Set a pointer to store the first parameter. +JCLL1: ILDB D,B ;Load the next character. + JUMPE D,FN2 ;Exit the loop, if null. + CAIN D,30 ;Jump to next parameter word, if + CAIL D,140 ;Check, if the char is > 96. + SUBI D,40 ;Make sure that the code is always < 96 + SUBI D,40 ;Convert the char to SIXBIT. + IDBP D,C ;Deposit the converter value in FNAME1. + JRST JCLL1 ;Loop back to read the next character. +FN2: MOVE C,[BPTR,,FNAME2] ;Load a pointer to FNAME2 into C. + POPJ P, ;Return from routine. ;Subroutine to print a string of text on the output. ; Clobbers A and B.