23 static constexpr byte TR = 0x80;
24 static constexpr byte BD = 0x10;
25 static constexpr byte CE = 0x01;
34 void reset(EmuTime::param time);
39 void sync(EmuTime::param time) {
40 if (CMD >> 4)
sync2(time);
42 void sync2(EmuTime::param time);
46 void setCmdReg(
byte reg,
byte val, EmuTime::param time);
50 void setCmdData(
byte value, EmuTime::param time);
54 [[nodiscard]]
byte getCmdData(EmuTime::param time);
58 [[nodiscard]]
byte peekCmdData(EmuTime::param time)
const;
65 [[nodiscard]]
byte getStatus(EmuTime::param time)
const {
93 template<
typename Archive>
94 void serialize(Archive& ar,
unsigned version);
100 static constexpr word BITS_PER_PIXEL = 4;
101 static constexpr word PIXELS_PER_BYTE = 2;
102 static unsigned getPitch(
unsigned width);
103 static unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
105 unsigned x,
unsigned y,
unsigned pitch);
106 static byte shift(
byte value,
unsigned fromX,
unsigned toX);
107 static byte shiftMask(
unsigned x);
108 static std::span<const byte, 256 * 256> getLogOpLUT(
byte op);
109 static byte logOp(std::span<const byte, 256 * 256> lut,
byte src,
byte dst);
111 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
112 byte srcColor,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
113 static void psetColor(
114 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
115 word color,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
121 static constexpr word BITS_PER_PIXEL = 4;
122 static constexpr word PIXELS_PER_BYTE = 2;
123 static unsigned getPitch(
unsigned width);
124 static unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
125 static byte point(
const V9990VRAM& vram,
126 unsigned x,
unsigned y,
unsigned pitch);
127 static byte shift(
byte value,
unsigned fromX,
unsigned toX);
128 static byte shiftMask(
unsigned x);
129 static std::span<const byte, 256 * 256> getLogOpLUT(
byte op);
130 static byte logOp(std::span<const byte, 256 * 256> lut,
byte src,
byte dst);
132 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
133 byte srcColor,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
134 static void psetColor(
135 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
136 word color,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
142 static constexpr word BITS_PER_PIXEL = 2;
143 static constexpr word PIXELS_PER_BYTE = 4;
144 static unsigned getPitch(
unsigned width);
145 static unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
146 static byte point(
const V9990VRAM& vram,
147 unsigned x,
unsigned y,
unsigned pitch);
148 static byte shift(
byte value,
unsigned fromX,
unsigned toX);
149 static byte shiftMask(
unsigned x);
150 static std::span<const byte, 256 * 256> getLogOpLUT(
byte op);
151 static byte logOp(std::span<const byte, 256 * 256> lut,
byte src,
byte dst);
153 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
154 byte srcColor,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
155 static void psetColor(
156 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
157 word color,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
163 static constexpr word BITS_PER_PIXEL = 4;
164 static constexpr word PIXELS_PER_BYTE = 2;
165 static unsigned getPitch(
unsigned width);
166 static unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
167 static byte point(
const V9990VRAM& vram,
168 unsigned x,
unsigned y,
unsigned pitch);
169 static byte shift(
byte value,
unsigned fromX,
unsigned toX);
170 static byte shiftMask(
unsigned x);
171 static std::span<const byte, 256 * 256> getLogOpLUT(
byte op);
172 static byte logOp(std::span<const byte, 256 * 256> lut,
byte src,
byte dst);
174 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
175 byte srcColor,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
176 static void psetColor(
177 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
178 word color,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
184 static constexpr word BITS_PER_PIXEL = 8;
185 static constexpr word PIXELS_PER_BYTE = 1;
186 static unsigned getPitch(
unsigned width);
187 static unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
188 static byte point(
const V9990VRAM& vram,
189 unsigned x,
unsigned y,
unsigned pitch);
190 static byte shift(
byte value,
unsigned fromX,
unsigned toX);
191 static byte shiftMask(
unsigned x);
192 static std::span<const byte, 256 * 256> getLogOpLUT(
byte op);
193 static byte logOp(std::span<const byte, 256 * 256> lut,
byte src,
byte dst);
195 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
196 byte srcColor,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
197 static void psetColor(
198 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
199 word color,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
205 static constexpr word BITS_PER_PIXEL = 16;
206 static constexpr word PIXELS_PER_BYTE = 0;
207 static unsigned getPitch(
unsigned width);
208 static unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
209 static word point(
const V9990VRAM& vram,
210 unsigned x,
unsigned y,
unsigned pitch);
211 static word shift(
word value,
unsigned fromX,
unsigned toX);
212 static word shiftMask(
unsigned x);
213 static std::span<const byte, 256 * 256> getLogOpLUT(
byte op);
214 static word logOp(std::span<const byte, 256 * 256> lut,
word src,
word dst,
bool transp);
216 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
217 word srcColor,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
218 static void psetColor(
219 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
220 word color,
word mask, std::span<const byte, 256 * 256> lut,
byte op);
223 void startSTOP (EmuTime::param time);
224 void startLMMC (EmuTime::param time);
225 void startLMMC16(EmuTime::param time);
226 void startLMMV (EmuTime::param time);
227 void startLMCM (EmuTime::param time);
228 void startLMCM16(EmuTime::param time);
229 void startLMMM (EmuTime::param time);
230 void startCMMC (EmuTime::param time);
231 void startCMMK (EmuTime::param time);
232 void startCMMM (EmuTime::param time);
233 void startBMXL (EmuTime::param time);
234 void startBMLX (EmuTime::param time);
235 void startBMLL (EmuTime::param time);
236 void startBMLL16(EmuTime::param time);
237 void startLINE (EmuTime::param time);
238 void startSRCH (EmuTime::param time);
239 template<
typename Mode>
void startPOINT(EmuTime::param time);
240 template<
typename Mode>
void startPSET (EmuTime::param time);
241 void startADVN (EmuTime::param time);
243 void executeSTOP (EmuTime::param limit);
244 template<
typename Mode>
void executeLMMC (EmuTime::param limit);
245 template<
typename Mode>
void executeLMMV (EmuTime::param limit);
246 template<
typename Mode>
void executeLMCM (EmuTime::param limit);
247 template<
typename Mode>
void executeLMMM (EmuTime::param limit);
248 template<
typename Mode>
void executeCMMC (EmuTime::param limit);
249 void executeCMMK (EmuTime::param limit);
250 template<
typename Mode>
void executeCMMM (EmuTime::param limit);
251 template<
typename Mode>
void executeBMXL (EmuTime::param limit);
252 template<
typename Mode>
void executeBMLX (EmuTime::param limit);
253 template<
typename Mode>
void executeBMLL (EmuTime::param limit);
254 template<
typename Mode>
void executeLINE (EmuTime::param limit);
255 template<
typename Mode>
void executeSRCH (EmuTime::param limit);
256 template<
typename Mode>
void executePOINT(EmuTime::param limit);
257 void executePSET (EmuTime::param limit);
258 void executeADVN (EmuTime::param limit);
260 RenderSettings& settings;
264 std::shared_ptr<BooleanSetting> cmdTraceSetting;
285 word ASX, ADX, ANX, ANY;
289 word SX, SY, DX, DY, NX, NY;
290 word WM, fgCol, bgCol;
321 void cmdReady(EmuTime::param time);
325 void reportV9990Command()
const;
328 void update(
const Setting&
setting)
noexcept override;
330 void setCommandMode();
332 [[nodiscard]]
word getWrappedNX()
const {
333 return NX ? NX : 2048;
335 [[nodiscard]]
word getWrappedNY()
const {
336 return NY ? NY : 4096;