1 / 24

Multiplication and Division Instructions - PowerPoint PPT Presentation

Multiplication and Division Instructions. Module M16.4 Section 10.4. Binary Multiplication. 9 C = 156. Binary Multiplication. 13 x 12 26 13 156. 1101 1100 0000 0000 1101 1101 10011100. Hex Multiplication. Hex Multiplication. Dec. Hex. 3D

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

PowerPoint Slideshow about ' Multiplication and Division Instructions' - ross-barton

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 - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Multiplication and DivisionInstructions

Module M16.4

Section 10.4

Binary Multiplication

13

x 12

26

13

156

1101

1100

0000

0000

1101

1101

10011100

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

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

100

011

= E3

MUL BL

F6

E3

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

31A4

x1B2C

253B0

6348

2 x 4 = 8

2 x A = 14

1 x 2 = 2 + 1 = 3

2 x 3 = 6

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

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

C 9C

Binary Division

1

1

0

1

1100

10011100

1100

1

0111

1100

0

0011

0000

0110

0

1100

0000

A

C

EE BC2F

B28

9A

F

C x E = A8

C x E = A8 + A = B2

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

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

Vector

Table

Offset

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