Link to home
Create AccountLog in
Avatar of hnael
hnaelFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to find the functinf ths assembly program

Hi to all , I am attaching a code , the q is what is the function of this code ? I aske the same q bfore but not able to know the answer but I done more study and want to check  my work? also there return that should show but could not include in the pic .
this is my answer The loop takes in turn 99  data values from a block stored in data memory
starting at hexadecimal address 0500, finds their 2s complement and stores
the results in a block of data memory starting at hexadecimal addres 0563

Open in new window

q3.JPG
Avatar of Infinity08
Infinity08
Flag of Belgium image

I assume this is a follow-up of :

        https://www.experts-exchange.com/questions/24357856/Subroutine-in-assembply-language.html


>> this is my answer The loop takes in turn 99  data values from a block stored in data memory
>> starting at hexadecimal address 0500, finds their 2s complement and stores
>> the results in a block of data memory starting at hexadecimal addres 0563

There are 100 values there, not 99.

I'm not sure what you mean by "finding the 2s complement". two's complement is a way to stored signed integer values. Read up on it if you're not familiar with it :

        http://en.wikipedia.org/wiki/Two%27s_complement

You say it stores "the results" - what are these results ?

How did you get to the address 0x0563 ?
In short : it seems you're further off than you were before (in the previous question).

In that question, you analyzed each of the statements, and understood what they did. The only thing that was left to do, was to place it all together, and to see the wood through the trees. That's all.
I suggested using pseudo code to help you understand what was going on. Did you give that a try ?
Avatar of hnael

ASKER

sorry my friend , your answer will have to make me go back again and think in totallly different direction, could u tel me please how can I use what u mentioed about pseudo code ?thks .
>> could u tel me please how can I use what u mentioed about pseudo code ?thks .

Do you know what pseudo code is ?

    http://en.wikipedia.org/wiki/Pseudocode
Avatar of hnael

ASKER

yes I know it , we took at uni before long time ago , but thks for the link ......I will see what each instruction is doing again ,and get back asap.
ok. I'll be here :)
Avatar of hnael

ASKER

Hi , I noticed that no matter what the value in rA is zero so could it be the function that to make sure whats in rA is alawys zero !!!!!!
So, what do you think that line 7 does ?
Avatar of hnael

ASKER

line seven just jump one instruction whatever the setuation to the instruction that will add 1 to rE SO it jump to the istruction where increment rE BY 1, IS that right .
I was referring to the line marked as 7 in the screenshot you posted :

>> add immediate rA 0001

That modifies rA, doesn't it ? So, rA will not always be 0 ...
Avatar of hnael

ASKER

that,s correct only if the condition is met  which in this case if the value are -ve then add one to rA . also the program uses whats in rE i.e 0500 and store it in r1 .
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of hnael

ASKER

well according to the threads  I should know the answer .
So, did you find the answer then ?