From: cuz Date: Fri, 1 Dec 2000 10:21:18 +0000 (+0000) Subject: Make _printf() __fastcall__ X-Git-Tag: V2.12.0~3033 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=27f600e9863606c26d2a2ebae2a3d910d3e2cb7b;p=cc65 Make _printf() __fastcall__ git-svn-id: svn://svn.cc65.org/cc65/trunk@507 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/common/_printf.h b/libsrc/common/_printf.h index 03e8f7307..9b5c26609 100644 --- a/libsrc/common/_printf.h +++ b/libsrc/common/_printf.h @@ -34,7 +34,7 @@ struct outdesc { /* 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); diff --git a/libsrc/common/_printf.s b/libsrc/common/_printf.s index d60ebdfe9..f390828ae 100644 --- a/libsrc/common/_printf.s +++ b/libsrc/common/_printf.s @@ -241,16 +241,17 @@ __printf: ; 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 diff --git a/libsrc/common/printf.s b/libsrc/common/printf.s index ad26b8655..3f95f8e6b 100644 --- a/libsrc/common/printf.s +++ b/libsrc/common/printf.s @@ -60,15 +60,15 @@ _printf: 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