Question

I'm currently attempting to write an NES emulator through .NET and I have a question about the particular opcodes that do decrementing and incrementing...

Since X, and Y registers are 8 bits, in terms of implementation, is it an unsigned or signed byte? That is, is the value range of the X and Y registers from -128 to 127 or 0-255?

I am confused by this because if the X and Y registers are initialized as 0, what happens when a DEX is performed? Or is it up to the programmer to actually worry about that?

Thanks in advance for the help everyone.

Était-ce utile?

La solution

Interestingly enough with two's complement signed numbers there is no difference when performing arithmetic, therefore DEX is agnostic as to whether the register contains a signed or unsigned number. For example, the bits representing -1 are the same as those representing 255. So 0 - 1 = 255 or -1 depending on your interpretation. The decrementation doesn't care.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top