1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-04 14:30:19 +00:00

Attempts to make pixel content observeable.

This commit is contained in:
Thomas Harte 2021-09-08 20:57:26 -04:00
parent 6e034c9b7f
commit fd70f7ad43
6 changed files with 72 additions and 32 deletions

View File

@ -14,7 +14,7 @@
using namespace Amiga;
Blitter::Blitter(uint16_t *ram, size_t size) : ram_(ram), ram_size_(size) {}
Blitter::Blitter(uint16_t *ram, size_t size) : ram_(ram), ram_mask_(uint32_t(size-1)) {}
void Blitter::set_control(int index, uint16_t value) {
LOG("Set control " << index << " to " << PADHEX(4) << value);
@ -61,5 +61,6 @@ uint16_t Blitter::get_status() {
}
bool Blitter::advance() {
ram_[addresses_[3] & ram_mask_] = 0xffff;
return false;
}

View File

@ -45,7 +45,7 @@ class Blitter {
private:
uint16_t *const ram_;
const size_t ram_size_;
const uint32_t ram_mask_;
uint32_t addresses_[4];
uint8_t minterms_;

View File

@ -231,10 +231,37 @@ template <int cycle> void Chipset::output() {
}
if(pixels_) {
pixels_[0] = 0xffff;
pixels_[1] = 0x0000;
pixels_[2] = 0xffff;
pixels_[3] = 0x0000;
// TODO: this is obviously nonsense.
pixels_[0] = palette_[
((current_bitplanes_[0]&1) << 0) |
((current_bitplanes_[1]&1) << 1) |
((current_bitplanes_[2]&1) << 2) |
((current_bitplanes_[3]&1) << 3) |
((current_bitplanes_[4]&1) << 4)
];
pixels_[1] = palette_[
((current_bitplanes_[0]&2) >> 1) |
((current_bitplanes_[1]&2) << 0) |
((current_bitplanes_[2]&2) << 1) |
((current_bitplanes_[3]&2) << 2) |
((current_bitplanes_[4]&2) << 3)
];
pixels_[2] = palette_[
((current_bitplanes_[0]&4) >> 2) |
((current_bitplanes_[1]&4) >> 1) |
((current_bitplanes_[2]&4) << 0) |
((current_bitplanes_[3]&4) << 1) |
((current_bitplanes_[4]&4) << 2)
];
pixels_[3] = palette_[
((current_bitplanes_[0]&8) >> 3) |
((current_bitplanes_[1]&8) >> 2) |
((current_bitplanes_[2]&8) >> 1) |
((current_bitplanes_[3]&8) << 0) |
((current_bitplanes_[4]&8) << 1)
];
current_bitplanes_ >>= 4;
pixels_ += 4;
}
}
@ -408,9 +435,6 @@ template <bool stop_on_cpu> Chipset::Changes Chipset::run(HalfCycles length) {
did_fetch_ = false;
}
std::fill(even_playfield_.begin(), even_playfield_.end(), 0);
std::fill(odd_playfield_.begin(), odd_playfield_.end(), 0);
if(y_ == frame_height_) {
++changes.vsyncs;
interrupt_requests_ |= InterruptMask<InterruptFlag::VerticalBlank>::value;
@ -430,18 +454,29 @@ template <bool stop_on_cpu> Chipset::Changes Chipset::run(HalfCycles length) {
}
void Chipset::post_bitplanes(const BitplaneData &data) {
// Convert to future pixels.
const int odd_offset = line_cycle_ + odd_delay_;
const int even_offset = line_cycle_ + odd_delay_;
for(int x = 0; x < 16; x++) {
const uint16_t mask = uint16_t(1 << x);
even_playfield_[x + even_offset] = uint8_t(
((data[0] & mask) | ((data[2] & mask) << 1) | ((data[4] & mask) << 2)) >> x
);
odd_playfield_[x + odd_offset] = uint8_t(
((data[1] & mask) | ((data[3] & mask) << 1) | ((data[5] & mask) << 2)) >> x
);
// TODO: should probably store for potential delay?
current_bitplanes_ = data;
if(data[0] || data[1]) {
printf("");
}
// current_bitplanes_[0] = 0xaaaa;
// current_bitplanes_[1] = 0x3333;
// current_bitplanes_[2] = 0x4444;
// current_bitplanes_[3] = 0x1111;
// Convert to future pixels.
// const int odd_offset = line_cycle_ + odd_delay_;
// const int even_offset = line_cycle_ + odd_delay_;
// for(int x = 0; x < 16; x++) {
// const uint16_t mask = uint16_t(1 << x);
// even_playfield_[x + even_offset] = uint8_t(
// ((data[0] & mask) | ((data[2] & mask) << 1) | ((data[4] & mask) << 2)) >> x
// );
// odd_playfield_[x + odd_offset] = uint8_t(
// ((data[1] & mask) | ((data[3] & mask) << 1) | ((data[5] & mask) << 2)) >> x
// );
// }
}
void Chipset::update_interrupts() {

View File

@ -179,7 +179,17 @@ class Chipset {
uint16_t *pixels_ = nullptr;
void flush_output();
using BitplaneData = std::array<uint16_t, 6>;
struct BitplaneData: public std::array<uint16_t, 6> {
BitplaneData &operator >>= (int c) {
(*this)[0] >>= c;
(*this)[1] >>= c;
(*this)[2] >>= c;
(*this)[3] >>= c;
(*this)[4] >>= c;
(*this)[5] >>= c;
return *this;
}
};
class Bitplanes: public DMADevice<6> {
public:
@ -199,8 +209,9 @@ class Chipset {
void post_bitplanes(const BitplaneData &data);
std::array<uint8_t, 912> even_playfield_;
std::array<uint8_t, 912> odd_playfield_;
BitplaneData current_bitplanes_, next_bitplanes_;
// std::array<uint8_t, 912> even_playfield_;
// std::array<uint8_t, 912> odd_playfield_;
int odd_delay_ = 0, even_delay_ = 0;
// MARK: - Copper.

View File

@ -65,7 +65,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableAddressSanitizer = "YES"
enableASanStackUseAfterReturn = "YES"
disableMainThreadChecker = "YES"
launchStyle = "0"

View File

@ -1896,16 +1896,10 @@ template <class T, bool dtack_is_implicit, bool signal_will_perform> void Proces
negative_flag_ = zero_result_ & 0x80000000;
break;
case Operation::STOP: {
static int stops = 0;
++stops;
if(stops == 559) {
printf("");
}
case Operation::STOP:
apply_status(prefetch_queue_.halves.low.full);
execution_state_ = ExecutionState::Stopped;
} break;
break;
/*
Development period debugging.