Assembly Language: Transposing This Souce Code

Silv3rSurf3r_20
04-18-2004, 05:21 AM
Good Day All,

I have a problem. I'm new to assembly programming and i have no idea how i'm gonna do this task. I need to write a program in assembly language and i'm not familiar with the syntax but i've written the pseudocode for it. I was wondering if anyone could help me transpose this.

set x=y=0
loop 3 times
z = get valid digit from the keyboard
draw suqare of size z at (x,y)
y = y+z
end loop

I need to do this in intel x8086. i'm not too sure how to pass values in a parameter list in assembly language. do i use a stack for that?

any amount of help will be greatly appreciated.

Cheers.

Iceplug
04-18-2004, 02:15 PM
Yes, it is recommended to use a stack when making function calls in ASM:
Example:

MOV ax, 50
MOV bx, 20
MOV cx, 20
CALL ADDER
...
ADDER:
; Only using dx to show that you can preserve registers this way.
PUSH dx
MOV dx, cx
ADD dx, bx
ADD dx, ax
MOV ax, dx
POP dx
RET

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum