Skip to content

Commit 80edacd

Browse files
committed
Merge branch 'leiradel-allow_invalid_regs'
2 parents 2b7c8b9 + d623866 commit 80edacd

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

chips/ay38910.h

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -622,37 +622,31 @@ uint64_t ay38910_iorq(ay38910_t* ay, uint64_t pins) {
622622
const uint8_t data = ay->reg[ay->addr];
623623
AY38910_SET_DATA(pins, data);
624624
}
625+
else {
626+
// see: https://github.com/floooh/chips/pull/111
627+
// https://worldofspectrum.org/forums/discussion/23327/
628+
AY38910_SET_DATA(pins, 0);
629+
}
625630
AY38910_SET_PA(pins, ay->port_a);
626631
AY38910_SET_PB(pins, ay->port_b);
627632
ay->pins = pins;
628633
}
629634
return pins;
630635
}
631636

632-
/*
633-
uint64_t ay38910_tick(ay38910_t* ay, uint64_t pins) {
634-
if (pins & (AY38910_BDIR|AY38910_BC1)) {
635-
pins = _ay38910_iorq(ay, pins);
636-
}
637-
pins = _ay38910_tick(ay, pins);
638-
AY38910_SET_PA(pins, ay->port_a);
639-
AY38910_SET_PB(pins, ay->port_b);
640-
ay->pins = pins;
641-
return pins;
642-
}
643-
*/
644-
645637
void ay38910_set_register(ay38910_t* ay, uint8_t addr, uint8_t data) {
646-
CHIPS_ASSERT(ay && (addr < AY38910_NUM_REGISTERS));
647-
ay->reg[addr] = data & _ay38910_reg_mask[addr];
648-
_ay38910_update_values(ay);
649-
if (addr == AY38910_REG_ENV_SHAPE_CYCLE) {
650-
_ay38910_restart_env_shape(ay);
638+
CHIPS_ASSERT(ay);
639+
if (addr < AY38910_NUM_REGISTERS) {
640+
ay->reg[addr] = data & _ay38910_reg_mask[addr];
641+
_ay38910_update_values(ay);
642+
if (addr == AY38910_REG_ENV_SHAPE_CYCLE) {
643+
_ay38910_restart_env_shape(ay);
644+
}
651645
}
652646
}
653647

654648
void ay38910_set_addr_latch(ay38910_t* ay, uint8_t addr) {
655-
CHIPS_ASSERT(ay && (addr < AY38910_NUM_REGISTERS));
649+
CHIPS_ASSERT(ay);
656650
ay->addr = addr;
657651
}
658652

0 commit comments

Comments
 (0)