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:
parent
b56482607e
commit
9566c87532
@ -19,3 +19,17 @@ MOS6560::MOS6560() :
|
||||
"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)
|
||||
{
|
||||
}
|
||||
|
@ -18,6 +18,11 @@ class MOS6560 {
|
||||
MOS6560();
|
||||
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:
|
||||
std::unique_ptr<Outputs::CRT::CRT> _crt;
|
||||
};
|
||||
|
@ -21,28 +21,22 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
||||
{
|
||||
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))
|
||||
{
|
||||
uint8_t returnValue = 0xff;
|
||||
|
||||
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;
|
||||
*value = read_memory(address);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(address < sizeof(_ram))
|
||||
_ram[address] = *value;
|
||||
if(address < sizeof(_ram)) _ram[address] = *value;
|
||||
else if((address&0xfff0) == 0x9000)
|
||||
{
|
||||
_mos6560->set_register(address - 0x9000, *value);
|
||||
}
|
||||
// TODO: the 6522
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -45,6 +45,14 @@ class Machine: public CPU6502::Processor<Machine>, public CRTMachine::Machine {
|
||||
uint8_t _kernelROM[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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user