Assembly Language Programming in Intel 8086: Multiplication, Division, and Array Handling

 
Assembly Lang. – Intel 8086
Ch. 9 & 10
 
MUL – unsigned multiplication
IMUL – integer multiply – for signed
multiplication
 
If 2 bytes r multiplied 
 product is Word [16
bits]
If 2 words … 
 double-word [32 bits]
 
 
Byte form –
MUL 
 
source   ;source= register, mem; not const.
 
One no. is in ‘source’
Another no. is in AL
Product is in AX
 
 
Word form
Source ; 16-bit reg/mem – not const.
AX
 
MSB in DX, LSB in AX  [DX:AX]
Q.
 
   
A = 5xA – 12xB
A, B = word variables.
No overflow.
 
MOV
  
AX, 5
IMUL
  
A
  
;AX=5xA
MOV
  
A,AX
  
;A=5A
MOV
  
AX,12
  
;AX=12
IMUL
  
B
  
;AX=12B
SUB
  
A,AX
  
;A=5A – 12B
 
Q. Factorial that will compute N!
 
 
DIV, IDIV
 
DIV – divide – unsigned division
IDIV – integer divide
DIV
 
divisor
 
Byte form:
Divisor 
 8-bt reg/mem
Dividend 
 16-bit in AX
After division, Quotient 
 8-bit in AL
…, Remainder 
 8-bit in AH
 
15 ÷ 3 = 5, 
3
 is the 
divisor
 
 
Word form:
Divisor 
 16-bit reg/mem
Dividend 
 32-bit in DX:AX
After division, Quotient 
 16-bit in AX
…, Remainder 
 16-bit in DX
 
Divide overflow
 
Ch. 10
 
1-D array
DUP – to define arrays whose elements share a
common initial value
E.g.,
  
GAMMA
 
DW
 
100
  
DUP (0)
Sets up an array of 100 words, with each entry –
initialized to 0.
  
GAMMA
 
DW
 
100
  
DUP (?)
 Sets up an array of 100 words, with each entry –
UN
-initialized.
 
 
DUPs may be nested…
Slide Note
Embed
Share

Assembly language programming in Intel 8086 involves operations like unsigned and signed multiplication using MUL and IMUL instructions, respectively, along with division using DIV and IDIV instructions. This programming also encompasses handling arrays through the use of DUP to define arrays with common initial values and the nesting of DUPs for more complex data structures.

  • Assembly Language
  • Intel 8086
  • Multiplication
  • Division
  • Array Handling

Uploaded on Sep 14, 2024 | 3 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Assembly Lang. Intel 8086 Ch. 9 & 10 MUL unsigned multiplication IMUL integer multiply for signed multiplication If 2 bytes r multiplied product is Word [16 bits] If 2 words double-word [32 bits]

  2. Byte form MUL source ;source= register, mem; not const. One no. is in source Another no. is in AL Product is in AX

  3. Word form Source ; 16-bit reg/mem not const. AX MSB in DX, LSB in AX [DX:AX]

  4. Q. A = 5xA 12xB A, B = word variables. No overflow. MOV IMUL MOV MOV IMUL SUB AX, 5 A A,AX AX,12 B A,AX ;AX=5xA ;A=5A ;AX=12 ;AX=12B ;A=5A 12B

  5. Q. Factorial that will compute N!

  6. DIV, IDIV DIV divide unsigned division IDIV integer divide DIV divisor 15 3 = 5, 3 is the divisor Byte form: Divisor 8-bt reg/mem Dividend 16-bit in AX After division, Quotient 8-bit in AL , Remainder 8-bit in AH

  7. Word form: Divisor 16-bit reg/mem Dividend 32-bit in DX:AX After division, Quotient 16-bit in AX , Remainder 16-bit in DX

  8. Divide overflow

  9. Ch. 10 1-D array DUP to define arrays whose elements share a common initial value E.g., GAMMA DW 100 Sets up an array of 100 words, with each entry initialized to 0. GAMMA DW 100 Sets up an array of 100 words, with each entry UN-initialized. DUP (0) DUP (?)

  10. DUPs may be nested

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#