Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

1-Operand instruction types

1 INC/ DEC/ NOT/NEG R/M

4 x (16+48) = 256 opcodes

2 PUSH/ POP R16/M16/SR/F


2 x (8+24+4+1) = 74 opcodes

3 MUL/ IMUL/ DIV/ DIV R/M


4 x (16+48) = 256 opcodes

Increment R16

INC BX 8 opcodes Before After


Ex. 1 BX 1234H 1235H
Ex. 2 BX FFFFH 0000H

Increment R8

INC DH 8 opcodes Before After


Ex. 1 DH 12H 13H
Ex. 2 DH FFH 00H

Increment M8

INC byteptr [BX] Before After


24 opcodes BX 2000H
DS:2000H FFH 00H
DS:2001H 12H 12H

NOTE:- In this instruction there is a single operand, [BX]. It is not clear whether it is
byte or word operand. Byteptr assembler directive announces to the assembler that it is a
byte operation.

Increment M16

INC wordptr [BX] Before After


24 opcodes BX 2000H
DS:2000H FFH 00H
DS:2001H 12H 13H

NOTE:- In this instruction there is a single operand, [BX]. It is not clear whether it is
byte or word operand. wordptr assembler directive announces to the assembler that it is a
word operation.
Decrement R16

DEC BX 8 opcodes Before After


Ex. 1 BX 1234H 1233H
Ex. 2 BX 0000H FFFFH

Decrement R8
DEC DH 8 opcodes Before After
Ex. 1 DH 12H 11H
Ex. 2 DH 00H FFH

Decrement M8
DEC byteptr [BX] Before After
24 opcodes BX 2000H
DS:2000H 00H FFH
DS:2001H 12H 12H

NOTE:-In this instruction there is a single operand, [BX]. It is not clear whether it is byte
or word operand. Byteptr assembler directive announces to the assembler that it is a byte
operation.
Decrement M16
DEC wordptr [BX] Before After
24 opcodes BX 2000H
DS:2000H 00H FFH
DS:2001H 12H 11H

NOTE:- In this instruction there is a single operand, [BX]. It is not clear whether it is
byte or word operand. wordptr assembler directive announces to the assembler that it is a
word operation.
Perform 1’s complement of R16

NOT BX 8 opcodes Before After


BX 1234H EDCBH
NOT operation performs 1’s complement.
Easy way: Subtract each hex digit from F

Perform 1’s complement of R8


NOT DH 8 opcodes Before After
DH 12H EDH

Perform 1’s complement of M8


NOT byteptr [BX] Before After
24 opcodes BX 2000H
DS:2000H 23H DCH
DS:2001H 12H 12H
NOTE:- In this instruction there is a single operand, [BX]. It is not clear whether it is
byte or word operand. Byteptr assembler directive announces to the assembler that it is a
byte operation.

Perform 1’s complement of M16

NOT wordptr [BX] Before After


24 opcodes BX 2000H
DS:2000H 34H CBH
DS:2001H 12H EDH

NOTE:- In this instruction there is a single operand, [BX]. It is not clear whether it is
byte or word operand. wordptr assembler directive announces to the assembler that it is a
word operation.

Perform 2’s complement of R16

NEG BX 8 opcodes Before After


BX 1234H EDCCH
NEG operation performs 2’s complement.
Easy way: Subtract each hex digit from F and add 1

Perform 2’s complement of R8

NEG DH 8 opcodes Before After


DH 12H EEH

Perform 2’s complement of M8

NEG byteptr [BX] Before After


24 opcodes BX 2000H
DS:2000H 23H DDH
DS:2001H 12H 12H

NOTE:- In this instruction there is a single operand, [BX]. It is not clear whether it is
byte or word operand. Byteptr assembler directive announces to the assembler that it is a
byte operation.

Perform 2’s complement of M16

NEG wordptr [BX] Before After


24 opcodes BX 2000H
DS:2000H 34H CBH
DS:2001H 12H EDH
NOTE:- In this instruction there is a single operand, [BX]. It is not clear whether it is
byte or word operand. wordptr assembler directive announces to the assembler that it is a
word operation.

