mirror of https://github.com/stella-emu/stella.git
d65ab5c62b
...but we need them in the Expression classes and the DebuggerParser. Expressions now return uInt16 instead of int. This gets us 6502-like behaviour when dealing with numbers that don't fit into the 6502's 16-bit address space. -1 in 6502-speak is equal to $ffff (twos' complement); this is exactly what happens in C++ if you try to assign -1 to an unsigned short (aka a uInt16). I believe the C++ standard doesn't *require* conforming implementations to use twos' complement math, but I doubt anyone will ever port Stella to any hardware old or esoteric enough to use anything else. Also, I've added casts to uInt8 to the debugger commands that set registers. This also results in 6502-like handling of negative numbers: using "a -2" to set the Accumulator will result in it having the value $fe, which is exactly correct for a 6502. This may seem like undesirable behaviour (and in a regular C++ program, when it happens by accident, it IS undesired), but trust me, this is exactly what a 6502 assembly programmer would expect. Also also, I got rid of the distinction between commands that take a byte or word argument. They all take words now. I had to do this to make the "a -2" example work. A side effect is that you can now say something like "a $1234" and the value will get truncated to $34 (due to the cast to uInt8). What remains to be seen is whether all this behaves the way I think it should on a big-endian platform (e.g. the Mac). My poor Mac is having cooling issues, so I can't actually compile Stella any more :( However, I can get it to run long enough to compile a little 5-10 line test program to see how these casts work. If I'm wrong, and they behave differently on the Mac, I'll have to add platform-dependent "uInt16_to_uInt8" type functions, which I'd really rather avoid... But the debugger has GOT to treat negative and out-of-range values the same way as a 6502 does. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@694 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba |
||
---|---|---|
CVSROOT | ||
stella |