home *** CD-ROM | disk | FTP | other *** search
- COSUBM MACRO
- ; * * * * * COSUB.LIB CONSOLE OUTPUT SUBROUTINES
- ;
- ; Subroutine to write [A] to console
- ; alters only [A] and [F]
- ;
- COUT EQU $
- PUSH B ! PUSH D ! PUSH H
- ANI 7FH ; CP/M expects bit 7 = 0
- MOV E,A ; put data where CP/M expects
- MVI C,2 ; console output function
- CALL 0005H
- POP H ! POP D ! POP B
- RET
- ;
- ; Subroutine to write return, linefeed to console
- ; alters no registers
- ;
- COCRLF EQU $
- PUSH PSW
- MVI A,CR ; the return...
- CALL COUT
- MVI A,LF ; ...the line feed
- CALL COUT
- POP PSW
- RET
- ;
- ; Subroutine to write a space to the console
- ; alters no registers
- ;
- COSPACE EQU $
- PUSH PSW
- MVI A,BLANK
- CALL COUT
- POP PSW
- RET
- ;
- ; Subroutine to write bytes addressed by HL,
- ; up to and including one with bit 7 = 1
- ; alters [A] and [F], steps HL to last byte of string.
- ;
- COSTR EQU $
- MOV A,M ; pick up byte to go
- CALL COUT ; print it
- MOV A,M ; look again, and
- RLC ; ..check if bit 7
- RC ; ..return if on
- INX H ; else point to next,
- JMP COSTR ; ..and continue
- ;
- ; * * * * * END OF COSUB.LIB
- ENDM