mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-09 06:29:33 +00:00
Switches bitplane shifter to returning four high-res pixels at a time.
This commit is contained in:
parent
7118a515e0
commit
c6535bf035
@ -181,26 +181,13 @@ template <int cycle> void Chipset::output() {
|
|||||||
if(pixels_) {
|
if(pixels_) {
|
||||||
// TODO: this doesn't support dual playfields; use an alternative
|
// TODO: this doesn't support dual playfields; use an alternative
|
||||||
// palette table for that.
|
// palette table for that.
|
||||||
|
const uint32_t source = bitplane_pixels_.get(is_high_res_);
|
||||||
|
bitplane_pixels_.shift(is_high_res_);
|
||||||
|
|
||||||
if(is_high_res_) {
|
pixels_[0] = palette_[source >> 24];
|
||||||
pixels_[0] = palette_[bitplane_pixels_.get()];
|
pixels_[1] = palette_[(source >> 16) & 0xff];
|
||||||
bitplane_pixels_.shift();
|
pixels_[2] = palette_[(source >> 8) & 0xff];
|
||||||
|
pixels_[3] = palette_[source & 0xff];
|
||||||
pixels_[1] = palette_[bitplane_pixels_.get()];
|
|
||||||
bitplane_pixels_.shift();
|
|
||||||
|
|
||||||
pixels_[2] = palette_[bitplane_pixels_.get()];
|
|
||||||
bitplane_pixels_.shift();
|
|
||||||
|
|
||||||
pixels_[3] = palette_[bitplane_pixels_.get()];
|
|
||||||
bitplane_pixels_.shift();
|
|
||||||
} else {
|
|
||||||
pixels_[0] = pixels_[1] = palette_[bitplane_pixels_.get()];
|
|
||||||
bitplane_pixels_.shift();
|
|
||||||
|
|
||||||
pixels_[2] = pixels_[3] = palette_[bitplane_pixels_.get()];
|
|
||||||
bitplane_pixels_.shift();
|
|
||||||
}
|
|
||||||
|
|
||||||
// QUICK HACK: dump sprite pixels:
|
// QUICK HACK: dump sprite pixels:
|
||||||
//
|
//
|
||||||
@ -1378,7 +1365,13 @@ int Chipset::Mouse::get_number_of_buttons() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Chipset::Mouse::set_button_pressed(int button, bool is_set) {
|
void Chipset::Mouse::set_button_pressed(int button, bool is_set) {
|
||||||
const uint8_t mask = 0x80 >> button;
|
// TODO: this is nothing like correct; the second and optional
|
||||||
|
// third buttons aren't exposed via CIA A like the first is,
|
||||||
|
// so there's not really a single location of buttons.
|
||||||
|
//
|
||||||
|
// Leaving as is for now, as this gives me a working left
|
||||||
|
// button in port 0 and that'll do.
|
||||||
|
const auto mask = uint8_t(0x40 << button);
|
||||||
button_state =
|
button_state =
|
||||||
(button_state & ~mask) |
|
(button_state & ~mask) |
|
||||||
(is_set ? 0 : mask);
|
(is_set ? 0 : mask);
|
||||||
|
@ -226,13 +226,22 @@ class Chipset: private ClockingHint::Observer {
|
|||||||
int odd_delay,
|
int odd_delay,
|
||||||
int even_delay);
|
int even_delay);
|
||||||
|
|
||||||
void shift() {
|
void shift(bool high_res) {
|
||||||
(*this)[1] = ((*this)[1] << 8) | ((*this)[0] >> 56);
|
constexpr int shifts[] = {16, 32};
|
||||||
(*this)[0] <<= 8;
|
|
||||||
|
(*this)[1] = ((*this)[1] << shifts[high_res]) | ((*this)[0] >> (64 - shifts[high_res]));
|
||||||
|
(*this)[0] <<= shifts[high_res];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t get() {
|
uint32_t get(bool high_res) {
|
||||||
return uint8_t((*this)[1] >> 56);
|
if(high_res) {
|
||||||
|
return uint32_t((*this)[1] >> 32);
|
||||||
|
} else {
|
||||||
|
uint32_t result = uint16_t((*this)[1] >> 48);
|
||||||
|
result = ((result & 0xff00) << 8) | (result & 0x00ff);
|
||||||
|
result |= result << 8;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} bitplane_pixels_;
|
} bitplane_pixels_;
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
// Copyright © 2021 Thomas Harte. All rights reserved.
|
// Copyright © 2021 Thomas Harte. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <stdio.h>
|
#ifndef NDEBUG
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOG_PREFIX "[Copper] "
|
#define LOG_PREFIX "[Copper] "
|
||||||
#include "../../Outputs/Log.hpp"
|
#include "../../Outputs/Log.hpp"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user