.proc __fopen
- sta f
- stx f+1 ; Save f
+ sta file
+ stx file ; Save f
; Get a pointer to the mode string
; 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;
+ 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
;
; Ullrich von Bassewitz, 22.11.2002
;
-; size_t __fastcall__ fread (void* buf, size_t size, size_t count, FILE* f);
+; size_t __fastcall__ fread (void* buf, size_t size, size_t count, FILE* file);
; /* Read from a file */
;
.proc _fread
-; Save f and place it into ptr1
+; Save file and place it into ptr1
- sta f
+ sta file
sta ptr1
- stx f+1
+ stx file+1
stx ptr1+1
; Check if the file is open
; Check if the stream is in an error state
-@L2: lda (ptr1),y ; get f->f_flags again
+@L2: lda (ptr1),y ; get file->f_flags again
and #_FERROR
bne @L1
ldy #_FILE_f_fd
lda (ptr1),y
ldx #$00
- jsr pushax ; f->f_fd
+ jsr pushax ; file->f_fd
ldy #9
jsr pushwysp ; buf
-; Stack is now: buf/size/count/f->fd/buf
+; Stack is now: buf/size/count/file->fd/buf
; Calculate the number of bytes to read: count * size
ldy #7
lda #_FERROR
@L4: sta tmp1
- lda f
+ lda file
sta ptr1
- lda f+1
+ lda file+1
sta ptr1+1
ldy #_FILE_f_flags
lda (ptr1),y
; Data
.bss
-f: .res 2
+file: .res 2
;
; Ullrich von Bassewitz, 22.11.2002
;
-; size_t __fastcall__ fwrite (const void* buf, size_t size, size_t count, FILE* f);
+; size_t __fastcall__ fwrite (const void* buf, size_t size, size_t count, FILE* file);
; /* Write to a file */
;
.proc _fwrite
-; Save f and place it into ptr1
+; Save file and place it into ptr1
- sta f
+ sta file
sta ptr1
- stx f+1
+ stx file+1
stx ptr1+1
; Check if the file is open
; Check if the stream is in an error state
-@L2: lda (ptr1),y ; get f->f_flags again
+@L2: lda (ptr1),y ; get file->f_flags again
and #_FERROR
bne @L1
ldy #_FILE_f_fd
lda (ptr1),y
ldx #$00
- jsr pushax ; f->f_fd
+ jsr pushax ; file->f_fd
ldy #9
jsr pushwysp ; buf
-; Stack is now: buf/size/count/f->fd/buf
+; Stack is now: buf/size/count/file->fd/buf
; Calculate the number of bytes to write: count * size
ldy #7
; Error in write. Set the stream error flag and bail out. _oserror and/or
; errno are already set by write().
- lda f
+ lda file
sta ptr1
- lda f+1
+ lda file+1
sta ptr1+1
ldy #_FILE_f_flags
lda (ptr1),y
; Data
.bss
-f: .res 2
+file: .res 2