; > GeneralIO ; General I/O routines ; Print inline text ; ================= ; Corrupts r0,r1 ; .PrintInline ; Print inline text mov (sp)+,r1 ; Get return address to r1 jsr pc,PrintR1 ; Print text at r1, corrupts r0,r2 inc r1 ; increment return address bic #1,r1 ; clear bit zero mov r1,pc ; jump to return address ; Print text at R1 ; ================ ; On entry, R1=>zero-terminated string ; .PrintR1 ; Print text pointed to by R1, term. by &00 movb (r1)+,r0 ; get byte from r1, inc r1 beq PrintR1End ; exit if final byte jsr pc,PrintR0Token ; print expandable character br PrintR1 ; loop back .PrintR1End rts pc ; and exit ; Print character, checking COUNT and WIDTH ; ========================================= .PrintAscii jsr pc,IO_ASCI ; Output character br PrintR0Check .PrintR0 jsr pc,IO_WRCH ; Output character .PrintR0Check cmp r0,#13 beq PrintR0_Clear ; If , clear COUNT cmp r0,#32 bcs PrintR0_Ret ; Control codes, ignore count incb SV_COUNT ; Increment COUNT cmpb SV_COUNT,SV_WIDTH ; Has COUNT reached WIDTH? bne PrintR0_Ret ; No, exit jsr pc,IO_NEWL ; Print newline .PrintR0_Clear clrb SV_COUNT ; Set COUNT to zero .PrintR0_Ret rts pc ; Read line of text ; ================= ; On entry, R1=>memory to read string to ; On exit, R2=length of string ; Other regs preserved ; If Escape state, Escape error generated ; .IO_ReadLine mov r1,-(sp) ; Save pointer to text buffer mov r1,MOS_BUF ; Put text pointer in control block mov #&20FF,MOS_BUF+2 movb #&FF,MOS_BUF+4 adr MOS_BUF,r1 ; Point to control block clr r0 jsr pc,IO_WORD ; OSWORD 0 - read line of text mov (sp)+,r1 ; Restore pointer to text buffer bcs IO_Escape1 ; Escape state generates Escape error .IO_NoEscape rts pc ; Check for Escape state ; ---------------------- .IO_Escape tstb SV_ESCFLG ; Check local Escape flag bpl IO_NoEscape ; Return with no Escape state .IO_Escape1 jsr pc,Error equb 17,"Escape",0 align