Introduction:
Flat:
For more information on the
Flat Memory Model see the Intel Documentation at:
ftp://download.intel.com/design/intarch/papers/esc_ia_p.pdf
Stdcall:
;Written
code
Procedure PROC p1:DWORD, p2:DWORD
xor eax,eax
ret
Procedure ENDP
;Assembled
code
Procedure PROC p1:DWORD, p2:DWORD
ENTERD 00000h,0
; inserted by assembler
xor eax,eax
LEAVED
; inserted by assembler
RET 00008h
; changed by assembler
Procedure ENDP
As can be seen, using stdcall adds some overhead to the program (7 bytes in this example). However, it allows the ability to pass function parameters on the stack easily. One advantage of using assembly language, though, is the ability to pass parameters using the registers, which both increases speed and reduces code size.
Generally, for type checking,
readability, and programming ease it is worthwile to pass parameters via
the stack. But if maximum speed and minimum code size are required, parameters
should be passed through the registers.
For a plaintext copy: modelfs.txt