; ; SYSLIB Module Name: SEPSTR ; Author: Richard Conn ; SYSLIB Version Number: 2.0 ; Module Version Number: 1.0 ; Module Entry Points: ; EPSTR ; Module External References: ; COUT ; ; ; EPSTR -- ; PRINT STRING PTED TO BY HL ; AFFECT ONLY HL -- WHEN DONE, HL PTS TO BYTE AFTER STRING ; PERFORM NO CONTROL CHARACTER EXPANSION EXCEPT FOR ; INTERPRET , , , ; EXT COUT EPSTR:: PUSH D ; SAVE REGS PUSH B PUSH PSW ; SAVE REG A AND FLAGS MVI C,0 ; SET POSITION COUNT PSL: MOV A,M ; GET BYTE INX H ; PT TO NEXT ORA A ; 0=DONE JZ PSD CPI TAB ; EXPAND JZ PST ; PRINT CHAR INR C ; INCR POSITION CALL COUT ; PRINT IT ON CON: CPI CR ; CHECK FOR JZ PCR CPI LF ; CHECK FOR JZ PLF CPI BEL ; CHECK FOR JZ PLF CPI BS ; CHECK FOR JZ PBS JMP PSL ; -- RESET POSITION COUNT PCR: MVI C,0 ; RESET JMP PSL ; , , -- CURSOR DIDN'T ADVANCE PLF: DCR C ; BACK UP COUNT BY 1 JMP PSL ; -- CURSOR WENT BACKWARD, MAYBE PBS: MOV A,C ; CHECK FOR ZERO ORA A JZ PSL DCR C ; BACK UP COUNT BY 2 DCR C JMP PSL ; EXPAND PST: MOV A,C ; GET COUNT ANI 7 ; MASK FOR SUB FROM 8 MOV B,A ; STORE TEMPORARILY MVI A,8 ; SUBTRACT FROM 8 FOR COUNT SUB B MOV B,A ; COUNT IN B ADD C ; ADD TO POSITION COUNT MOV C,A MVI A,' ' ; PRINT PSTL: CALL COUT DCR B ; COUNT DOWN JNZ PSTL JMP PSL ; EPSTR DONE PSD: POP PSW ; RESTORE REG A AND FLAGS POP B ; RESTORE REGS POP D RET ; ; ASCII SPECIAL CHARACTER EQUATES ; NULL EQU 0 ; NULL BEL EQU 7 ; BELL BS EQU 8 ; BACKSPACE TAB EQU 9 ; TAB LF EQU 10 ; LINE FEED CR EQU 13 ; CARRIAGE RETURN CTRLR EQU 'R'-40H ; CTRL-R CTRLU EQU 'U'-40H ; CTRL-U CTRLX EQU 'X'-40H ; CTRL-X DEL EQU 7FH ; DELETE CHAR END