user3354521
user3354521

Reputation: 1

How shift left will work

.model small
.stack 100h
.data
.code

main proc 

mov ax,2
shl ax,1
shl ax,2

int 21h

mov ah,4ch
int 21h

main endp 
end main

My question is that any other value except 1 in the value of count to left shift is giving invalid instruction operand

Upvotes: 0

Views: 75

Answers (1)

Aki Suihkonen
Aki Suihkonen

Reputation: 20037

In 8086, variable number of bit shifts is done with shl reg, cl
Shifting with Imm8 is allowed starting from 80286. See this for allowed addressing modes up to 80486.

Assuming that you intend to use 80386+, you should most likely provide a processor directive to the assembler; such as placing .386 in the header.

NASM: CPU 80386
MASM: .386

Upvotes: 2

Related Questions