1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Return NULL on error (or end of directory).

This commit is contained in:
Oliver Schmidt 2020-10-29 17:42:36 +01:00
parent 944ebbc23c
commit d8e6fa61bb
2 changed files with 14 additions and 4 deletions

View File

@ -5,7 +5,7 @@
; struct filehandle* Get1stDirEntry (void);
.import __oserror
.import __oserror, return0
.export _Get1stDirEntry
.include "diskdrv.inc"
@ -14,6 +14,10 @@
_Get1stDirEntry:
jsr Get1stDirEntry
stx __oserror
lda r5L
txa
beq L0 ; error?
jmp return0 ; return NULL
L0: lda r5L
ldx r5H
rts

View File

@ -5,7 +5,7 @@
; struct filehandle* GetNxtDirEntry (void);
.import __oserror
.import __oserror, return0
.export _GetNxtDirEntry
.include "diskdrv.inc"
@ -14,6 +14,12 @@
_GetNxtDirEntry:
jsr GetNxtDirEntry
stx __oserror
lda r5L
txa
beq L0 ; error?
tya
beq L0 ; end of dir?
jmp return0 ; return NULL
L0: lda r5L
ldx r5H
rts