DU: Added CS.RUN.ISATTY and fixed EOL handling

This commit is contained in:
Bobbi Webber-Manners 2021-07-04 19:12:41 -04:00
parent 4164f4106c
commit eaf74ea10f
1 changed files with 20 additions and 6 deletions

View File

@ -1,8 +1,5 @@
NEW
AUTO 3,1
*---------------------------------------
* DU: Disk Usage - Bobbi - June 15, 2021
*---------------------------------------
.LIST OFF
.OP 65C02
.OR $2000
@ -30,6 +27,7 @@ hLineBuf .BS 1
ZPLineBuf .BS 2
bPass2 .BS 1
bDirLevel .BS 1
bIsTTY .BS 1
ZS.END
.ED
*--------------------------------------
@ -74,7 +72,9 @@ CS.INIT clc
rts
*--------------------------------------
CS.RUN
.1 stz bDirLevel
.1 stz bIsTTY
jsr CS.RUN.ISATTY
stz bDirLevel
>INC.G ArgCount
>SYSCALL ArgV
bcs .6
@ -391,10 +391,24 @@ CS.RUN.PrintCwd >PUSHW L.MSG.CWD
*--------------------------------------
CS.RUN.NewLine lda #C.CR
>SYSCALL PutChar
lda bIsTTY
beq .9
lda #C.LF
>SYSCALL PutChar
clc
rts
.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.DOEVENT sec
rts