1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-14 13:33:42 +00:00

Reinstituted something of the don't-do-pixel-work-until-an-affecting-write-occurs optimisation.

This commit is contained in:
Thomas Harte 2016-12-15 19:20:14 -05:00
parent c1c70a767a
commit f61176cd7d
4 changed files with 21 additions and 6 deletions

View File

@ -58,13 +58,13 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
} }
else else
{ {
update_display(); if(address >= video_access_range_.low_address && address <= video_access_range_.high_address) update_display();
ram_[address] = *value; ram_[address] = *value;
} }
// for the entire frame, RAM is accessible only on odd cycles; in modes below 4 // for the entire frame, RAM is accessible only on odd cycles; in modes below 4
// it's also accessible only outside of the pixel regions // it's also accessible only outside of the pixel regions
cycles += video_output_->get_cycles_until_next_ram_availability(cycles_since_display_update_ + 1); cycles += video_output_->get_cycles_until_next_ram_availability((int)(cycles_since_display_update_ + 1));
} }
else else
{ {
@ -109,6 +109,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{ {
update_display(); update_display();
video_output_->set_register(address, *value); video_output_->set_register(address, *value);
video_access_range_ = video_output_->get_memory_access_range();
queue_next_display_interrupt(); queue_next_display_interrupt();
} }
break; break;
@ -344,13 +345,13 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target)
if(target.loadingCommand.length()) // TODO: and automatic loading option enabled if(target.loadingCommand.length()) // TODO: and automatic loading option enabled
{ {
// set_typer_for_string(target.loadingCommand.c_str()); set_typer_for_string(target.loadingCommand.c_str());
} }
if(target.acorn.should_hold_shift) if(target.acorn.should_hold_shift)
{ {
// set_key_state(KeyShift, true); set_key_state(KeyShift, true);
// is_holding_shift_ = true; is_holding_shift_ = true;
} }
} }

View File

@ -134,6 +134,7 @@ class Machine:
unsigned int cycles_since_audio_update_; unsigned int cycles_since_audio_update_;
int cycles_until_display_interrupt_; int cycles_until_display_interrupt_;
Interrupt next_display_interrupt_; Interrupt next_display_interrupt_;
VideoOutput::Range video_access_range_;
// Tape // Tape
Tape tape_; Tape tape_;

View File

@ -417,7 +417,7 @@ unsigned int VideoOutput::get_cycles_until_next_ram_availability(int from_time)
{ {
const int current_column = graphics_column(position + (position&1)); const int current_column = graphics_column(position + (position&1));
int current_line = graphics_line(position); int current_line = graphics_line(position);
if(current_line < 256) if(current_column < 80 && current_line < 256)
{ {
if(screen_mode_ == 3) if(screen_mode_ == 3)
{ {
@ -433,6 +433,14 @@ unsigned int VideoOutput::get_cycles_until_next_ram_availability(int from_time)
return result; return result;
} }
VideoOutput::Range VideoOutput::get_memory_access_range()
{
VideoOutput::Range range;
range.low_address = std::min(start_screen_address_, screen_mode_base_address_);
range.high_address = 0x8000;
return range;
}
#pragma mark - The screen map #pragma mark - The screen map
void VideoOutput::setup_screen_map() void VideoOutput::setup_screen_map()

View File

@ -30,6 +30,11 @@ class VideoOutput {
unsigned int get_cycles_until_next_ram_availability(int from_time); unsigned int get_cycles_until_next_ram_availability(int from_time);
struct Range {
uint16_t low_address, high_address;
};
Range get_memory_access_range();
private: private:
inline void start_pixel_line(); inline void start_pixel_line();
inline void end_pixel_line(); inline void end_pixel_line();