Use a counter to determine the end of the field

This commit is contained in:
2026-01-04 16:59:06 +01:00
parent 716f665ebc
commit a3459dc549

View File

@@ -104,8 +104,10 @@ PUTLN: PUSHJ P,OUTSTR ;Calls the OUTSTR subroutine
;The contents of the field is expected in FIELD
PFIELD: PUSH P,A ;Save the A register.
PUSH P,B ;Save the contents of register B.
PUSH P,C ;Save the contents of register C.
PUSH P,X ;Save the contents of the index register.
PUSH P,Y ;Save the contents of the Y register
MOVE C,033 ;Set a counter.
MOVE X,[440400,,FIELD] ;Store a bytepointer in X.
PFIELN: .IOT CHTTYO,[^M] ;Print a carriage return.
.IOT CHTTYO,[^J] ;Print a new line.
@@ -117,7 +119,7 @@ PFIELN: .IOT CHTTYO,[^M] ;Print a carriage return.
PFIENO: MOVEI B,020 ;Print a space.
.IOT CHTTYO,B
ILDB B,X ;Load the next field.
JUMPE B,PFIEEX ;Exit, if no more elements are read.
SOJE C,PFIEEX ;Exit, if no more elements are read.
ADDI B,060 ;Convert number into char.
.IOT CHTTYO,B ;Print the number.
.IOT CHTTYO,[ ] ;Print a space.
@@ -127,6 +129,7 @@ PFIENO: MOVEI B,020 ;Print a space.
PFIEEX: POP P,Y ;Restore the Y register.
POP P,X ;Restore the index register.
POP P,C ;Restore the C register.
POP P,B ;Restore the B register.
POP P,A ;Restore the A register.
POPJ P, ;Return from the subroutine.