mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
Made two GEOS directory functions return NULL if they can't give a valid entry.
This commit is contained in:
parent
d8e6fa61bb
commit
aad17a6f05
@ -858,20 +858,21 @@ The functions described here are common for SEQ and VLIR structures.
|
|||||||
<p>
|
<p>
|
||||||
<tt/struct filehandle *GetNxtDirEntry (void)/
|
<tt/struct filehandle *GetNxtDirEntry (void)/
|
||||||
<p>
|
<p>
|
||||||
These two functions are best suited for scanning the whole directory for particular files. Note that
|
Those two functions are best suited for scanning the whole directory for particular files. Note that
|
||||||
the returned filehandles describe all file slots in the directory - even those with deleted files.
|
the returned filehandles describe all file slots in the directory -- even those with deleted files.
|
||||||
The return value can be obtained by casting both sides to <tt/unsigned/ - as in the <tt/SetNextFree/
|
The return value is <tt/NULL/ if there are no more slots, or if there was a disk error. The
|
||||||
function or read directly after a call to those two functions from <tt/r5/. The current sector number
|
<tt/_oserror/ variable is non-zero if it was a disk error (see <tt>geos/gdisk.h</tt>). The current
|
||||||
is in <tt/r1/ and the sector data itself is in <tt/diskBlkBuf/.
|
directory track and sector numbers are in <tt/r1L/ and <tt/r1H/. The sector data itself is in
|
||||||
|
<tt/diskBlkBuf/.
|
||||||
|
|
||||||
<sect3>FindFile
|
<sect3>FindFile
|
||||||
<p>
|
<p>
|
||||||
<tt/char FindFile (char *fName)/
|
<tt/char FindFile (char *fName)/
|
||||||
<p>
|
<p>
|
||||||
This function scans the whole directory for the given filename. It returns either 0 (success) or 5
|
This function scans the whole directory for the given filename. It returns either 0 (success), 5
|
||||||
(FILE_NOT_FOUND, defined in <tt/gdisk.h/) or any other fatal disk read error. After a successful
|
(FILE_NOT_FOUND, defined in <tt>geos/gdisk.h</tt>), or any other fatal disk read error. After a successful
|
||||||
<tt/FindFile/ you will have <tt/struct filehandle/ at <tt/dirEntryBuf/ filled with the file's data and
|
<tt/FindFile()/, you will have <tt/struct filehandle/ at <tt/dirEntryBuf/ filled with the file's data, and
|
||||||
other registers set as described in <tt/GetNxtDirEntry/.
|
other registers set as described in <tt/GetNxtDirEntry()/.
|
||||||
|
|
||||||
<sect3>FindFTypes
|
<sect3>FindFTypes
|
||||||
<p>
|
<p>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Maciej 'YTM/Alliance' Witkowiak
|
; 1999-10-26, Maciej 'YTM/Alliance' Witkowiak
|
||||||
|
; 2020-10-29, Greg King
|
||||||
;
|
;
|
||||||
; 26.10.99
|
|
||||||
|
|
||||||
; struct filehandle* Get1stDirEntry (void);
|
; struct filehandle* Get1stDirEntry (void);
|
||||||
|
|
||||||
@ -15,9 +15,9 @@ _Get1stDirEntry:
|
|||||||
jsr Get1stDirEntry
|
jsr Get1stDirEntry
|
||||||
stx __oserror
|
stx __oserror
|
||||||
txa
|
txa
|
||||||
beq L0 ; error?
|
bne L1 ; jump if disk error
|
||||||
jmp return0 ; return NULL
|
lda r5L
|
||||||
|
|
||||||
L0: lda r5L
|
|
||||||
ldx r5H
|
ldx r5H
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
L1: jmp return0 ; return NULL if not valid entry
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
;
|
;
|
||||||
; Maciej 'YTM/Alliance' Witkowiak
|
; 1999-10-26, Maciej 'YTM/Alliance' Witkowiak
|
||||||
|
; 2020-10-29, Greg King
|
||||||
;
|
;
|
||||||
; 26.10.99
|
|
||||||
|
|
||||||
; struct filehandle* GetNxtDirEntry (void);
|
; struct filehandle* GetNxtDirEntry (void);
|
||||||
|
|
||||||
@ -15,11 +15,11 @@ _GetNxtDirEntry:
|
|||||||
jsr GetNxtDirEntry
|
jsr GetNxtDirEntry
|
||||||
stx __oserror
|
stx __oserror
|
||||||
txa
|
txa
|
||||||
beq L0 ; error?
|
bne L1 ; jump if disk error
|
||||||
tya
|
tya
|
||||||
beq L0 ; end of dir?
|
bne L1 ; jump when no more entries
|
||||||
jmp return0 ; return NULL
|
lda r5L
|
||||||
|
|
||||||
L0: lda r5L
|
|
||||||
ldx r5H
|
ldx r5H
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
L1: jmp return0 ; return NULL if not valid entry
|
||||||
|
Loading…
Reference in New Issue
Block a user