mirror of
https://github.com/cc65/cc65.git
synced 2024-12-22 12:30:41 +00:00
Use the constants from _file.inc
git-svn-id: svn://svn.cc65.org/cc65/trunk@1650 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
ef886278a8
commit
0edf53fd2f
@ -1,4 +1,4 @@
|
||||
;
|
||||
;
|
||||
; Ullrich von Bassewitz, 31.05.1998
|
||||
;
|
||||
; Several small file stream functions
|
||||
@ -9,17 +9,19 @@
|
||||
.import __errno
|
||||
.importzp ptr1
|
||||
|
||||
.include "_file.inc"
|
||||
|
||||
;
|
||||
; Get the FILE* parameter, check if the file is open
|
||||
;
|
||||
|
||||
getf: sta ptr1
|
||||
stx ptr1+1
|
||||
ldy #1
|
||||
lda (ptr1),y ; get f->f_flags
|
||||
and #$01 ; file open?
|
||||
beq @L1 ; jump if no
|
||||
clc ; ok
|
||||
ldy #_FILE_f_flags
|
||||
lda (ptr1),y ; get f->f_flags
|
||||
and #_FOPEN ; file open?
|
||||
beq @L1 ; jump if no
|
||||
clc ; ok
|
||||
rts
|
||||
@L1: sec
|
||||
rts
|
||||
@ -32,7 +34,7 @@ _clearerr:
|
||||
jsr getf
|
||||
bcs err
|
||||
lda (ptr1),y
|
||||
and #$F9
|
||||
and #<~(_FEOF | _FERROR)
|
||||
sta (ptr1),y
|
||||
err: rts
|
||||
|
||||
@ -44,7 +46,7 @@ _feof:
|
||||
jsr getf
|
||||
; bcs err
|
||||
lda (ptr1),y
|
||||
and #$02
|
||||
and #_FEOF
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
@ -56,7 +58,7 @@ _ferror:
|
||||
jsr getf
|
||||
; bcs err
|
||||
lda (ptr1),y
|
||||
and #$04
|
||||
and #_FERROR
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user