x86 Assembly

Moderators: None (Apply to moderate this forum)
Number of threads: 4563
Number of posts: 16029

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
8086 assembler or any Microprocessor Z80 8085 Posted by dagarve on 14 May 2007 at 5:44 PM
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 .ORG 18A0h
0002 18A0 06 2E MVI B,002Eh
0003 18A2 16 3C MVI D,003Ch
0004 18A4 1E 1B MVI E,001Bh
0005 18A6 0E 46 MVI C,0046h
0006 18A8 21 A0 18 START: LXI H,18A0h
0007 18AB 7E MOV A,M
0008 18AC 23 INX H
0009 18AD C3 B3 18 JMP ADD
0010 18B0 D2 B8 18 JNC FOUND
0011 18B3 23 ADD: INX H
0012 18B4 86 ADD M
0013 18B5 32 C1 18 STA LRGST
0014 18B8 23 FOUND: INX H
0015 18B9 C3 B3 18 JMP ADD
0016 18BC BE CMP M
0017 18BD D2 C1 18 JNC LRGST
0018 18C0 76 HLT
0019 18C1
0020 18C1 00 LRGST: .db 00h
0021 18C2
0022 18C2 .end
0023 18C2
0024 18C2
0025 18C2
0026 18C2
0027 18C2
0028 18C2
0029 18C2
0030 18C2
tasm: Number of errors = 0


Report
Re: 8086 assembler or any Microprocessor Z80 8085 Posted by ankit_cool on 14 May 2007 at 9:52 PM
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.

Report
Re: 8086 assembler or any Microprocessor Z80 8085 Posted by dagarve on 18 May 2007 at 7:31 AM
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.
:
:

Report
Re: 8086 assembler or any Microprocessor Z80 8085 Posted by rom_bios on 15 May 2007 at 4:34 AM
: 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.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.