MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / ba0W16

Function ba0W16

pcsx2/Memory.cpp:261–317  ·  view source on GitHub ↗

These regs are related to DEV9 and DVE stuff, we don't have to go crazy with this, but this sucks less than the original code

Source from the content-addressed store, hash-verified

259
260// These regs are related to DEV9 and DVE stuff, we don't have to go crazy with this, but this sucks less than the original code
261void ba0W16(u32 mem, u16 value)
262{
263 //MEM_LOG("ba000000 Memory write16 address %x value %x", mem, value);
264 u32 masked_mem = (mem & 0xFF);
265
266 if (masked_mem == 0x6) // Status Reg
267 {
268 s_ba[0x6] &= ~3;
269 }
270 else
271 s_ba[masked_mem] = value;
272
273 if (masked_mem == 0x00) // Command Execute Reg
274 {
275 if (s_ba[0x2] == 0x4F || s_ba[0x2] == 0x41)
276 {
277 DevCon.Warning("Error running DVE command, Control Reg value set to %x", value);
278 s_ba_error_detected = true;
279 }
280 else if (s_ba[masked_mem] & 0x80) // Start executing
281 {
282 if (s_ba[0x2] == 0x43) // Write Mode
283 {
284 int size = (s_ba[masked_mem] & 0xF);
285 s_ba_current_reg = s_ba[0x10];
286 size--;
287
288 // 0x10->0x22 seems to be some sort of FIFO, with 0x10 generally being the register to read/write
289 for (int i = 0; i < size; i++)
290 {
291 s_dve_regs[s_ba_current_reg] = s_ba[0x12 + i];
292 }
293
294 s_ba_command_executing = true;
295 s_ba_error_detected = false;
296 }
297 else if (s_ba[0x2] == 0x42) // Read Mode
298 {
299 int size = (s_ba[masked_mem] & 0xF);
300
301 for (int i = 0; i < size; i++)
302 s_ba[0x10 + i] = s_dve_regs[s_ba_current_reg]; // Probably not right but we don't access the real regs, will be enough for now.
303 s_ba_command_executing = true;
304 s_ba_error_detected = false;
305 }
306 }
307 }
308 else if (masked_mem == 0xA) // Power/Standby (?) Reg
309 {
310 if (value == 0)
311 s_ba_error_detected = true;
312 else
313 s_ba_error_detected = false;
314
315 DevCon.Warning("DVE powered %s", value == 0 ? "off" : "on");
316 }
317}
318

Callers 1

_ext_memWrite16Function · 0.85

Calls 1

WarningMethod · 0.45

Tested by

no test coverage detected