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
dl
register is 8 bits, and so this is necessarily an 8-bit data operation. Ifcol
is not defined as an 8 bit value, you will get an operand type error.col
needs to be defined as an 8-bit value, for example:Since in your code you've cleared the high byte of
dx
withxor dx, dx
before loadingdl
, you could move a word:Here, the assembler will assume that the data type is necessarily 16 bits, so
col
must be defined as a word, such as: