1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Captures appropriate fields.

No action yet.
This commit is contained in:
Thomas Harte 2021-06-27 21:36:55 -04:00
parent 5729e6e13a
commit 6afee7bb9b
2 changed files with 35 additions and 2 deletions

View File

@ -200,10 +200,29 @@ uint8_t TimedInterruptSource::get_new_interrupts() {
} }
void TimedInterruptSource::write(uint16_t address, uint8_t value) { void TimedInterruptSource::write(uint16_t address, uint8_t value) {
(void)address; address &= 15;
(void)value; switch(address) {
default: break;
case 0: case 2:
channels_[address >> 1].reload = (channels_[address >> 1].reload & 0xff00) | value;
break;
case 1: case 3:
channels_[address >> 1].reload = uint16_t((channels_[address >> 1].reload & 0x00ff) | ((value & 0xf) << 8));
break;
case 7:
channels_[0].sync = value & 0x01;
channels_[1].sync = value & 0x02;
rate_ = InterruptRate((value >> 5) & 3);
break;
}
} }
void TimedInterruptSource::run_for(Cycles cycles) { void TimedInterruptSource::run_for(Cycles cycles) {
(void)cycles; (void)cycles;
} }
Cycles TimedInterruptSource::get_next_sequence_point() const {
return Cycles::max();
}

View File

@ -125,8 +125,22 @@ class TimedInterruptSource {
void run_for(Cycles); void run_for(Cycles);
Cycles get_next_sequence_point() const;
private: private:
uint8_t interrupts_ = 0; uint8_t interrupts_ = 0;
enum class InterruptRate {
OnekHz,
FiftyHz,
ToneGenerator0,
ToneGenerator1,
} rate_ = InterruptRate::OnekHz;
struct Channel {
uint16_t value, reload;
bool sync;
} channels_[2];
}; };
} }