Parse command line
This commit is contained in:
@@ -15,10 +15,10 @@ PDL: BLOCK PDLLEN ;Reserve the stack memory
|
|||||||
BPTR==440700 ;Define a byte pointer.
|
BPTR==440700 ;Define a byte pointer.
|
||||||
|
|
||||||
CHTTYO==1 ;Define a channel for TTY output.
|
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.
|
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.
|
START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack.
|
||||||
SETZM JCL ;Zero out the JCL
|
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.
|
JRST DONE ;Jump to the end of the program.
|
||||||
|
|
||||||
;Subroutine to read the JCL from DDT and get the command line parameters.
|
;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
|
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.
|
POPJ P, ;Return from routine.
|
||||||
;Subroutine to print a string of text on the output.
|
;Subroutine to print a string of text on the output.
|
||||||
; Clobbers A and B.
|
; Clobbers A and B.
|
||||||
|
|||||||
Reference in New Issue
Block a user