.proc __fopen
- sta f
- stx f+1 ; Save f
+ sta file
+ stx file+1 ; Save f
; Get a pointer to the mode string
invmode:
lda #EINVAL
- sta __errno
- lda #0
- sta __errno+1
- tax
+ jsr __seterrno ; Set __errno, returns zero in A
+ tax ; a/x = 0
jmp incsp4
; Mode string successfully parsed. Store the binary mode onto the stack in
-; the same place where the mode string pointer was before. The call open()
+; the same place where the mode string pointer was before. Then call open()
modeok: ldy #$00
txa ; Mode -> A
; Open call succeeded
-openok: ldy f
+openok: ldy file
sty ptr1
- ldy f+1
+ ldy file+1
sty ptr1+1
- ldy #_FILE_f_fd
- sta (ptr1),y ; f->f_fd = fd;
- ldy #_FILE_f_flags
+ ldy #_FILE::f_fd
+ sta (ptr1),y ; file->f_fd = fd;
+ ldy #_FILE::f_flags
lda #_FOPEN
- sta (ptr1),y ; f->f_flags = _FOPEN;
+ sta (ptr1),y ; file->f_flags = _FOPEN;
; Return the pointer to the file structure
; Data
.bss
-f: .res 2
+file: .res 2