Completed _scanf.c, added vsscanf.c, rewrote sscanf.c.

Added an assembler include _file.inc and changed asm code that uses struct
FILE to be independent of its size.
Fixed return codes in several files to use EOF instead of -1.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1205 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-03-24 13:26:18 +00:00
parent d4cb713197
commit 6e37905b18
15 changed files with 295 additions and 99 deletions

View File

@@ -6,34 +6,37 @@
.export __fdesc
.import return0, __filetab
.importzp tmp1
.import return0
__fdesc:
ldy #0
L1: lda __filetab+1,y ; load flags
beq L2 ; jump if empty (== CLOSED)
iny
iny
cpy #16 ; Done?
bne L1
.include "_file.inc"
.proc __fdesc
ldy #0
lda #_FOPEN
Loop: and __filetab + _FILE_f_flags,y ; load flags
beq Found ; jump if closed
.repeat ::_FILE_size
iny
.endrepeat
cpy #(FOPEN_MAX * _FILE_size) ; Done?
bne Loop
; File table is full
jmp return0
jmp return0
; Free slot found
; Free slot found, get address
Found: tya ; Offset
clc
adc #<__filetab
ldx #>__filetab ; High byte
bcc @L1 ; Jump if no overflow
inx ; Bump high byte
@L1: rts
.endproc
L2: sty tmp1 ; Offset
lda #<__filetab
ldx #>__filetab
clc
adc tmp1
tay
txa
adc #0
tax
tya
rts