Skip to content

Commit

Permalink
kc85: fix ctc/pio chip select pin
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Jul 24, 2024
1 parent b5cfa74 commit d571bb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/bitutils.zig
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub inline fn pin(bus: anytype, p: comptime_int) bool {

/// test multiple pins against a mask
pub inline fn pins(bus: anytype, m: comptime_int, p: comptime_int) bool {
return (bus & p) == m;
return (bus & m) == p;
}

/// test if all pins are set
Expand Down
4 changes: 4 additions & 0 deletions src/systems/kc85.zig
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,13 @@ pub fn Type(comptime model: Model) type {
// IO address decoding (fixme: replace with a switch?)
if (pins(bus, CTC.CE_MASK, CTC.CE_PINS)) {
bus |= Z80CTC.CE;
} else {
bus &= ~Z80CTC.CE;
}
if (pins(bus, PIO.CE_MASK, PIO.CE_PINS)) {
bus |= Z80PIO.CE;
} else {
bus &= ~Z80PIO.CE;
}

// tick the CTC and PIO
Expand Down

0 comments on commit d571bb6

Please sign in to comment.