|
This post was updated on .
Okay, so I'm doing the exercises at the end of Ch. 4 at the moment and something strange is going on with my mult.asm program; I get Comparison Failures when I run it against the test file (i.e. doesn't give the right output). The really weird thing is that it has errored out at different points in the program without me changeing the code at all...that is to say, sometimes it clears the first four test inputs and gets stuck on the fifth, sometimes it gets stuck on the fourth instead, and sometimes it can't even get past the second input...This baffles me, since logically it should always fail at the same point right?
I've gone line by line to see what the problem was for the fifth test inputs (RAM[0] = 2 and RAM[1]=4) and again when it errored out for the second test inputs (RAM[0]=1 and RAM[1]=0), and I found that for some strange reason when I tried to set A to the value at the RAM location 1 (i.e. RAM[1]) it just set A to the constant 1 instead! The problem seems to be that even though I'm using variables when I write the code, the compiler changes the variable of "R1" (for instance), to "@1" which simply sets A to 1 rather than to whatever is at location 1. That is to say, the compiler changes "@R1" to "@1," then when it reads "@1" when RAM location 1 is set to 4, it changes A to 1 instead of 4, which led to "1x0=1" and "4x2=2"...what am I doing wrong? D=
Here is my code:
(Edit: problem has been solved, code removed from post)
|