2 ; Ullrich von Bassewitz, 2004-05-12
4 ; int __fastcall__ ungetc (int c, FILE* f);
5 ; /* Push back a character into a file stream. */
11 .import ptr1: zp, tmp1: zp
17 ; ------------------------------------------------------------------------
22 ; Save the file pointer to ptr1
27 ; Get c from stack and save the lower byte in tmp1
32 ; c must be in char range
37 ; Check if the file is open
41 and #_FOPEN ; Is the file open?
42 beq error ; Branch if no
44 ; Set the pushback flag and reset the end-of-file indicator
51 ; Store the character into the pushback buffer
53 ldy #_FILE::f_pushback
62 ; File is not open or the character is invalid