Procedure Calls

You have become acquainted with the simplified method of calling procedures in MASM. This is the invoke directive. The procedure must be defined beforehand using the PROTO keyword, for example:

 MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD     ...     invoke MessageBox, h, ADDR TheMsg, ADDR TitleW, MB_OK 

Here, h is the descriptor of the window, from which the message is called, TheMsg is the message string, TitleW is the window header, and MB_OK is the message type. ADDR in this case is synonymous to OFFSET .

The TASM syntax also has a simplified call.

 EXTERN MESSAGEBOX:PROC     ...     call MessageBox PASCAL, h, ADDR TheMsg, ADDR TitleW, MB_OK 

Here, PASCAL is the call type, or, to be more precise, the order of parameters. It is also possible to use the C parameter; then the order of parameters will be inverted.



The Assembly Programming Master Book
The Assembly Programming Master Book
ISBN: 8170088178
EAN: 2147483647
Year: 2004
Pages: 140
Authors: Vlad Pirogov

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net