From: cuz Date: Mon, 2 Jun 2003 16:08:26 +0000 (+0000) Subject: Rewrote vprintf in assembler and made it __fastcall__ X-Git-Tag: V2.12.0~1532 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7b3f6f93693826c6f6e99095078698db10108a77;p=cc65 Rewrote vprintf in assembler and made it __fastcall__ git-svn-id: svn://svn.cc65.org/cc65/trunk@2186 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/include/stdio.h b/include/stdio.h index 47db40c85..9e77bacd9 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -102,7 +102,7 @@ int remove (const char* name); int rename (const char* old, const char* new); int sprintf (char* buf, const char* format, ...); int __fastcall__ vfprintf (FILE* f, const char* format, va_list ap); -int vprintf (const char* format, va_list ap); +int __fastcall__ vprintf (const char* format, va_list ap); int __fastcall__ vsprintf (char* buf, const char* format, va_list ap); /* Not available or testing: */ diff --git a/libsrc/common/.cvsignore b/libsrc/common/.cvsignore index 92e2088b4..6038dd9e4 100644 --- a/libsrc/common/.cvsignore +++ b/libsrc/common/.cvsignore @@ -33,6 +33,6 @@ sscanf.s strftime.s strtok.s strxfrm.s +system.s timezone.s -vprintf.s vsscanf.s diff --git a/libsrc/common/Makefile b/libsrc/common/Makefile index cb77af872..52b460c88 100644 --- a/libsrc/common/Makefile +++ b/libsrc/common/Makefile @@ -53,7 +53,6 @@ C_OBJS = _afailed.o \ strtok.o \ system.o \ timezone.o \ - vprintf.o \ vsscanf.o @@ -139,6 +138,7 @@ S_OBJS = _fdesc.o \ tolower.o \ toupper.o \ vfprintf.o \ + vprintf.o \ vsprintf.o \ zerobss.o diff --git a/libsrc/common/vprintf.c b/libsrc/common/vprintf.c deleted file mode 100644 index 7ad77b396..000000000 --- a/libsrc/common/vprintf.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * vprintf.c - * - * Ullrich von Bassewitz, 11.08.1998 - */ - - - -#include -#include -#include "_printf.h" - - - -int vprintf (const char* format, va_list ap) -{ - return vfprintf (stdout, format, ap); -} - - - diff --git a/libsrc/common/vprintf.s b/libsrc/common/vprintf.s new file mode 100644 index 000000000..99e8018f9 --- /dev/null +++ b/libsrc/common/vprintf.s @@ -0,0 +1,51 @@ +; +; 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 + +