mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-14 21:29:42 +00:00
Mild refactoring of the keyboard IO to make the C++ and C# versions as close as possible.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
86d5ae4745
commit
45d1fe605f
@ -32,20 +32,17 @@ void EightBit::GameBoy::IoRegisters::Bus_ReadingByte(EightBit::EventArgs) {
|
||||
|
||||
// Port/Mode Registers
|
||||
case P1: {
|
||||
auto p14 = m_scanP14 && !m_p14;
|
||||
auto p15 = m_scanP15 && !m_p15;
|
||||
auto live = p14 || p15;
|
||||
auto p10 = live && !m_p10;
|
||||
auto p11 = live && !m_p11;
|
||||
auto p12 = live && !m_p12;
|
||||
auto p13 = live && !m_p13;
|
||||
poke(port,
|
||||
((int)!p10)
|
||||
| ((int)!p11 << 1)
|
||||
| ((int)!p12 << 2)
|
||||
| ((int)!p13 << 3)
|
||||
| Chip::Bit4 | Chip::Bit5
|
||||
| Chip::Bit6 | Chip::Bit7);
|
||||
auto directionKeys = m_scanP14 && !m_p14;
|
||||
auto miscKeys = m_scanP15 && !m_p15;
|
||||
auto live = directionKeys || miscKeys;
|
||||
auto rightOrA = live && !m_p10;
|
||||
auto leftOrB = live && !m_p11;
|
||||
auto upOrSelect = live && !m_p12;
|
||||
auto downOrStart = live && !m_p13;
|
||||
auto lowNibble = ((int)!rightOrA) | ((int)!leftOrB << 1) | ((int)!upOrSelect << 2) | ((int)!downOrStart << 3);
|
||||
auto highNibble = Chip::promoteNibble(Chip::Mask4);
|
||||
auto value = lowNibble | highNibble;
|
||||
poke(port, lowNibble | highNibble);
|
||||
}
|
||||
break;
|
||||
case SB:
|
||||
|
Loading…
x
Reference in New Issue
Block a user