Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Help required with query (http://www.go4expert.com/forums/help-required-query-t4035/)

tigerdivision 26Apr2007 17:43

Help required with query
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!

shabbir 26Apr2007 18:59

Re: Help required with query
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

DaWei 26Apr2007 23:42

Re: Help required with query
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:

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.

All times are GMT +5.5. The time now is 15:48.