Update to BUS FastJump.

This commit is contained in:
Stephen Anthony 2017-05-13 18:12:14 -02:30
parent 78cb21d798
commit 145d47315e
2 changed files with 16 additions and 5 deletions

View File

@ -221,13 +221,15 @@ uInt8 CartridgeBUS::peek(uInt16 address)
if(bankLocked())
return peekvalue;
// implement JMP FASTJMP which fetches the destination address from stream 33
if (myFastJumpActive)
// implement JMP FASTJMP which fetches the destination address from stream 17
if (myFastJumpActive
&& myJMPoperandAddress == address)
{
uInt32 pointer;
uInt8 value;
myFastJumpActive--;
myJMPoperandAddress++;
pointer = getDatastreamPointer(JUMPSTREAM);
value = myDisplayImage[ pointer >> 20 ];
@ -236,17 +238,20 @@ uInt8 CartridgeBUS::peek(uInt16 address)
return value;
}
// test for JMP FASTJUMP where FASTJUMP = $0000
if (BUS_STUFF_ON
&& peekvalue == 0x4C
&& myProgramImage[(myCurrentBank << 12) + address+1] == 0
&& myProgramImage[(myCurrentBank << 12) + address+2] == 0)
{
myFastJumpActive = 2; // return next two peeks from datastream 31
myFastJumpActive = 2; // return next two peeks from datastream 17
myJMPoperandAddress = address + 1;
return peekvalue;
}
myJMPoperandAddress = 0;
// save the STY's zero page address
if (BUS_STUFF_ON && mySTYZeroPageAddress == address)
myBusOverdriveAddress = peekvalue;
@ -564,6 +569,7 @@ bool CartridgeBUS::save(Serializer& out) const
// Addresses for bus override logic
out.putShort(myBusOverdriveAddress);
out.putShort(mySTYZeroPageAddress);
out.putShort(myJMPoperandAddress);
// Save cycles and clocks
out.putInt(mySystemCycles);
@ -607,6 +613,7 @@ bool CartridgeBUS::load(Serializer& in)
// Addresses for bus override logic
myBusOverdriveAddress = in.getShort();
mySTYZeroPageAddress = in.getShort();
myJMPoperandAddress = in.getShort();
// Get system cycles and fractional clocks
mySystemCycles = (Int32)in.getInt();

View File

@ -247,9 +247,13 @@ class CartridgeBUS : public Cartridge
// set to address of ZP if last byte peeked was $84 (STY ZP)
uInt16 mySTYZeroPageAddress;
// 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;
// System cycle count when the last update to music data fetchers occurred
Int32 mySystemCycles;
// ARM cycle count from when the last callFunction() occurred
Int32 myARMCycles;