Simplify chip pin level matching a little.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-10-21 19:42:20 +01:00
parent 3aa5b4bb91
commit 4bfb264380
3 changed files with 11 additions and 5 deletions

View File

@ -87,10 +87,10 @@ void Board::Bus_ReadingByte_Acia(EightBit::EventArgs&) {
void Board::updateAciaPins(const EightBit::Chip::PinLevel rw) { void Board::updateAciaPins(const EightBit::Chip::PinLevel rw) {
ACIA().RW() = rw; ACIA().RW() = rw;
ACIA().DATA() = DATA(); ACIA().DATA() = DATA();
ADDRESS().word & EightBit::Chip::Bit0 ? ACIA().raise(ACIA().RS()) : ACIA().lower(ACIA().RS()); ACIA().match(ACIA().RS(), ADDRESS().word & EightBit::Chip::Bit0);
ADDRESS().word & EightBit::Chip::Bit15 ? ACIA().raise(ACIA().CS0()) : ACIA().lower(ACIA().CS0()); ACIA().match(ACIA().CS0(), ADDRESS().word & EightBit::Chip::Bit15);
ADDRESS().word & EightBit::Chip::Bit13 ? ACIA().raise(ACIA().CS1()) : ACIA().lower(ACIA().CS1()); ACIA().match(ACIA().CS1(), ADDRESS().word & EightBit::Chip::Bit13);
ADDRESS().word & EightBit::Chip::Bit14 ? ACIA().raise(ACIA().CS2()) : ACIA().lower(ACIA().CS2()); ACIA().match(ACIA().CS2(), ADDRESS().word & EightBit::Chip::Bit14);
} }
void Board::Cpu_ExecutedInstruction_Terminator(EightBit::mc6809&) { void Board::Cpu_ExecutedInstruction_Terminator(EightBit::mc6809&) {

View File

@ -64,6 +64,8 @@ namespace EightBit {
static bool lowered(const PinLevel line) { return line == Low; } static bool lowered(const PinLevel line) { return line == Low; }
static void lower(PinLevel& line) { 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 highNibble(const int value) { return value >> 4; }
static int lowNibble(const int value) { return value & Mask4; } static int lowNibble(const int value) { return value & Mask4; }

View File

@ -3,4 +3,8 @@
void EightBit::Chip::powerOn() { void EightBit::Chip::powerOn() {
raise(POWER()); raise(POWER());
} }
void EightBit::Chip::match(PinLevel& line, int value) {
value ? raise(line) : lower(line);
}