mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-12 15:31:09 +00:00
Make a first attempt to spool into RAM.
This commit is contained in:
parent
b47ca13ed3
commit
d6e2a3f425
@ -905,8 +905,23 @@ void Chipset::Sprite::set_image_data(int slot, uint16_t value) {
|
||||
// MARK: - Disk.
|
||||
|
||||
void Chipset::DiskDMA::enqueue(uint16_t value, bool matches_sync) {
|
||||
(void)value;
|
||||
// TODO: handle matches_sync.
|
||||
(void)matches_sync;
|
||||
|
||||
buffer_[buffer_write_ & 3] = value;
|
||||
if(buffer_write_ == buffer_read_ + 4) ++buffer_read_;
|
||||
++buffer_write_;
|
||||
}
|
||||
|
||||
void Chipset::DiskDMA::set_length(uint16_t value) {
|
||||
dma_enable_ = value & 0x8000;
|
||||
write_ = value & 0x4000;
|
||||
length_ = value & 0x3fff;
|
||||
buffer_read_ = buffer_write_ = 0;
|
||||
|
||||
if(dma_enable_) {
|
||||
printf("Disk DMA [%s of %d to %06x]\n", write_ ? "write" : "read", length_, pointer_[0]);
|
||||
}
|
||||
}
|
||||
|
||||
bool Chipset::DiskDMA::advance() {
|
||||
@ -914,10 +929,11 @@ bool Chipset::DiskDMA::advance() {
|
||||
|
||||
if(!write_) {
|
||||
// TODO: run an actual PLL, collect actual disk data.
|
||||
if(length_) {
|
||||
ram_[pointer_[0] & ram_mask_] = 0xffff;
|
||||
if(length_ && buffer_read_ != buffer_write_) {
|
||||
ram_[pointer_[0] & ram_mask_] = buffer_[buffer_read_ & 3];
|
||||
++pointer_[0];
|
||||
--length_;
|
||||
++buffer_read_;
|
||||
|
||||
if(!length_) {
|
||||
chipset_.posit_interrupt(InterruptFlag::DiskBlock);
|
||||
|
@ -9,6 +9,7 @@
|
||||
#ifndef Chipset_hpp
|
||||
#define Chipset_hpp
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
@ -228,16 +229,7 @@ class Chipset: private ClockingHint::Observer {
|
||||
public:
|
||||
using DMADevice::DMADevice;
|
||||
|
||||
void set_length(uint16_t value) {
|
||||
dma_enable_ = value & 0x8000;
|
||||
write_ = value & 0x4000;
|
||||
length_ = value & 0x3fff;
|
||||
|
||||
if(dma_enable_) {
|
||||
printf("Not yet implemented: disk DMA [%s of %d to %06x]\n", write_ ? "write" : "read", length_, pointer_[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void set_length(uint16_t value);
|
||||
bool advance();
|
||||
|
||||
void enqueue(uint16_t value, bool matches_sync);
|
||||
@ -246,6 +238,9 @@ class Chipset: private ClockingHint::Observer {
|
||||
uint16_t length_;
|
||||
bool dma_enable_ = false;
|
||||
bool write_ = false;
|
||||
|
||||
std::array<uint16_t, 4> buffer_;
|
||||
size_t buffer_read_ = 0, buffer_write_ = 0;
|
||||
} disk_;
|
||||
|
||||
class DiskController: public Storage::Disk::Controller {
|
||||
|
Loading…
x
Reference in New Issue
Block a user