2016-02-18 10:32:22 +00:00
|
|
|
auto System::portRead(uint16 addr) -> uint8 {
|
2016-03-08 11:34:00 +00:00
|
|
|
//DISP_MODE
|
|
|
|
if(addr == 0x0060) return (
|
|
|
|
r.unknown << 0
|
|
|
|
| r.format << 5
|
|
|
|
| r.color << 6
|
|
|
|
| r.depth << 7
|
|
|
|
);
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
//IEEP_DATA
|
|
|
|
if(addr == 0x00ba) return eeprom.read(EEPROM::DataLo);
|
|
|
|
if(addr == 0x00bb) return eeprom.read(EEPROM::DataHi);
|
|
|
|
|
|
|
|
//IEEP_ADDR
|
|
|
|
if(addr == 0x00bc) return eeprom.read(EEPROM::AddressLo);
|
|
|
|
if(addr == 0x00bd) return eeprom.read(EEPROM::AddressHi);
|
|
|
|
|
|
|
|
//IEEP_CMD
|
|
|
|
if(addr == 0x00be) return eeprom.read(EEPROM::Status);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto System::portWrite(uint16 addr, uint8 data) -> void {
|
2016-03-08 11:34:00 +00:00
|
|
|
//DISP_MODE
|
|
|
|
if(addr == 0x0060) {
|
|
|
|
r.unknown = data.bits(0,4) & 0b01011;
|
|
|
|
r.format = data.bit (5);
|
|
|
|
r.color = data.bit (6);
|
|
|
|
r.depth = data.bit (7);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-02-18 10:32:22 +00:00
|
|
|
//IEEP_DATA
|
|
|
|
if(addr == 0x00ba) return eeprom.write(EEPROM::DataLo, data);
|
|
|
|
if(addr == 0x00bb) return eeprom.write(EEPROM::DataHi, data);
|
|
|
|
|
|
|
|
//IEEP_ADDR
|
|
|
|
if(addr == 0x00bc) return eeprom.write(EEPROM::AddressLo, data);
|
|
|
|
if(addr == 0x00bd) return eeprom.write(EEPROM::AddressHi, data);
|
|
|
|
|
|
|
|
//IEEP_CMD
|
|
|
|
if(addr == 0x00be) return eeprom.write(EEPROM::Command, data);
|
|
|
|
}
|