; ; File generated by cc65 v 2.11.0 ; .fopt compiler,"cc65 v 2.11.0" .setcpu "6502" .smart on .autoimport on .case on .debuginfo on .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 .macpack longbranch .dbg file, "ftell.c", 921, 1084485241 .dbg file, "../../include/stdio.h", 5945, 1113916546 .dbg file, "../../include/stddef.h", 2974, 1061022172 .dbg file, "../../include/stdarg.h", 2817, 1102777145 .dbg file, "../../include/errno.h", 3647, 1060696125 .dbg file, "../../include/unistd.h", 3912, 1061022172 .dbg file, "./_file.h", 742, 1084367783 .export _ftell .import __errno .import _lseek ; --------------------------------------------------------------- ; long __fastcall__ ftell (register struct _FILE*) ; --------------------------------------------------------------- .segment "CODE" .proc _ftell .segment "CODE" ; ; { ; .dbg line, "ftell.c", 24 jsr pushax ldy #$00 ldx #$04 jsr regswap2 ; ; if ((f->f_flags & _FOPEN) == 0) { ; .dbg line, "ftell.c", 28 jsr decsp4 ldy #$01 lda (regbank+4),y and #$01 bne L0004 ; ; _errno = EINVAL; /* File not open */ ; .dbg line, "ftell.c", 29 tax lda #$07 sta __errno stx __errno+1 ; ; return -1L; ; .dbg line, "ftell.c", 30 dex stx sreg stx sreg+1 txa jmp L0003 ; ; pos = lseek (f->f_fd, 0L, SEEK_CUR); ; .dbg line, "ftell.c", 34 L0004: jsr decsp6 dey lda (regbank+4),y ldy #$04 sta (sp),y iny lda #$00 sta (sp),y tax tay sta (sp),y iny sta (sp),y iny sta (sp),y iny sta (sp),y jsr _lseek ldy #$00 jsr steaxysp ; ; if (pos > 0 && (f->f_flags & _FPUSHBACK)) { ; .dbg line, "ftell.c", 39 ldy #$03 jsr ldeaxysp jsr pusheax ldx #$00 stx sreg stx sreg+1 lda #$01 jsr tosgeeax beq L0010 ldy #$01 lda (regbank+4),y and #$08 beq L0010 ; ; --pos; ; .dbg line, "ftell.c", 40 ldx #$00 tya dey jsr lsubeqysp ; ; return pos; ; .dbg line, "ftell.c", 44 L0010: ldy #$03 jsr ldeaxysp ; ; } ; .dbg line, "ftell.c", 45 L0003: pha ldy #$04 lda (sp),y sta regbank+4 iny lda (sp),y sta regbank+5 pla jmp incsp6 .dbg line .endproc