I think my Mult.asm should work, but it doesn't & not sure why . . .

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

I think my Mult.asm should work, but it doesn't & not sure why . . .

schrezraoeder
I guess I shouldn't share too much code on here as I don't want to ruin it for anyone who wants to go through the struggle themselves to obtain the reward of learning it the right way. The subject line basically has my question. I'm wondering if someone who has some ability with the Hack assembly language could look at my code and just give me a hint or nudge in the right direction what I'm doing wrong. Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: I think my Mult.asm should work, but it doesn't & not sure why . . .

schrezraoeder
Nevermind, I finally got it. I wasn't initializing R2 to zero. I also had some unreachable code, but ultimately the last thing I finally figured out was that I needed to initialize R2 to zero so when I jumped to the end of the program when R1 was zero or R0 was zero, R2 would have the correct answer already at that point in time.