1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Switches back to hsync for interrupts; corrects current address reads.

This commit is contained in:
Thomas Harte 2019-11-08 21:25:28 -05:00
parent 6902251d8b
commit 7caef46c05
3 changed files with 17 additions and 17 deletions

View File

@ -505,7 +505,7 @@ class ConcreteMachine:
mc68000_.set_interrupt_level(6); mc68000_.set_interrupt_level(6);
} else if(video_->vsync()) { } else if(video_->vsync()) {
mc68000_.set_interrupt_level(4); mc68000_.set_interrupt_level(4);
} else if(video_->hblank()) { } else if(video_->hsync()) {
mc68000_.set_interrupt_level(2); mc68000_.set_interrupt_level(2);
} else { } else {
mc68000_.set_interrupt_level(0); mc68000_.set_interrupt_level(0);

View File

@ -338,8 +338,8 @@ void Video::output_border(int duration) {
crt_.output_level(duration); crt_.output_level(duration);
} }
bool Video::hblank() { bool Video::hsync() {
return horizontal_.blank; return horizontal_.sync;
} }
bool Video::vsync() { bool Video::vsync() {
@ -356,32 +356,32 @@ HalfCycles Video::get_next_sequence_point() {
// Sequence of events within a line: // Sequence of events within a line:
// //
// 1) blank disabled; // 1) blank disabled;
// 2) de enabled; // 2) display enabled;
// 3) de disabled; // 3) display disabled;
// 4) blank enabled; // 4) blank enabled;
// 5) end-of-line, potential vertical event. // 5) sync enabled;
// 6) sync disabled;
// 7) end-of-line, potential vertical event.
const auto horizontal_timings = horizontal_parameters(field_frequency_); const auto horizontal_timings = horizontal_parameters(field_frequency_);
// Test for end of blank.
if(x < horizontal_timings.reset_blank) return HalfCycles(horizontal_timings.reset_blank - x);
// If this is a vertically-enabled line, check for the display enable boundaries. // If this is a vertically-enabled line, check for the display enable boundaries.
if(vertical_.enable) { if(vertical_.enable) {
if(x < horizontal_timings.set_enable) return HalfCycles(horizontal_timings.set_enable - x); if(x < horizontal_timings.set_enable) return HalfCycles(horizontal_timings.set_enable - x);
if(x < horizontal_timings.reset_enable) return HalfCycles(horizontal_timings.reset_enable - x); if(x < horizontal_timings.reset_enable) return HalfCycles(horizontal_timings.reset_enable - x);
} }
// Test for beginning of blank. // Test for beginning and end of sync.
if(x < horizontal_timings.set_blank) return HalfCycles(horizontal_timings.set_blank - x); if(x < line_length_ - 50) return HalfCycles(line_length_ - 50 - x);
if(x < line_length_ - 10) return HalfCycles(line_length_ - 10 - x);
// Okay, then, it depends on the next line. If the next line is the start or end of vertical sync, // Okay, then, it depends on the next line. If the next line is the start or end of vertical sync,
// it's that. // it's that.
const auto vertical_timings = horizontal_parameters(field_frequency_); const auto vertical_timings = horizontal_parameters(field_frequency_);
if(y+1 == vertical_timings.length || y+1 == 3) return HalfCycles(line_length_ - x); if(y+1 == vertical_timings.length || y+1 == 3) return HalfCycles(line_length_ - x);
// It wasn't any of those, so it's blank disabled on the next line. // It wasn't any of those, so it's display enabled on the next line.
return HalfCycles(line_length_ + horizontal_timings.reset_blank - x); return HalfCycles(line_length_ + horizontal_timings.set_enable - x);
} }
// MARK: - IO dispatch // MARK: - IO dispatch
@ -394,9 +394,9 @@ uint16_t Video::read(int address) {
break; break;
case 0x00: return uint16_t(0xff00 | (base_address_ >> 16)); case 0x00: return uint16_t(0xff00 | (base_address_ >> 16));
case 0x01: return uint16_t(0xff00 | (base_address_ >> 8)); case 0x01: return uint16_t(0xff00 | (base_address_ >> 8));
case 0x02: return uint16_t(0xff00 | (current_address_ >> 15)); case 0x02: return uint16_t(0xff00 | (current_address_ >> 15)); // Current address is kept in word precision internally;
case 0x03: return uint16_t(0xff00 | (current_address_ >> 7)); case 0x03: return uint16_t(0xff00 | (current_address_ >> 7)); // the shifts here represent a conversion back to
case 0x04: return uint16_t(0xff00 | (current_address_ << 1)); case 0x04: return uint16_t(0xff00 | (current_address_ << 1)); // byte precision.
case 0x05: return sync_mode_ | 0xfcff; case 0x05: return sync_mode_ | 0xfcff;
case 0x30: return video_mode_ | 0xfcff; case 0x30: return video_mode_ | 0xfcff;

View File

@ -39,7 +39,7 @@ class Video {
*/ */
HalfCycles get_next_sequence_point(); HalfCycles get_next_sequence_point();
bool hblank(); bool hsync();
bool vsync(); bool vsync();
bool display_enabled(); bool display_enabled();