Fixed tab removal which somehow went wrong

git-svn-id: svn://svn.cc65.org/cc65/trunk@3382 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2005-02-14 09:38:30 +00:00
parent bb66b590a9
commit bc5d046503
5 changed files with 381 additions and 381 deletions

View File

@@ -5,58 +5,58 @@
; 2005-01-01, Greg King
;
.export _cscanf
.export _cscanf
.import pushax, addysp, _vcscanf
.import pushax, addysp, _vcscanf
.macpack generic
.include "zeropage.inc"
.macpack generic
.include "zeropage.inc"
; ----------------------------------------------------------------------------
; Code
;
_cscanf:
sty ArgSize ; Number of argument bytes passed in .Y
dey ; subtract size of format pointer
sty ArgSize ; Number of argument bytes passed in .Y
dey ; subtract size of format pointer
dey
tya
; Now, calculate the va_list pointer -- which points to format.
ldx sp+1
add sp
bcc @L1
ldx sp+1
add sp
bcc @L1
inx
@L1: sta ptr1
stx ptr1+1
@L1: sta ptr1
stx ptr1+1
; Push a copy of the format pointer onto the stack.
ldy #1
lda (ptr1),y
ldy #1
lda (ptr1),y
tax
dey
lda (ptr1),y
jsr pushax
lda (ptr1),y
jsr pushax
; Load va_list [last and __fastcall__ argument for vcscanf()].
lda ptr1
ldx ptr1+1
lda ptr1
ldx ptr1+1
; Call vcscanf().
jsr _vcscanf
jsr _vcscanf
; Clean up the stack. We will return what we got from vcscanf().
ldy ArgSize
jmp addysp
ldy ArgSize
jmp addysp
; ----------------------------------------------------------------------------
; Data
;
.bss
ArgSize:
.res 1 ; Number of argument bytes
.res 1 ; Number of argument bytes

View File

@@ -4,20 +4,20 @@
; 2005-01-02, Greg King
;
.export _vcscanf
.export _vcscanf
.import _cgetc, _cputc
.import popax, pushax, swapstk
.import _cgetc, _cputc
.import popax, pushax, swapstk
.include "../common/_scanf.inc"
.include "../common/_scanf.inc"
; static bool pushed;
; static char back;
;
.bss
pushed: .res 1
back: .res 1
pushed: .res 1
back: .res 1
.code
; /* Call-back functions:
@@ -39,26 +39,26 @@ back: .res 1
; return (int)C;
; }
;
get: ldx pushed
beq L1
get: ldx pushed
beq L1
; Return the old, pushed-back character (instead of getting a new one).
;
dex ; ldx #>0
stx pushed
lda back
dex ; ldx #>0
stx pushed
lda back
rts
; Directly read the keyboard.
;
L1: jsr _cgetc
L1: jsr _cgetc
; Echo the character to the screen.
;
pha
jsr _cputc
jsr _cputc
pla
ldx #>0
ldx #>0
rts
@@ -68,10 +68,10 @@ L1: jsr _cgetc
; return back = c;
; }
;
unget: ldx #1
stx pushed
jsr popax ; get the first argument
sta back
unget: ldx #1
stx pushed
jsr popax ; get the first argument
sta back
rts
@@ -96,35 +96,35 @@ unget: ldx #1
;
; Beware: Because ap is a fastcall parameter, we must not destroy .XA.
;
.proc _vcscanf
.proc _vcscanf
; ----------------------------------------------------------------------------
; Static, constant scanfdata structure for the _vcscanf routine.
;
.rodata
d: .addr get ; SCANFDATA::GET
.addr unget ; SCANFDATA::UNGET
; .addr 0 ; SCANFDATA::DATA (not used)
d: .addr get ; SCANFDATA::GET
.addr unget ; SCANFDATA::UNGET
; .addr 0 ; SCANFDATA::DATA (not used)
.code
pha ; Save low byte of ap
pha ; Save low byte of ap
txa
pha ; Save high byte of ap
ldx #0
stx pushed
pha ; Save high byte of ap
ldx #0
stx pushed
; Put &d on the stack in front of the format pointer.
lda #<d
ldx #>d
jsr swapstk ; Swap .XA with top-of-stack
jsr pushax ; Put format pointer back on stack
jsr pushax ; Put format pointer back on stack
; Restore ap, and jump to _scanf which will clean up the stack.
pla
tax
pla
jmp __scanf
jmp __scanf
.endproc