1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 17:16:44 +00:00

Adds enough logic to advance to an ACIA access error.

This commit is contained in:
Thomas Harte
2019-10-09 23:01:11 -04:00
parent 42ebe06474
commit 127bb043e7
5 changed files with 92 additions and 10 deletions
+17 -5
View File
@@ -123,11 +123,7 @@ void MFP68901::run_for(HalfCycles time) {
--timers_[c].divisor;
if(!timers_[c].divisor) {
timers_[c].divisor = timers_[c].prescale;
--timers_[c].value;
if(!timers_[c].value) {
// TODO: interrupt.
}
decrement_timer(c);
}
}
}
@@ -159,3 +155,19 @@ void MFP68901::set_timer_data(int timer, uint8_t value) {
uint8_t MFP68901::get_timer_data(int timer) {
return timers_[timer].value;
}
void MFP68901::set_timer_event_input(int channel, bool value) {
if(timers_[channel].event_input == value) return;
timers_[channel].event_input = value;
if(timers_[channel].mode == TimerMode::EventCount && !value) { /* TODO: which edge is counted? "as defined by the associated Interrupt Channels edge bit"? */
decrement_timer(channel);
}
}
void MFP68901::decrement_timer(int timer) {
--timers_[timer].value;
if(!timers_[timer].value) {
// TODO: interrupt. Reload, possibly.
}
}