mirror of
https://github.com/cc65/cc65.git
synced 2024-11-02 18:06:48 +00:00
7b3f6f9369
git-svn-id: svn://svn.cc65.org/cc65/trunk@2186 b7a2c559-68d2-44c3-8de9-860c34a00d81
52 lines
840 B
ArmAsm
52 lines
840 B
ArmAsm
;
|
|
; Ullrich von Bassewitz, 2003-06-02
|
|
;
|
|
; int __fastcall__ vprintf (const char* format, va_list ap);
|
|
;
|
|
|
|
.export _vprintf
|
|
.import _vfprintf, _stdout
|
|
.import decsp2
|
|
.importzp sp
|
|
|
|
|
|
.proc _vprintf
|
|
|
|
; Save A which contains the low part of ap
|
|
|
|
pha
|
|
|
|
; Allocate one more word on the stack
|
|
|
|
jsr decsp2
|
|
|
|
; Move the format parameter down and store stdout in it's place
|
|
|
|
ldy #2
|
|
lda (sp),y
|
|
ldy #0
|
|
sta (sp),y
|
|
ldy #3
|
|
lda (sp),y
|
|
ldy #1
|
|
sta (sp),y
|
|
|
|
iny
|
|
lda _stdout
|
|
sta (sp),y
|
|
iny
|
|
lda _stdout+1
|
|
sta (sp),y
|
|
|
|
; Restore A
|
|
|
|
pla
|
|
|
|
; Call vfprintf (stdout, format, ap) which will cleanup the stack and return
|
|
|
|
jmp _vfprintf
|
|
|
|
.endproc
|
|
|
|
|