/
BusComponent.cpp
46 lines (38 loc) · 1.02 KB
/
BusComponent.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "BusComponent.h"
#include "Bus.h"
#include "Emulator.h"
#include "SlotSelector.h"
using namespace nowind;
BusComponent::BusComponent(Emulator& aEmulator) : Component(aEmulator),
mBus(aEmulator.getBus())
{
mSlot = 0;
mSubSlot = 0;
}
void BusComponent::initialize()
{
}
void BusComponent::setSlot(SlotSelector* slotSelector, Uint8 slot, Uint8 subslot)
{
mSlotSelector = slotSelector;
mSlot = slot;
mSubSlot = subslot;
}
bool BusComponent::inExpandedSlot()
{
return mSlotSelector->getSlotExpanded(mSlot);
}
void BusComponent::activateSection(Uint8 section)
{
mBus.activateSection(section, mSlot, mSubSlot, inExpandedSlot());
activate(section);
}
void BusComponent::activateReadSectionMemory(Uint8 section, byte* memory)
{
if (section == constMaxSection && inExpandedSlot())
{
// do not allow activateReadSectionMemory, because it would disable read/writes to the subslot-selection-register (0xffff)
return;
}
mBus.activateReadSectionMemory(section, memory);
}