A multi-platform Atari 2600 Emulator
Go to file
urchlay d65ab5c62b Steve, I know you hate uInt8 and uInt16, and I hate them too...
...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
2005-07-27 01:36:51 +00:00
CVSROOT Add syncmail as a admin file to checkout. 2001-12-27 20:02:13 +00:00
stella Steve, I know you hate uInt8 and uInt16, and I hate them too... 2005-07-27 01:36:51 +00:00