programb35 - Microprocessors & Applications (UPTU) Appendix...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Appendix B  Explanation : Consider that a block of data of N bytes is present at the source location. Let the number of bytes N = 10 for example. We have to initialize this as count in the CX register. Our task is to find out the average of these 10 bytes. i.e. to find out average of 10 numbers. Average = . We know that the source address is in the SI register. Clear the direction flag. Initially, we will add the N bytes, byte by byte using ADD instruction. Once the addition is compute, result of addition will be stored in register AX. Now, we will divide this sum by number of bytes N to find the average. The result of division i.e. quotient is present in the AL register. Display the result using display routine. For example : Block Data : 01 02 03 04 05 06 07 08 09 0A Sum : 01 + 02 + 03 + 04 + 05 + 06 + 07 + 08 + 09 + 0AH = 37 H average = = = 5 H  Algorithm : Step I : Initialise the data segment. Step II
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/04/2011 for the course ECON 101 taught by Professor Lucky during the Spring '11 term at Silver Lake.

Page1 / 2

programb35 - Microprocessors & Applications (UPTU) Appendix...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online