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

View File

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