1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Switched to a real (unexpanded) memory map, meaning that nonsense is no longer being supplied to the VIC.

This commit is contained in:
Thomas Harte 2016-06-05 16:00:35 -04:00
parent 3be1ce457b
commit 2ab21e7a3c
2 changed files with 15 additions and 3 deletions

View File

@ -31,7 +31,8 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
}
else
{
if(address < sizeof(_ram)) _ram[address] = *value;
uint8_t *ram = ram_pointer(address);
if(ram) *ram = *value;
else if((address&0xfff0) == 0x9000)
{
_mos6560->set_register(address - 0x9000, *value);

View File

@ -43,10 +43,21 @@ class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
uint8_t _characterROM[0x1000];
uint8_t _basicROM[0x2000];
uint8_t _kernelROM[0x2000];
uint8_t _ram[0x2000];
uint8_t _userBASICMemory[0x0400];
uint8_t _screenMemory[0x1000];
uint8_t _colorMemory[0x0200];
inline uint8_t *ram_pointer(uint16_t address) {
if(address < sizeof(_userBASICMemory)) return &_userBASICMemory[address];
if(address >= 0x1000 && address < 0x1200) return &_screenMemory[address&0x0fff];
if(address >= 0x9400 && address < 0x9600) return &_colorMemory[0x01ff];
return nullptr;
}
inline uint8_t read_memory(uint16_t address) {
if(address < sizeof(_ram)) return _ram[address];
uint8_t *ram = ram_pointer(address);
if(ram) return *ram;
else if(address >= 0x8000 && address < 0x9000) return _characterROM[address&0x0fff];
else if(address >= 0xc000 && address < 0xe000) return _basicROM[address&0x1fff];
else if(address >= 0xe000) return _kernelROM[address&0x1fff];