December 18, 1984

Resident command 'DIR' fix in ZCPR3 and SYSRCP.ASM

Greetings all -- I have stumbled (truly!) upon a distasteful, though not
essentially serious bug in both ZCPR3.ASM and the SYSRCP.ASM segment.
Fortunately (more for me than for you) a fix is easy and works 100%.  In my
immodesty I used my name as a label for the fix.  I hope that some soul,
hopefully Richard Conn in the next update to ZCPR3 will correct the bug in his
imminently elegant way and get rid of my fix in the process.

I am probably one of the few folks who likes the resident DIR command, but I
surely wanted to limit the use of the DIR flags to those who know which
characters I use to invoke the DIR only, DIR and SYS files both, and the SYS
files only.  In the RELEASE version of ZCPR3 and SYSRCP.ASM, the (SYS and DIR)
flag is tested for absolutely, but the (SYS only) flag is inappropriately
tested for, and if not found, then the (SYS and DIR) flag is assumed to have
been used, and the whole directory, SYS and DIR, is displayed.  Try it; if you
type 'DIR *.* $' or any other character in place of the '$', the entire
directory, including SYS files will be displayed.  I merely made the SYS only
flag testing an absolute, and when it failed, then automatically reverted to
the DIR only mode.  Section 5A from the SYSRCP.ASM file follows (the ZCPR3
section 5A is almost the same, and the area for modification is identical, as
is the fix....)

Bucky Carr, SYSOP, World Peace RCP/M, Denver, 303-320-4822, 300/1200, 24 hrs

By the way, my highest compliments to Richard Conn (and the rest of the public
domain programming community) for their immeasurable contributions to society
via computing.


;Section 5A
;Command: DIR
;Function:  To display a directory of the files on disk
;Forms:
;       DIR <afn>       Displays the DIR files
;       DIR <afn> S     Displays the SYS files
;       DIR <afn> A     Display both DIR and SYS files
;Notes:
;       The flag SYSFLG defines the letter used to display both DIR and
;               SYS files (A in the above Forms section)
;       The flag SOFLG defines the letter used to display only the SYS
;               files (S in the above Forms section)
;       The flag WIDE determines if the file names are spaced further
;               apart (WIDE=TRUE) for 80-col screens
;       The flag FENCE defines the character used to separate the file
;               names
;
       IF      DIRON
DIR:
;
; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED
;
       IF      WDIR
       CALL    WHLTST
       ENDIF           ;WHEEL APPROVAL
;
       CALL    RETSAVE         ;SAVE RET ADDRESS AND SET STACK
       LXI     H,FCB1+1        ;MAKE FCB WILD (ALL '?') IF NO FILENAME.TYP
       MOV     A,M             ;GET FIRST CHAR OF FILENAME.TYP
       CPI     ' '             ;IF <SP>, ALL WILD
       CZ      FILLQ
       LDA     FCB2+1          ;GET FIRST CHAR OF 2ND FILE NAME
       MVI     B,80H           ;PREPARE FOR DIR-ONLY SELECTION
       CPI     ' '             ;ANY FLAG?
       JRZ     DIRPR           ;THERE IS NO FLAG, SO DIR ONLY
       MVI     B,1             ;SET FOR BOTH DIR AND SYS FILES
       CPI     SYSFLG          ;SYSTEM AND DIR FLAG SPECIFIER?
       JRZ     DIRPR           ;GOT SYSTEM SPECIFIER
       CPI     SOFLG           ;SYS ONLY?
;
; ---> the fix begins here <---
;
       JRZ     BUCKY   ;it was the SYS only flag, exactly!
       MVI     B,80H   ;NOT the SYS flag either, so default to DIR only
       JR      DIRPR   ;and do the directory as requested.
;
; ---> commented out the next two lines of original code <---
;
;       JRNZ    DIRPR
;       DCR     B               ;B=0 FOR SYS FILES ONLY
;
; ---> added the 'SYS flag ok' routine here <---
;
BUCKY:  MVI     B,0     ;as described below, if SYS only=true then reg B=0
       JR      DIRPR   ;now go on with the dirpr routine.
;
; ---> that ends the fix <---

       ENDIF           ;DIRON
;
; DIRECTORY PRINT ROUTINE; ON ENTRY, B REG IS SET AS FOLLOWS:
;       0 FOR ONLY SYSTEM FILES, 80H FOR ONLY DIR FILES, 1 FOR BOTH
;
       IF      DIRON OR ERAON OR LTON OR PROTON OR CPON OR RENON
DIRPR:
       MOV     A,B             ;GET SYSTST FLAG