11.13 Calling functions with an address in the register
--------------------------------------------------------
C-- lets you call a function whose address is in a register. The
parameters for this call are transferred only via the stack. The type of
function call for Windows programs is 'stdcall' and for other programs
'pascal'. The address of a function for a 32-bitprogram should be in a
32-bit register, and for a 16-bit program in a 16-bit register. This sort
of call is thought to have a return of type 'unsigned int'. For example:
BX = # proc;
BX (a);
IF ( BX(b) == 0 ) AX=2;
The following code is produced:
test.c-- 8: BX=#proc;
0104 BB1A01 mov bx,11Ah
test.c-- 9: BX(a);
0107 FF76FC push word ptr [bp-4]
010A FFD3 call near bx
test.c-- 10: IF (BX(b) == 0)AX=2;
010C FF76FE push word ptr [bp-2]
010F FFD3 call near bx
0111 85C0 test ax,ax
0113 7503 jne 118h
0115 B80200 mov ax,2