Tuesday, October 20, 2009

Debugger progress

So it turns out it wasn't an incorrect shift. What was happening was that my count variable was getting set to zero right away as a result of the multiplication op, and therefore by the time that the loop was checking its status, it was already negative.

This was happening because there was a bug in my assembler that wasn't properly checking to see if I could load immediate operands into registers. The instruction to do so is a bit unique; you pass it an 8 bit number and a 4 bit rotate value; you then rotate the 8 bit number by twice the 4 bit rotate value. This means that you can get all powers of 2, but you also cannot get every possible number.

I was trying to load my registers with 0x00100010, which cannot be loaded. I have error checking code to make sure this reports an error, but the bug prevented this error from coming up. Once fixed, everything proceeded smoothly.

I also started on the symbol debugger today. I decided on the file format and wrote the code in the assembler to save to it if it's specified on the command line. However, I need to put more thought into how the emulator will handle this. How the emulator handles debugging currently is a bit of a hack, not very bad, but it needs to be polished up a little bit.

No comments:

Post a Comment