diff --git a/Machines/Acorn/Archimedes/InputOutputController.hpp b/Machines/Acorn/Archimedes/InputOutputController.hpp index a60713c87..5be53b863 100644 --- a/Machines/Acorn/Archimedes/InputOutputController.hpp +++ b/Machines/Acorn/Archimedes/InputOutputController.hpp @@ -314,11 +314,11 @@ struct InputOutputController { return true; } - InputOutputController(InterruptObserverT &observer) : + InputOutputController(InterruptObserverT &observer, const uint8_t *ram) : observer_(observer), keyboard_(serial_), - sound_(*this), - video_(*this, sound_) + sound_(*this, ram), + video_(*this, sound_, ram) { irq_a_.status = IRQA::SetAlways | IRQA::PowerOnReset; irq_b_.status = 0x00; diff --git a/Machines/Acorn/Archimedes/MemoryController.hpp b/Machines/Acorn/Archimedes/MemoryController.hpp index d087e8d83..926878e97 100644 --- a/Machines/Acorn/Archimedes/MemoryController.hpp +++ b/Machines/Acorn/Archimedes/MemoryController.hpp @@ -32,7 +32,7 @@ static_assert(BitMask<15, 14>::value == 49152); template struct MemoryController { MemoryController(InterruptObserverT &observer) : - ioc_(observer) {} + ioc_(observer, ram_.data()) {} int interrupt_mask() const { return ioc_.interrupt_mask(); diff --git a/Machines/Acorn/Archimedes/Sound.hpp b/Machines/Acorn/Archimedes/Sound.hpp index 9d1e5f20e..501e0ff7e 100644 --- a/Machines/Acorn/Archimedes/Sound.hpp +++ b/Machines/Acorn/Archimedes/Sound.hpp @@ -15,7 +15,7 @@ namespace Archimedes { /// Models the Archimedes sound output; in a real machine this is a joint efort between the VIDC and the MEMC. template struct Sound { - Sound(InterruptObserverT &observer) : observer_(observer) {} + Sound(InterruptObserverT &observer, const uint8_t *ram) : ram_(ram), observer_(observer) {} void set_next_end(uint32_t value) { next_.end = value; @@ -83,6 +83,8 @@ struct Sound { } private: + const uint8_t *ram_ = nullptr; + uint8_t divider_ = 0, reload_ = 0; int byte_ = 0; diff --git a/Machines/Acorn/Archimedes/Video.hpp b/Machines/Acorn/Archimedes/Video.hpp index 96b670141..42acc49ed 100644 --- a/Machines/Acorn/Archimedes/Video.hpp +++ b/Machines/Acorn/Archimedes/Video.hpp @@ -16,8 +16,8 @@ namespace Archimedes { template struct Video { - Video(InterruptObserverT &observer, SoundT &sound) : - observer_(observer), sound_(sound) {} + Video(InterruptObserverT &observer, SoundT &sound, const uint8_t *ram) : + observer_(observer), sound_(sound), ram_(ram) {} void write(uint32_t value) { const auto target = (value >> 24) & 0xfc; @@ -166,6 +166,10 @@ private: InterruptObserverT &observer_; SoundT &sound_; + // In the current version of this code, video DMA occurrs costlessly, + // being deferred to the component itself. + const uint8_t *ram_ = nullptr; + // TODO: real video output. uint32_t position_ = 0;