1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-26 10:29:31 +00:00

Elide the two fills; fix address masking.

This commit is contained in:
Thomas Harte 2023-03-21 20:05:34 -04:00
parent 7d63a50f3e
commit 655638656f
3 changed files with 13 additions and 25 deletions

View File

@ -947,12 +947,12 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
case 0b0110: break; // TODO: srch. [search horizontally for a colour]
case 0b0111: Begin(Line); break; // LINE [draw a Bresenham line].
case 0b1000: Begin(LogicalFill); break; // LMMV [logical move, VDP to VRAM, i.e. solid-colour fill].
case 0b1000: Begin(Fill<true>); break; // LMMV [logical move, VDP to VRAM, i.e. solid-colour fill].
case 0b1001: Begin(Move<MoveType::Logical>); break; // LMMM [logical move, VRAM to VRAM].
case 0b1010: break; // TODO: lmcm. [logical move, VRAM to CPU]
case 0b1011: Begin(MoveFromCPU<true>); break; // LMMC [logical move, CPU to VRAM].
case 0b1100: Begin(HighSpeedFill); break; // HMMV [high-speed move, VDP to VRAM, i.e. single-byte fill].
case 0b1100: Begin(Fill<false>); break; // HMMV [high-speed move, VDP to VRAM, i.e. single-byte fill].
case 0b1101: Begin(Move<MoveType::HighSpeed>); break; // HMMM [high-speed move, VRAM to VRAM].
case 0b1110: Begin(Move<MoveType::YOnly>); break; // YMMM [high-speed move, y only, VRAM to VRAM].
case 0b1111: Begin(MoveFromCPU<false>); break; // HMMC [high-speed move, CPU to VRAM].

View File

@ -382,9 +382,9 @@ template <Personality personality> struct Base: public Storage<personality> {
auto &context = Storage<personality>::command_context_;
const uint8_t *const source = (context.arguments & 0x10) ? Storage<personality>::expansion_ram_.data() : ram_.data();
const AddressT source_mask = (context.arguments & 0x10) ? 0x1fff : 0xffff;
const AddressT source_mask = (context.arguments & 0x10) ? 0xfff : 0x1ffff;
uint8_t *const destination = (context.arguments & 0x20) ? Storage<personality>::expansion_ram_.data() : ram_.data();
const AddressT destination_mask = (context.arguments & 0x20) ? 0x1fff : 0xffff;
const AddressT destination_mask = (context.arguments & 0x20) ? 0xfff : 0x1ffff;
switch(Storage<personality>::next_command_step_) {
// Duplicative, but keeps the compiler happy.
case CommandStep::None:

View File

@ -361,30 +361,18 @@ template <MoveType type> struct Move: public Rectangle<type == MoveType::Logical
// MARK: - Rectangular fills.
struct HighSpeedFill: public Rectangle<false, false> {
HighSpeedFill(CommandContext &context, ModeDescription &mode_description) : Rectangle(context, mode_description) {
cycles = 56;
access = AccessType::WriteByte;
template <bool logical> struct Fill: public Rectangle<logical, false> {
using RectangleBase = Rectangle<logical, false>;
Fill(CommandContext &context, ModeDescription &mode_description) : RectangleBase(context, mode_description) {
Command::cycles = logical ? 64 : 56;
Command::access = logical ? Command::AccessType::PlotPoint : Command::AccessType::WriteByte;
}
void advance() final {
cycles = 48;
if(advance_pixel()) {
cycles += 56;
}
}
};
struct LogicalFill: public Rectangle<false, false> {
LogicalFill(CommandContext &context, ModeDescription &mode_description) : Rectangle(context, mode_description) {
cycles = 64;
access = AccessType::PlotPoint;
}
void advance() final {
cycles = 72;
if(advance_pixel()) {
cycles += 64;
Command::cycles = logical ? 72 : 48;
if(RectangleBase::advance_pixel()) {
Command::cycles += logical ? 64 : 56;
}
}
};