1
0
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:
Thomas Harte 2016-01-07 22:26:49 -05:00
parent 47a7654c00
commit 716bb3281b
3 changed files with 23 additions and 11 deletions

View File

@ -14,8 +14,9 @@ using namespace Electron;
Machine::Machine() Machine::Machine()
{ {
setup6502(); _crt = new Outputs::CRT(128, 312, 1, 1);
_interruptStatus = 0x02; _interruptStatus = 0x02;
setup6502();
} }
Machine::~Machine() Machine::~Machine()
@ -28,12 +29,14 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{ {
if(isReadOperation(operation)) if(isReadOperation(operation))
{ {
*value = ram[address]; *value = _ram[address];
} }
else else
{ {
ram[address] = *value; _ram[address] = *value;
} }
// TODO: RAM timing
} }
else else
{ {
@ -95,7 +98,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
else else
{ {
if(isReadOperation(operation)) if(isReadOperation(operation))
*value = os[address - 49152]; *value = _os[address - 49152];
} }
} }
else else
@ -106,7 +109,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{ {
case ROMSlotBASIC: case ROMSlotBASIC:
case ROMSlotBASIC+1: case ROMSlotBASIC+1:
*value = basic[address - 32768]; *value = _basic[address - 32768];
break; break;
case ROMSlotKeyboard: case ROMSlotKeyboard:
case ROMSlotKeyboard+1: case ROMSlotKeyboard+1:
@ -126,8 +129,8 @@ void Machine::set_rom(ROMSlot slot, size_t length, const uint8_t *data)
uint8_t *target = nullptr; uint8_t *target = nullptr;
switch(slot) switch(slot)
{ {
case ROMSlotBASIC: target = basic; break; case ROMSlotBASIC: target = _basic; break;
case ROMSlotOS: target = os; break; case ROMSlotOS: target = _os; break;
default: return; default: return;
} }

View File

@ -17,13 +17,14 @@
namespace Electron { namespace Electron {
enum ROMSlot: uint8_t { enum ROMSlot: uint8_t {
ROMSlot0 = 0, ROMSlot1, ROMSlot2, ROMSlot3, ROMSlot0 = 0,
ROMSlot4, ROMSlot5, ROMSlot6, ROMSlot7, ROMSlot1, ROMSlot2, ROMSlot3,
ROMSlot4, ROMSlot5, ROMSlot6, ROMSlot7,
ROMSlotKeyboard = 8, ROMSlot9, ROMSlotKeyboard = 8, ROMSlot9,
ROMSlotBASIC = 10, ROMSlot11, ROMSlotBASIC = 10, ROMSlot11,
ROMSlot12, ROMSlot13, ROMSlot14, ROMSlot15, ROMSlot12, ROMSlot13, ROMSlot14, ROMSlot15,
ROMSlotOS ROMSlotOS
}; };
@ -39,11 +40,15 @@ class Machine: public CPU6502::Processor<Machine> {
void set_rom(ROMSlot slot, size_t length, const uint8_t *data); void set_rom(ROMSlot slot, size_t length, const uint8_t *data);
Outputs::CRT *get_crt() { return _crt; }
private: private:
uint8_t os[16384], basic[16384], ram[32768]; uint8_t _os[16384], _basic[16384], _ram[32768];
uint8_t _interruptStatus, _interruptControl; uint8_t _interruptStatus, _interruptControl;
uint16_t _screenStartAddress; uint16_t _screenStartAddress;
ROMSlot _activeRom; ROMSlot _activeRom;
Outputs::CRT *_crt;
}; };
} }

View File

@ -27,4 +27,8 @@
_electron.set_rom(Electron::ROMSlotBASIC, rom.length, (const uint8_t *)rom.bytes); _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 @end