Assembling file errors

Viewed 34

What should I change that the error at tasm /zi file name would disappear?

ERROR TYPE

ex1.ASM(16) Operand types do not much

The expression 300-[5*(d-2*a)-1], data types: a -byte, d -word

The code :

   ASSUME cs:text_,ds:data_
data_ SEGMENT
a db 2
d dd 4
res dd ?
data_ ENDS

text_ SEGMENT
start:
mov bl,2;
mov al,a;
imul bl;ax=2*a
mov bx,d; bx=d
sub bx,ax;bx=d-2*a
mov ax,5;
imul bx; dxax=5*(d-2a)
sub ax,1;
sbb dx,0; dxax= 5*(d-2a)-1
mov bx,300; 
mov cx,0;cxbx =300
;cxbx
;dxax
sub bx,ax; 
sbb cx,dx;300-[5*(d-2*a)-1]
mov word ptr res+0,bx; 
mov word ptr res+2,cx;
mov ax, 4c00h
int 21h
text_ ENDS

END start
1 Answers

You declare d with dd, which makes it a dword (4 bytes). Later, you have mov bx,d which tries to load a 4 byte value into a 2 byte register.

You should declare d with dw:

d dw 4
Related