mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-12 00:30:31 +00:00
Switched to deferred updates for the 6532.
This commit is contained in:
parent
a3fcd15980
commit
837cccdf83
@ -22,6 +22,7 @@ Machine::Machine() :
|
|||||||
tia_input_value_{0xff, 0xff},
|
tia_input_value_{0xff, 0xff},
|
||||||
cycles_since_speaker_update_(0),
|
cycles_since_speaker_update_(0),
|
||||||
cycles_since_video_update_(0),
|
cycles_since_video_update_(0),
|
||||||
|
cycles_since_6532_update_(0),
|
||||||
frame_record_pointer_(0),
|
frame_record_pointer_(0),
|
||||||
is_ntsc_(true)
|
is_ntsc_(true)
|
||||||
{
|
{
|
||||||
@ -203,6 +204,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
|
|||||||
|
|
||||||
// check for a PIA access
|
// check for a PIA access
|
||||||
if((address&0x1280) == 0x280) {
|
if((address&0x1280) == 0x280) {
|
||||||
|
update_6532();
|
||||||
if(isReadOperation(operation)) {
|
if(isReadOperation(operation)) {
|
||||||
returnValue &= mos6532_.get_register(address);
|
returnValue &= mos6532_.get_register(address);
|
||||||
} else {
|
} 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);
|
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;
|
return cycles_run_for / 3;
|
||||||
}
|
}
|
||||||
@ -321,6 +323,12 @@ void Machine::update_video()
|
|||||||
cycles_since_video_update_ = 0;
|
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()
|
void Machine::synchronise()
|
||||||
{
|
{
|
||||||
update_audio();
|
update_audio();
|
||||||
|
@ -77,11 +77,15 @@ class Machine:
|
|||||||
|
|
||||||
// speaker backlog accumlation counter
|
// speaker backlog accumlation counter
|
||||||
unsigned int cycles_since_speaker_update_;
|
unsigned int cycles_since_speaker_update_;
|
||||||
void update_audio();
|
inline void update_audio();
|
||||||
|
|
||||||
// video backlog accumulation counter
|
// video backlog accumulation counter
|
||||||
unsigned int cycles_since_video_update_;
|
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
|
// output frame rate tracker
|
||||||
struct FrameRecord
|
struct FrameRecord
|
||||||
|
Loading…
x
Reference in New Issue
Block a user