making return function in assembly make me work so hard with it.
it's simple to give you example of factorial
example: 5! write in assembly language
mov cx,5
push cx
call 200
@
200 push bp
mov bp,sp
cmp cx,0
je ##
sub cx,1
push cx
call 200
#
add sp,2
mov ax,[bp+4]
mul dl ==>ex: ax=al*dl = 1*1
jmp ###
## mov dx,1
### pop bp
ret
Subscribe to:
Post Comments (Atom)