2 ; int fscanf (FILE* f, const char* format, ...);
4 ; Ullrich von Bassewitz, 2004-11-28
8 .import addysp, decsp4, _vfscanf
13 ; ----------------------------------------------------------------------------
18 ParamSize: .res 1 ; Number of parameter bytes
20 ; ----------------------------------------------------------------------------
21 ; int fscanf (FILE* f, const char* format, ...)
22 ; /* Standard C function */
26 ; /* Setup for variable arguments */
27 ; va_start (ap, format);
29 ; /* Call vfscanf(). Since we know that va_end won't do anything, we will
30 ; * save the call and return the value directly.
32 ; return vfscanf (f, format, ap);
39 sty ParamSize ; Number of param bytes passed in Y
41 ; We have to push f and format, both in the order they already have on stack.
42 ; To make this somewhat more efficient, we will create space on the stack and
43 ; then do a copy of the complete block instead of pushing each parameter
44 ; separately. Since the size of the arguments passed is the same as the size
45 ; of the fixed arguments, this will allow us to calculate the pointer to the
46 ; fixed size arguments easier (they're just ParamSize bytes away).
50 ; Calculate a pointer to the Format argument
60 ; Now copy both, f and format
68 ; Load va_list (last and __fastcall__ parameter to vfscanf)
77 ; Cleanup the stack. We will return what we got from vfscanf