Google

Jun 17, 2008

Find the maximum number from the list of hexa decimal numbers

The program will find the maximum number form the list of hexadecimal numbers

LDA 2200H
MOV C,A
XRAA
LXI H,2201H
BACK: CMP M
JNC SKIP
MOVE A,M
SKIP: INX H
DCR C
JNZ BACK
STA 2300H
HLT


the algorithm is as follows
  • first initialize counter C= no of numbers in the list
  • then assign the maximum value is equal to zero ( thats the minimum possible value we can assign ) A=0
  • then initialize the pointer to the list of numbers
  • compare the number with A
  • if the number is greater the then maximum number that is A then replace A with the new number if not go for the next number
  • i.e increment pointer value and decrement count C
  • if c reaches 0 then come out of loop
  • store the number in A in some memory location
  • stop the program
You might be also interested in:

:: Assembly Language Programs to compute an expression
:: Interfacing Analog-to-Digital converter to 8086 using 8255
:: Interfacing Digital-To-Analog converter to 8086 using 8255
:: Temperature Control system using 8086

No comments: