- 113 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' Multiplication and Division Instructions' - ross-barton

**An Image/Link below is provided (as is) to download presentation**

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

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

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

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

Unsigned Multiplication

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

Signed Multiplication

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

Signed Multiplication

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

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

Divisor may be too small

D71 rem 1

E BC2F

Quotient does not fit in AL

Causes a “divide by zero” interrupt

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

Download Presentation

Connecting to Server..