diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index 1eb761350..247615edb 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -871,17 +871,17 @@ void Base::commit_register(int reg, uint8_t value) { default: break; case 0b0100: break; // TODO: point. [read a pixel colour] - case 0b0101: Begin(PointSet); break; // PSET + case 0b0101: Begin(PointSet); break; // PSET. case 0b0110: break; // TODO: srch. [search horizontally for a colour] - case 0b0111: Begin(Line); break; // LINE + case 0b0111: Begin(Line); break; // LINE. - case 0b1000: Begin(LogicalFill); break; // LMMV [logical move, VDP to VRAM, i.e. solid-colour fill] - case 0b1001: break; // TODO: lmmm. [logical move, VRAM to VRAM] + case 0b1000: Begin(LogicalFill); break; // LMMV [logical move, VDP to VRAM, i.e. solid-colour fill]. + case 0b1001: Begin(LogicalMove); break; // LMMM [logical move, VRAM to VRAM]. case 0b1010: break; // TODO: lmcm. [logical move, VRAM to CPU] case 0b1011: Begin(LogicalMoveFromCPU); 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 0b1101: break; // TODO: hmmm. [high-speed move, VRAM to VRAM] + case 0b1100: Begin(HighSpeedFill); break; // HMMV [high-speed move, VDP to VRAM, i.e. single-byte fill]. + case 0b1101: Begin(HighSpeedMove); break; // HMMM [high-speed move, VRAM to VRAM]. case 0b1110: break; // TODO: ymmm. [high-speed move, y only, VRAM to VRAM] case 0b1111: break; // TODO: hmmc. [high-speed move, CPU to VRAM] } diff --git a/Components/9918/Implementation/YamahaCommands.hpp b/Components/9918/Implementation/YamahaCommands.hpp index 17f1194e7..2b3381455 100644 --- a/Components/9918/Implementation/YamahaCommands.hpp +++ b/Components/9918/Implementation/YamahaCommands.hpp @@ -280,7 +280,7 @@ template struct Rectangle: public Command { int start_x_ = 0, width_ = 0; }; -// MARK: - Rectangular manipulations; logical. +// MARK: - Rectangular moves to/from CPU. struct LogicalMoveFromCPU: public Rectangle { LogicalMoveFromCPU(CommandContext &context) : Rectangle(context) { @@ -312,7 +312,37 @@ struct LogicalMoveFromCPU: public Rectangle { } }; -// MARK: - Rectangular manipulations; fast. +// MARK: - Rectangular moves within VRAM. + +struct HighSpeedMove: public Rectangle { + HighSpeedMove(CommandContext &context) : Rectangle(context) { + access = AccessType::CopyByte; + cycles = 64; + } + + void advance(int pixels_per_byte) final { + cycles = 64; + if(advance_pixel(pixels_per_byte)) { + cycles += 64; + } + } +}; + +struct LogicalMove: public Rectangle { + LogicalMove(CommandContext &context) : Rectangle(context) { + access = AccessType::CopyPoint; + cycles = 64; + } + + void advance(int pixels_per_byte) final { + cycles = 64; + if(advance_pixel(pixels_per_byte)) { + cycles += 64; + } + } +}; + +// MARK: - Rectangular fills. struct HighSpeedFill: public Rectangle { HighSpeedFill(CommandContext &context) : Rectangle(context) { @@ -322,7 +352,7 @@ struct HighSpeedFill: public Rectangle { void advance(int pixels_per_byte) final { cycles = 48; - if(!advance_pixel(pixels_per_byte)) { + if(advance_pixel(pixels_per_byte)) { cycles += 56; } } @@ -334,9 +364,9 @@ struct LogicalFill: public Rectangle { access = AccessType::PlotPoint; } - void advance(int pixels_per_byte) final { + void advance(int) final { cycles = 72; - if(!advance_pixel(pixels_per_byte)) { + if(advance_pixel()) { cycles += 64; } }