mirror of
https://github.com/wwarthen/RomWBW.git
synced 2026-02-06 22:23:13 -06:00
137 lines
3.3 KiB
Plaintext
137 lines
3.3 KiB
Plaintext
page
|
||
|
||
; Library: RCPDIR for Z34RCP
|
||
; Author: Carson Wilson
|
||
; Version: 1.0
|
||
; Date: August 6, 1989
|
||
; Changes: Now allows "DIR [dir:].aft" as well as "DIR [dir:]*.aft"
|
||
; to show all files of a given file extentsion,
|
||
; e.g., "d .?80" gives all .Z80 and .180 files.
|
||
;
|
||
; Version: 1.0
|
||
; Date: June 15, 1988
|
||
;
|
||
; Command: DIR
|
||
; Function: Display a directory of the files on disk
|
||
; Syntax: DIR [dir:afn] Displays the DIR files
|
||
; DIR [dir:afn] S Displays the SYS files
|
||
; DIR [dir:afn] A Display both DIR and SYS files
|
||
;
|
||
; If slashchk is true:
|
||
;
|
||
; DIR [dir:]/S Equivalent to DIR [dir:]*.* S
|
||
; DIR [dir:]/A Equivalent to DIR [dir:]*.* A
|
||
|
||
dir:
|
||
call retsave ; Save return address and set stack
|
||
|
||
; See if FCB should be made wild (all '?')
|
||
|
||
ld hl,fcb1+1 ; Point to file name in FCP
|
||
ld a,(hl) ; Get first character of filename
|
||
|
||
if slashchk ; Allow "DIR /S" and "DIR /A" formats
|
||
cp '/' ; If name does not start with '/'
|
||
jr nz,dir01 ; ..branch and process normally
|
||
inc hl ; Point to second character
|
||
ld a,(hl) ; Get option character after slash
|
||
ld (fcb2+1),a ; ..and put it into second FCB
|
||
dec hl ; Back to first character
|
||
ld a,' ' ; Simulate empty FCB
|
||
endif ;slashchk
|
||
|
||
dir01:
|
||
cp ' ' ; See if no file spec given
|
||
jr nz,dir02 ; Spec given
|
||
|
||
ld b,8 ; Wildcard name
|
||
ld a,(fcb1+9)
|
||
cp ' ' ; Wildcard type?
|
||
jr nz,dir01a ; No
|
||
ld b,11 ; Yes. Fill name and type.
|
||
dir01a: ld a,'?' ; Get ready to fill with '?'
|
||
call fillp ; ..carry out fill
|
||
dir02:
|
||
if nosys ; Suppress-SYS-file-if-no-wheel option
|
||
call getwhl ; Get wheel status
|
||
jr z,dirnly ; If wheel off, ignore options
|
||
endif
|
||
|
||
ld a,(fcb2+1) ; Get first char of 2nd file name
|
||
ld b,1 ; Set for both dir and sys files
|
||
cp allflag ; SYS and DIR flag specifier?
|
||
jr z,dirpr ; Got system specifier
|
||
dec b ; B=0 for sys files only
|
||
cp sysflag ; SYS only?
|
||
jr z,dirpr
|
||
|
||
dirnly: ld b,80h ; Must be dir-only selection
|
||
|
||
; DIRECTORY PRINT ROUTINE
|
||
; On entry, B reg is set as follows:
|
||
; 0 for only system files, 80h for only dir files, 1 for both
|
||
;
|
||
dirpr:
|
||
ld a,b ; Get systst flag
|
||
call getdir ; Load and sort directory
|
||
jp z,prfnf ; Print no file message
|
||
if wide
|
||
ld e,5
|
||
else
|
||
ld e,4 ; Count down to 0
|
||
endif ; wide
|
||
;
|
||
; ENTRY PRINT LOOP
|
||
; On entry, HL pts to files selected (terminated by 0)
|
||
; and E is entry counter
|
||
;
|
||
dir3:
|
||
ld a,(hl) ; Check for done
|
||
or a
|
||
if dirsp and spaceon
|
||
jp z,spaexit ; Show space when done
|
||
else
|
||
jp z,exit ; Exit if done
|
||
endif ; Dirsp and spaceon
|
||
ld a,e ; Get entry counter
|
||
or a ; Output CRLF if 4 or 5 entries printed in line
|
||
jr nz,dir3a ; Continue
|
||
call crlf ; New line
|
||
if wide
|
||
ld e,5
|
||
else
|
||
ld e,4 ; Reset entry count
|
||
endif ; wide
|
||
|
||
ld a,e ; Get entry count
|
||
dir3a:
|
||
if wide
|
||
cp 5
|
||
else
|
||
cp 4 ; First entry?
|
||
endif ; wide
|
||
|
||
jr z,dir4
|
||
call print
|
||
;
|
||
if wide
|
||
;
|
||
db ' ' ; 2 spaces
|
||
db ' '+80h ; Then 1 more space
|
||
;
|
||
else
|
||
;
|
||
db ' ' ; Space
|
||
db fence+80h ; Then fence char
|
||
;
|
||
endif ; Wide
|
||
;
|
||
dir4:
|
||
call prfn ; Print file name
|
||
call break ; Check for abort
|
||
dec e ; Decrement entry counter
|
||
jr dir3
|
||
|
||
; End RCPDIR.LIB
|
||
|
||
|