Assembly Language Instructions and Programs for Arithmetic Operations

arithmetic and logic instructions div 3 n.w
1 / 8
Embed
Share

Explore various assembly language instructions for arithmetic operations like division and multiplication, along with sample programs for computing expressions and averages. Learn about the flags affected by these instructions and how to utilize DIV and MUL operations effectively in assembly programming.

  • Assembly Language
  • Arithmetic Operations
  • DIV Instruction
  • MUL Instruction
  • Programming

Uploaded on | 0 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. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

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.

E N D

Presentation Transcript


  1. Arithmetic and Logic Instructions DIV 3 : .

  2. Second Group Instructions MUL, DIV REG Memory MUL instructions affect these flags only: CF, OF When result is over operand size these flags are set to 1, when result fits in operand size these flags are set to 0. For DIV flags are undefined.

  3. DIV instruction when operand is a byte: AL = AX / operand AH = remainder. when operand is a word: AX = (DX AX) / operand DX = remainder.

  4. DIV instruction Q: Write a program in assembly language to compute Z=203 /4 MOV AX, 203 ; AX = 00CBh MOV BL, 4 DIV BL ; AL = 50 (32h), AH = 3 RET

  5. Q: Write a program in assembly language to compute C=(FD/9)*(FA-32)

  6. Q: Write a program in assembly language to compute C=(FD/9)*(FA-32) MOV Al,0FDH MOV Bl,09 DIV Bl MOV Bl,0FAH MOV Cl, 32H SUB Bl,Cl MUL Bl RET MOV AX,0FDH MOV BX,09 DIV BX MOV BX,0FAH MOV CX, 32H SUB BX,CX MUL BX RET

  7. Q: Write a program in assembly language to compute the average of 5 degrees 80,88,90,80,88 ? ADD AX,80 ADD AX,88 ADD AX,90 ADD AX,80 ADD AX,88 MOV BX,05 DIV BX RET

  8. Q: Write a program in assembly language to compute the AV of array a1 elements? mov cx, 5 sum: add al,a1[si] inc si loop sum mov bl,5 div bl ret a1 db 1, 2, 3, 4, 5

Related


More Related Content