; ; 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, "freopen.c", 878, 1068141847 .dbg file, "../../include/stdio.h", 5945, 1113916546 .dbg file, "../../include/stddef.h", 2974, 1061022172 .dbg file, "../../include/stdarg.h", 2817, 1102777145 .dbg file, "../../include/fcntl.h", 3407, 1101568713 .dbg file, "../../include/errno.h", 3647, 1060696125 .dbg file, "./_file.h", 742, 1084367783 .export _freopen .import _close .import __errno .import __fopen ; --------------------------------------------------------------- ; struct _FILE* __fastcall__ freopen (const unsigned char*, const unsigned char*, struct _FILE*) ; --------------------------------------------------------------- .segment "CODE" .proc _freopen .segment "CODE" ; ; { ; .dbg line, "freopen.c", 23 jsr pushax ; ; if ((f->f_flags & _FOPEN) == 0) { ; .dbg line, "freopen.c", 25 ldy #$01 jsr ldaxysp ldy #$01 sta ptr1 stx ptr1+1 lda (ptr1),y and #$01 bne L0004 ; ; _errno = EINVAL; /* File not input */ ; .dbg line, "freopen.c", 27 tax lda #$07 sta __errno stx __errno+1 ; ; return 0; ; .dbg line, "freopen.c", 28 txa jmp incsp6 ; ; if (close (f->f_fd) < 0) { ; .dbg line, "freopen.c", 34 L0004: jsr ldaxysp ldy #$00 sta ptr1 stx ptr1+1 ldx #$00 lda (ptr1),y jsr _close txa bpl L000B ; ; return 0; ; .dbg line, "freopen.c", 36 ldx #$00 txa jmp incsp6 ; ; return _fopen (name, mode, f); ; .dbg line, "freopen.c", 40 L000B: jsr decsp4 ldy #$09 jsr ldaxysp ldy #$02 sta (sp),y iny txa sta (sp),y ldy #$07 jsr ldaxysp ldy #$00 sta (sp),y iny txa sta (sp),y ldy #$05 jsr ldaxysp jsr __fopen ; ; } ; .dbg line, "freopen.c", 41 jmp incsp6 .dbg line .endproc