forked from cc65/cc65
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee8c8df
commit eb1741d
Showing
4 changed files
with
35 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
; | ||
; Colin Leroy-Mira, 2024 | ||
; | ||
; Helper to check for file opened, not eof, not ferror | ||
; Expects file pointer in ptr, returns 0 if everything is OK, -1 otherwise | ||
; Destroys A, X, Y | ||
; | ||
|
||
.export checkferror | ||
.importzp ptr1 | ||
|
||
.include "_file.inc" | ||
|
||
checkferror: | ||
ldy #_FILE::f_flags | ||
lda (ptr1),y | ||
tax | ||
and #_FOPEN ; Check for file open | ||
beq ret_eof | ||
txa | ||
and #(_FERROR|_FEOF); Check for error/eof | ||
bne ret_eof | ||
lda #$00 | ||
rts | ||
|
||
ret_eof: | ||
lda #$01 | ||
rts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters