mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-15 12:08:33 +00:00
Make faulty attempt at 80-column text.
This commit is contained in:
parent
1edf747f9f
commit
bf0ed2813c
@ -330,10 +330,18 @@ void TMS9918<personality>::run_for(const HalfCycles cycles) {
|
||||
next_line_buffer.next_border_column = Timing<personality>::LastTextCycle;
|
||||
next_line_buffer.pixel_count = 240;
|
||||
break;
|
||||
case ScreenMode::YamahaText80:
|
||||
next_line_buffer.fetch_mode = FetchMode::Yamaha;
|
||||
next_line_buffer.first_pixel_output_column = Timing<personality>::FirstTextCycle;
|
||||
next_line_buffer.next_border_column = Timing<personality>::LastTextCycle;
|
||||
next_line_buffer.pixel_count = 480;
|
||||
break;
|
||||
|
||||
case ScreenMode::SMSMode4:
|
||||
next_line_buffer.fetch_mode = FetchMode::SMS;
|
||||
this->mode_timing_.maximum_visible_sprites = 8;
|
||||
break;
|
||||
|
||||
case ScreenMode::YamahaGraphics3:
|
||||
case ScreenMode::YamahaGraphics4:
|
||||
case ScreenMode::YamahaGraphics7:
|
||||
|
@ -314,6 +314,32 @@ void Base<personality>::draw_yamaha(LineBuffer &buffer, int start, int end) {
|
||||
return;
|
||||
}
|
||||
|
||||
if constexpr (mode == ScreenMode::YamahaText80) {
|
||||
const uint32_t primary_colours[2] = { palette()[background_colour_], palette()[text_colour_] };
|
||||
// const uint32_t inverse_colours[2] = { palette()[background_colour_], palette()[text_colour_] }; // TODO.
|
||||
|
||||
start >>= 1;
|
||||
end >>= 1;
|
||||
|
||||
const int shift = start % 6;
|
||||
int byte_column = start / 6;
|
||||
int pattern = Numeric::bit_reverse(buffer.patterns[byte_column >> 1][byte_column & 1]) >> shift;
|
||||
int pixels_left = end - start;
|
||||
int length = std::min(pixels_left, 6 - shift);
|
||||
while(true) {
|
||||
pixels_left -= length;
|
||||
for(int c = 0; c < length; ++c) {
|
||||
pixel_target_[c] = primary_colours[pattern&0x01]; // TODO.
|
||||
pattern >>= 1;
|
||||
}
|
||||
pixel_target_ += length;
|
||||
|
||||
if(!pixels_left) break;
|
||||
length = std::min(6, pixels_left);
|
||||
byte_column++;
|
||||
pattern = Numeric::bit_reverse(buffer.patterns[byte_column >> 1][byte_column & 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <Personality personality>
|
||||
@ -326,6 +352,7 @@ void Base<personality>::draw_yamaha(int start, int end) {
|
||||
// These modes look the same as on the TMS.
|
||||
case ScreenMode::Text: draw_tms_text(start >> 2, end >> 2); break;
|
||||
|
||||
Dispatch(YamahaText80);
|
||||
Dispatch(YamahaGraphics3);
|
||||
Dispatch(YamahaGraphics4);
|
||||
Dispatch(YamahaGraphics5);
|
||||
|
@ -493,7 +493,6 @@ template<ScreenMode mode> void Base<personality>::fetch_yamaha(LineBuffer &line_
|
||||
name_[1] = ram_[start + column + 1];
|
||||
name_[2] = ram_[start + column + 2];
|
||||
name_[3] = ram_[start + column + 3];
|
||||
// TODO: should 80-column mode use alternate page access?
|
||||
} break;
|
||||
|
||||
default: break;
|
||||
@ -523,12 +522,12 @@ template<ScreenMode mode> void Base<personality>::fetch_yamaha(LineBuffer &line_
|
||||
|
||||
case ScreenMode::YamahaText80: {
|
||||
const auto column = AddressT(Storage<personality>::data_block_);
|
||||
Storage<personality>::data_block_ += 4;
|
||||
Storage<personality>::data_block_ += 2;
|
||||
|
||||
const AddressT start = pattern_generator_table_address_ & (0x1f800 | (y & 7));
|
||||
line_buffer.patterns[column + 0][0] = ram_[start + AddressT(name_[0] << 3)];
|
||||
line_buffer.patterns[column + 1][0] = ram_[start + AddressT(name_[1] << 3)];
|
||||
line_buffer.patterns[column + 0][1] = ram_[start + AddressT(name_[2] << 3)];
|
||||
line_buffer.patterns[column + 0][1] = ram_[start + AddressT(name_[1] << 3)];
|
||||
line_buffer.patterns[column + 1][0] = ram_[start + AddressT(name_[2] << 3)];
|
||||
line_buffer.patterns[column + 1][1] = ram_[start + AddressT(name_[3] << 3)];
|
||||
} break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user