Use 25 to 50 words to discuss one of the Shift, Rotate, Multiplication, Division Instructions and give a simple example of the .asm complete program code that you have compiled. Just keep the code simple with not much program description. Put your code in a program and make sure it compiles then copy it. Do some research, using articles other than your textbook would be great also.
Shift Instructions:
In Assembly Language there are 5 shift instructions, these instructions are used to move the bits in a register left or right by a specified number of bits, called shift length.
Register shift can be performed:
Directly by the instructions ASR, LSR, LSL, ROR, and RRX, and the result is written to a destination register.
During the calculation of Operand2 by the instructions that specify the second operand as a register with shift. The result is used by the instruction.
Arithmetic shift right (ASR)
Arithmetic shift right by m bits moves the left-hand 32-m bits of a register to the right by n places, into the right-hand 32-m bits of the result.
Logical shift right (LSR)
Logical shift right by m bits moves the left-hand 32-m bits of a register to the right by m places, into the right-hand 32-m bits of the result. It sets the left-hand n bits of the result to 0.
Logical shift left (LSL)
Logical shift left by m bits moves the right-hand 32-m bits of a register to the left by m places, into the left-hand 32-m bits of the result. It sets the right-hand m bits of the result to 0.
Rotate right (ROR)
Rotate right by m bits moves the left-hand 32-m bits of a register to the right by m places, into the right-hand 32-m bits of the result. It also moves the right-hand m bits of the register into the left-hand m bits of the result.
Rotate right with extend (RRX)
Rotate right with extend moves the bits of a register to the right by one bit. It copies the carry flag into bit[31] of the result.
MULTIPLICATION INSTRUCTION:
In Assembly Language MUL(Unsigned multiplication) & IMUL(Signed multiplication) instructions are used to multiply two 8-,16-,32-bit registers.
Eg:
.DATA
A DW 0FF87H
B DW 0FF84H
C DW ?
.CODE
START:
MOV AX,@DATA
MOV DS,AX
MOV SI,0000H
MOV AX,A
MOV CX,B
MUL CX ; IMUL for signed multiplication
INT 03H
END START
DIVISION INSTRUCTION:
In Assembly Language DIV(Unsigned division) & IDIV(Signed division) instructions are used to divide two 8-,16-,32-bit registers.
Eg:
.DATA
A DW 0FF87H
B DW 0FF84H
C DW ?
.CODE
START:
MOV AX,@DATA
MOV DS,AX
MOV SI,0000H
MOV AX,A
MOV CX,B
DIV CX ;IDIV for signed division
INT 03H
END START
Get Answers For Free
Most questions answered within 1 hours.