mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Took basic steps towards supporting memory expansions.
This commit is contained in:
parent
0a13dd5c5b
commit
a547b7e1d8
@ -35,9 +35,33 @@ Machine::Machine() :
|
||||
_tape.set_delegate(this);
|
||||
|
||||
// establish the memory maps
|
||||
set_memory_size(MemorySize::Default);
|
||||
|
||||
// _debugPort.reset(new ::Commodore::Serial::DebugPort);
|
||||
// _debugPort->set_serial_bus(_serialBus);
|
||||
// _serialBus->add_port(_debugPort);
|
||||
}
|
||||
|
||||
void Machine::set_memory_size(MemorySize size)
|
||||
{
|
||||
memset(_processorReadMemoryMap, 0, sizeof(_processorReadMemoryMap));
|
||||
memset(_processorWriteMemoryMap, 0, sizeof(_processorWriteMemoryMap));
|
||||
|
||||
switch(size)
|
||||
{
|
||||
default: break;
|
||||
case ThreeKB:
|
||||
write_to_map(_processorReadMemoryMap, _expansionRAM, 0x0000, 0x1000);
|
||||
write_to_map(_processorWriteMemoryMap, _expansionRAM, 0x0000, 0x1000);
|
||||
break;
|
||||
case ThirtyTwoKB:
|
||||
write_to_map(_processorReadMemoryMap, _expansionRAM, 0x0000, 0x8000);
|
||||
write_to_map(_processorWriteMemoryMap, _expansionRAM, 0x0000, 0x8000);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// install the ROMs and VIC-visible memory
|
||||
write_to_map(_processorReadMemoryMap, _userBASICMemory, 0x0000, sizeof(_userBASICMemory));
|
||||
write_to_map(_processorReadMemoryMap, _screenMemory, 0x1000, sizeof(_screenMemory));
|
||||
write_to_map(_processorReadMemoryMap, _colorMemory, 0x9400, sizeof(_colorMemory));
|
||||
@ -48,10 +72,6 @@ Machine::Machine() :
|
||||
write_to_map(_processorWriteMemoryMap, _userBASICMemory, 0x0000, sizeof(_userBASICMemory));
|
||||
write_to_map(_processorWriteMemoryMap, _screenMemory, 0x1000, sizeof(_screenMemory));
|
||||
write_to_map(_processorWriteMemoryMap, _colorMemory, 0x9400, sizeof(_colorMemory));
|
||||
|
||||
// _debugPort.reset(new ::Commodore::Serial::DebugPort);
|
||||
// _debugPort->set_serial_bus(_serialBus);
|
||||
// _serialBus->add_port(_debugPort);
|
||||
}
|
||||
|
||||
void Machine::write_to_map(uint8_t **map, uint8_t *area, uint16_t address, uint16_t length)
|
||||
|
@ -32,6 +32,12 @@ enum ROMSlot {
|
||||
Drive
|
||||
};
|
||||
|
||||
enum MemorySize {
|
||||
Default,
|
||||
ThreeKB,
|
||||
ThirtyTwoKB
|
||||
};
|
||||
|
||||
#define key(line, mask) (((mask) << 3) | (line))
|
||||
|
||||
enum Key: uint16_t {
|
||||
@ -259,6 +265,7 @@ class Machine:
|
||||
_userPortVIA->set_joystick_state(input, isPressed);
|
||||
_keyboardVIA->set_joystick_state(input, isPressed);
|
||||
}
|
||||
void set_memory_size(MemorySize size);
|
||||
|
||||
inline void set_use_fast_tape_hack(bool activate) { _use_fast_tape_hack = activate; }
|
||||
inline void set_should_automatically_load_media(bool activate) { _should_automatically_load_media = activate; }
|
||||
@ -291,6 +298,7 @@ class Machine:
|
||||
uint8_t _characterROM[0x1000];
|
||||
uint8_t _basicROM[0x2000];
|
||||
uint8_t _kernelROM[0x2000];
|
||||
uint8_t _expansionRAM[0x8000];
|
||||
|
||||
uint8_t *_rom;
|
||||
uint16_t _rom_address, _rom_length;
|
||||
|
Loading…
x
Reference in New Issue
Block a user