why won't my assembly program compile correctly?

amdskip

Lifer
Jan 6, 2001
22,530
13
81
Never done assembly before so I'm a newb.
Program must do: X = (A-(B-C)) - (D-(E-F)) and we cannot simplify it says.

This must be done in old style if that makes sense.

Here's what I have:

.model tiny
.code startupcode
mov ax,b
sub ax,c
mov bx,a
sub bx,ax
mov cx,e
sub cx,f
mov dx,d
sub dx,cx
sub bx,dx
mov x,bx
exitcode
a dw 4
b dw 3
c dw 1
d dw 2
e dw 1
f dw 0
x dw 0
end
 

Lico

Member
Apr 15, 2004
26
0
66
.model tiny
.code startupcode
mov ax,b
sub ax,c
mov bx,a
sub bx,ax
mov cx,e
sub cx,f
mov dx,d
sub dx,cx
sub bx,dx
mov x,bx
exitcode
a dw 4
b dw 3
c dw 1
d dw 2
e dw 1
f dw 0
end

x is undefined?

Lico
 

Crusty

Lifer
Sep 30, 2001
12,684
2
81
Originally posted by: Lico
.model tiny
.code startupcode
mov ax,b
sub ax,c
mov bx,a
sub bx,ax
mov cx,e
sub cx,f
mov dx,d
sub dx,cx
sub bx,dx
mov x,bx
exitcode
a dw 4
b dw 3
c dw 1
d dw 2
e dw 1
f dw 0
end

x is undefined?

Lico

doh! :p I didn't even catch that!