; Program that demonstrates INVOKE with ADDR of string

.386
.MODEL FLAT
        ; Procedure prototypes:
        print_str   PROTO   NEAR32 C, pstr:PTR BYTE
        ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
        
INCLUDE IO.H        ; header file for input/output

.DATA
        str1    BYTE    "This is a string", 0
        
.CODE                           ; start of main program code
_start:
        INVOKE  print_str, ADDR str1 

        INVOKE  ExitProcess, 0  ; exit with return code 0

PUBLIC _start                   ; make entry point public

print_str PROC NEAR32 C, arg1:PTR BYTE
        mov eax, arg1
        output  [eax]           ; display string
        ret
print_str ENDP

END                             ; end of source code

; DUMPBIN disassembly:
;
;_start:
;  0040104C: 68 00 40 40 00     push        404000h    ;  ASCII "This is a string"
;  00401051: E8 0A 00 00 00     call        _print_str
;  00401056: 83 C4 04           add         esp,4
;  00401059: 6A 00              push        0
;  0040105B: E8 8E 03 00 00     call        _ExitProcess@4
;_print_str:
;  00401060: 55                 push        ebp
;  00401061: 8B EC              mov         ebp,esp
;  00401063: 8B 45 08           mov         eax,dword ptr [ebp+8]
; output  [eax]
;  00401066: 50                 push        eax
;  00401067: 8D 00              lea         eax,[eax]
;  00401069: 50                 push        eax
;  0040106A: E8 AF FF FF FF     call        @ILT+25(outproc) (*)
;  0040106F: 58                 pop         eax
;  00401070: C9                 leave
;  00401071: C3                 ret
;
; (*)
; call @ILT+25(outproc) means that function outproc is located at slot 25 in the Incremental Link Table.
;