MOV ESP, 02000H ; initialize the stack
        IN EAX, [0] ;get a user input
        PUSH EAX ; push the value of the
parameter
into the STACK before
function call
        CALL incsub
        OUT [1], EAX ; here the program will
return
from the subprogram,
        ;the
return value was stored in EAX, so it can be
outputed from EAX
        ADD ESP, 4 ;ESP returns to the initial
value
      ; we need this line to clear the stack from
the parameter that was pushed
      ; in C/C++ the calling function is
responsible for this
        RET
incsub:
          PUSH EBX ; this register will be
used to
hold the value of the
parameter or/and for computations
          MOV EBX, [ESP + 8] ; move the
value of
the parameter into EBX
          INC EBX ; increment the value of
EBX by
1
          MOV EAX, EBX ; remember! return
value
should be stored in EAX
          POP EBX ; EBX will get some
garbage
value, but
it doesn't affect
anything
        ;the important part is that now the ESP holds
the address of the
statement
        ;where the subprogram should return
        RET
        global incsub
incsub:
        push
ebx
        mov ebx, [esp+8]
        inc ebx
        mov eax, ebx
        pop ebx
        ret
#inlcude < iostream >
using namespace std;
extern "C" int incsub ( int x );
int main (){
#include < stdio.h >
int incsub (int x);
int main ( ){