i have
color dw ?
and
parm:
mov ah, 62h
int 21h
mov es, bx
mov bx, 80h
mov cl, [es:bx]
cmp cl, 2
ret
mov bx, 82h
xor ax, ax
xor dx, dx
mov dl, [es:bx]
sub dl, '0'
mov [col], dl
inc bx
I want read value of parameter, but there are error: operand types do not match. Why this not work?
When you have an instruction such as the following in x86 assembly:
The
dlregister is 8 bits, and so this is necessarily an 8-bit data operation. Ifcolis not defined as an 8 bit value, you will get an operand type error.colneeds to be defined as an 8-bit value, for example:Since in your code you've cleared the high byte of
dxwithxor dx, dxbefore loadingdl, you could move a word:Here, the assembler will assume that the data type is necessarily 16 bits, so
colmust be defined as a word, such as: