Parse data
This commit is contained in:
@@ -10,7 +10,7 @@ X=10 ;X and Y are used for indexing
|
|||||||
Y=11 ;loops etc.
|
Y=11 ;loops etc.
|
||||||
P=17 ;Define P as the stack pointer.
|
P=17 ;Define P as the stack pointer.
|
||||||
|
|
||||||
PDLLEN==20 ;Set the size of the stack to 20 words.
|
PDLLEN==30 ;Set the size of the stack to 30 words.
|
||||||
PDL: BLOCK PDLLEN ;Reserve the stack memory
|
PDL: BLOCK PDLLEN ;Reserve the stack memory
|
||||||
BPTR==440700 ;Define a byte pointer.
|
BPTR==440700 ;Define a byte pointer.
|
||||||
|
|
||||||
@@ -21,34 +21,48 @@ FNAME1: BLOCK 15 ;The first part of the file name.
|
|||||||
FNAME2: BLOCK 15 ;The second 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
|
|
||||||
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.
|
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,OUTSTR ;Print the out string.
|
PUSHJ P,OUTSTR ;Print the out string.
|
||||||
MOVE A,[BPTR,,JCL] ;Read the parameter.
|
MOVE A,[BPTR,,FNAME1] ;Read the parameter.
|
||||||
PUSHJ P,PUTLN ;Print the rest of the line.
|
PUSHJ P,PUTLN ;Print the file name
|
||||||
|
MOVE A,[BPTR,,FNAME2] ;Print the second file name.
|
||||||
|
PUSHJ P,PUTLN
|
||||||
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, C and D.
|
GETJCL: PUSH P,A ;Save the register A.
|
||||||
GETJCL: .BREAK 12,[..RJCL,,JCL] ;Get the JCL
|
PUSH P,B ;Save the register B.
|
||||||
MOVE B,[BPTR,,JCL] ;Load the command parameters.
|
SETZM JCL ;Zero out the JCL
|
||||||
MOVE C,[BPTR,,FNAME1] ;Set a pointer to store the first parameter.
|
MOVE A,[JCL,,JCL+30]
|
||||||
JCLL1: ILDB D,B ;Load the next character.
|
BLT A,JCL+30
|
||||||
JUMPE D,FN2 ;Exit the loop, if null.
|
.BREAK 12,[..RJCL,,JCL] ;Request the JCL.
|
||||||
CAIN D,30 ;Jump to next parameter word, if
|
MOVE A,[BPTR,,JCL] ;Load the command parameters into A.
|
||||||
CAIL D,140 ;Check, if the char is > 96.
|
MOVE B,[BPTR,,FNAME1] ;Pointer to the first file name.
|
||||||
SUBI D,40 ;Make sure that the code is always < 96
|
PUSHJ TOSIXBIT ;Transfer the first word into FNAME1
|
||||||
SUBI D,40 ;Convert the char to SIXBIT.
|
MOVE B,[BPTR,,FNAME2] ;Pointer to the second file name.
|
||||||
IDBP D,C ;Deposit the converter value in FNAME1.
|
PUSHJ TOSIXBIT ;Transfer the second word into FNAME2
|
||||||
JRST JCLL1 ;Loop back to read the next character.
|
POP P,B ;Restore the B register.
|
||||||
FN2: MOVE C,[BPTR,,FNAME2] ;Load a pointer to FNAME2 into C.
|
POP P,A ;Restore the A register.
|
||||||
|
|
||||||
POPJ P, ;Return from routine.
|
POPJ P, ;Return from routine.
|
||||||
|
|
||||||
|
;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.
|
||||||
|
TOSIXBT:PUSH P,D ;Store the contents of register D.
|
||||||
|
TOSIXBL:ILDB D,A ;Load the next character from A.
|
||||||
|
JUMPE D,TOSIXEN ;Exit the loop, if charachter is null.
|
||||||
|
CAIN D,40 ;If the character is a whitespace,
|
||||||
|
JUMPA TOSIXEN ;exit the loop.
|
||||||
|
CAIL D,140 ;If the character is > 96,
|
||||||
|
SUBI D,40 ;then cut it down, so it's in range.
|
||||||
|
SUBI D,40 ;Convert 32..95 to 0..63
|
||||||
|
IDBP D,B ;Deposit the character in the destination.
|
||||||
|
JRST TOSIXBL ;Repeat with next character.
|
||||||
|
TOSIXEN:POP P,D ;Restore the D register.
|
||||||
|
POPJ P, ;Return from function.
|
||||||
|
|
||||||
;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.
|
||||||
|
|||||||
Reference in New Issue
Block a user