Fixed two bugs, made the sources somewhat better readable.

git-svn-id: svn://svn.cc65.org/cc65/trunk@4256 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2009-09-28 17:47:33 +00:00
parent 85f96a7d6f
commit 6c8fab8e51
2 changed files with 46 additions and 47 deletions

View File

@@ -1,33 +1,32 @@
;
; int vsprintf (char* Buf, const char* Format, va_list ap);
; int __fastcall__ vsprintf (char* Buf, const char* Format, va_list ap);
;
; Ullrich von Bassewitz, 2009-09-26
;
.export _vsprintf
.import ldax0sp, pushax, staxysp
.import pushw0sp, staxysp
.import _vsnprintf
; ----------------------------------------------------------------------------
; vsprintf - formatted output into a buffer
;
; int vsprintf (char* buf, const char* format, va_list ap);
; int __fastcall__ vsprintf (char* buf, const char* format, va_list ap);
;
_vsprintf:
pha ; Save low byte of ap
pha ; Save low byte of ap
txa
pha ; Save high byte of op
; Build a stackframe for vsnprintf. To do that, we move format one word down,
; and store 0x7FF (INT_MAX) as size.
; and store 0x7FFF (INT_MAX) as size.
jsr ldax0sp ; Get format
jsr pushax ; And push it
lda #$7F
ldx #$FF ; INT_MAX
jsr pushw0sp ; Get format and push it
lda #$FF
ldx #$7F ; INT_MAX
ldy #2
jsr staxysp