Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
8086 assembler or any Microprocessor Z80 8085
Can someone help me write a program that adds 3 consecutive numbers,
06H,2EH,36H,42H,00H 00H indicates the end. Place their sum in LRGST(largest) it should compare their sum and place the largest number in LRGST
2EH + 3CH = 34H
3CH + 1BH = 64H
1BH + 46H = 78H
I came up with this solution. could anyone check to if this is correct.
when the program adds the first 2 numbers their sum is placed in memory location LRGST.
If the new sum is larger than number in LRGST it will be replaced with new larger sum.
This is my solution. Need someone to check and let me know if I am correct.
0001 18A0 [color=Green] .ORG 18A0h[/color]
0002 18A0 06 2E [color=Green] MVI B,002Eh[/color]
0003 18A2 16 3C [color=Green] MVI D,003Ch[/color]
0004 18A4 1E 1B [color=Green] MVI E,001Bh[/color]
0005 18A6 0E 46 [color=Green] MVI C,0046h[/color]
0006 18A8 21 A0 18 [color=Green]START: LXI H,18A0h[/color]
0007 18AB 7E [color=Green] MOV A,M[/color]
0008 18AC 23 [color=Green] INX H[/color]
0009 18AD C3 B3 18 [color=Green] JMP ADD[/color]
0010 18B0 D2 B8 18 [color=Green] JNC FOUND[/color]
0011 18B3 23 ADD: [color=Green] INX H[/color]
0012 18B4 86 [color=Green] ADD M[/color]
0013 18B5 32 C1 18 [color=Green] STA LRGST [/color]
0014 18B8 23 FOUND: [color=Green] INX H[/color]
0015 18B9 C3 B3 18 [color=Green] JMP ADD[/color]
0016 18BC BE [color=Green] CMP M[/color]
0017 18BD D2 C1 18 [color=Green] JNC LRGST[/color]
0018 18C0 76 [color=Green] HLT[/color]
0020 18C1 00 [color=Green] LRGST: .db 00h[/color]
0022 18C2 [color=Green] .end[/color]
tasm: Number of errors = 0
0 · ·