Bring the C++ code a little closer to the C# code.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-06-02 12:12:04 +01:00
parent 90bfac83d5
commit dca2e1bb8e
5 changed files with 14 additions and 6 deletions

View File

@ -44,7 +44,7 @@ void EightBit::M6532::step() {
if (interruptTimer)
setFlag(IF(), Bit7);
interruptPA7 || interruptTimer ? lower(IRQ()) : raise(IRQ());
match(IRQ(), !(interruptPA7 || interruptTimer));
const auto read = raised(RW());
const auto write = lowered(RW());

View File

@ -113,10 +113,10 @@ EightBit::MemoryMapping Board::mapping(uint16_t address) {
void Board::updateAciaPins() {
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());
EightBit::Device::match(ACIA().RS(), ADDRESS().word & EightBit::Chip::Bit0);
EightBit::Device::match(ACIA().CS0(), ADDRESS().word & EightBit::Chip::Bit15);
EightBit::Device::match(ACIA().CS1(), ADDRESS().word & EightBit::Chip::Bit13);
EightBit::Device::match(ACIA().CS2(), ADDRESS().word & EightBit::Chip::Bit14);
}
bool Board::accessAcia() {

View File

@ -205,7 +205,7 @@ namespace EightBit {
auto& RDR() { return m_RDR; }
bool activated() { return powered() && raised(E()) && selected(); }
bool selected();
bool selected() { return raised(CS0()) && raised(CS1()) && lowered(CS2()); }
void markTransmitComplete();
void markReceiveStarting();

Binary file not shown.

View File

@ -64,6 +64,14 @@ namespace EightBit {
static constexpr auto lowered(const PinLevel line) { return line == PinLevel::Low; }
static void lower(PinLevel& line) noexcept { line = PinLevel::Low; }
static void match(PinLevel& line, int condition) {
match(line, condition != 0);
}
static void match(PinLevel& line, bool condition) {
condition ? raise(line) : lower(line);
}
virtual ~Device() {};
[[nodiscard]] bool powered() noexcept { return raised(POWER()); }