mirror of
https://github.com/TomHarte/CLK.git
synced 2025-11-23 05:19:20 +00:00
Make other layout edits.
This commit is contained in:
@@ -14,6 +14,10 @@
|
|||||||
|
|
||||||
namespace Acorn::Tube {
|
namespace Acorn::Tube {
|
||||||
|
|
||||||
|
// TODO: the handling of the 'ROM' below seems to match what I'm reading but doesn't make a lot
|
||||||
|
// of sense to me; it is copied into RAM (by whom?) and then copied in again upon every reset
|
||||||
|
// (again: by whom?).
|
||||||
|
|
||||||
template <typename ULAT>
|
template <typename ULAT>
|
||||||
struct Tube6502 {
|
struct Tube6502 {
|
||||||
public:
|
public:
|
||||||
@@ -33,10 +37,8 @@ public:
|
|||||||
const uint8_t result = ula_.parasite_read(address);
|
const uint8_t result = ula_.parasite_read(address);
|
||||||
value = result;
|
value = result;
|
||||||
update_interrupts();
|
update_interrupts();
|
||||||
// printf("Parasite read %04x of %02x\n", +address, result);
|
|
||||||
} else {
|
} else {
|
||||||
ula_.parasite_write(address, value);
|
ula_.parasite_write(address, value);
|
||||||
// printf("Parasite write %04x of %02x\n", +address, +value);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if constexpr (is_read(operation)) {
|
if constexpr (is_read(operation)) {
|
||||||
@@ -48,9 +50,8 @@ public:
|
|||||||
return Cycles(1);
|
return Cycles(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_rom(const std::vector<uint8_t> &source) {
|
void set_rom(std::vector<uint8_t> source) {
|
||||||
// TODO: verify the ROM is 2kb.
|
source.resize(sizeof(rom_));
|
||||||
// TODO: determine whether this really is ROM, or is ROM that should have copied itself to RAM, or is something else.
|
|
||||||
std::copy(source.begin(), source.end(), rom_);
|
std::copy(source.begin(), source.end(), rom_);
|
||||||
reinstall_rom();
|
reinstall_rom();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,38 +29,23 @@ struct ULA {
|
|||||||
to_host4_(*this, 0x01)
|
to_host4_(*this, 0x01)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
uint8_t status() const {
|
/// @returns @c true if the parasite's reset line should be active.
|
||||||
return flags_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void set_status(const uint8_t value) {
|
|
||||||
const uint8_t bits = value & 0x3f;
|
|
||||||
if(value & 0x80) {
|
|
||||||
flags_ |= bits;
|
|
||||||
} else {
|
|
||||||
flags_ &= ~bits;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool parasite_reset() const {
|
bool parasite_reset() const {
|
||||||
return !(flags_ & 0x20);
|
return !(flags_ & 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Call-in for the FIFOs; indicates that a FIFO just went from empty to not-empty,
|
||||||
|
/// which might cause an interrupt elsewhere depending on the mask and on whether
|
||||||
|
/// that interrupt is enabled.
|
||||||
void fifo_has_data(const uint8_t mask) {
|
void fifo_has_data(const uint8_t mask) {
|
||||||
if(!(flags_ & mask)) return;
|
if(!(flags_ & mask)) return;
|
||||||
|
|
||||||
switch(mask) {
|
switch(mask) {
|
||||||
default: __builtin_unreachable();
|
default: __builtin_unreachable();
|
||||||
case 0x01:
|
case 0x01: host_.set_host_tube_irq(); break;
|
||||||
host_.set_host_tube_irq();
|
|
||||||
break;
|
|
||||||
case 0x02:
|
case 0x02:
|
||||||
case 0x04:
|
case 0x04: host_.set_parasite_tube_irq(); break;
|
||||||
host_.set_parasite_tube_irq();
|
case 0x08: host_.set_parasite_tube_nmi(); break;
|
||||||
break;
|
|
||||||
case 0x08:
|
|
||||||
host_.set_parasite_tube_nmi();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,6 +114,21 @@ struct ULA {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
|
uint8_t status() const {
|
||||||
|
return flags_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_status(const uint8_t value) {
|
||||||
|
const uint8_t bits = value & 0x3f;
|
||||||
|
if(value & 0x80) {
|
||||||
|
flags_ |= bits;
|
||||||
|
} else {
|
||||||
|
flags_ &= ~bits;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: understand meaning of bit 4.
|
||||||
|
}
|
||||||
|
|
||||||
HostT &host_;
|
HostT &host_;
|
||||||
uint8_t flags_ = 0x3f;
|
uint8_t flags_ = 0x3f;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user