PUSH R16

Ex. PUSH CX Before After


CX 1234H
SP 5678H 5676H
Empty
Empty SS: 5676H 1122H Full 1234H
Full SS:5678H 3344H 3344H

Suppose SP content is 5678H. It means locations 5678, 567A, 567C … in stack segment
are full. Locations 5676, 5674, … are empty. Information pushed to location 5676 and SP
value changes to 5676H. Push operation is always on 16 bit data.

PUSH M16

Ex. PUSH [BX] Before After


BX 1234H
SP 3366H 3364H
DS:1234H 5678H
Empty
Empty SP: 5676H 1122H Full 5678H
Full SP: 5678H 3344H 3344H

PUSH SR

Ex. PUSH CS Before After


CS 1234H
SP 5678H 5676H
Empty
Empty SS: 5676H 1122H Full 1234H
Full SS: 5678H 3344H 3344H

PUSH Flags

Ex. PUSHF Before After


Flags 1234H
SP 5678H 5676H
Empty
Empty SS: 5676H 1122H Full 1234H
Full SS: 5678H 3344H 3344H
POP R16

Ex. POP CX Before After


CX 1234H 1122H
SP 5678H 567AH
Empty
Full SS: 5678H 1122H Empty 1122H
SS: 567AH 3344H Full 3344H

NOTE:- Suppose SP content is 5678H. It means locations 5678, 567A, 567C … in stack
segment are full. Locations 5676, 5674, … are empty. Information poped from location
5678 and SP value changes to 567AH. Pop operation is always on 16 bit data.

POP M16

Ex. POP [BX] Before After


BX 1234H
SP 3366H 3368H
DS:1234H 5678H 1122H
Empty
Full SS: 3366H 1122H Empty 1122H
SS: 3368H 3344H Full 3344H

POP SR

Ex. POP CS Before After


CS 1234H 1122H
SP 5678H 567AH
Empty
Full SS: 5678H 1122H Empty 1122H
SS: 567AH 3344H Full 3344H

POP Flags

Ex. POPF Before After


Flags 1234H 1122H
SP 5678H 567AH
Empty
Full SS: 5678H 1122H Empty 1122H
SS: 567AH 3344H Full 3344H
Unsigned Multiply R8 with AL and store product in AX

MUL CH Before After


CH FEH FEH
AL 02H FCH 01FCH = 508
AH 34H 01H

Unsigned Multiply R16 with AX and store product in DX AX

MUL CX Before After

CX 00FEH 00FEH
AX 0002H 01FCH 01FCH = 508
DX 1234H 0000H

Signed Multiply R8 with AL and store product in AX

IMUL CH Before After

FEH = -02 CH FEH


AL 02H FCH FFFCH = -04
AH 34H FFH

NOTE:- IMUL CH instruction multiplies AL and CH treating them as signed numbers.


The 16-bit product is stored in AX.

Unsigned Division of AX by R8 and store quotient in AL and remainder in AH

DIV CH Before After


CH F0H
AL 25H 01H Quotient
AH 01H 35H Remainder

NOTE:- DIV CH instruction divides AX by CH treating them as unsigned numbers. The


8-bit quotient is stored in AL and the 8-bit remainder stored in AH.

Unsigned Division of DX AX by R16 and store quotient in AX and remainder in DX

DIV CX Before After


CX 00F0H
AX 0125H 0001H Quotient
DX 0000H 0035H Remainder

NOTE:- DIV CX instruction divides DX AX by CX treating them as unsigned numbers.


The 16-bit quotient is stored in AX and the 16-bit remainder stored in DX.
Signed Division of AX by R8 and store quotient in AL and remainder in AH

IDIV CH Before After


F0H = -10H CH F0H EE = -12H
AL 25H EEH Quotient
AH 01H 05H Remainder

NOTE:-IDIV CH instruction divides AX by CH treating them as signed numbers. The 8-


bit quotient is stored in AL and the 8-bit remainder stored in AH.

You might also like