1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 03:32:01 +00:00

Eliminate data_block_ entirely.

This commit is contained in:
Thomas Harte 2023-02-18 21:41:22 -05:00
parent d6e4f12fdc
commit 270c5dfe85
2 changed files with 10 additions and 14 deletions

View File

@ -503,13 +503,14 @@ template<ScreenMode mode> void Base<personality>::fetch_yamaha(LineBuffer &line_
case Type::Name: case Type::Name:
switch(mode) { switch(mode) {
case ScreenMode::Text: { case ScreenMode::Text: {
const auto column = AddressT(Storage<personality>::data_block_); const auto column = AddressT(Storage<personality>::next_event_->id << 1);
text_fetcher.fetch_name(column, 0); text_fetcher.fetch_name(column, 0);
text_fetcher.fetch_name(column + 1, 1); text_fetcher.fetch_name(column + 1, 1);
} break; } break;
case ScreenMode::YamahaText80: { case ScreenMode::YamahaText80: {
const auto column = AddressT(Storage<personality>::data_block_); const auto column = AddressT(Storage<personality>::next_event_->id << 2);
const auto start = pattern_name_address_ & bits<12>(AddressT((y >> 3) * 80)); const auto start = pattern_name_address_ & bits<12>(AddressT((y >> 3) * 80));
name_[0] = ram_[start + column + 0]; name_[0] = ram_[start + column + 0];
@ -532,7 +533,7 @@ template<ScreenMode mode> void Base<personality>::fetch_yamaha(LineBuffer &line_
case Type::Colour: case Type::Colour:
switch(mode) { switch(mode) {
case ScreenMode::YamahaText80: { case ScreenMode::YamahaText80: {
const auto column = AddressT(Storage<personality>::data_block_ >> 3); const auto column = AddressT(Storage<personality>::next_event_->id);
const auto address = colour_table_address_ & bits<9>(AddressT((y >> 3) * 10)); const auto address = colour_table_address_ & bits<9>(AddressT((y >> 3) * 10));
line_buffer.characters.flags[column] = ram_[address + column]; line_buffer.characters.flags[column] = ram_[address + column];
} break; } break;
@ -551,18 +552,16 @@ template<ScreenMode mode> void Base<personality>::fetch_yamaha(LineBuffer &line_
case Type::Pattern: case Type::Pattern:
switch(mode) { switch(mode) {
case ScreenMode::Text: { case ScreenMode::Text: {
const auto column = AddressT(Storage<personality>::data_block_); const auto column = AddressT(Storage<personality>::next_event_->id << 1);
Storage<personality>::data_block_ += 2;
text_fetcher.fetch_pattern(column, 0); text_fetcher.fetch_pattern(column, 0);
text_fetcher.fetch_pattern(column + 1, 1); text_fetcher.fetch_pattern(column + 1, 1);
} break; } break;
case ScreenMode::YamahaText80: { case ScreenMode::YamahaText80: {
const auto column = AddressT(Storage<personality>::data_block_); const auto column = Storage<personality>::next_event_->id << 2;
Storage<personality>::data_block_ += 4;
const auto start = pattern_generator_table_address_ & bits<11>(AddressT(y & 7)); const auto start = pattern_generator_table_address_ & bits<11>(AddressT(y & 7));
line_buffer.characters.shapes[column + 0] = ram_[start + AddressT(name_[0] << 3)]; line_buffer.characters.shapes[column + 0] = ram_[start + AddressT(name_[0] << 3)];
line_buffer.characters.shapes[column + 1] = ram_[start + AddressT(name_[1] << 3)]; line_buffer.characters.shapes[column + 1] = ram_[start + AddressT(name_[1] << 3)];
line_buffer.characters.shapes[column + 2] = ram_[start + AddressT(name_[2] << 3)]; line_buffer.characters.shapes[column + 2] = ram_[start + AddressT(name_[2] << 3)];

View File

@ -81,7 +81,6 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
// State that tracks fetching position within a line. // State that tracks fetching position within a line.
const Event *next_event_ = nullptr; const Event *next_event_ = nullptr;
int data_block_ = 0;
// Text blink colours. // Text blink colours.
uint8_t blink_text_colour_ = 0; uint8_t blink_text_colour_ = 0;
@ -97,8 +96,6 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
/// Resets line-ephemeral state for a new line. /// Resets line-ephemeral state for a new line.
void begin_line(ScreenMode mode, bool is_refresh) { void begin_line(ScreenMode mode, bool is_refresh) {
data_block_ = 0;
if(is_refresh) { if(is_refresh) {
next_event_ = refresh_events.data(); next_event_ = refresh_events.data();
return; return;
@ -383,9 +380,9 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
const int sub_block = offset % 48; const int sub_block = offset % 48;
switch(sub_block) { switch(sub_block) {
default: break; default: break;
case 0: return Event::Type::Name; case 0: return Event(Event::Type::Name, uint8_t(block));
case 18: return (block & 1) ? Event::Type::External : Event::Type::Colour; case 18: return (block & 1) ? Event::Type::External : Event(Event::Type::Colour, uint8_t(block >> 1));
case 24: return Event::Type::Pattern; case 24: return Event(Event::Type::Pattern, uint8_t(block));
} }
} }