1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-29 12:50:28 +00:00

Added enough to the machine that the 6560 can now produce output if it wishes.

This commit is contained in:
Thomas Harte 2016-06-05 12:11:12 -04:00
parent b56482607e
commit 9566c87532
4 changed files with 38 additions and 17 deletions

View File

@ -19,3 +19,17 @@ MOS6560::MOS6560() :
"return vec3(1.0);" "return vec3(1.0);"
"}"); "}");
} }
void MOS6560::set_register(int address, uint8_t value)
{
printf("%02x -> %d\n", value, address);
}
uint16_t MOS6560::get_address()
{
return 0;
}
void MOS6560::set_graphics_value(uint8_t value)
{
}

View File

@ -18,6 +18,11 @@ class MOS6560 {
MOS6560(); MOS6560();
Outputs::CRT::CRT *get_crt() { return _crt.get(); } Outputs::CRT::CRT *get_crt() { return _crt.get(); }
uint16_t get_address();
void set_graphics_value(uint8_t value);
void set_register(int address, uint8_t value);
private: private:
std::unique_ptr<Outputs::CRT::CRT> _crt; std::unique_ptr<Outputs::CRT::CRT> _crt;
}; };

View File

@ -21,28 +21,22 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{ {
set_reset_line(false); set_reset_line(false);
// run the phase-1 part of this cycle, in which the VIC accesses memory
_mos6560->set_graphics_value(read_memory(_mos6560->get_address()));
// run the phase-2 part of the cycle, which is whatever the 6502 said it should be
if(isReadOperation(operation)) if(isReadOperation(operation))
{ {
uint8_t returnValue = 0xff; *value = read_memory(address);
if(address < sizeof(_ram))
returnValue &= _ram[address];
if(address >= 0x8000 && address < 0x9000)
returnValue &= _characterROM[address&0x0fff];
if(address >= 0xc000 && address < 0xe000)
returnValue &= _basicROM[address&0x1fff];
if(address >= 0xe000)
returnValue &= _kernelROM[address&0x1fff];
*value = returnValue;
} }
else else
{ {
if(address < sizeof(_ram)) if(address < sizeof(_ram)) _ram[address] = *value;
_ram[address] = *value; else if((address&0xfff0) == 0x9000)
{
_mos6560->set_register(address - 0x9000, *value);
}
// TODO: the 6522
} }
return 1; return 1;

View File

@ -45,6 +45,14 @@ class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
uint8_t _kernelROM[0x2000]; uint8_t _kernelROM[0x2000];
uint8_t _ram[0x2000]; uint8_t _ram[0x2000];
inline uint8_t read_memory(uint16_t address) {
if(address < sizeof(_ram)) return _ram[address];
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];
return 0xff;
}
std::unique_ptr<MOS::MOS6560> _mos6560; std::unique_ptr<MOS::MOS6560> _mos6560;
}; };