How to declare a function that returns value and has parameters x86 assembly MASM -
i'm trying declare function using proc
, far not work:
inputarray(lpintegerarray:dword,lpstrnum:dword,lpstrprompt:dword):dword proc
and neither this
inputarray proc lpintegerarray:dword,lpstrnum:dword,lpstrprompt:dword:dword
how declare function in x86 assembly masm takes parameters and returns dword value?
i'm using .model flat
well, chisx, if astronomy, can tell assembler language planet, different other. next code little 8086 assembler program intel syntax has 1 function calculate factorial, gets 1 parameter si register , returns value in ax register (made emu8086) :
.stack 100h .data .code ;initialize data segment. mov ax,@data mov ds,ax mov si, 5 ;parameter function. call non_recursive_factorial ;results returns in ax. ;finish program properly. mov ax, 4c00h int 21h ;----------------------------------------- ;function calculate factorial. ;parameter : si. ;returns : ax. proc non_recursive_factorial mov cx,2 ;second number multiply. mov ax,1 ;first number multiply. while: mul cx ;ax*cx = dx:ax. inc cx ;next number multiply. cmp cx, si ;parameter been used. jbe while ret endp
not sure if looking for. hope helps.
Comments
Post a Comment