Re:Easy 6502 - Learn the 6502 Assembly Language
by michaelochurch on Sunday July 08, 2012 @04:34PM
(#4215615)
If you open the Monitor in the first example and step through it in the debugger, the byte at address 0xFE changes at every step. This doesn't seem to be documented and it's not clear to me why it's doing that.
Moreover the content of 0xFE keeps changing even after execution stops (if you keep hitting the "step" button).
0xFF isn't even listed, but a load from that address seems to work (with value 0x00). [ETA: actually, that seems to be a quirk of the Monitor's initial config. If you set "length" to 100 instead of ff, you can see byte 0xFF in the monitor. Nothing wrong or weird there.]
Re:Easy 6502 - Learn the 6502 Assembly Language
by loganfsmyth on Sunday July 08, 2012 @05:01PM
(#4215695)
Examining it a bit more, The value in 0xFE can be ignored. It is just a random value. I don't know why.
There is a function called 'setRandomByte' that is called on every debugger step, but it has no comments so it may just be leftover debugging logic.
Re:Easy 6502 - Learn the 6502 Assembly Language
by loganfsmyth on Sunday July 08, 2012 @04:51PM
(#4215665)
Ahh, I see what you mean.
0xFF doesn't show up because the Monitor's length is set to 0xFF, which is 255. If you set the length to 0x100 it properly shows the first 256 entries.
As for the value at 0xFE, I don't know.
* This is an old processor, so it doesn't support fancy stuff like multiplication and division and floating-point. Generally you just try to avoid multiplication whenever possible, or keep it to powers of 2, since that can be done with shift operations. You can do multiplication using looped addition, but if you were to implement it you'd want to use a constant-time binary multiplication algorithm instead.