From 4ac4da908c78dc4275648e57ed0f157b17331b55 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 21 Mar 2024 21:40:11 -0400 Subject: [PATCH] Reduce TODOs, do _something_ with border colour. --- Machines/Acorn/Archimedes/Video.hpp | 93 +++++++++-------------------- 1 file changed, 28 insertions(+), 65 deletions(-) diff --git a/Machines/Acorn/Archimedes/Video.hpp b/Machines/Acorn/Archimedes/Video.hpp index 890fbdbff..6e2abd1d5 100644 --- a/Machines/Acorn/Archimedes/Video.hpp +++ b/Machines/Acorn/Archimedes/Video.hpp @@ -22,7 +22,10 @@ struct Video { sound_(sound), ram_(ram), crt_(Outputs::Display::InputDataType::Red4Green4Blue4) { - set_clock_divider(2); + set_clock_divider(3); + + // Limit to a subset of the PAL area. + crt_.set_visible_area(Outputs::Display::Rect(0.1f, 0.07f, 0.9f, 0.9f)); } void write(uint32_t value) { @@ -30,6 +33,10 @@ struct Video { const auto timing_value = [](uint32_t value) -> uint32_t { return (value >> 14) & 0x3ff; }; + const auto colour = [](uint32_t value) -> uint16_t { + // TODO: convert to internal format. + return static_cast(value & 0x1fff); + }; switch(target) { case 0x00: case 0x04: case 0x08: case 0x0c: @@ -39,78 +46,31 @@ struct Video { logger.error().append("TODO: Video palette logical colour %d to %03x", (target >> 2), value & 0x1fff); break; - case 0x40: - logger.error().append("TODO: Video border colour to %03x", value & 0x1fff); - break; + case 0x40: border_colour_ = colour(value); break; case 0x44: case 0x48: case 0x4c: logger.error().append("TODO: Cursor colour %d to %03x", (target - 0x44) >> 2, value & 0x1fff); break; - case 0x80: - logger.error().append("TODO: Video horizontal period: %d", (value >> 14) & 0x3ff); - horizontal_timing_.period = timing_value(value); - break; - case 0x84: - logger.error().append("TODO: Video horizontal sync width: %d", (value >> 14) & 0x3ff); - horizontal_timing_.sync_width = timing_value(value); - break; - case 0x88: - logger.error().append("TODO: Video horizontal border start: %d", (value >> 14) & 0x3ff); - horizontal_timing_.border_start = timing_value(value); - break; - case 0x8c: - logger.error().append("TODO: Video horizontal display start: %d", (value >> 14) & 0x3ff); - horizontal_timing_.display_start = timing_value(value); - break; - case 0x90: - logger.error().append("TODO: Video horizontal display end: %d", (value >> 14) & 0x3ff); - horizontal_timing_.display_end = timing_value(value); - break; - case 0x94: - logger.error().append("TODO: Video horizontal border end: %d", (value >> 14) & 0x3ff); - horizontal_timing_.border_end = timing_value(value); - break; - case 0x98: - logger.error().append("TODO: Video horizontal cursor end: %d", (value >> 14) & 0x3ff); - horizontal_timing_.cursor_end = timing_value(value); - break; + case 0x80: horizontal_timing_.period = timing_value(value); break; + case 0x84: horizontal_timing_.sync_width = timing_value(value); break; + case 0x88: horizontal_timing_.border_start = timing_value(value); break; + case 0x8c: horizontal_timing_.display_start = timing_value(value); break; + case 0x90: horizontal_timing_.display_end = timing_value(value); break; + case 0x94: horizontal_timing_.border_end = timing_value(value); break; + case 0x98: horizontal_timing_.cursor_end = timing_value(value); break; case 0x9c: logger.error().append("TODO: Video horizontal interlace: %d", (value >> 14) & 0x3ff); break; - case 0xa0: - logger.error().append("TODO: Video vertical period: %d", (value >> 14) & 0x3ff); - vertical_timing_.period = timing_value(value); - break; - case 0xa4: - logger.error().append("TODO: Video vertical sync width: %d", (value >> 14) & 0x3ff); - vertical_timing_.sync_width = timing_value(value); - break; - case 0xa8: - logger.error().append("TODO: Video vertical border start: %d", (value >> 14) & 0x3ff); - vertical_timing_.border_start = timing_value(value); - break; - case 0xac: - logger.error().append("TODO: Video vertical display start: %d", (value >> 14) & 0x3ff); - vertical_timing_.display_start = timing_value(value); - break; - case 0xb0: - logger.error().append("TODO: Video vertical display end: %d", (value >> 14) & 0x3ff); - vertical_timing_.display_end = timing_value(value); - break; - case 0xb4: - logger.error().append("TODO: Video vertical border end: %d", (value >> 14) & 0x3ff); - vertical_timing_.border_end = timing_value(value); - break; - case 0xb8: - logger.error().append("TODO: Video vertical cursor start: %d", (value >> 14) & 0x3ff); - vertical_timing_.cursor_start = timing_value(value); - break; - case 0xbc: - logger.error().append("TODO: Video vertical cursor end: %d", (value >> 14) & 0x3ff); - vertical_timing_.cursor_end = timing_value(value); - break; + case 0xa0: vertical_timing_.period = timing_value(value); break; + case 0xa4: vertical_timing_.sync_width = timing_value(value); break; + case 0xa8: vertical_timing_.border_start = timing_value(value); break; + case 0xac: vertical_timing_.display_start = timing_value(value); break; + case 0xb0: vertical_timing_.display_end = timing_value(value); break; + case 0xb4: vertical_timing_.border_end = timing_value(value); break; + case 0xb8: vertical_timing_.cursor_start = timing_value(value); break; + case 0xbc: vertical_timing_.cursor_end = timing_value(value); break; case 0xe0: logger.error().append("TODO: video control: %08x", value); @@ -193,7 +153,7 @@ struct Video { crt_.output_level(duration, 0xf888); break; case Phase::Border: - crt_.output_level(duration, 0xffff); + crt_.output_level(duration, border_colour_); break; } @@ -274,6 +234,9 @@ private: }; Timing horizontal_timing_, vertical_timing_; + // Colour palette, converted to internal format. + uint16_t border_colour_; + // An interrupt flag; more closely related to the interface by which // my implementation of the IOC picks up an interrupt request than // to hardware.