OD: Add CS.RUN.ISATTY and use it to control CR/CRLF

This commit is contained in:
Bobbi Webber-Manners 2021-07-04 15:59:46 -04:00
parent b539462726
commit 24fbd7ddb1
1 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,5 @@
NEW
AUTO 3,1
.LIST OFF
.OP 65C02
.OR $2000
@ -22,6 +24,7 @@ char .BS 1
ByteCount .BS 3
bPause .BS 1
bPipe .BS 1
bIsTTY .BS 1
bTemp .BS 1
bDummy .BS 1
@ -57,6 +60,8 @@ CS.INIT clc
rts
*--------------------------------------
CS.RUN stz bPipe
stz bIsTTY
jsr CS.RUN.ISATTY
jsr CS.RUN.CheckArgs
bcs CS.RUN.LOOP.RTS
@ -209,6 +214,19 @@ CS.RUN.OPEN >PUSHYA
sta hFile
.9 rts
*--------------------------------------
CS.RUN.ISATTY ldy #S.PS.hStdOut
lda (pPS),y
tax
lsr
bcc .9
lda Nod.Table.hFD-2,x
>SYSCALL GetMemPtr
>STYA ZPPtr1
lda (ZPPtr1)
beq .9
inc bIsTTY
.9 rts
*--------------------------------------
CS.QUIT lda hFile
beq .1
>SYSCALL FClose
@ -287,6 +305,8 @@ CS.RUN.PRINTASCII
lda #C.CR
>SYSCALL PutChar
lda bIsTTY
beq .9
lda #C.LF
>SYSCALL PutChar
.9 rts
@ -328,3 +348,6 @@ MSG.HEXBYTE .AZ "%h "
DS.START
DS.END .ED
*--------------------------------------
MAN
SAVE usr/src/bin/od.s
ASM