hi everyone

I hope you can help me with converting some c code into assembly code, i have tried much now, and i still don't get it.

i'm new to programming ASM

this c code gets two number from the user to draw an ellipse

```
#include<stdio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
void main()
{
long d1,d2;
long rx,ry,rxsq,rysq,tworxsq,tworysq,dx,dy;
int gd=DETECT,gm,x,y;
clrscr();
printf("enter x radius of the ellipse(20)");
scanf("%ld",&rx);
printf("enter y radius of the ellipse(40)");
scanf("%ld",&ry);
initgraph(&gd,&gm,"");
rxsq=rx*rx;
rysq=ry*ry;
tworxsq=2*rxsq;
tworysq=2*rysq;
x=0;
y=ry;
d1=rysq-rxsq*ry+(0.25*rxsq);
dx=tworysq*x;
dy=tworxsq*y;
do{
putpixel(200+x,200+y,15);
putpixel(200-x,200-y,15);
putpixel(200+x,200-y,15);
putpixel(200-x,200+y,15);
if(d1<0)
{
x=x+1;
y=y;
dx=dx+tworysq;
d1=d1+dx+rysq;
}
else
{
x=x+1;
y=y-1;
dx=dx+tworysq;
dy=dy-tworxsq;
d1=d1+dx-dy+rysq;
}
delay(200);
}
while(dx<dy); // in dige yani chi ?
d2=rysq*(x+0.5)*(x+0.5)+rxsq*(y-1)*(y-1)-rxsq*rysq;
do{
putpixel(200+x,200+y,15);
putpixel(200-x,200-y,15);
putpixel(200+x,200-y,15);
putpixel(200-x,200+y,15);
if(d2>0){
x=x;
y=y-1;
dy=dy-tworxsq;
d2=d2-dy+rxsq;
}
else
{
x=x+1;
y=y-1;
dy=dy-tworxsq;
dx=dx+tworysq;
d2=d2+dx-dy+rxsq;
}
}
while(y>0);
getch();
}
```

my asm code

```
putpix macro x,y
mov cx,x
mov dx,y
mov ah,0ch
mov al,9
int 10h
endm
init macro
mov al,13h
mov ah,0
int 10h
endm
.model small
.stack 128
.data
d1 dw 0
d2 dw 0
rx dw 0
ry dw 0
rxsq dw 0
rysq dw 0
tworxsq dw 0
tworysq dw 0
x dw 0
y dw 0
dxx dw 0
dyy dw 0
km1 dw 0
km2 dw 0
km3 dw 0
two dw 2
four dw 4
.code
main proc far
mov ax,@data
mov ds,ax
init
mov rx,30
mov ry,10
mov ax,rx
mul ax
mov rxsq,ax
mov ax,ry
mul ax
mov rysq,ax
mov ax,rxsq
mul two
mov tworxsq,ax
mov ax,rysq
mul two
mov tworysq,ax
mov x,0
mov bx,ry
mov y,bx
;-----
;d1=rysq-rxsq*ry+(0.25*rxsq)
;4d1=4rysq-4rxsq*ry+(rxsq);
;
mov ax,rysq
mul four
mov cx,ax
;
mov ax,rxsq
mul ry
mul four
mov bx,ax
;
sub cx,bx
add cx,rxsq
;
mov ax,cx
div four
mov d1,ax
;-----
mov ax,rxsq
mul two
mov dxx,ax
mov ax,rysq
mul two
mov dyy,ax
;***loop1
lw1:cmp dxx,ax
jge endw1
;200+x
mov bx,x
add bx,200
;200+y
mov cx,y
add cx,200
putpix bx,cx
;200-x
mov bx,x
sub bx,200
neg bx
;200-y
mov cx,y
sub cx,200
neg cx
putpix bx,cx
;200+x
mov bx,x
add bx,200
;200-y
mov cx,y
sub cx,200
neg cx
putpix bx,cx
;200-x
mov bx,x
sub bx,200
neg bx
;200+y
mov cx,y
add cx,200
putpix bx,cx
cmp d1,0
jge else1
inc x
mov bx,tworysq
add dxx,bx
mov bx,rysq
add d1,bx
jmp ifexit1
else1:
inc x
dec y
mov bx,tworysq
add dxx,bx
mov bx,tworxsq
sub dyy,bx
;d1=d1+dx-dy+rysq;
mov bx,dxx
sub bx,dyy
add bx,rysq
add d1,bx
ifexit1:
mov cx,09999h
l12:
loop l12
jmp lw1
endw1:
;d2=rysq*(x+0.5)*(x+0.5)+rxsq*(y-1)*(y-1)-rxsq*rysq;
;4d2=rysq*(2x+1)*(2x+1)+4rxsq*(y-1)*(y-1)-4rxsq*rysq;
;4d2=km1+km2+km3
;km1
mov ax,x
mul two
add ax,1
mul ax
mul rysq
mov km1,ax
;km2
mov ax,y
dec ax
mul ax
mul rxsq
mul four
mov km2,ax
;km3
mov ax,rxsq
mul ax
mul four
mov km3,ax
mov ax,km1
add ax,km2
add ax,km3
div four
mov d2,ax
;***loop2
lw2:
cmp y,0
jle endw2
;200+x
mov bx,x
add bx,200
;200+y
mov cx,y
add cx,200
putpix bx,cx
;200-x
mov bx,x
sub bx,200
neg bx
;200-y
mov cx,y
sub cx,200
neg cx
putpix bx,cx
;200+x
mov bx,x
add bx,200
;200-y
mov cx,y
sub cx,200
neg cx
putpix bx,cx
;200-x
mov bx,x
sub bx,200
neg bx
;200+y
mov cx,y
add cx,200
putpix bx,cx
cmp d2,0
jle else2
dec y
mov bx,tworxsq
sub dyy,bx
;d2=d2-dy+rxsq;
mov bx,rxsq
add bx,dyy
sub d2,bx
jmp ifexit2
else2:
inc x
dec y
mov bx,tworxsq
sub y,bx
add dx,tworysq
;d2=d2+dx-dy+rxsq;
mov bx,dxx
add bx,rxsq
sub bx,dyy
sub d2,dx
ifexit2:
jmp lw2
endw2:
getch:mov ah,0
int 16h
mov ah,4ch
int 21h
main endp
end main
```