1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-13 08:25:28 +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); ; struct filehandle* Get1stDirEntry (void);
.import __oserror .import __oserror, return0
.export _Get1stDirEntry .export _Get1stDirEntry
.include "diskdrv.inc" .include "diskdrv.inc"
@@ -14,6 +14,10 @@
_Get1stDirEntry: _Get1stDirEntry:
jsr Get1stDirEntry jsr Get1stDirEntry
stx __oserror stx __oserror
lda r5L txa
beq L0 ; error?
jmp return0 ; return NULL
L0: lda r5L
ldx r5H ldx r5H
rts rts

View File

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