2 ; int printf (const char* Format, ...);
4 ; Ullrich von Bassewitz, 1.12.2000
8 .import _stdout, pushax, addysp, _vfprintf
13 ; ----------------------------------------------------------------------------
18 ParamSize: .res 1 ; Number of parameter bytes
20 ; ----------------------------------------------------------------------------
27 sty ParamSize ; Number of param bytes passed in Y
29 ; We are using a (hopefully) clever trick here to reduce code size. On entry,
30 ; the stack pointer points to the last pushed parameter of the variable
31 ; parameter list. Adding the number of parameter bytes, would result in a
32 ; pointer that points *after* the Format parameter.
33 ; Since we have to push stdout anyway, we will do that here, so
35 ; * we will save the subtraction of 2 (__fixargs__) later
36 ; * we will have the address of the Format parameter which needs to
44 ; Now calculate the va_list pointer, which does points to Format
63 ; Load va_list (last and __fastcall__ parameter to vfprintf)
72 ; Cleanup the stack. We will return what we got from vfprintf