; Program that demonstrates CALL and RET instructions

.386
.MODEL FLAT

ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD

.CODE                           ; start of main program code
_start:
        mov     eax, 10         ; move data into registers
        mov     ebx, 20
        call    add2nums        ; push address of next instruction
                                ; onto the stack, and pass control
                                ; to the address of add2nums
        INVOKE  ExitProcess, 0  ; exit with return code 0

PUBLIC _start                   ; make entry point public

add2nums:
        add     eax, ebx        ; Add two numbers
        ret                     ; Return result in EAX

END                             ; end of source code