Complete vcslib bootstrap.

This commit is contained in:
Christian Speckner 2024-07-27 00:49:28 +02:00
parent 54e65a9c03
commit bc83f56924
5 changed files with 42 additions and 11 deletions

View File

@ -204,15 +204,6 @@ void CartridgeELF::reset()
myIsBusDriven = false;
myDriveBusValue = 0;
myTransactionQueue
.reset()
.injectROM(0x00, 0x1ffc)
.injectROM(0x10)
.setNextInjectAddress(0x1000);
myVcsLib.vcsCopyOverblankToRiotRam();
myVcsLib.vcsStartOverblank();
std::memset(mySectionStack.get(), 0, STACK_SIZE);
std::memset(mySectionText.get(), 0, TEXT_SIZE);
std::memset(mySectionData.get(), 0, DATA_SIZE);
@ -228,6 +219,17 @@ void CartridgeELF::reset()
std::memcpy(mySectionTables.get(), LOOKUP_TABLES, sizeof(LOOKUP_TABLES));
myCortexEmu.reset();
myTransactionQueue
.reset()
.injectROM(0x00, 0x1ffc)
.injectROM(0x10)
.setNextInjectAddress(0x1000);
myVcsLib.vcsCopyOverblankToRiotRam();
myVcsLib.vcsStartOverblank();
myVcsLib.vcsEndOverblank();
myVcsLib.vcsNop2n(1024);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -70,6 +70,11 @@ BusTransactionQueue& BusTransactionQueue::setNextInjectAddress(uInt16 address)
return *this;
}
uInt16 BusTransactionQueue::getNextInjectAddress() const
{
return myNextInjectAddress;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BusTransactionQueue& BusTransactionQueue::injectROM(uInt8 value)
{

View File

@ -39,6 +39,8 @@ class BusTransactionQueue {
BusTransactionQueue& reset();
BusTransactionQueue& setNextInjectAddress(uInt16 address);
uInt16 getNextInjectAddress() const;
BusTransactionQueue& injectROM(uInt8 value);
BusTransactionQueue& injectROM(uInt8 value, uInt16 address);

View File

@ -55,6 +55,24 @@ void VcsLib::vcsStartOverblank()
.yield(0x0080);
}
void VcsLib::vcsEndOverblank()
{
myTransactionQueue
.injectROM(0x00, 0x1fff)
.yield(0x00ac)
.setNextInjectAddress(0x1000);
}
void VcsLib::vcsNop2n(uInt16 n)
{
if (n == 0) return;
myTransactionQueue.injectROM(0xea);
myTransactionQueue.setNextInjectAddress(
myTransactionQueue.getNextInjectAddress() + (n - 1)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CortexM0::err_t VcsLib::fetch16(uInt32 address, uInt16& value, uInt8& op, CortexM0& cortex)
{
@ -84,7 +102,8 @@ CortexM0::err_t VcsLib::fetch16(uInt32 address, uInt16& value, uInt8& op, Cortex
FatalEmulationError::raise("unimplemented: vcsNop2");
case ADDR_VCS_NOP2N:
FatalEmulationError::raise("unimplemented: vcsNop2n");
vcsNop2n(cortex.getRegister(0));
return returnFromStub(value, op);
case ADDR_VCS_WRITE5:
FatalEmulationError::raise("unimplemented: vcsWrite5");
@ -131,7 +150,8 @@ CortexM0::err_t VcsLib::fetch16(uInt32 address, uInt16& value, uInt8& op, Cortex
return returnFromStub(value, op);
case ADDR_VCS_END_OVERBLANK:
FatalEmulationError::raise("unimplemented: vcsEndOverblank");
vcsEndOverblank();
return returnFromStub(value, op);
case ADDR_VCS_READ4:
FatalEmulationError::raise("unimplemented: vcsRead4");

View File

@ -32,6 +32,8 @@ class VcsLib: public CortexM0::BusTransactionDelegate {
void vcsWrite5(uInt8 zpAddress, uInt8 value);
void vcsCopyOverblankToRiotRam();
void vcsStartOverblank();
void vcsEndOverblank();
void vcsNop2n(uInt16 n);
private:
CortexM0::err_t returnFromStub(uInt16& value, uInt8& op);