Removed (pretty inconsistently used) tab chars from source code base.
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
; Cursor related variables
|
||||
;
|
||||
|
||||
.export cursor
|
||||
.export cursor
|
||||
|
||||
.bss
|
||||
|
||||
cursor: .res 1
|
||||
cursor: .res 1
|
||||
|
||||
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
; Ullrich von Bassewitz, 1.12.2000
|
||||
;
|
||||
|
||||
.export _cprintf
|
||||
.import pushax, addysp, _vcprintf
|
||||
.importzp sp, ptr1
|
||||
.export _cprintf
|
||||
.import pushax, addysp, _vcprintf
|
||||
.importzp sp, ptr1
|
||||
|
||||
.macpack generic
|
||||
.macpack generic
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Data
|
||||
|
||||
.bss
|
||||
|
||||
ParamSize: .res 1 ; Number of parameter bytes
|
||||
ParamSize: .res 1 ; Number of parameter bytes
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; Code
|
||||
@@ -24,41 +24,41 @@ ParamSize: .res 1 ; Number of parameter bytes
|
||||
|
||||
|
||||
_cprintf:
|
||||
sty ParamSize ; Number of param bytes passed in Y
|
||||
sty ParamSize ; Number of param bytes passed in Y
|
||||
|
||||
; Calculate a pointer that points to Format
|
||||
|
||||
dey
|
||||
dey ; Sub size of Format
|
||||
tya
|
||||
add sp
|
||||
sta ptr1
|
||||
ldx sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
dey
|
||||
dey ; Sub size of Format
|
||||
tya
|
||||
add sp
|
||||
sta ptr1
|
||||
ldx sp+1
|
||||
bcc @L1
|
||||
inx
|
||||
@L1: stx ptr1+1
|
||||
|
||||
; Push Format
|
||||
|
||||
ldy #1
|
||||
lda (ptr1),y
|
||||
tax
|
||||
dey
|
||||
lda (ptr1),y
|
||||
jsr pushax
|
||||
ldy #1
|
||||
lda (ptr1),y
|
||||
tax
|
||||
dey
|
||||
lda (ptr1),y
|
||||
jsr pushax
|
||||
|
||||
; Load va_list (last and __fastcall__ parameter to vfprintf)
|
||||
|
||||
lda ptr1
|
||||
ldx ptr1+1
|
||||
lda ptr1
|
||||
ldx ptr1+1
|
||||
|
||||
; Call vcprintf
|
||||
|
||||
jsr _vcprintf
|
||||
jsr _vcprintf
|
||||
|
||||
; Cleanup the stack. We will return what we got from vcprintf
|
||||
|
||||
ldy ParamSize
|
||||
jmp addysp
|
||||
ldy ParamSize
|
||||
jmp addysp
|
||||
|
||||
|
||||
|
||||
@@ -5,31 +5,31 @@
|
||||
; void cputhex16 (unsigned val);
|
||||
;
|
||||
|
||||
.export _cputhex8, _cputhex16
|
||||
.import _cputc
|
||||
.import __hextab
|
||||
.export _cputhex8, _cputhex16
|
||||
.import _cputc
|
||||
.import __hextab
|
||||
|
||||
|
||||
_cputhex16:
|
||||
pha ; Save low byte
|
||||
txa ; Get high byte into A
|
||||
jsr _cputhex8 ; Output high byte
|
||||
pla ; Restore low byte and run into _cputhex8
|
||||
pha ; Save low byte
|
||||
txa ; Get high byte into A
|
||||
jsr _cputhex8 ; Output high byte
|
||||
pla ; Restore low byte and run into _cputhex8
|
||||
|
||||
_cputhex8:
|
||||
pha ; Save the value
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
tay
|
||||
lda __hextab,y
|
||||
jsr _cputc
|
||||
pla
|
||||
and #$0F
|
||||
tay
|
||||
lda __hextab,y
|
||||
jmp _cputc
|
||||
pha ; Save the value
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
lsr a
|
||||
tay
|
||||
lda __hextab,y
|
||||
jsr _cputc
|
||||
pla
|
||||
and #$0F
|
||||
tay
|
||||
lda __hextab,y
|
||||
jmp _cputc
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,32 +5,32 @@
|
||||
; void cputs (char* s);
|
||||
;
|
||||
|
||||
.export _cputsxy, _cputs
|
||||
.import popa, _gotoxy, _cputc
|
||||
.importzp ptr1, tmp1
|
||||
|
||||
.export _cputsxy, _cputs
|
||||
.import popa, _gotoxy, _cputc
|
||||
.importzp ptr1, tmp1
|
||||
|
||||
_cputsxy:
|
||||
sta ptr1 ; Save s for later
|
||||
stx ptr1+1
|
||||
jsr popa ; Get Y
|
||||
jsr _gotoxy ; Set cursor, pop x
|
||||
jmp L0 ; Same as cputs...
|
||||
sta ptr1 ; Save s for later
|
||||
stx ptr1+1
|
||||
jsr popa ; Get Y
|
||||
jsr _gotoxy ; Set cursor, pop x
|
||||
jmp L0 ; Same as cputs...
|
||||
|
||||
_cputs: sta ptr1 ; Save s
|
||||
stx ptr1+1
|
||||
L0: ldy #0
|
||||
L1: lda (ptr1),y
|
||||
beq L9 ; Jump if done
|
||||
iny
|
||||
sty tmp1 ; Save offset
|
||||
jsr _cputc ; Output char, advance cursor
|
||||
ldy tmp1 ; Get offset
|
||||
bne L1 ; Next char
|
||||
inc ptr1+1 ; Bump high byte
|
||||
bne L1
|
||||
_cputs: sta ptr1 ; Save s
|
||||
stx ptr1+1
|
||||
L0: ldy #0
|
||||
L1: lda (ptr1),y
|
||||
beq L9 ; Jump if done
|
||||
iny
|
||||
sty tmp1 ; Save offset
|
||||
jsr _cputc ; Output char, advance cursor
|
||||
ldy tmp1 ; Get offset
|
||||
bne L1 ; Next char
|
||||
inc ptr1+1 ; Bump high byte
|
||||
bne L1
|
||||
|
||||
; Done
|
||||
|
||||
L9: rts
|
||||
L9: rts
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -4,17 +4,17 @@
|
||||
; unsigned char cursor (unsigned char onoff);
|
||||
;
|
||||
|
||||
.export _cursor
|
||||
.import cursor
|
||||
.export _cursor
|
||||
.import cursor
|
||||
|
||||
|
||||
.proc _cursor
|
||||
.proc _cursor
|
||||
|
||||
tay ; onoff into Y
|
||||
ldx #0 ; High byte of result
|
||||
lda cursor ; Get old value
|
||||
sty cursor ; Set new value
|
||||
rts
|
||||
tay ; onoff into Y
|
||||
ldx #0 ; High byte of result
|
||||
lda cursor ; Get old value
|
||||
sty cursor ; Set new value
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -4,22 +4,22 @@
|
||||
; void screensize (unsigned char* x, unsigned char* y);
|
||||
;
|
||||
|
||||
.export _screensize
|
||||
.export _screensize
|
||||
|
||||
.import popsreg
|
||||
.import screensize
|
||||
.importzp ptr1, sreg
|
||||
.import popsreg
|
||||
.import screensize
|
||||
.importzp ptr1, sreg
|
||||
|
||||
.proc _screensize
|
||||
.proc _screensize
|
||||
|
||||
sta ptr1 ; Store the y pointer
|
||||
stx ptr1+1
|
||||
sta ptr1 ; Store the y pointer
|
||||
stx ptr1+1
|
||||
jsr popsreg ; Get the x pointer into sreg
|
||||
jsr screensize ; Get screensize into X/Y
|
||||
tya ; Get Y size into A
|
||||
|
||||
.IFP02
|
||||
ldy #0
|
||||
ldy #0
|
||||
sta (ptr1),y
|
||||
txa
|
||||
sta (sreg),y
|
||||
@@ -29,7 +29,7 @@
|
||||
sta (sreg)
|
||||
.ENDIF
|
||||
|
||||
rts
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
; Ullrich von Bassewitz, 2.12.2000
|
||||
;
|
||||
|
||||
.export _vcprintf
|
||||
.import pushax, popax
|
||||
.import __printf, _cputc
|
||||
.importzp sp, ptr1, ptr2, ptr3, tmp1
|
||||
.export _vcprintf
|
||||
.import pushax, popax
|
||||
.import __printf, _cputc
|
||||
.importzp sp, ptr1, ptr2, ptr3, tmp1
|
||||
|
||||
.macpack generic
|
||||
.macpack generic
|
||||
|
||||
|
||||
.data
|
||||
@@ -19,11 +19,11 @@
|
||||
; Static data for the _vsprintf routine
|
||||
;
|
||||
|
||||
outdesc: ; Static outdesc structure
|
||||
.word 0 ; ccount
|
||||
.word out ; Output function pointer
|
||||
.word 0 ; ptr
|
||||
.word 0 ; uns
|
||||
outdesc: ; Static outdesc structure
|
||||
.word 0 ; ccount
|
||||
.word out ; Output function pointer
|
||||
.word 0 ; ptr
|
||||
.word 0 ; uns
|
||||
|
||||
.code
|
||||
|
||||
@@ -36,60 +36,60 @@ outdesc: ; Static outdesc structure
|
||||
; /* Fast screen output */
|
||||
; d->ccount += count;
|
||||
; while (count) {
|
||||
; cputc (*buf);
|
||||
; ++buf;
|
||||
; --count;
|
||||
; cputc (*buf);
|
||||
; ++buf;
|
||||
; --count;
|
||||
; }
|
||||
; }
|
||||
;
|
||||
; We're using ptr1 and tmp1, since we know that the cputc routine will not use
|
||||
; them (they're also used in cputs, so they must be safe).
|
||||
|
||||
out: jsr popax ; count
|
||||
sta ptr2
|
||||
eor #$FF
|
||||
sta outdesc+6
|
||||
txa
|
||||
sta ptr2+1
|
||||
eor #$FF
|
||||
sta outdesc+7
|
||||
out: jsr popax ; count
|
||||
sta ptr2
|
||||
eor #$FF
|
||||
sta outdesc+6
|
||||
txa
|
||||
sta ptr2+1
|
||||
eor #$FF
|
||||
sta outdesc+7
|
||||
|
||||
jsr popax ; buf
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
jsr popax ; buf
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
|
||||
jsr popax ; d
|
||||
sta ptr3
|
||||
stx ptr3+1
|
||||
jsr popax ; d
|
||||
sta ptr3
|
||||
stx ptr3+1
|
||||
|
||||
; Sum up the total count of characters
|
||||
|
||||
ldy #0 ; ccount in struct outdesc
|
||||
sty tmp1 ; Initialize tmp1 while we have zero available
|
||||
lda (ptr3),y
|
||||
add ptr2
|
||||
sta (ptr3),y
|
||||
iny
|
||||
lda (ptr3),y
|
||||
adc ptr2+1
|
||||
sta (ptr3),y
|
||||
ldy #0 ; ccount in struct outdesc
|
||||
sty tmp1 ; Initialize tmp1 while we have zero available
|
||||
lda (ptr3),y
|
||||
add ptr2
|
||||
sta (ptr3),y
|
||||
iny
|
||||
lda (ptr3),y
|
||||
adc ptr2+1
|
||||
sta (ptr3),y
|
||||
|
||||
; Loop outputting characters
|
||||
|
||||
@L1: inc outdesc+6
|
||||
beq @L4
|
||||
@L2: ldy tmp1
|
||||
lda (ptr1),y
|
||||
iny
|
||||
bne @L3
|
||||
inc ptr1+1
|
||||
@L3: sty tmp1
|
||||
jsr _cputc
|
||||
jmp @L1
|
||||
@L1: inc outdesc+6
|
||||
beq @L4
|
||||
@L2: ldy tmp1
|
||||
lda (ptr1),y
|
||||
iny
|
||||
bne @L3
|
||||
inc ptr1+1
|
||||
@L3: sty tmp1
|
||||
jsr _cputc
|
||||
jmp @L1
|
||||
|
||||
@L4: inc outdesc+7
|
||||
bne @L2
|
||||
rts
|
||||
@L4: inc outdesc+7
|
||||
bne @L2
|
||||
rts
|
||||
|
||||
; ----------------------------------------------------------------------------
|
||||
; vcprintf - formatted console i/o
|
||||
@@ -113,46 +113,46 @@ out: jsr popax ; count
|
||||
; gained by using __fastcall__.
|
||||
|
||||
_vcprintf:
|
||||
sta ptr1 ; Save ap
|
||||
stx ptr1+1
|
||||
sta ptr1 ; Save ap
|
||||
stx ptr1+1
|
||||
|
||||
; Setup the outdesc structure
|
||||
|
||||
lda #0
|
||||
sta outdesc
|
||||
sta outdesc+1 ; Clear ccount
|
||||
lda #0
|
||||
sta outdesc
|
||||
sta outdesc+1 ; Clear ccount
|
||||
|
||||
; Get the format parameter and push it again
|
||||
|
||||
ldy #1
|
||||
lda (sp),y
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
jsr pushax
|
||||
ldy #1
|
||||
lda (sp),y
|
||||
tax
|
||||
dey
|
||||
lda (sp),y
|
||||
jsr pushax
|
||||
|
||||
; Replace the passed format parameter on the stack by &d - this creates
|
||||
; exactly the stack frame _printf expects. Parameters will get dropped
|
||||
; by _printf.
|
||||
|
||||
ldy #2 ; Low byte of d
|
||||
lda #<outdesc
|
||||
sta (sp),y
|
||||
iny
|
||||
lda #>outdesc
|
||||
sta (sp),y
|
||||
ldy #2 ; Low byte of d
|
||||
lda #<outdesc
|
||||
sta (sp),y
|
||||
iny
|
||||
lda #>outdesc
|
||||
sta (sp),y
|
||||
|
||||
; Restore ap and call _printf
|
||||
|
||||
lda ptr1
|
||||
ldx ptr1+1
|
||||
jsr __printf
|
||||
lda ptr1
|
||||
ldx ptr1+1
|
||||
jsr __printf
|
||||
|
||||
; Return the number of bytes written.
|
||||
|
||||
lda outdesc ; ccount
|
||||
ldx outdesc+1
|
||||
rts
|
||||
lda outdesc ; ccount
|
||||
ldx outdesc+1
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user