This code could've been intended to calculate some non-negative integer
power of another integer, but the whole stack thing with the order of
pushes and pops is weird.

There are no such registers and instructions. What is it ??

cheers

On Sat, Oct 13, 2012 at 6:10 PM, Ashok Varma <verma....@gmail.com> wrote:

> what does the stack initially hold ?
>
>
> On Sat, Oct 13, 2012 at 4:18 PM, Akshat Sapra <sapraaks...@gmail.com>wrote:
>
>>
>> DETERMINE THE OUTPUT R1,R2,R3 ARE THREE REGISTERS
>>
>> START :POP R1
>> POP R2
>> COMPARE R2,0
>> JUMP_EQ DONE_Z
>> PUSH R2
>> PUSH R1
>> SUBTRATCT R2,1
>> PUSH R2
>> CALL START
>> POP R3
>> POP R1
>> POP R2
>> MULTIPLY R3,R2
>> JUMP DONE
>> DONE_Z:MOVE R3,1
>> DONE:PUSH R3
>> PUSH R1
>> RETURN
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
 Sharad Dixit

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to