From b3a16fc0a5c70202a4eb33536a5e6d5697f6cfd6 Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 10 Apr 2010 21:57:49 +0000 Subject: [PATCH] Fixed another Distella bug wrt RELATIVE addressing. This fixes an issue I noticed River Raid, where labels were being generated above 0x10000 (the maximum should be 0xFFFF). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2002 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/DiStella.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index d7587a34b..58580ed6c 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -490,27 +490,25 @@ void DiStella::disasm(uInt32 distart, int pass) // where wraparound occurred on a 32-bit int, and subsequent // indexing into the labels array caused a crash d1 = Debugger::debugger().peek(myPC+myOffset); myPC++; - ad = (myPC + (Int8)d1) & 0xfff; + ad = ((myPC + (Int8)d1) & 0xfff) + myOffset; labfound = mark(ad+myOffset, REFERENCED); if (pass == 1) { - if ((addbranch) && !check_bit(labels[ad], REACHABLE)) + if ((addbranch) && !check_bit(labels[ad-myOffset], REACHABLE)) { - myAddressQueue.push(ad+myOffset); - mark(ad+myOffset, REACHABLE); - /* addressq=addq(addressq,myPC+myOffset); */ + myAddressQueue.push(ad); + mark(ad, REACHABLE); } } else if (pass == 3) { - int tmp = myPC+ad+myOffset; if (labfound == 1) - nextline << " L" << HEX4 << tmp; + nextline << " L" << HEX4 << ad; else - nextline << " $" << HEX4 << tmp; + nextline << " $" << HEX4 << ad; - nextlinebytes << HEX2 << (int)(tmp&0xff) << " " << HEX2 << (int)(tmp>>8); + nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8); } break; }