mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Eliminates 'reversed_c' as I no longer believe low-resolution colour numbers are reversed.
Also gets explicit about phase.
This commit is contained in:
parent
a26ab7086d
commit
8dd7c6ef23
@ -36,6 +36,7 @@ VideoBase::VideoBase() :
|
|||||||
// Show only the centre 75% of the TV frame.
|
// Show only the centre 75% of the TV frame.
|
||||||
crt_->set_video_signal(Outputs::CRT::VideoSignal::Composite);
|
crt_->set_video_signal(Outputs::CRT::VideoSignal::Composite);
|
||||||
crt_->set_visible_area(Outputs::CRT::Rect(0.115f, 0.117f, 0.77f, 0.77f));
|
crt_->set_visible_area(Outputs::CRT::Rect(0.115f, 0.117f, 0.77f, 0.77f));
|
||||||
|
crt_->set_immediate_default_phase(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
Outputs::CRT::CRT *VideoBase::get_crt() {
|
Outputs::CRT::CRT *VideoBase::get_crt() {
|
||||||
@ -46,6 +47,12 @@ uint16_t VideoBase::scaled_byte[256];
|
|||||||
uint16_t VideoBase::low_resolution_patterns[2][16];
|
uint16_t VideoBase::low_resolution_patterns[2][16];
|
||||||
|
|
||||||
void VideoBase::setup_tables() {
|
void VideoBase::setup_tables() {
|
||||||
|
// Rules of Apple II high resolution video:
|
||||||
|
//
|
||||||
|
// Bit 0 appears on screen first. Then bit 1. Etc to bit 6.
|
||||||
|
//
|
||||||
|
// If bit 7 is set, the whole serialisation is delayed for half a pixel, holding
|
||||||
|
// whichever level was previously being output.
|
||||||
for(int c = 0; c < 128; ++c) {
|
for(int c = 0; c < 128; ++c) {
|
||||||
const uint16_t value =
|
const uint16_t value =
|
||||||
((c & 0x01) ? 0x0003 : 0x0000) |
|
((c & 0x01) ? 0x0003 : 0x0000) |
|
||||||
@ -70,17 +77,16 @@ void VideoBase::setup_tables() {
|
|||||||
|
|
||||||
for(int c = 0; c < 16; ++c) {
|
for(int c = 0; c < 16; ++c) {
|
||||||
// Produce the whole 28-bit pattern that would cover two columns.
|
// Produce the whole 28-bit pattern that would cover two columns.
|
||||||
const int reversed_c = ((c&0x1) ? 0x8 : 0x0) | ((c&0x2) ? 0x4 : 0x0) | ((c&0x4) ? 0x2 : 0x0) | ((c&0x8) ? 0x1 : 0x0);
|
|
||||||
int pattern = 0;
|
int pattern = 0;
|
||||||
for(int l = 0; l < 7; ++l) {
|
for(int l = 0; l < 7; ++l) {
|
||||||
pattern <<= 4;
|
pattern <<= 4;
|
||||||
pattern |= reversed_c;
|
pattern |= c;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pack that 28-bit pattern into the appropriate look-up tables.
|
// Pack that 28-bit pattern into the appropriate look-up tables.
|
||||||
uint8_t *const left_entry = reinterpret_cast<uint8_t *>(&low_resolution_patterns[0][c]);
|
uint8_t *const left_entry = reinterpret_cast<uint8_t *>(&low_resolution_patterns[0][c]);
|
||||||
uint8_t *const right_entry = reinterpret_cast<uint8_t *>(&low_resolution_patterns[1][c]);
|
uint8_t *const right_entry = reinterpret_cast<uint8_t *>(&low_resolution_patterns[1][c]);
|
||||||
left_entry[0] = static_cast<uint8_t>(pattern);;
|
left_entry[0] = static_cast<uint8_t>(pattern);
|
||||||
left_entry[1] = static_cast<uint8_t>(pattern >> 7);
|
left_entry[1] = static_cast<uint8_t>(pattern >> 7);
|
||||||
right_entry[0] = static_cast<uint8_t>(pattern >> 14);
|
right_entry[0] = static_cast<uint8_t>(pattern >> 14);
|
||||||
right_entry[1] = static_cast<uint8_t>(pattern >> 21);
|
right_entry[1] = static_cast<uint8_t>(pattern >> 21);
|
||||||
|
@ -144,15 +144,15 @@ template <class BusHandler> class Video: public VideoBase {
|
|||||||
const uint8_t graphic = bus_handler_.perform_read(static_cast<uint16_t>(graphics_address + c));
|
const uint8_t graphic = bus_handler_.perform_read(static_cast<uint16_t>(graphics_address + c));
|
||||||
pixel_pointer_[c] = scaled_byte[graphic];
|
pixel_pointer_[c] = scaled_byte[graphic];
|
||||||
if(graphic & 0x80) {
|
if(graphic & 0x80) {
|
||||||
reinterpret_cast<uint8_t *>(&pixel_pointer_[c])[0] |= graphics_carry_;
|
reinterpret_cast<uint8_t *>(&pixel_pointer_[c])[0] |= (graphics_carry_&1);
|
||||||
}
|
}
|
||||||
graphics_carry_ = (graphic >> 6) & 1;
|
graphics_carry_ = graphic >> 6;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ending_column >= 40) {
|
if(ending_column >= 40) {
|
||||||
crt_->output_data(280, 80);
|
output_data(80);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(ending_column >= 40) {
|
if(ending_column >= 40) {
|
||||||
@ -261,6 +261,9 @@ template <class BusHandler> class Video: public VideoBase {
|
|||||||
|
|
||||||
const int flash_length = 8406;
|
const int flash_length = 8406;
|
||||||
BusHandler &bus_handler_;
|
BusHandler &bus_handler_;
|
||||||
|
void output_data(unsigned int length) {
|
||||||
|
crt_->output_data((length*7)/2, length);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user