1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Don't allow a disabled screen to interfere with Yamaha addressing.

This commit is contained in:
Thomas Harte 2023-02-02 12:03:33 -05:00
parent 0d4dc214fb
commit debdad350d
2 changed files with 11 additions and 11 deletions

View File

@ -308,7 +308,8 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
// Establish the current screen output mode, which will be captured as a // Establish the current screen output mode, which will be captured as a
// line mode momentarily. // line mode momentarily.
this->screen_mode_ = this->current_screen_mode(); this->screen_mode_ = this->template current_screen_mode<true>();
this->underlying_mode_ = this->template current_screen_mode<false>();
// Based on the output mode, pick a line mode. // Based on the output mode, pick a line mode.
next_line_buffer.first_pixel_output_column = Timing<personality>::FirstPixelCycle; next_line_buffer.first_pixel_output_column = Timing<personality>::FirstPixelCycle;
@ -723,7 +724,7 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
// b5: enable light pen interrupts // b5: enable light pen interrupts
// b6: set colour bus to input or output mode // b6: set colour bus to input or output mode
LOG("Screen mode: " << int(current_screen_mode())); LOG("Screen mode: " << int(current_screen_mode<true>()));
break; break;
case 1: case 1:
@ -733,7 +734,7 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
((value & 0x08) >> 2) ((value & 0x08) >> 2)
); );
LOG("Screen mode: " << int(current_screen_mode())); LOG("Screen mode: " << int(current_screen_mode<true>()));
break; break;
case 8: case 8:
@ -845,7 +846,7 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
Storage<personality>::command_ && Storage<personality>::command_ &&
Storage<personality>::command_->access == Command::AccessType::WaitForColourReceipt Storage<personality>::command_->access == Command::AccessType::WaitForColourReceipt
) { ) {
Storage<personality>::command_->advance(pixels_per_byte(this->screen_mode_)); Storage<personality>::command_->advance(pixels_per_byte(this->underlying_mode_));
Storage<personality>::update_command_step(fetch_pointer_.column); Storage<personality>::update_command_step(fetch_pointer_.column);
} }
break; break;

View File

@ -543,7 +543,7 @@ template <Personality personality> struct Base: public Storage<personality> {
bool enable_line_interrupts_ = false; bool enable_line_interrupts_ = false;
bool line_interrupt_pending_ = false; bool line_interrupt_pending_ = false;
ScreenMode screen_mode_; ScreenMode screen_mode_, underlying_mode_;
LineBuffer line_buffers_[313]; LineBuffer line_buffers_[313];
void posit_sprite(LineBuffer &buffer, int sprite_number, int sprite_y, int screen_row); void posit_sprite(LineBuffer &buffer, int sprite_number, int sprite_y, int screen_row);
@ -570,8 +570,8 @@ template <Personality personality> struct Base: public Storage<personality> {
void commit_register(int reg, uint8_t value); void commit_register(int reg, uint8_t value);
ScreenMode current_screen_mode() const { template <bool check_blank> ScreenMode current_screen_mode() const {
if(blank_display_) { if(check_blank && blank_display_) {
return ScreenMode::Blank; return ScreenMode::Blank;
} }
@ -737,13 +737,13 @@ template <Personality personality> struct Base: public Storage<personality> {
ram_[address] = Storage<personality>::command_latch_; ram_[address] = Storage<personality>::command_latch_;
Storage<personality>::command_->advance(pixels_per_byte(this->screen_mode_)); Storage<personality>::command_->advance(pixels_per_byte(this->underlying_mode_));
Storage<personality>::update_command_step(access_column); Storage<personality>::update_command_step(access_column);
} break; } break;
case CommandStep::WriteByte: case CommandStep::WriteByte:
ram_[command_address()] = Storage<personality>::command_context_.colour; ram_[command_address()] = Storage<personality>::command_context_.colour;
Storage<personality>::command_->advance(pixels_per_byte(this->screen_mode_)); Storage<personality>::command_->advance(pixels_per_byte(this->underlying_mode_));
Storage<personality>::update_command_step(access_column); Storage<personality>::update_command_step(access_column);
break; break;
} }
@ -756,8 +756,7 @@ template <Personality personality> struct Base: public Storage<personality> {
++ram_pointer_; ++ram_pointer_;
if constexpr (is_yamaha_vdp(personality)) { if constexpr (is_yamaha_vdp(personality)) {
const ScreenMode mode = current_screen_mode(); if(this->underlying_mode_ == ScreenMode::YamahaGraphics6 || this->underlying_mode_ == ScreenMode::YamahaGraphics7) {
if(mode == ScreenMode::YamahaGraphics6 || mode == ScreenMode::YamahaGraphics7) {
// Rotate address one to the right as the hardware accesses // Rotate address one to the right as the hardware accesses
// the underlying banks of memory alternately but presents // the underlying banks of memory alternately but presents
// them as if linear. // them as if linear.