Multi.tst is failing but my manual tests pass

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

Multi.tst is failing but my manual tests pass

ouverson
When I run tests manually by placing values in R0 and R1, R2 has correct values; but when I run against the Multi.tst the test fails.

https://www.screencast.com/t/io1Nt4E0

I'll remove the link after you've taken a look.
Reply | Threaded
Open this post in threaded view
|

Re: Multi.tst is failing but my manual tests pass

WBahn
Administrator
From the screen shot you linked, it looks like you are claiming that 1 * 0 = 4.

Walk through your code step by step. Perhaps use R[0] = 16 and R[1] = 0
Reply | Threaded
Open this post in threaded view
|

Re: Multi.tst is failing but my manual tests pass

ouverson
Well, that was a fail: both in my code and in my testing :)
Reply | Threaded
Open this post in threaded view
|

Re: Multi.tst is failing but my manual tests pass

WBahn
Administrator
A good way to figure out the logic and code for something like this is to bench-check it (i.e., pretend you are the processor and do it step by step by hand using a piece of paper or even index cards as your registers and memory.

For instance, take a sheet of paper and put several columns on it. The first two should be headed "A" and "D" for the two registers. Then put columns for R0, R1, and R2 since you know that you need to use these per the problem statement. Then put a few more, either as actual memory addresses or just add them as variable names as needed (knowing that these will get assigned to addresses starting at 16).

Then put a couple of numbers in R0 and R1 (since that is what the problem statement says will happen). Make them small, but not zero or one (you'll need to check these cases later though). Say 3 and 4.

Now think about how you are going to go about doing this in the simplest (not necessarily most efficient) way you can come up with, probably either adding 3 to itself 4 times or 4 to itself 3 times. Just pick one and go from there. Then proceed to do it, writing down the steps that you take. You can either do it in steps that map directly to individual ASM instructions, or you can do it in human-sized steps as long as you keep in mind that, eventually, you need to convert each of those steps into ASM instructions.
Reply | Threaded
Open this post in threaded view
|

Re: Multi.tst is failing but my manual tests pass

ouverson
This post was updated on .
Thanks for the advice. I did develop my own sort of iteration walk-through.

I was able to get Mult.asm code to pass all the tests, and my Fill.asm behaved per requirements.

Thank you for your help.