OD: Bugfix to ASCII printout. Handle ^C/^S when reading from file.

This commit is contained in:
Bobbi Webber-Manners 2021-07-03 23:52:28 -04:00
parent 1262246050
commit 75ca6300b9
1 changed files with 37 additions and 4 deletions

View File

@ -20,6 +20,8 @@ hFile .BS 1
hBuf .BS 1
char .BS 1
ByteCount .BS 3
bPause .BS 1
bPipe .BS 1
bTemp .BS 1
bDummy .BS 1
@ -54,14 +56,41 @@ L.MSG.HEXBYTE .DA MSG.HEXBYTE
CS.INIT clc
rts
*--------------------------------------
CS.RUN jsr CS.RUN.CheckArgs
CS.RUN stz bPipe
jsr CS.RUN.CheckArgs
bcs CS.RUN.LOOP.RTS
stz ByteCount
stz ByteCount+1
stz ByteCount+2
CS.RUN.LOOP >SLEEP
CS.RUN.LOOP lda bPipe If reading from pipe
bne .2 No ^C/^S handling
ldy #S.PS.hStdIn
lda (pPS),y
>SYSCALL FEOF
bcs .9 I/O Error
tay
bne .1 No char
>SYSCALL GetChar
bcs .9 I/O error
cmp #$03 Ctrl-C
beq .9
cmp #$13 Ctrl-S
bne .1
lda bPause
eor #$ff
sta bPause
bne CS.RUN.LOOP
.1 lda bPause
bne CS.RUN.LOOP
.2 >SLEEP
lda hFile
>SYSCALL GetC
@ -139,6 +168,7 @@ CS.RUN.CheckArgs jsr CS.RUN.NextArg
ldy #S.PS.hStdIn
lda (pPS),y
sta hFile
inc bPipe
.80 >LDYAI 256
>SYSCALL GetMem
@ -238,9 +268,12 @@ CS.RUN.PRINTASCII
ldy #$00
.7 lda (ZPBufPtr),y
phy
cmp #$7f
bcs .75 Character >= $7f
cmp #C.SPACE
bcs .8
lda #'.'
bcc .75 Character < Space
bra .8
.75 lda #'.'
.8 >SYSCALL PutChar
ply