1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-01 13:58:20 +00:00

Switched to deferred updates for the 6532.

This commit is contained in:
Thomas Harte 2017-03-04 14:58:28 -05:00
parent a3fcd15980
commit 837cccdf83
2 changed files with 15 additions and 3 deletions

View File

@ -22,6 +22,7 @@ Machine::Machine() :
tia_input_value_{0xff, 0xff},
cycles_since_speaker_update_(0),
cycles_since_video_update_(0),
cycles_since_6532_update_(0),
frame_record_pointer_(0),
is_ntsc_(true)
{
@ -203,6 +204,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
// check for a PIA access
if((address&0x1280) == 0x280) {
update_6532();
if(isReadOperation(operation)) {
returnValue &= mos6532_.get_register(address);
} else {
@ -216,7 +218,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
}
if(!tia_->get_cycles_until_horizontal_blank(cycles_since_video_update_)) set_ready_line(false);
mos6532_.run_for_cycles(cycles_run_for / 3);
cycles_since_6532_update_ += (cycles_run_for / 3);
return cycles_run_for / 3;
}
@ -321,6 +323,12 @@ void Machine::update_video()
cycles_since_video_update_ = 0;
}
void Machine::update_6532()
{
mos6532_.run_for_cycles(cycles_since_6532_update_);
cycles_since_6532_update_ = 0;
}
void Machine::synchronise()
{
update_audio();

View File

@ -77,11 +77,15 @@ class Machine:
// speaker backlog accumlation counter
unsigned int cycles_since_speaker_update_;
void update_audio();
inline void update_audio();
// video backlog accumulation counter
unsigned int cycles_since_video_update_;
void update_video();
inline void update_video();
// RIOT backlog accumulation counter
unsigned int cycles_since_6532_update_;
inline void update_6532();
// output frame rate tracker
struct FrameRecord