ptrCtr DC 1048576 ; control register address
ptrStat DC 1048577 ; status register address
ptrData DC 1048578 ; data register address
retVal EQU -3
parData EQU -2
Print
PUSHR SP ;save regs
LOAD R1, parData(FP)
STORE R1, @ptrData ; data to print
LOAD R1, =0
STORE R1, @ptrStat
; init (clear) state register
LOAD R1, =1
STORE R1, @ptrCtr
; give command to print
Wait LOAD R1, @PtrStat ; check state
register
JNZER R1, Done
JUMP Wait ; wait until I/O done
Done LOAD R1, =0 ; return ”Success”
STORE R1, retVal(FP)
POPR SP ; recover regs
IRET SP, =1
Solution with no timeout