1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-19 02:22:39 +00:00

Hack in low-resolution Mode 7.

This commit is contained in:
Thomas Harte
2025-09-24 22:25:43 -04:00
parent 7015e46227
commit b6e41ceea7
2 changed files with 34 additions and 13 deletions
+8 -8
View File
@@ -121,7 +121,7 @@ void SAA5050Serialiser::begin_frame() {
void SAA5050Serialiser::begin_line() {
++line_;
if(line_ == 20) {
if(line_ == 10) {
line_ = 0;
++row_;
}
@@ -151,13 +151,13 @@ void SAA5050Serialiser::add(const uint8_t c) {
}
// TODO: proper scaling!
const uint8_t source = font[c - 32][line_ >> 1];
const uint8_t source = font[c - 32][line_];
output_.pixels = uint16_t(
((source & 0x01) ? 0xb0000'0000'0011 : 0) |
((source & 0x02) ? 0xb0000'0000'1100 : 0) |
((source & 0x04) ? 0xb0000'0011'0000 : 0) |
((source & 0x08) ? 0xb0000'1100'0000 : 0) |
((source & 0x10) ? 0xb0011'0000'0000 : 0) |
((source & 0x20) ? 0xb1100'0000'0000 : 0)
((source & 0x01) ? 0b0000'0000'0011 : 0) |
((source & 0x02) ? 0b0000'0000'1100 : 0) |
((source & 0x04) ? 0b0000'0011'0000 : 0) |
((source & 0x08) ? 0b0000'1100'0000 : 0) |
((source & 0x10) ? 0b0011'0000'0000 : 0) |
((source & 0x20) ? 0b1100'0000'0000 : 0)
);
}
+26 -5
View File
@@ -17,8 +17,9 @@
#include "Components/6522/6522.hpp"
#include "Components/6845/CRTC6845.hpp"
#include "Components/SN76489/SN76489.hpp"
#include "Components/6850/6850.hpp"
#include "Components/SAA5050/SAA5050.hpp"
#include "Components/SN76489/SN76489.hpp"
#include "Components/uPD7002/uPD7002.hpp"
// TODO: factor this more appropriately.
@@ -361,6 +362,15 @@ public:
output_mode = OutputMode::Blank;
}
// Consider some SAA5050 signalling.
if(output_mode != previous_output_mode_) {
if(output_mode == OutputMode::Pixels) {
saa5050_serialiser_.begin_line();
} else if(output_mode == OutputMode::Sync && state.vsync) {
saa5050_serialiser_.begin_frame();
}
}
// If a transition between sync/border/pixels just occurred, flush whatever was
// in progress to the CRT and reset counting. Also flush if this mode has just been effective
// for a really long time, so as not to buffer too much.
@@ -416,11 +426,20 @@ public:
pixel_shifter_ = should_fetch ? ram_[address] : 0;
if(active_collation_.is_teletext) {
// TODO: output meaningful teletext pixels.
for(int c = 0; c < 12; c++) {
*pixel_pointer_++ = (pixel_shifter_ & 0x80 ? 0xff : 0x00) ^ cursor_mask_;
pixel_shifter_ <<= 1;
const auto output = saa5050_serialiser_.output();
uint16_t tshifter = output.pixels;
if(tshifter) {
printf("");
}
for(int c = 0; c < 12; c++) {
*pixel_pointer_++ = ((tshifter & 0b1000'0000'0000) ? output.alpha : output.background) ^ cursor_shifter_;
tshifter <<= 1;
}
saa5050_serialiser_.add(pixel_shifter_);
} else {
switch(crtc_clock_multiplier_ * active_collation_.pixels_per_clock) {
case 1: shift_pixels<1>(cursor_shifter_ & 7); break;
@@ -513,6 +532,8 @@ private:
const uint8_t *const ram_ = nullptr;
SystemVIA &system_via_;
Mullard::SAA5050Serialiser saa5050_serialiser_;
};
using CRTC = Motorola::CRTC::CRTC6845<
CRTCBusHandler,