1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Adds support for the alternate video buffer.

This commit is contained in:
Thomas Harte 2019-05-05 23:05:24 -04:00
parent cefc3af08b
commit 4f5a38b5c5
3 changed files with 21 additions and 12 deletions

View File

@ -189,6 +189,10 @@ class ConcreteMachine:
ROM_is_overlay_ = rom_is_overlay;
}
void set_use_alternate_screen_buffer(bool use_alternate_screen_buffer) {
video_.set_use_alternate_screen_buffer(use_alternate_screen_buffer);
}
private:
class VIAPortHandler: public MOS::MOS6522::PortHandler {
public:
@ -213,8 +217,9 @@ class ConcreteMachine:
b3: 0 = use alternate sound buffer, 1 = use ordinary sound buffer
b2b0: audio output volume
*/
printf(" w A: %02x", value);
printf("6522 A: %02x\n", value);
machine_.set_rom_is_overlay(!!(value & 0x10));
machine_.set_use_alternate_screen_buffer(!(value & 0x40));
break;
case Port::B:
@ -229,7 +234,7 @@ class ConcreteMachine:
b1: clock's data-clock line
b0: clock's serial data line
*/
printf(" w B: %02x", value);
printf("6522 B: %02x\n", value);
break;
}
}
@ -237,18 +242,17 @@ class ConcreteMachine:
uint8_t get_port_input(Port port) {
switch(port) {
case Port::A:
printf(" r A");
break;
printf("6522 r A\n");
return 0xff;
case Port::B:
printf(" r B");
break;
printf("6522 r B\n");
return 0x00;
}
return 0xff;
}
void set_control_line_output(Port port, Line line, bool value) {
printf(" l %c%d: %c", port ? 'B' : 'A', int(line), value ? 't' : 'f');
printf("6522 line %c%d: %c\n", port ? 'B' : 'A', int(line), value ? 't' : 'f');
}
private:

View File

@ -137,11 +137,14 @@ void Video::run_for(HalfCycles duration) {
frame_position_ = frame_position_ + cycles_left_in_line;
if(frame_position_ == frame_length) {
frame_position_ = HalfCycles(0);
video_address_ = 0x1a700 >> 1;
/*
Video: $1A700 and the alternate buffer starts at $12700; for a 512K Macintosh, add $60000 to these numbers.
*/
video_address_ = use_alternate_screen_buffer_ ? (0x12700 >> 1) : (0x1a700 >> 1);
}
}
}
/*
Video: $1A700 and the alternate buffer starts at $12700; for a 512K Macintosh, add $60000 to these numbers.
*/
void Video::set_use_alternate_screen_buffer(bool use_alternate_screen_buffer) {
use_alternate_screen_buffer_ = use_alternate_screen_buffer;
}

View File

@ -20,6 +20,7 @@ class Video {
Video(uint16_t *ram);
void set_scan_target(Outputs::Display::ScanTarget *scan_target);
void run_for(HalfCycles duration);
void set_use_alternate_screen_buffer(bool use_alternate_screen_buffer);
// TODO: feedback on blanks and syncs.
@ -30,6 +31,7 @@ class Video {
size_t video_address_;
uint16_t *ram_;
uint8_t *pixel_buffer_;
bool use_alternate_screen_buffer_ = false;
};
}