home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
F
/
PTXT10.ARC
/
PTXT10.MAC
< prev
next >
Wrap
Text File
|
1993-03-28
|
4KB
|
182 lines
TITLE PTXT10.COM -- TEXT DISPLAY UTILITY
;
; 24 Jan 86 v1.0
; PTXT10.MAC is a derivative of TEXT50.ASM. It has
; been improved to add a local stack (vital under some
; condtitions), to use an ASCII Form Feed as a page break
; character, to accept Control-S as a scroll pause
; character, and to accept only Control-S or Control-Q
; as scroll resume characters.
; Control-X, Control-K, or Control-C will abort.
; Intel mnemonics and 8080 code have been converted
; to Zilog code/mnemonics. (Neither Intel mnemonics nor
; ANY Intel CPU's will be supported in the future.)
; -Jim Sinning
;
;--------------------------------------------------------
;
; ** ASCII Character Equates **
;
LF EQU 0AH ;ASCII Line Feed
AFF EQU 0CH ;ASCII Form Feed
CR EQU 0DH ;ASCII Carriage Return
CTLC EQU 'C'-40H ;Control-C
CTLK EQU 'K'-40H ;Control-K
CTLQ EQU 'Q'-40H ;Control-Q
CTLS EQU 'S'-40H ;Control-S
CTLX EQU 'X'-40H ;Control-X
EOF EQU 1AH ;END-OF-FILE Marker
ESC EQU 1BH ;Escape Character
;
;
; ** CP/M Equates **
;
BDOS EQU 0005H ;BDOS entry point
;
DIRIO EQU 6 ;direct console I/O
;
;=================================================
;
ORG 100H
;
;=================================================
START:
LD (STACK),SP
LD SP,STACK
LD HL,BUFFER ;point to text
;
PLP:
LD A,(HL) ;get a byte
INC HL ;INC pointer
AND 7FH ;Mask off hi-bit
OR A ;done if 0
JR Z,DONE ;YES, exit
CP AFF ;page break ?
JR Z,PAGE ;YES, break page
CALL PCHAR ;NO, just print the char
CALL CKBRK ;Check for abort
JR PLP ;Loop
;
DONE:
LD SP,(STACK) ;Restore CP/M's Stack
RET ;Return to CP/M
;
PAGE:
PUSH HL ;Save Text pointer
LD HL,PMSG ;Point CR message
PAGE2:
LD A,(HL) ;Get message byte
INC HL ;INC message pointer
OR A ;Done if 0
JR Z,PAUSE ;Yes, wait for CR
CALL PCHAR ;No, type message char
JR PAGE2 ;Loop
;
PAUSE:
LD E,0FFH ;Direct Console Input
LD C,DIRIO
CALL BDOS
OR A ;0 if nothing
JR Z,PAUSE
CP CR ;Got a char; CR ?
JR Z,CONT ;Yes, continue
CALL CKBK2
JR Z,DONE
JR PAUSE ;No, loop till CR
;
CONT:
CALL BLANK ;Overwrite the Cont message
POP HL ;Recover text pointer
JR PLP ;and jump back to text loop
;
BLANK:
LD HL,BLANKM
BLNK2:
LD A,(HL) ;Get a byte
OR A ;Quit if 0
RET Z ;and return to caller
INC HL ;INC pointer
CALL PCHAR ;Print the byte
JR BLNK2 ;Loop
;
PCHAR:
PUSH HL ;Save the pointer
LD E,A ;byte into E for BDOS
LD C,DIRIO ;Direct Console I/O
CALL BDOS
POP HL ;Get out pointer back
RET
;
CKBRK:
PUSH HL ;Save the pointer
LD E,0FFH ;Direct Console Input
LD C,DIRIO
CALL BDOS
POP HL ;Recover the pointer
OR A ;0 if nothing
RET Z ;so just return
CALL CKBK2 ;Returns Z if abort requested
JR Z,DONE
CP CTLS ;not abort, pause ?
JR Z,WAIT ;yes, wait
RET ;no, ignore anything else
;
CKBK2:
CP CTLC ;Got something, is ^C ?
RET Z ;yes, quit
CP CTLX ;^X then ?
RET Z ;yes, quit
CP CTLK ;^K maybe ?
RET ;Return Z or NZ flag
;
WAIT:
PUSH HL ;Save the pointer
LD E,0FFH ;Direct Console Input
LD C,DIRIO
CALL BDOS
POP HL ;Recover the pointer
OR A ;0 if nothing
JR Z,WAIT ;so loop till something
CP CTLS ;got something, ^S ?
RET Z ;Yes, return
CP CTLQ ;^Q then ?
JR NZ,WAIT ;No, wait some more
RET
;
;=================================================
; ** MESSAGES AND STACK AND TEXT BUFFER **
;
PMSG:
DEFB '<CR> to Continue...',0
;
; The following message is used to blank out the
; "<CR> to Continue..." message. It is a variation
; of the backspace,space,backspace technique, and the
; length of spaces must equal the length of the PMSG:
; message above. You could also use backspaces, but
; I prefer not to introduce control characters into
; someone's attempt to capture text sent via this program
; from an RBBS. (It is much easier to edit out a line
; of text and spaces than control chars.)
BLANKM:
DEFB CR,' ',CR,0
;
; The following message will BE the stack...
DEFB CR,LF,'INSERT YOUR TEXT BETWEEN THE "->" '
DEFB 'AND THE "^@''s"',CR,LF
STACK:
DEFB '->' ;This is run-time stack pointer
;storage as well as indicator for
;text placement.
;
;
BUFFER: ;Text goes here
DEFB CR,LF,0,0 ;0's mark end of text
;
;
;Now pad with EOF's to an even page boundary
DEFS (($+100H) AND 0FF00H)-$,1AH
;
END
;