From eaf74ea10fe12ae392423e990fda1fd315aa6bb9 Mon Sep 17 00:00:00 2001 From: Bobbi Webber-Manners Date: Sun, 4 Jul 2021 19:12:41 -0400 Subject: [PATCH] DU: Added CS.RUN.ISATTY and fixed EOL handling --- BIN/DU.S.txt | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/BIN/DU.S.txt b/BIN/DU.S.txt index e8abb29d..855d07a0 100644 --- a/BIN/DU.S.txt +++ b/BIN/DU.S.txt @@ -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