I am trying to do this: z=(5*a-b/7)/(3/b+a*a) in assembly code and I keep getting some errors.
Here is the code & the errs.
assume cs:code,ds:data
data segment
a dw 5
b dw 6
z dw 10
intermed dw ?
rez db ?
data ends
code segment
start:
mov ax,data
mov ds,ax
mul 5 ; ERROR Argument needs type override & Illegal immediate
; in ax we will have a*5;
mov bx,ax ; we move the ax data in the bx register bx:ax
mov ax,b; we move the b in the ax register ax:b
cwd ; ERROR Argument needs type override& Illegal immediate ;we convert the word from ax in doubleword, in dx:ax
idiv 7 ; ax=b/7
sub bx,ax; we substract ax out of bx ( ax: ax-bx <=> 5*a-b/7 )
mov intermed, ax ;we move all the data from ax to interm=(5*a-b*7)
mov al,3
idiv b; ax:3/b
mov bx,a; bx:a
mul a; bx:a*a
add ax, bx; ax=ax+bx;
mov bx,intermed; Err. Undefined symbol Intermed
idiv ax; we obtain the result in al and the reminder in ah
mov rez,al
mov ax, 4C00h
int 21h
code ends
end start
Where are my sins? Thank you !