diff --git a/MC6809/test/Board.cpp b/MC6809/test/Board.cpp index f108057..37d5337 100644 --- a/MC6809/test/Board.cpp +++ b/MC6809/test/Board.cpp @@ -87,10 +87,10 @@ void Board::Bus_ReadingByte_Acia(EightBit::EventArgs&) { void Board::updateAciaPins(const EightBit::Chip::PinLevel rw) { ACIA().RW() = rw; ACIA().DATA() = DATA(); - ADDRESS().word & EightBit::Chip::Bit0 ? ACIA().raise(ACIA().RS()) : ACIA().lower(ACIA().RS()); - ADDRESS().word & EightBit::Chip::Bit15 ? ACIA().raise(ACIA().CS0()) : ACIA().lower(ACIA().CS0()); - ADDRESS().word & EightBit::Chip::Bit13 ? ACIA().raise(ACIA().CS1()) : ACIA().lower(ACIA().CS1()); - ADDRESS().word & EightBit::Chip::Bit14 ? ACIA().raise(ACIA().CS2()) : ACIA().lower(ACIA().CS2()); + ACIA().match(ACIA().RS(), ADDRESS().word & EightBit::Chip::Bit0); + ACIA().match(ACIA().CS0(), ADDRESS().word & EightBit::Chip::Bit15); + ACIA().match(ACIA().CS1(), ADDRESS().word & EightBit::Chip::Bit13); + ACIA().match(ACIA().CS2(), ADDRESS().word & EightBit::Chip::Bit14); } void Board::Cpu_ExecutedInstruction_Terminator(EightBit::mc6809&) { diff --git a/inc/Chip.h b/inc/Chip.h index 5bf7dfe..36c868f 100644 --- a/inc/Chip.h +++ b/inc/Chip.h @@ -64,6 +64,8 @@ namespace EightBit { static bool lowered(const PinLevel line) { return line == Low; } static void lower(PinLevel& line) { line = Low; } + static void match(PinLevel& line, int value); + static int highNibble(const int value) { return value >> 4; } static int lowNibble(const int value) { return value & Mask4; } diff --git a/src/Chip.cpp b/src/Chip.cpp index 0d9aa64..1cff8c7 100644 --- a/src/Chip.cpp +++ b/src/Chip.cpp @@ -3,4 +3,8 @@ void EightBit::Chip::powerOn() { raise(POWER()); -} \ No newline at end of file +} + +void EightBit::Chip::match(PinLevel& line, int value) { + value ? raise(line) : lower(line); +}