Loading in 5 sec....

Multiplication and Division InstructionsPowerPoint Presentation

Multiplication and Division Instructions

- 100 Views
- Uploaded on
- Presentation posted in: General

Multiplication and Division Instructions

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Multiplication and DivisionInstructions

Module M16.4

Section 10.4

9 C = 156

13

x 12

26

13

156

1101

1100

0000

0000

1101

1101

10011100

Hex Multiplication

Hex Multiplication

Dec

Hex

3D

x 5A

262 A x D = 82, A x 3 = 1E + 8 = 26

131 5 x D = 41, 5 x 3 = F + 4 = 13

157216 = 549010

61

x 90

5490

Hex Multiplication

0000 B0 3D MOV AL,3DH ;AL=3DH

0002 B3 5A MOV BL,5AH ;BL=5AH

0004 F6 E3 MUL BL ;AX=ALxBL

product = 1572H is in AX

11

100

011

= E3

MUL BL

F6

E3

16-Bit Hex Multiplication

31A4

x1B2C

253B0

4 x C = 30

A x C = 78 + 3 = 7B

1 x C = C + 7 = 13

3 x C = 24 + 1 = 25

16-Bit Hex Multiplication

31A4

x1B2C

253B0

6348

2 x 4 = 8

2 x A = 14

1 x 2 = 2 + 1 = 3

2 x 3 = 6

16-Bit Hex Multiplication

31A4

x1B2C

253B0

6348

2220C

4 x B = 2C

A x B = 6E + 2 = 70

1 x B = B + 7 = 12

3 x B = 21 + 1 = 22

16-Bit Hex Multiplication

31A4

x1B2C

253B0

6348

2220C

31A4

0544D430

0000 B8 A4 31 MOV AX,31A4H ;AX=31A4H

0003 BB 2C 1B MOV BX,1B2CH ;BX=1B2CH

0006 F7 E3 MUL BX ;DX:AX = AX x BX

Hex

Dec

A5

x 24

294

14A

1734

165

x 36

990

495

5940

594010 = 173416

But A5 = 10100101 can be a signed number

2’s comp = 01011011 = 5BH = 9110

Therefore, A5 can represent -91

Dec

327610 = 0CCC16

= 0000 1100 1100 1100

2’s comp = 1111 0011 0011 0100

= F334H

-91

x 36

546

273

-3276

Therefore, for signed multiplication

A5H x 24H = F334H

and not 1734H

The 8086 IMUL instruction performs SIGNED multiplciation

0000 B0 A5 MOV AL,A5H ;AL=A5H

0002 B3 24 MOV BL,24H ;BL=24H

0004 F6 EB IMUL BL ;AX=ALxBL

product = F334H is in AX

D

C 9C

1

1

0

1

1100

10011100

1100

1

0111

1100

0

0011

0000

0110

0

1100

0000

Hex Division

A

C

EE BC2F

B28

9A

F

C x E = A8

C x E = A8 + A = B2

Hex Division

A

C

EE BC2F

B28

9A

F

94C

63

Dividend = BC2F

Divisor = EE

Quotient = CA

Remainder = 63

A x E = 8C

A x E = 8C + 8 = 94

Hex Division

A

C

EE BC2F

B28

9A

F

94C

63

0000 B8 2F BC MOV AX,0BC2FH ;AX=BC2FH

0003 B3 EE MOV BL,0EEH ;BL=EEH

0006 F6 F3 DIV BL ;AL=AX/BL

quotient = AL = CAH

remainder = AH = 63H

D71 rem 1

E BC2F

Quotient does not fit in AL

Causes a “divide by zero” interrupt

Interrupt

Vector

Table

Interrupt Vector Table

Offset

address

Type number

000

004

008

00C

010

014

IP

0

1

2

3

4

5

Division by zero

Single Stepping

NMI Interrupt

1-Byte INT (opcode = CC)

Signed overflow (INTO)

Print screen

CS

IP

CS

IP

CS

IP

CS

IP

CS

IP

CS