Add JCL (command line parameters)
This commit is contained in:
@@ -17,13 +17,27 @@ 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.
|
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.
|
||||||
|
|
||||||
START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack.
|
START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack.
|
||||||
|
SETZM JCL ;Zero out the JCL
|
||||||
|
MOVE A,[JCL,,JCL+30]
|
||||||
|
BLT A,JCL+30
|
||||||
.OPEN CHTTYO,[.UAO,,'TTY] ;Open an output channel on the TTY.
|
.OPEN CHTTYO,[.UAO,,'TTY] ;Open an output channel on the TTY.
|
||||||
.LOSE %LSFIL ;Gobble up any errors.
|
.LOSE %LSFIL ;Gobble up any errors.
|
||||||
|
PUSHJ P,GETJCL ;Read the command line.
|
||||||
MOVE A,[BPTR,,HELLO] ;Load A with a byte pointer to HELLO.
|
MOVE A,[BPTR,,HELLO] ;Load A with a byte pointer to HELLO.
|
||||||
PUSHJ P,PUTLN ;Print the out string.
|
PUSHJ P,OUTSTR ;Print the out string.
|
||||||
|
MOVE A,[BPTR,,JCL] ;Read the parameter.
|
||||||
|
PUSHJ P,PUTLN ;Print the rest of the line.
|
||||||
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.
|
||||||
|
;Clobbers B.
|
||||||
|
GETJCL: .BREAK 12,[..RJCL,,JCL] ;Get the JCL
|
||||||
|
MOVE B,[BPTR,,JCL] ;Byte pointer to JCL
|
||||||
|
PUSHJ 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.
|
||||||
OUTSTR: HRLI A,BPTR ;Ensure, A is a byte pointer.
|
OUTSTR: HRLI A,BPTR ;Ensure, A is a byte pointer.
|
||||||
@@ -41,5 +55,5 @@ PUTLN: PUSHJ P,OUTSTR ;Calls the OUTSTR subroutine
|
|||||||
POPJ P, ;before returning.
|
POPJ P, ;before returning.
|
||||||
|
|
||||||
DONE: .LOGOUT 2, ;Exit point for the program.
|
DONE: .LOGOUT 2, ;Exit point for the program.
|
||||||
HELLO: ASCIZ /HELLO WORLD/ ;Define example string.
|
HELLO: ASCIZ /HELLO / ;Define example string.
|
||||||
END START
|
END START
|
||||||
|
|||||||
Reference in New Issue
Block a user