mirror of https://github.com/stella-emu/stella.git
Fixed bug in debugger 'runto' command; it now looks at the generated
disassembly instead of re-disassembling again. Still TODO is make the search case in-sensitive. Added latest DPC+ code from Spiceware. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1988 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
1103f1dfbb
commit
a94c579fec
|
@ -1168,21 +1168,31 @@ void DebuggerParser::executeRun()
|
|||
void DebuggerParser::executeRunTo()
|
||||
{
|
||||
ostringstream buf;
|
||||
bool done = false;
|
||||
int cycles = 0, count = 0;
|
||||
const CartDebug& cartdbg = debugger->cartDebug();
|
||||
const CartDebug::DisassemblyList& list = cartdbg.disassemblyList();
|
||||
|
||||
uInt32 count = 0;
|
||||
bool done = false;
|
||||
do {
|
||||
cycles += debugger->step();
|
||||
string next = debugger->cartDebug().disassemble(debugger->cpuDebug().pc(), 1);
|
||||
debugger->step();
|
||||
|
||||
// Update romlist to point to current PC
|
||||
int pcline = cartdbg.addressToLine(debugger->cpuDebug().pc());
|
||||
if(pcline >= 0)
|
||||
{
|
||||
const string& next = list[pcline].disasm;
|
||||
done = (next.find(argStrings[0]) != string::npos);
|
||||
}
|
||||
++count;
|
||||
} while(!done && count < 10000);
|
||||
} while(!done && count < list.size());
|
||||
|
||||
if(done)
|
||||
buf << "found " << argStrings[0] << " in " << debugger->valueToString(cycles)
|
||||
<< " cycles";
|
||||
buf << "found " << argStrings[0] << " in "
|
||||
<< debugger->valueToString(count, kBASE_10)
|
||||
<< " disassembled instructions";
|
||||
else
|
||||
buf << argStrings[0] << " not found in " << debugger->valueToString(count)
|
||||
buf << argStrings[0] << " not found in "
|
||||
<< debugger->valueToString(count, kBASE_10)
|
||||
<< " disassembled instructions";
|
||||
|
||||
commandResult = buf.str();
|
||||
|
|
|
@ -22,13 +22,12 @@
|
|||
#include "System.hxx"
|
||||
#include "CartDPCPlus.hxx"
|
||||
|
||||
// TODO - INC AUDV0+$40 music support
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size)
|
||||
: myFastFetch(false),
|
||||
myLDAimmediate(false),
|
||||
mySelectByte(0),
|
||||
myMusicVolume(0),
|
||||
mySystemCycles(0),
|
||||
myFractionalClocks(0.0)
|
||||
{
|
||||
|
@ -49,9 +48,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size)
|
|||
for(uInt16 i = 0; i < 8; ++i)
|
||||
myTops[i] = myBottoms[i] = myCounters[i] = myFlags[i] = myFractionalIncrements[i] = 0;
|
||||
|
||||
// None of the data fetchers are in music mode
|
||||
myMusicVolumes[0] = myMusicVolumes[1] = myMusicVolumes[2] = 0;
|
||||
|
||||
// Set waveforms to square waves
|
||||
myMusicWaveforms[0] = myMusicWaveforms[1] = myMusicWaveforms[2] = 0xAAAAAAAA;
|
||||
|
||||
|
@ -143,11 +139,77 @@ inline void CartridgeDPCPlus::updateMusicModeDataFetchers()
|
|||
|
||||
// Let's update counters and flags of the music mode data fetchers
|
||||
for(int x = 5; x <= 7; ++x)
|
||||
{
|
||||
// Update only if the data fetcher is in music mode
|
||||
if(myMusicVolumes[x - 5])
|
||||
{
|
||||
myMusicCounters[x - 5] += myMusicFrequencies[x - 5];
|
||||
if (myMusicFrequencies[x-5]>myMusicCounters[x-5])
|
||||
myMusicWaveforms[x-5] = (myMusicWaveforms[x-5]>>1)|(myMusicWaveforms[x-5]<<31);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
inline void CartridgeDPCPlus::writeByte(uInt8 value)
|
||||
{
|
||||
switch (mySelectByte)
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0xFFFFFF00) | value;
|
||||
break;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0xFFFF00FF) | (value<<8);
|
||||
break;
|
||||
}
|
||||
case 0x02:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0xFF00FFFF) | (value<<16);
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0x00FFFFFF) | (value<<24);
|
||||
break;
|
||||
}
|
||||
case 0x04:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0xFFFFFF00) | value;
|
||||
break;
|
||||
}
|
||||
case 0x05:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0xFFFF00FF) | (value<<8);
|
||||
break;
|
||||
}
|
||||
case 0x06:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0xFF00FFFF) | (value<<16);
|
||||
break;
|
||||
}
|
||||
case 0x07:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0x00FFFFFF) | (value<<24);
|
||||
break;
|
||||
}
|
||||
case 0x08:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0xFFFFFF00) | value;
|
||||
break;
|
||||
}
|
||||
case 0x09:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0xFFFF00FF) | (value<<8);
|
||||
break;
|
||||
}
|
||||
case 0x0A:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0xFF00FFFF) | (value<<16);
|
||||
break;
|
||||
}
|
||||
case 0x0B:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0x00FFFFFF) | (value<<24);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,8 +229,8 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
// Check if we're in Fast Fetch mode and the prior byte was an A9 (LDA #value)
|
||||
if(myFastFetch && myLDAimmediate)
|
||||
{
|
||||
// if #value is a read-register then we want to use that as the address
|
||||
if(peekvalue < 0x0028)
|
||||
// if #value is a read-register then we want to use that as the address
|
||||
address = peekvalue;
|
||||
}
|
||||
myLDAimmediate = false;
|
||||
|
@ -197,52 +259,40 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
{
|
||||
switch(index)
|
||||
{
|
||||
case 0x00: // advance and return byte 0 of random
|
||||
case 0x00: // RANDOM0NEXT - advance and return byte 0 of random
|
||||
clockRandomNumberGenerator();
|
||||
result = myRandomNumber & 0xFF;
|
||||
break;
|
||||
|
||||
case 0x01: // return to prior and return byte 0 of random
|
||||
case 0x01: // RANDOM0PRIOR - return to prior and return byte 0 of random
|
||||
priorClockRandomNumberGenerator();
|
||||
result = myRandomNumber & 0xFF;
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
case 0x02: // RANDOM1
|
||||
result = (myRandomNumber>>8) & 0xFF;
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
case 0x03: // RANDOM2
|
||||
result = (myRandomNumber>>16) & 0xFF;
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
case 0x04: // RANDOM3
|
||||
result = (myRandomNumber>>24) & 0xFF;
|
||||
break;
|
||||
|
||||
case 0x05: // No, it's a music read
|
||||
case 0x05: // AMPLITUDE
|
||||
{
|
||||
static const uInt8 musicAmplitudes[8] = {
|
||||
0x00, 0x04, 0x05, 0x09, 0x06, 0x0a, 0x0b, 0x0f
|
||||
};
|
||||
|
||||
// Update the music data fetchers (counter & flag)
|
||||
updateMusicModeDataFetchers();
|
||||
|
||||
uInt8 i = 0;
|
||||
if(myMusicVolumes[0] && (myMusicCounters[0]>>31))
|
||||
{
|
||||
i |= 0x01;
|
||||
}
|
||||
if(myMusicVolumes[1] && (myMusicCounters[1]>>31))
|
||||
{
|
||||
i |= 0x02;
|
||||
}
|
||||
if(myMusicVolumes[2] && (myMusicCounters[2]>>31))
|
||||
{
|
||||
i |= 0x04;
|
||||
}
|
||||
uInt32 i = 0;
|
||||
|
||||
result = musicAmplitudes[i];
|
||||
i = myMusicVolume + ((myMusicVolume >> 12) * (uInt8) (myMusicWaveforms[0] >> 31)) +
|
||||
((myMusicVolume >> 16) * (uInt8) (myMusicWaveforms[1] >> 31)) +
|
||||
((myMusicVolume >> 24) * (uInt8) (myMusicWaveforms[2] >> 31));
|
||||
|
||||
result = (uInt8)i;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -253,7 +303,7 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
break;
|
||||
}
|
||||
|
||||
// DFx display data read
|
||||
// DFxDATA - display data read
|
||||
case 0x01:
|
||||
{
|
||||
result = myDisplayImage[myCounters[index]];
|
||||
|
@ -261,7 +311,7 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
break;
|
||||
}
|
||||
|
||||
// DFx display data read AND'd w/flag
|
||||
// DFxDATAW - display data read AND'd w/flag ("windowed")
|
||||
case 0x02:
|
||||
{
|
||||
result = myDisplayImage[myCounters[index]] & myFlags[index];
|
||||
|
@ -269,7 +319,7 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
break;
|
||||
}
|
||||
|
||||
// DFx display data read w/fractional increment
|
||||
// DFxFRACDATA - display data read w/fractional increment
|
||||
case 0x03:
|
||||
{
|
||||
result = myDisplayImage[myFractionalCounters[index] >> 8];
|
||||
|
@ -281,10 +331,10 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0x00:
|
||||
case 0x01:
|
||||
case 0x02:
|
||||
case 0x03:
|
||||
case 0x00: // DF0FLAG
|
||||
case 0x01: // DF1FLAG
|
||||
case 0x02: // DF2FLAG
|
||||
case 0x03: // DF3FLAG
|
||||
{
|
||||
result = myFlags[index];
|
||||
break;
|
||||
|
@ -365,151 +415,74 @@ bool CartridgeDPCPlus::poke(uInt16 address, uInt8 value)
|
|||
|
||||
switch(function)
|
||||
{
|
||||
//DFxFrac counter low
|
||||
//DFxFRACLOW - fractional data pointer low byte
|
||||
case 0x00:
|
||||
{
|
||||
myFractionalCounters[index] = (myFractionalCounters[index] & 0x0F0000) | ((uInt16)value << 8);
|
||||
break;
|
||||
}
|
||||
|
||||
// DFxFrac counter high
|
||||
// DFxFRACHI - fractional data pointer high byte
|
||||
case 0x01:
|
||||
{
|
||||
myFractionalCounters[index] = (((uInt16)value & 0x0F) << 16) | (myFractionalCounters[index] & 0x00ffff);
|
||||
break;
|
||||
}
|
||||
|
||||
//DFx Fraction Increment amount
|
||||
//DFxFRACINC - Fractional Increment amount
|
||||
case 0x02:
|
||||
{
|
||||
myFractionalIncrements[index] = value;
|
||||
myFractionalCounters[index] = myFractionalCounters[index] & 0x0FFF00;
|
||||
break;
|
||||
}
|
||||
|
||||
// DFx top count
|
||||
// DFxTOP - set top of window (for reads of DFxDATAW)
|
||||
case 0x03:
|
||||
{
|
||||
myTops[index] = value;
|
||||
myFlags[index] = 0x00;
|
||||
break;
|
||||
}
|
||||
|
||||
// DFx bottom count
|
||||
// DFxBOT - set bottom of window (for reads of DFxDATAW)
|
||||
case 0x04:
|
||||
{
|
||||
myBottoms[index] = value;
|
||||
break;
|
||||
}
|
||||
|
||||
// DFx counter low
|
||||
// DFxLOW - data pointer low byte
|
||||
case 0x05:
|
||||
{
|
||||
myCounters[index] = (myCounters[index] & 0x0F00) | value ;
|
||||
break;
|
||||
}
|
||||
|
||||
// Control registers
|
||||
case 0x06:
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
// FastFetch control
|
||||
case 0x00:
|
||||
{
|
||||
case 0x00: // FASTFETCH - turns on LDA #<DFxDATA mode of value is 0
|
||||
myFastFetch = (value == 0);
|
||||
break;
|
||||
}
|
||||
// SelectByte
|
||||
case 0x01:
|
||||
{
|
||||
|
||||
case 0x01: // SELECTBYTE - set byte to update in writeByte()
|
||||
mySelectByte = value;
|
||||
break;
|
||||
}
|
||||
// Write Byte
|
||||
case 0x02:
|
||||
{
|
||||
switch (mySelectByte)
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0xFFFFFF00) | value;
|
||||
|
||||
case 0x02: // WRITEBYTE
|
||||
writeByte(value);
|
||||
break;
|
||||
}
|
||||
case 0x01:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0xFFFF00FF) | (value<<8);
|
||||
break;
|
||||
}
|
||||
case 0x02:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0xFF00FFFF) | (value<<16);
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
{
|
||||
myMusicWaveforms[0] = (myMusicWaveforms[0] & 0x00FFFFFF) | (value<<24);
|
||||
break;
|
||||
}
|
||||
case 0x04:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0xFFFFFF00) | value;
|
||||
break;
|
||||
}
|
||||
case 0x05:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0xFFFF00FF) | (value<<8);
|
||||
break;
|
||||
}
|
||||
case 0x06:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0xFF00FFFF) | (value<<16);
|
||||
break;
|
||||
}
|
||||
case 0x07:
|
||||
{
|
||||
myMusicWaveforms[1] = (myMusicWaveforms[1] & 0x00FFFFFF) | (value<<24);
|
||||
break;
|
||||
}
|
||||
case 0x08:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0xFFFFFF00) | value;
|
||||
break;
|
||||
}
|
||||
case 0x09:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0xFFFF00FF) | (value<<8);
|
||||
break;
|
||||
}
|
||||
case 0x0A:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0xFF00FFFF) | (value<<16);
|
||||
break;
|
||||
}
|
||||
case 0x0B:
|
||||
{
|
||||
myMusicWaveforms[2] = (myMusicWaveforms[2] & 0x00FFFFFF) | (value<<24);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x03: // reserved
|
||||
case 0x04: // reserved
|
||||
break;
|
||||
case 0x05:
|
||||
case 0x06:
|
||||
case 0x07:
|
||||
{
|
||||
myMusicVolumes[index - 5] = (value & 0x0F);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// DF Push
|
||||
case 0x05: // VOLUME0
|
||||
myMusicVolume = (myMusicVolume & 0xFFFF00FF) | ((value & 0x0F)<<12);
|
||||
break;
|
||||
|
||||
case 0x06: // VOLUME1
|
||||
myMusicVolume = (myMusicVolume & 0xFF00FFFF) | ((value & 0x0F)<<16);
|
||||
break;
|
||||
|
||||
case 0x07: // VOLUME2
|
||||
myMusicVolume = (myMusicVolume & 0x00FFFFFF) | ((value & 0x0F)<<24);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
// DFxPUSH - Push value into data bank
|
||||
case 0x07:
|
||||
{
|
||||
myCounters[index] = (myCounters[index] - 0x1) & 0x0fff;
|
||||
|
@ -517,46 +490,45 @@ bool CartridgeDPCPlus::poke(uInt16 address, uInt8 value)
|
|||
break;
|
||||
}
|
||||
|
||||
// DFx counter hi, same as counter high, but w/out music mode
|
||||
// DFxHI - data pointer high byte
|
||||
case 0x08:
|
||||
{
|
||||
myCounters[index] = (((uInt16)value & 0x0F) << 8) | (myCounters[index] & 0x00ff);
|
||||
break;
|
||||
}
|
||||
|
||||
// Random Number Generator Reset
|
||||
case 0x09:
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0x00:
|
||||
case 0x00: // RRESET - Random Number Generator Reset
|
||||
{
|
||||
myRandomNumber = 0x2B435044; // "DPC+"
|
||||
break;
|
||||
}
|
||||
case 0x01:
|
||||
case 0x01: // RWRITE0 - update byte 0 of random number
|
||||
{
|
||||
myRandomNumber = (myRandomNumber & 0xFFFFFF00) | value;
|
||||
break;
|
||||
}
|
||||
case 0x02:
|
||||
case 0x02: // RWRITE1 - update byte 1 of random number
|
||||
{
|
||||
myRandomNumber = (myRandomNumber & 0xFFFF00FF) | (value<<8);
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
case 0x03: // RWRITE2 - update byte 2 of random number
|
||||
{
|
||||
myRandomNumber = (myRandomNumber & 0xFF00FFFF) | (value<<16);
|
||||
break;
|
||||
}
|
||||
case 0x04:
|
||||
case 0x04: // RWRITE3 - update byte 3 of random number
|
||||
{
|
||||
myRandomNumber = (myRandomNumber & 0x00FFFFFF) | (value<<24);
|
||||
break;
|
||||
}
|
||||
case 0x05:
|
||||
case 0x06:
|
||||
case 0x07:
|
||||
case 0x05: // NOTE0
|
||||
case 0x06: // NOTE1
|
||||
case 0x07: // NOTE2
|
||||
{
|
||||
myMusicFrequencies[index-5] = myFrequencyImage[(value<<2)] +
|
||||
(myFrequencyImage[(value<<2)+1]<<8) +
|
||||
|
@ -570,7 +542,7 @@ bool CartridgeDPCPlus::poke(uInt16 address, uInt8 value)
|
|||
break;
|
||||
}
|
||||
|
||||
// DF Write
|
||||
// DFxWRITE - write into data bank
|
||||
case 0x0a:
|
||||
{
|
||||
myDisplayImage[myCounters[index]] = value;
|
||||
|
@ -717,24 +689,20 @@ bool CartridgeDPCPlus::save(Serializer& out) const
|
|||
|
||||
// The Fast Fetcher Enabled flag
|
||||
out.putBool(myFastFetch);
|
||||
|
||||
// Last immediate byte peeked
|
||||
out.putBool(myLDAimmediate);
|
||||
|
||||
// Control byte
|
||||
// Control Byte to update
|
||||
out.putByte((char) mySelectByte);
|
||||
|
||||
// The music volumes for the data fetchers
|
||||
out.putInt(3);
|
||||
for(i = 0; i < 3; ++i)
|
||||
out.putByte((char)myMusicVolumes[i]);
|
||||
// The music volume
|
||||
out.putInt(myMusicVolume);
|
||||
|
||||
// The music mode counters for the data fetchers
|
||||
// The music counters
|
||||
out.putInt(3);
|
||||
for(i = 0; i < 3; ++i)
|
||||
out.putInt(myMusicCounters[i]);
|
||||
|
||||
// The music mode frequency addends for the data fetchers
|
||||
// The music frequencies
|
||||
out.putInt(3);
|
||||
for(i = 0; i < 3; ++i)
|
||||
out.putInt(myMusicFrequencies[i]);
|
||||
|
@ -806,17 +774,13 @@ bool CartridgeDPCPlus::load(Serializer& in)
|
|||
|
||||
// The Fast Fetcher Enabled flag
|
||||
myFastFetch = in.getBool();
|
||||
|
||||
// Last immediate byte peeked
|
||||
myLDAimmediate = in.getBool();
|
||||
|
||||
// Control byte
|
||||
// Control Byte to update
|
||||
mySelectByte = (uInt8) in.getByte();
|
||||
|
||||
// The music mode flags for the data fetchers
|
||||
limit = (uInt32) in.getInt();
|
||||
for(i = 0; i < limit; ++i)
|
||||
myMusicVolumes[i] = (uInt8) in.getByte();
|
||||
// The music volume
|
||||
myMusicVolume = (uInt32) in.getInt();
|
||||
|
||||
// The music mode counters for the data fetchers
|
||||
limit = (uInt32) in.getInt();
|
||||
|
|
|
@ -159,6 +159,11 @@ class CartridgeDPCPlus : public Cartridge
|
|||
*/
|
||||
inline void updateMusicModeDataFetchers();
|
||||
|
||||
/**
|
||||
Writes a control byte
|
||||
*/
|
||||
inline void writeByte(uInt8 value);
|
||||
|
||||
private:
|
||||
// Indicates which bank is currently active
|
||||
uInt16 myCurrentBank;
|
||||
|
@ -202,13 +207,13 @@ class CartridgeDPCPlus : public Cartridge
|
|||
// Control Byte to update
|
||||
uInt8 mySelectByte;
|
||||
|
||||
// The music volumes
|
||||
uInt8 myMusicVolumes[3];
|
||||
// The music volume
|
||||
uInt32 myMusicVolume;
|
||||
|
||||
// The music mode counters
|
||||
uInt32 myMusicCounters[3];
|
||||
|
||||
// The music frequency addends
|
||||
// The music frequency
|
||||
uInt32 myMusicFrequencies[3];
|
||||
|
||||
// The music waveforms
|
||||
|
|
Loading…
Reference in New Issue