1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-24 12:30:17 +00:00

Adjust visible Y9938 area; clamp scrolled y; use proper mode 2 terminator.

This commit is contained in:
Thomas Harte 2023-03-07 18:19:08 -05:00
parent e8404bdcc0
commit cc7b209e1a
2 changed files with 24 additions and 8 deletions

View File

@ -55,7 +55,12 @@ Base<personality>::Base() :
template <Personality personality>
TMS9918<personality>::TMS9918() {
this->crt_.set_display_type(Outputs::Display::DisplayType::RGB);
if constexpr (is_yamaha_vdp(personality)) {
this->crt_.set_visible_area(Outputs::Display::Rect(0.07f, 0.065f, 0.875f, 0.875f));
} else {
this->crt_.set_visible_area(Outputs::Display::Rect(0.07f, 0.0375f, 0.875f, 0.875f));
}
// The TMS remains in-phase with the NTSC colour clock; this is an empirical measurement
// intended to produce the correct relationship between the hard edges between pixels and
@ -122,7 +127,7 @@ void Base<personality>::posit_sprite(LineBuffer &buffer, int sprite_number, int
if(buffer.sprites_stopped) return;
// A sprite Y of 208 means "don't scan the list any further".
if(mode_timing_.allow_sprite_terminator && sprite_position == mode_timing_.sprite_terminator) {
if(mode_timing_.allow_sprite_terminator && sprite_position == mode_timing_.sprite_terminator(buffer.screen_mode)) {
buffer.sprites_stopped = true;
return;
}
@ -220,13 +225,13 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
function<true>( \
this->line_buffers_[this->fetch_pointer_.row], \
this->line_buffers_[(this->fetch_pointer_.row + 1) % this->mode_timing_.total_lines], \
this->fetch_pointer_.row + offset, \
(this->fetch_pointer_.row + offset) & 0xff, \
first_window, final_window); \
} else { \
function<false>( \
this->line_buffers_[this->fetch_pointer_.row], \
this->line_buffers_[(this->fetch_pointer_.row + 1) % this->mode_timing_.total_lines], \
this->fetch_pointer_.row + offset, \
(this->fetch_pointer_.row + offset) & 0xff, \
first_window, final_window); \
} \
}
@ -937,6 +942,8 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
// (e.g. a line of length 0).
if(!Storage<personality>::command_ && (value >> 4)) {
LOG("TODO: Yamaha command " << PADHEX(2) << +value);
} else {
LOG("Performing Yamaha command " << PADHEX(2) << +value);
}
// Seed timing information if a command was found.

View File

@ -182,7 +182,17 @@ template <Personality personality> struct Base: public Storage<personality> {
// Enables or disabled the recognition of the sprite
// list terminator, and sets the terminator value.
bool allow_sprite_terminator = true;
uint8_t sprite_terminator = 0xd0;
uint8_t sprite_terminator(ScreenMode mode) {
switch(mode) {
default: return 0xd0;
case ScreenMode::YamahaGraphics3:
case ScreenMode::YamahaGraphics4:
case ScreenMode::YamahaGraphics5:
case ScreenMode::YamahaGraphics6:
case ScreenMode::YamahaGraphics7:
return 0xd8;
}
}
} mode_timing_;
uint8_t line_interrupt_target_ = 0xff;
@ -357,9 +367,6 @@ template <Personality personality> struct Base: public Storage<personality> {
// has yet to pass.
if(queued_access_ == MemoryAccess::None || access_column < minimum_access_column_) {
if constexpr (is_yamaha_vdp(personality)) {
const uint8_t *const source = (Storage<personality>::command_context_.arguments & 0x10) ? Storage<personality>::expansion_ram_.data() : ram_.data();
uint8_t *const destination = (Storage<personality>::command_context_.arguments & 0x20) ? Storage<personality>::expansion_ram_.data() : ram_.data();
using CommandStep = typename Storage<personality>::CommandStep;
if(
@ -370,6 +377,8 @@ template <Personality personality> struct Base: public Storage<personality> {
}
auto &context = Storage<personality>::command_context_;
const uint8_t *const source = (context.arguments & 0x10) ? Storage<personality>::expansion_ram_.data() : ram_.data();
uint8_t *const destination = (context.arguments & 0x20) ? Storage<personality>::expansion_ram_.data() : ram_.data();
switch(Storage<personality>::next_command_step_) {
// Duplicative, but keeps the compiler happy.
case CommandStep::None: