Optionally print SIXBIT

This commit is contained in:
2025-08-09 14:09:15 +02:00
parent 87562354b1
commit 80b7bd46a3

View File

@@ -18,11 +18,20 @@ CHTTYO==1 ;Define a channel for TTY output.
JCL: BLOCK 30 ;Reserve space for the command line.
FNAME1: BLOCK 15 ;The first part of the file name.
FNAME2: BLOCK 15 ;The second file name.
FNAME2: BLOCK 15 ;The second file name.
;Print flags
;Allows to change the beavihour of the OUTSTR and PUTLN subroutines.
;The different bits in the word have different meanings.
;Flags:
; 001 - SIXBIT: Prints the next character as a SIXBIT char, instead of ASCII, if set.
PFLAGS: BLOCK 1
START: MOVE P,[-PDLLEN,,PDL-1] ;Initialize the stack.
.OPEN CHTTYO,[.UAO,,'TTY] ;Open an output channel on the TTY.
.LOSE %LSFIL ;Gobble up any errors.
MOVEI A,001 ;Initialize the print flag
MOVEM A,PFLAGS ;to print SIXBIT
PUSHJ P,GETJCL ;Read the command line.
MOVE A,[BPTR,,HELLO] ;Load A with a byte pointer to HELLO.
PUSHJ P,OUTSTR ;Print the out string.
@@ -41,9 +50,9 @@ GETJCL: PUSH P,A ;Save the register A.
.BREAK 12,[..RJCL,,JCL] ;Request the JCL.
MOVE A,[BPTR,,JCL] ;Load the command parameters into A.
MOVE B,[BPTR,,FNAME1] ;Pointer to the first file name.
PUSHJ TOSIXB ;Transfer the first word into FNAME1
PUSHJ P,TOSIXB ;Transfer the first word into FNAME1
MOVE B,[BPTR,,FNAME2] ;Pointer to the second file name.
PUSHJ TOSIXB ;Transfer the second word into FNAME2
PUSHJ P,TOSIXB ;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.
@@ -64,13 +73,20 @@ TOSEN: POP P,D ;Restore the D register.
POPJ P, ;Return from function.
;Subroutine to print a string of text on the output.
; Clobbers A and B.
OUTSTR: HRLI A,BPTR ;Ensure, A is a byte pointer.
;Clobbers A.
OUTSTR: PUSH P,B ;Save register B.
PUSH P,D ;Save register D.
HRLI A,BPTR ;Ensure, A is a byte pointer.
OUT: ILDB B,A ;Load the next byte from A.
JUMPE B,OUTEX ;Exit the routine, if all bytes are done.
MOVEI D,PFLAGS ;Load the print flags.
TRNE D,001 ;Test, if the SIXBIT flag is set.
ADDI B,40 ;Convert SIXBIT to ASCII.
.IOT CHTTYO,B ;Print a character.
JRST OUT ;Jump back to print the next character.
OUTEX: POPJ P, ;Return from the output routine.
OUTEX: POP P,D ;Restore D to its original value.
POP P,B ;Restore B to its original value.
POPJ P, ;Return from the output routine.
;Subroutine to print an entire line of text, including a line break.
;Clobbers A and B.