1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-01 22:41:32 +00:00

Give sound and video somewhere to read from.

This commit is contained in:
Thomas Harte 2024-03-21 20:22:20 -04:00
parent 5c645fb3c2
commit 1f49c3b113
4 changed files with 13 additions and 7 deletions

View File

@ -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;

View File

@ -32,7 +32,7 @@ static_assert(BitMask<15, 14>::value == 49152);
template <typename InterruptObserverT>
struct MemoryController {
MemoryController(InterruptObserverT &observer) :
ioc_(observer) {}
ioc_(observer, ram_.data()) {}
int interrupt_mask() const {
return ioc_.interrupt_mask();

View File

@ -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 <typename InterruptObserverT>
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;

View File

@ -16,8 +16,8 @@ namespace Archimedes {
template <typename InterruptObserverT, typename SoundT>
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;