Help required with query

tigerdivision's Avatar
Newbie Member
Greetings everyone

I am currently experiencing a problem when trying to figure out the contents of an Accumulator. My query is this:

Locations 601 to 603 hold data i.e. decimal numbers as per below:
601 30
602 3
603 9
.

Locations 740 to 744 hold instructions as per below:
740 LDA 601
741 ADD 602
742 ADD 603
743 STO 603
744 HALT 000

Immediately before the instructions are executed the Accumulator holds the value 5.

What is the value held in the accumulator after the instruction at location 740 has been executed? Is it 30? Or is it 30 + 5 i.e. 35?

After all the instructions have been executed I reasoned that the value at location 603 is 47. Is this coorect?

Many thanks!
P.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Having such a title and having the thread in the introduction made me to move it into the Database section and then I thought its not database query but your query in Assembly language. Frame your question so that its easy to understand from the title itself
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
It is impossible to answer your question without having the definition of the instruction set. If "LDA 601" is an immediate mode instruction, the contents of the accumulator (assuming "LDA" means load the accumulator), then the contents will be 601. If it is a direct mode instruction, then the contents will be the contents of location 601. If it is an indirect mode instruction, the the contents will come from the location whose address is contained in 601.

I see no reason why it would ever add 5 with instruction 740. Where the hell did you come up with that?

If one presumes that the operations are direct mode, then:
Code:
740 LDA 601 == 30
741 ADD 602 == 33
742 ADD 603 == 42
743 STO 603 == 42 overwrites the 9
744 HALT 000
You should definitely learn how to incorporate important information into your posts. You don't mention the processor type or anything that helps you get help.