mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-04 14:30:19 +00:00
Expand Yamaha graphics mode recognition.
This commit is contained in:
parent
d1f929e6f7
commit
cefcc1d443
@ -285,7 +285,16 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
||||
next_line_buffer.line_mode = LineMode::SMS;
|
||||
this->mode_timing_.maximum_visible_sprites = 8;
|
||||
break;
|
||||
case ScreenMode::YamahaGraphics3:
|
||||
case ScreenMode::YamahaGraphics4:
|
||||
case ScreenMode::YamahaGraphics5:
|
||||
case ScreenMode::YamahaGraphics6:
|
||||
case ScreenMode::YamahaGraphics7:
|
||||
// TODO: actual line modes.
|
||||
next_line_buffer.line_mode = LineMode::Refresh;
|
||||
break;
|
||||
default:
|
||||
// This covers both MultiColour and Graphics modes.
|
||||
next_line_buffer.line_mode = LineMode::Character;
|
||||
break;
|
||||
}
|
||||
@ -431,6 +440,8 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
||||
case LineMode::Character: draw(draw_tms_character(relative_start, relative_end), Clock::TMSPixel); break;
|
||||
case LineMode::Text: draw(draw_tms_text(relative_start, relative_end), Clock::TMSPixel); break;
|
||||
|
||||
// TODO: Yamaha line modes.
|
||||
|
||||
case LineMode::Refresh: break; /* Dealt with elsewhere. */
|
||||
}
|
||||
}
|
||||
@ -653,6 +664,11 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
|
||||
default: break;
|
||||
|
||||
case 0:
|
||||
Storage<personality>::mode_ = uint8_t(
|
||||
(Storage<personality>::mode_ & 3) |
|
||||
((value & 0xe) << 1)
|
||||
);
|
||||
|
||||
LOG("TODO: Yamaha additional mode selection; " << PADHEX(2) << +value);
|
||||
// b1–b3: M3–M5
|
||||
// b4: enable horizontal retrace interrupt
|
||||
@ -660,6 +676,14 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
|
||||
// b6: set colour bus to input or output mode
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Storage<personality>::mode_ = uint8_t(
|
||||
(Storage<personality>::mode_ & 0x1c) |
|
||||
((value & 0x10) >> 4) |
|
||||
((value & 0x08) >> 2)
|
||||
);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
LOG("TODO: Yamaha VRAM organisation, sprite disable, etc; " << PADHEX(2) << +value);
|
||||
// b7: "1 = input on colour bus, enable mouse; 1 = output on colour bus, disable mouse" [documentation clearly in error]
|
||||
|
@ -30,12 +30,27 @@ namespace TMS {
|
||||
// The screen mode is a necessary predecessor to picking the line mode,
|
||||
// which is the thing latched per line.
|
||||
enum class ScreenMode {
|
||||
// Original TMS modes.
|
||||
Blank,
|
||||
Text,
|
||||
MultiColour,
|
||||
ColouredText,
|
||||
Graphics,
|
||||
SMSMode4
|
||||
|
||||
// 8-bit Sega modes.
|
||||
SMSMode4,
|
||||
|
||||
// New Yamaha V9938 modes.
|
||||
YamahaText80,
|
||||
YamahaGraphics3,
|
||||
YamahaGraphics4,
|
||||
YamahaGraphics5,
|
||||
YamahaGraphics6,
|
||||
YamahaGraphics7,
|
||||
|
||||
// Rebranded Yamaha V9938 modes.
|
||||
YamahaGraphics1 = ColouredText,
|
||||
YamahaGraphics2 = Graphics,
|
||||
};
|
||||
|
||||
enum class LineMode {
|
||||
@ -135,6 +150,8 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
|
||||
uint32_t palette_[16]{};
|
||||
uint8_t new_colour_ = 0;
|
||||
uint8_t palette_entry_ = 0;
|
||||
|
||||
uint8_t mode_ = 0;
|
||||
};
|
||||
|
||||
// Master System-specific storage.
|
||||
@ -336,6 +353,21 @@ template <Personality personality> struct Base: public Storage<personality> {
|
||||
}
|
||||
}
|
||||
|
||||
if constexpr (is_yamaha_vdp(personality)) {
|
||||
switch(Storage<personality>::mode_) {
|
||||
case 0b00001: return ScreenMode::Text;
|
||||
case 0b01001: return ScreenMode::YamahaText80;
|
||||
case 0b00010: return ScreenMode::MultiColour;
|
||||
case 0b00000: return ScreenMode::YamahaGraphics1;
|
||||
case 0b00100: return ScreenMode::YamahaGraphics2;
|
||||
case 0b01000: return ScreenMode::YamahaGraphics3;
|
||||
case 0b01100: return ScreenMode::YamahaGraphics4;
|
||||
case 0b10000: return ScreenMode::YamahaGraphics5;
|
||||
case 0b10100: return ScreenMode::YamahaGraphics6;
|
||||
case 0b11100: return ScreenMode::YamahaGraphics7;
|
||||
}
|
||||
}
|
||||
|
||||
if(!mode1_enable_ && !mode2_enable_ && !mode3_enable_) {
|
||||
return ScreenMode::ColouredText;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user