Assembly Language Help (alang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Using VARARG in Procedures
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
See also: VARARG in Macros, PROC, PROTO, .MODEL, LanguageType
The VARARG attribute allows you to pass a variable number of
arguments to a procedure. The VARARG parameter receives a near
pointer to an array of WORD elements (DWORD if a far address is
passed). You can apply the VARARG attribute only to the last
parameter in a procedure definition. You can only use VARARG in
procedures when the C, SYSCALL, or STDCALL language types are in
effect.
addup PROTO NEAR C, parmcount:WORD, parmvalues:VARARG
invoke addup, 3, 5, 2, 4
addup PROC NEAR C, parmcount:WORD, parmvalues:VARARG
xor ax, ax
xor bx, bx
mov cx, parmcount
.REPEAT
add ax, parmvalues[bx]
inc bx
inc bx
.UNTILCXZ
ret
addup ENDP
-♦-