I want to store the address of the largest number in HL but I don't really know how to do it This is what i've done so far
0000 LXI H,3000H ;Load H-L pair with address 3000H
0001
0002
0003 MOV E,M ;Move counter from memory to reg. E.
0004 INX H ;Increment H-L pair
0005 MOV A,M ;Move the 1st number from memory to reg. A.
0006 DCR E ;Decrement counter.
0007 INX H ;Increment H-L pair
0008 MOV D,M ;Move the next number from memory to reg. D.
0009 CMP D ;Compare D with A.
000A JNC 000EH ;Jump to address 000EH if there is no carry
000B
000C
000D MOV A,D ;Move largest from reg. D to reg. A.
000E DCR E ;Decrement counter.
000F JNZ 0007H ;Jump to address 0007H if counter is not zero.
0010
0011
0012 INX H ;Increment H-L pair.
0013 MOV C,A ;Move the result from reg. A to C
0014 HLT
**MEMORY**
3000H: 05 (counter)
3001H: 2C
3002H: 1E
3003H: 58
3004H: 46
3005H: 53
The code works fine in the part of finding the maximum number but what I want is to also store the address of the maximum number in HL in the end