Advertisement Remove all ads

Locate smallest number in a block from 2050H to 2060H and store it in memory location 2061H - Computer Science 2

Advertisement Remove all ads
Advertisement Remove all ads
Advertisement Remove all ads

Locate smallest number in a block from 2050H to 2060H and store it in memory location 2061H

Advertisement Remove all ads

Solution

Mnemonics Comment
Opcode Operand
 MVI C, 0A ; Block length in C Register
   LXI H, 2050 ; Store 2050 in HL pair
MOV A, M ; Copy content of memory to Acc.
    BACK: INX H ; Increment HL pair by 1
               CMP M ; Compare Acc. with memory
               JC : NEXT ; If Cy = 1, then go to NEXT
               MOV A, M ; Copy content of Memory to Acc.
NEXT : DCR C ; Decrement C Reg. by 1
              JNZ : BACK ; If Cy ? 0, then go to Back
              INX H ; Increment HL by 1
              MOV M, A ; Store Acc. content to memory
              RST 1.0 ; Restart
Concept: Instruction Set and Programming of 8085
  Is there an error in this question or solution?

APPEARS IN

Advertisement Remove all ads
Share
Notifications

View all notifications


      Forgot password?
View in app×