1 #ifndef V9990CMDENGINE_HH
2 #define V9990CMDENGINE_HH
24 static constexpr
byte TR = 0x80;
25 static constexpr
byte BD = 0x10;
26 static constexpr
byte CE = 0x01;
35 void reset(EmuTime::param time);
40 inline void sync(EmuTime::param time) {
41 if (CMD >> 4)
sync2(time);
43 void sync2(EmuTime::param time);
47 void setCmdReg(
byte reg,
byte val, EmuTime::param time);
51 void setCmdData(
byte value, EmuTime::param time);
55 [[nodiscard]]
byte getCmdData(EmuTime::param time);
59 [[nodiscard]]
byte peekCmdData(EmuTime::param time);
94 template<
typename Archive>
95 void serialize(Archive& ar,
unsigned version);
101 static constexpr
word BITS_PER_PIXEL = 4;
102 static constexpr
word PIXELS_PER_BYTE = 2;
103 static inline unsigned getPitch(
unsigned width);
104 static inline unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
105 static inline byte point(
V9990VRAM& vram,
106 unsigned x,
unsigned y,
unsigned pitch);
107 static inline byte shift(
byte value,
unsigned fromX,
unsigned toX);
108 static inline byte shiftMask(
unsigned x);
109 static inline const byte* getLogOpLUT(
byte op);
110 static inline byte logOp(
const byte* lut,
byte src,
byte dst);
111 static inline void pset(
112 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
113 byte srcColor,
word mask,
const byte* lut,
byte op);
114 static inline void psetColor(
115 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
122 static constexpr
word BITS_PER_PIXEL = 4;
123 static constexpr
word PIXELS_PER_BYTE = 2;
124 static inline unsigned getPitch(
unsigned width);
125 static inline unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
126 static inline byte point(
V9990VRAM& vram,
127 unsigned x,
unsigned y,
unsigned pitch);
128 static inline byte shift(
byte value,
unsigned fromX,
unsigned toX);
129 static inline byte shiftMask(
unsigned x);
130 static inline const byte* getLogOpLUT(
byte op);
131 static inline byte logOp(
const byte* lut,
byte src,
byte dst);
132 static inline void pset(
133 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
134 byte srcColor,
word mask,
const byte* lut,
byte op);
135 static inline void psetColor(
136 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
143 static constexpr
word BITS_PER_PIXEL = 2;
144 static constexpr
word PIXELS_PER_BYTE = 4;
145 static inline unsigned getPitch(
unsigned width);
146 static inline unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
147 static inline byte point(
V9990VRAM& vram,
148 unsigned x,
unsigned y,
unsigned pitch);
149 static inline byte shift(
byte value,
unsigned fromX,
unsigned toX);
150 static inline byte shiftMask(
unsigned x);
151 static inline const byte* getLogOpLUT(
byte op);
152 static inline byte logOp(
const byte* lut,
byte src,
byte dst);
153 static inline void pset(
154 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
155 byte srcColor,
word mask,
const byte* lut,
byte op);
156 static inline void psetColor(
157 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
164 static constexpr
word BITS_PER_PIXEL = 4;
165 static constexpr
word PIXELS_PER_BYTE = 2;
166 static inline unsigned getPitch(
unsigned width);
167 static inline unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
168 static inline byte point(
V9990VRAM& vram,
169 unsigned x,
unsigned y,
unsigned pitch);
170 static inline byte shift(
byte value,
unsigned fromX,
unsigned toX);
171 static inline byte shiftMask(
unsigned x);
172 static inline const byte* getLogOpLUT(
byte op);
173 static inline byte logOp(
const byte* lut,
byte src,
byte dst);
174 static inline void pset(
175 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
176 byte srcColor,
word mask,
const byte* lut,
byte op);
177 static inline void psetColor(
178 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
185 static constexpr
word BITS_PER_PIXEL = 8;
186 static constexpr
word PIXELS_PER_BYTE = 1;
187 static inline unsigned getPitch(
unsigned width);
188 static inline unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
189 static inline byte point(
V9990VRAM& vram,
190 unsigned x,
unsigned y,
unsigned pitch);
191 static inline byte shift(
byte value,
unsigned fromX,
unsigned toX);
192 static inline byte shiftMask(
unsigned x);
193 static inline const byte* getLogOpLUT(
byte op);
194 static inline byte logOp(
const byte* lut,
byte src,
byte dst);
195 static inline void pset(
196 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
197 byte srcColor,
word mask,
const byte* lut,
byte op);
198 static inline void psetColor(
199 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
206 static constexpr
word BITS_PER_PIXEL = 16;
207 static constexpr
word PIXELS_PER_BYTE = 0;
208 static inline unsigned getPitch(
unsigned width);
209 static inline unsigned addressOf(
unsigned x,
unsigned y,
unsigned pitch);
211 unsigned x,
unsigned y,
unsigned pitch);
212 static inline word shift(
word value,
unsigned fromX,
unsigned toX);
213 static inline word shiftMask(
unsigned x);
214 static inline const byte* getLogOpLUT(
byte op);
215 static inline word logOp(
const byte* lut,
word src,
word dst,
bool transp);
216 static inline void pset(
217 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
219 static inline void psetColor(
220 V9990VRAM& vram,
unsigned x,
unsigned y,
unsigned pitch,
224 void startSTOP (EmuTime::param time);
225 void startLMMC (EmuTime::param time);
226 void startLMMC16(EmuTime::param time);
227 void startLMMV (EmuTime::param time);
228 void startLMCM (EmuTime::param time);
229 void startLMCM16(EmuTime::param time);
230 void startLMMM (EmuTime::param time);
231 void startCMMC (EmuTime::param time);
232 void startCMMK (EmuTime::param time);
233 void startCMMM (EmuTime::param time);
234 void startBMXL (EmuTime::param time);
235 void startBMLX (EmuTime::param time);
236 void startBMLL (EmuTime::param time);
237 void startBMLL16(EmuTime::param time);
238 void startLINE (EmuTime::param time);
239 void startSRCH (EmuTime::param time);
240 template<
typename Mode>
void startPOINT(EmuTime::param time);
241 template<
typename Mode>
void startPSET (EmuTime::param time);
242 void startADVN (EmuTime::param time);
244 void executeSTOP (EmuTime::param limit);
245 template<
typename Mode>
void executeLMMC (EmuTime::param limit);
246 template<
typename Mode>
void executeLMMV (EmuTime::param limit);
247 template<
typename Mode>
void executeLMCM (EmuTime::param limit);
248 template<
typename Mode>
void executeLMMM (EmuTime::param limit);
249 template<
typename Mode>
void executeCMMC (EmuTime::param limit);
250 void executeCMMK (EmuTime::param limit);
251 template<
typename Mode>
void executeCMMM (EmuTime::param limit);
252 template<
typename Mode>
void executeBMXL (EmuTime::param limit);
253 template<
typename Mode>
void executeBMLX (EmuTime::param limit);
254 template<
typename Mode>
void executeBMLL (EmuTime::param limit);
255 template<
typename Mode>
void executeLINE (EmuTime::param limit);
256 template<
typename Mode>
void executeSRCH (EmuTime::param limit);
257 template<
typename Mode>
void executePOINT(EmuTime::param limit);
258 void executePSET (EmuTime::param limit);
259 void executeADVN (EmuTime::param limit);
261 RenderSettings& settings;
265 std::shared_ptr<BooleanSetting> cmdTraceSetting;
286 word ASX, ADX, ANX, ANY;
290 word SX, SY, DX, DY, NX, NY;
291 word WM, fgCol, bgCol;
322 void cmdReady(EmuTime::param time);
326 void reportV9990Command()
const;
329 void update(
const Setting& setting) noexcept
override;
331 void setCommandMode();
333 [[nodiscard]]
inline unsigned getWrappedNX()
const {
334 return NX ? NX : 2048;
336 [[nodiscard]]
inline unsigned getWrappedNY()
const {
337 return NY ? NY : 4096;
Generic Gang-of-Four Observer class, templatized edition.
Class containing all settings for renderers.
void sync(EmuTime::param time)
Synchronizes the command engine with the V9990.
void serialize(Archive &ar, unsigned version)
void reset(EmuTime::param time)
Re-initialise the command engine's state.
bool getBrokenTiming() const
void setCmdData(byte value, EmuTime::param time)
set the data byte
void setCmdReg(byte reg, byte val, EmuTime::param time)
Set a value to one of the command registers.
byte getCmdData(EmuTime::param time)
read the command data byte
word getBorderX(EmuTime::param time)
byte getStatus(EmuTime::param time)
Get command engine related status bits.
const V9990 & getVDP() const
byte peekCmdData(EmuTime::param time)
read the command data byte (without side-effects)
V9990CmdEngine(V9990 &vdp, EmuTime::param time, RenderSettings &settings)
Constructor.
EmuTime estimateCmdEnd() const
Calculate an (under-)estimation for when the command will finish.
void sync2(EmuTime::param time)
Implementation of the Yamaha V9990 VDP as used in the GFX9000 cartridge by Sunrise.
This file implemented 3 utility functions:
uint8_t byte
8 bit unsigned integer
uint16_t word
16 bit unsigned integer
SERIALIZE_CLASS_VERSION(CassettePlayer, 2)
constexpr KeyMatrixPosition x
Keyboard bindings.
constexpr nibble mask[4][13]