mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-26 03:29:40 +00:00
Move all work [near] definitively into the SAA5050.
This commit is contained in:
@@ -110,13 +110,70 @@ constexpr uint8_t font[][10] = {
|
||||
{0x00, 0x00, 0x04, 0x00, 0x1f, 0x00, 0x04, 0x00, 0x00, 0x00, },
|
||||
{0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, },
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Old ElectrEm code for font smoothing:
|
||||
//
|
||||
// /* establish 12x20 smoothed versions */
|
||||
// int ct;
|
||||
// for(ct = 0; ct < 96; ct++)
|
||||
// {
|
||||
// for(c2 = 0; c2 < 10; c2++)
|
||||
// {
|
||||
// unsigned __int16 l, k;
|
||||
// unsigned __int8 c, d;
|
||||
//
|
||||
// c = CharSet[ct].Data[c2];
|
||||
// CharSet[ct].WideData[c2] =
|
||||
// k = l = ((c&0x20) ? 0x0c00 : 0x0000) |
|
||||
// ((c&0x10) ? 0x0300 : 0x0000) |
|
||||
// ((c&0x08) ? 0x00c0 : 0x0000) |
|
||||
// ((c&0x04) ? 0x0030 : 0x0000) |
|
||||
// ((c&0x02) ? 0x000c : 0x0000) |
|
||||
// ((c&0x01) ? 0x0003 : 0x0000);
|
||||
//
|
||||
// if(c2 != 9)
|
||||
// {
|
||||
// d = CharSet[ct].Data[c2+1];
|
||||
//
|
||||
// if ((c&0x10) && (d&0x08) && !(d&0x10)) l|=0x0080;
|
||||
// if ((c&0x08) && (d&0x04) && !(d&0x08)) l|=0x0020;
|
||||
// if ((c&0x04) && (d&0x02) && !(d&0x04)) l|=0x0008;
|
||||
// if ((c&0x02) && (d&0x01) && !(d&0x02)) l|=0x0002;
|
||||
// if ((d&0x10) && (c&0x08) && !(d&0x08)) l|=0x0100;
|
||||
// if ((d&0x08) && (c&0x04) && !(d&0x04)) l|=0x0040;
|
||||
// if ((d&0x04) && (c&0x02) && !(d&0x02)) l|=0x0010;
|
||||
// if ((d&0x02) && (c&0x01) && !(d&0x01)) l|=0x0004;
|
||||
// }
|
||||
//
|
||||
// if(c2)
|
||||
// {
|
||||
// d = CharSet[ct].Data[c2-1];
|
||||
//
|
||||
// if ((c&0x10) && (d&0x08) && !(d&0x10)) k|=0x0080;
|
||||
// if ((c&0x08) && (d&0x04) && !(d&0x08)) k|=0x0020;
|
||||
// if ((c&0x04) && (d&0x02) && !(d&0x04)) k|=0x0008;
|
||||
// if ((c&0x02) && (d&0x01) && !(d&0x02)) k|=0x0002;
|
||||
// if ((d&0x10) && (c&0x08) && !(d&0x08)) k|=0x0100;
|
||||
// if ((d&0x08) && (c&0x04) && !(d&0x04)) k|=0x0040;
|
||||
// if ((d&0x04) && (c&0x02) && !(d&0x02)) k|=0x0010;
|
||||
// if ((d&0x02) && (c&0x01) && !(d&0x01)) k|=0x0004;
|
||||
// }
|
||||
//
|
||||
// CharSet[ct].HighData[c2 << 1] = k;
|
||||
// CharSet[ct].HighData[(c2 << 1)+1] = l;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
using namespace Mullard;
|
||||
|
||||
void SAA5050Serialiser::begin_frame() {
|
||||
void SAA5050Serialiser::begin_frame(const bool is_odd) {
|
||||
line_ = -1;
|
||||
row_ = 0;
|
||||
odd_frame_ = is_odd;
|
||||
}
|
||||
|
||||
void SAA5050Serialiser::begin_line() {
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Mullard {
|
||||
|
||||
struct SAA5050Serialiser {
|
||||
public:
|
||||
void begin_frame();
|
||||
void begin_frame(bool is_odd);
|
||||
void begin_line();
|
||||
|
||||
void add(uint8_t);
|
||||
@@ -34,6 +34,7 @@ private:
|
||||
int row_, line_;
|
||||
Output output_;
|
||||
bool has_output_ = false;
|
||||
bool odd_frame_;
|
||||
|
||||
// TODO: more state. Graphics mode only, probably?
|
||||
};
|
||||
|
||||
@@ -356,7 +356,7 @@ public:
|
||||
output_mode = OutputMode::Sync;
|
||||
} else if(is_colour_burst) {
|
||||
output_mode = OutputMode::ColourBurst;
|
||||
} else if(should_fetch || cursor_shifter_) {
|
||||
} else if(should_fetch || cursor_shifter_ || (active_collation_.is_teletext && saa5050_serialiser_.has_output())) {
|
||||
output_mode = OutputMode::Pixels;
|
||||
} else {
|
||||
output_mode = OutputMode::Blank;
|
||||
@@ -367,7 +367,9 @@ public:
|
||||
if(output_mode == OutputMode::Pixels) {
|
||||
saa5050_serialiser_.begin_line();
|
||||
} else if(output_mode == OutputMode::Sync && state.vsync) {
|
||||
saa5050_serialiser_.begin_frame();
|
||||
// Complete fiction here; the SAA5050 field flag is set by peeking inside CRTC state.
|
||||
// TODO: what really sets CRS for the SAA5050?
|
||||
saa5050_serialiser_.begin_frame(state.field_count.bit<0>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,7 +418,6 @@ public:
|
||||
((state.refresh.get() & 0x800) << 3) |
|
||||
(state.refresh.get() & 0x3ff)
|
||||
);
|
||||
// TODO: wraparound? Does that happen on Mode 7?
|
||||
} else {
|
||||
address = uint16_t((state.refresh.get() << 3) | (state.line.get() & 7));
|
||||
if(address & 0x8000) {
|
||||
@@ -426,13 +427,18 @@ public:
|
||||
|
||||
pixel_shifter_ = should_fetch ? ram_[address] : 0;
|
||||
if(active_collation_.is_teletext) {
|
||||
const auto output = saa5050_serialiser_.output();
|
||||
if(saa5050_serialiser_.has_output()) {
|
||||
const auto output = saa5050_serialiser_.output();
|
||||
|
||||
uint16_t tshifter = output.pixels;
|
||||
for(int c = 0; c < 12; c++) {
|
||||
*pixel_pointer_++ =
|
||||
((tshifter & 0b1000'0000'0000) ? output.alpha : output.background) ^ cursor_shifter_;
|
||||
tshifter <<= 1;
|
||||
uint16_t tshifter = output.pixels;
|
||||
for(int c = 0; c < 12; c++) {
|
||||
*pixel_pointer_++ =
|
||||
((tshifter & 0b1000'0000'0000) ? output.alpha : output.background) ^ cursor_shifter_;
|
||||
tshifter <<= 1;
|
||||
}
|
||||
} else {
|
||||
std::fill(pixel_pointer_, pixel_pointer_ + 12, 0);
|
||||
pixel_pointer_ += 12;
|
||||
}
|
||||
|
||||
saa5050_serialiser_.add(pixel_shifter_);
|
||||
@@ -446,6 +452,8 @@ public:
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// TODO: continue to feed SAA5050.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user