Update to CDF FastJump

Revised CDF so "false" reads after NOPs, taken branch instructions, etc. no longer crash JMP FASTJMP
This commit is contained in:
Darrell Spice, Jr 2017-05-12 12:48:30 -05:00 committed by sa666666
parent 362f7c2888
commit 1c9343e0e4
2 changed files with 13 additions and 2 deletions

View File

@ -203,12 +203,14 @@ uInt8 CartridgeCDF::peek(uInt16 address)
return peekvalue;
// implement JMP FASTJMP which fetches the destination address from stream 33
if (myFastJumpActive)
if (myFastJumpActive
&& myJMPoperandAddress == address)
{
uInt32 pointer;
uInt8 value;
myFastJumpActive--;
myJMPoperandAddress++;
pointer = getDatastreamPointer(JUMPSTREAM);
value = myDisplayImage[ pointer >> 20 ];
@ -225,8 +227,11 @@ uInt8 CartridgeCDF::peek(uInt16 address)
&& myProgramImage[(myCurrentBank << 12) + address+2] == 0)
{
myFastJumpActive = 2; // return next two peeks from datastream 31
myJMPoperandAddress = address + 1;
return peekvalue;
}
myJMPoperandAddress = 0;
// Do a FAST FETCH LDA# if:
// 1) in Fast Fetch mode
@ -493,8 +498,9 @@ bool CartridgeCDF::save(Serializer& out) const
// State of FastJump
out.putByte(myFastJumpActive);
// Address of LDA # operand
// operand addresses
out.putShort(myLDAimmediateOperandAddress);
out.putShort(myJMPoperandAddress);
// Harmony RAM
out.putByteArray(myCDFRAM, 8192);
@ -537,6 +543,7 @@ bool CartridgeCDF::load(Serializer& in)
// Address of LDA # operand
myLDAimmediateOperandAddress = in.getShort();
myJMPoperandAddress = in.getShort();
// Harmony RAM
in.getByteArray(myCDFRAM, 8192);

View File

@ -281,6 +281,10 @@ class CartridgeCDF : public Cartridge
// set to address of #value if last byte peeked was A9 (LDA #)
uInt16 myLDAimmediateOperandAddress;
// set to address of the JMP operand if last byte peeked was 4C
// *and* the next two bytes in ROM are 00 00
uInt16 myJMPoperandAddress;
TIA* myTIA;
uInt8 myFastJumpActive;