Shunya
Shunya

Reputation: 20

Error: "Improper operand type"

This is a 8086 assembly program to convert 8-bit decimal number to hex number.
On the 14th line, why do I get next error?

improper operand type

.model small
.data
d1 DB 81d
d1 DB 16d
res DB ?
.code
mov ax,@data
mov ds,ax
xor ax,ax
xor bx,bx
mov al,d1
mov bl,d2
div bl
ror ah,4   ;Error occurs here
add ah,al
mov ax,res
int 3h
align 16
End

Upvotes: 0

Views: 1905

Answers (1)

dim
dim

Reputation: 660

ROR (and ROL/SHL/SHR/etc) with an immediate operand greater than 1 has been available starting from the 80186 processor only. It is unavailable on the 8086/88. The alternative is to do a sequence of 4 ROR ah, 1, or to use ROR ah, cl after having set CL to 4.

See https://en.wikipedia.org/wiki/X86_instruction_listings#Added_with_80186.2F80188

Upvotes: 7

Related Questions