; Program that demonstrates INVOKE

.386
.MODEL FLAT

ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD

; Procedure prototypes:
load_data PROTO NEAR32 C, arg1:WORD, arg2:WORD, arg3:WORD 
save_data PROTO NEAR32 C, arg1:DWORD, arg2:BYTE

.DATA
        x WORD ?
        y WORD ?
.CODE                           ; start of main program code
_start:
        INVOKE  load_data,  ax, x,  y
        INVOKE  save_data,  ebx, 10

        INVOKE  ExitProcess, 0  ; exit with return code 0

PUBLIC _start                   ; make entry point public

load_data PROC NEAR32 C, arg1:WORD, arg2:WORD, arg3:WORD 
        ;
        ret
load_data ENDP

save_data PROC NEAR32 C PUBLIC USES di si, arg1:DWORD, arg2:BYTE
        ;
        ret
save_data ENDP

END                             ; end of source code

; Compiled:
;
; _start:
; 00401058 83EC 02            SUB ESP,2
; 0040105B 66:FF35 02404000   PUSH WORD PTR DS:[404002]
; 00401062 83EC 02            SUB ESP,2
; 00401065 66:FF35 00404000   PUSH WORD PTR DS:[404000]
; 0040106C 83EC 02            SUB ESP,2
; 0040106F 66:50              PUSH AX
; 00401071 E8 15000000        CALL main._load_data
; 00401076 83C4 0C            ADD ESP,0C
; 00401079 6A 0A              PUSH 0A
; 0040107B 53                 PUSH EBX
; 0040107C E8 0F000000        CALL main._save_data
; 00401081 83C4 08            ADD ESP,8
; 00401084 6A 00              PUSH 0
; 00401086 E8 97 03 00 00     CALL        _ExitProcess@4
; _load_data:
; 0040108B 55                 PUSH EBP
; 0040108C 8BEC               MOV EBP,ESP
; 0040108E C9                 LEAVE
; 0040108F C3                 RETN
; _save_data:
; 00401090 55                 PUSH EBP
; 00401091 8BEC               MOV EBP,ESP
; 00401093 66:57              PUSH DI
; 00401095 66:56              PUSH SI
; 00401097 66:5E              POP SI
; 00401099 66:5F              POP DI
; 0040109B C9                 LEAVE
; 0040109C C3                 RETN
;