FibonacciElement generating incorrect output

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FibonacciElement generating incorrect output

fishboy1887
My FibonacciElement ASM file is generating the following output:

| RAM[0] |RAM[261]|
|    464 |      4 |

I am not sure how to approach this error, for every other basic ASM file in project 8, I have been fixing the error by stepping through the ASM program with the CPU emulator line by line but with FibonacciElement.asm being ~560 lines I am finding it really difficult to do so.

I have tried to re-order the .vm files which are translates so the Sys.vm file always goes first and I have tried updating the labels.

Any advice on what might be a good approach to debugging would be greatly appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: FibonacciElement generating incorrect output

pm100
looking at your result and the expected result, your value is 2x and your count is one more. It looks like you have looped once too often, check that your compares are doing lt and not le or vice versa , same for gt and ge.
Reply | Threaded
Open this post in threaded view
|

Re: FibonacciElement generating incorrect output

fishboy1887
Thanks for your reply.