mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
This at least now connects up a CRT, though it never talks to it.
This commit is contained in:
parent
47a7654c00
commit
716bb3281b
@ -14,8 +14,9 @@ using namespace Electron;
|
||||
|
||||
Machine::Machine()
|
||||
{
|
||||
setup6502();
|
||||
_crt = new Outputs::CRT(128, 312, 1, 1);
|
||||
_interruptStatus = 0x02;
|
||||
setup6502();
|
||||
}
|
||||
|
||||
Machine::~Machine()
|
||||
@ -28,12 +29,14 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
{
|
||||
if(isReadOperation(operation))
|
||||
{
|
||||
*value = ram[address];
|
||||
*value = _ram[address];
|
||||
}
|
||||
else
|
||||
{
|
||||
ram[address] = *value;
|
||||
_ram[address] = *value;
|
||||
}
|
||||
|
||||
// TODO: RAM timing
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -95,7 +98,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
else
|
||||
{
|
||||
if(isReadOperation(operation))
|
||||
*value = os[address - 49152];
|
||||
*value = _os[address - 49152];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -106,7 +109,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
{
|
||||
case ROMSlotBASIC:
|
||||
case ROMSlotBASIC+1:
|
||||
*value = basic[address - 32768];
|
||||
*value = _basic[address - 32768];
|
||||
break;
|
||||
case ROMSlotKeyboard:
|
||||
case ROMSlotKeyboard+1:
|
||||
@ -126,8 +129,8 @@ void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data)
|
||||
uint8_t *target = nullptr;
|
||||
switch(slot)
|
||||
{
|
||||
case ROMSlotBASIC: target = basic; break;
|
||||
case ROMSlotOS: target = os; break;
|
||||
case ROMSlotBASIC: target = _basic; break;
|
||||
case ROMSlotOS: target = _os; break;
|
||||
default: return;
|
||||
}
|
||||
|
||||
|
@ -17,13 +17,14 @@
|
||||
namespace Electron {
|
||||
|
||||
enum ROMSlot: uint8_t {
|
||||
ROMSlot0 = 0, ROMSlot1, ROMSlot2, ROMSlot3,
|
||||
ROMSlot4, ROMSlot5, ROMSlot6, ROMSlot7,
|
||||
ROMSlot0 = 0,
|
||||
ROMSlot1, ROMSlot2, ROMSlot3,
|
||||
ROMSlot4, ROMSlot5, ROMSlot6, ROMSlot7,
|
||||
|
||||
ROMSlotKeyboard = 8, ROMSlot9,
|
||||
ROMSlotBASIC = 10, ROMSlot11,
|
||||
|
||||
ROMSlot12, ROMSlot13, ROMSlot14, ROMSlot15,
|
||||
ROMSlot12, ROMSlot13, ROMSlot14, ROMSlot15,
|
||||
|
||||
ROMSlotOS
|
||||
};
|
||||
@ -39,11 +40,15 @@ class Machine: public CPU6502::Processor<Machine> {
|
||||
|
||||
void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
|
||||
|
||||
Outputs::CRT *get_crt() { return _crt; }
|
||||
|
||||
private:
|
||||
uint8_t os[16384], basic[16384], ram[32768];
|
||||
uint8_t _os[16384], _basic[16384], _ram[32768];
|
||||
uint8_t _interruptStatus, _interruptControl;
|
||||
uint16_t _screenStartAddress;
|
||||
ROMSlot _activeRom;
|
||||
|
||||
Outputs::CRT *_crt;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -27,4 +27,8 @@
|
||||
_electron.set_rom(Electron::ROMSlotBASIC, rom.length, (const uint8_t *)rom.bytes);
|
||||
}
|
||||
|
||||
- (void)setCRTDelegate:(Outputs::CRT::CRTDelegate *)delegate{
|
||||
_electron.get_crt()->set_delegate(delegate);
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user