8086 assembler or any Microprocessor Z80 8085 - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

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

dagarvedagarve Posts: 15Member
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]
0019 18C1
0020 18C1 00 [color=Green] LRGST: .db 00h[/color]
0021 18C2
0022 18C2 [color=Green] .end[/color]
0023 18C2
0024 18C2
0025 18C2
0026 18C2
0027 18C2
0028 18C2
0029 18C2
0030 18C2
tasm: Number of errors = 0


Comments

  • ankit_coolankit_cool Posts: 1Member
    hi im new at programming level and can't make out what are these number 036H and 00H etc. what r these numbers. i have read upto hexadecimal codes and upto dat there is no H in the digits. can u please tell me a bit abt the number system u r using.

  • rom_biosrom_bios Posts: 3Member
    : 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
    :
    : 06H + 2EH = 34H
    : 2EH + 36H = 64H
    : 36H + 42H = 78H
    :
    why don,t you check out the book "The Art of Assembly Language" it's freely availiable on the net and a good long book,
    big enough to fit in your needs.
  • dagarvedagarve Posts: 15Member
    Hexadecimal codes are base 16 eg. 32h
    Binary base 2 0000000000110010
    decimal base 10 50

    : hi im new at programming level and can't make out what are these
    : number 036H and 00H etc. what r these numbers. i have read upto
    : hexadecimal codes and upto dat there is no H in the digits. can u
    : please tell me a bit abt the number system u r using.
    :
    :

Sign In or Register to comment.