/* Internal formatting routine */
-int _printf (struct outdesc* d, const char* format, va_list ap);
+int __fastcall__ _printf (struct outdesc* d, const char* format, va_list ap);
; Save the register bank variables into the save area
- ldx #5
-Save: lda regbank,x
- sta RegSave,x
- dex
+ pha ; Save low byte of ap
+ ldy #5
+Save: lda regbank,y
+ sta RegSave,y
+ dey
bpl Save
; Get the parameters from the stack
- jsr popax ; Argument list pointer
- sta ArgList
+ pla ; Restore low byte of ap
+ sta ArgList ; Argument list pointer
stx ArgList+1
jsr popax ; Format string
lda (ptr1),y
jsr pushax
-; Push the va_list
+; Push va_list (last parameter to vfprintf)
- lda ptr1
- ldx ptr1+1
+ lda ptr1
+ ldx ptr1+1
jsr pushax
; Call vfprintf
- jsr _vfprintf
+ jsr _vfprintf
; Cleanup the stack. We will return what we got from vfprintf