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

Function _hwWrite8

pcsx2/HwWrite.cpp:282–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280
281template< uint page >
282void _hwWrite8(u32 mem, u8 value)
283{
284#if PSX_EXTRALOGS
285 if ((mem & 0x1000ff00) == 0x1000f300) DevCon.Warning("8bit Write to SIF Register %x value %x wibble", mem, value);
286#endif
287 if (mem == SIO_TXFIFO)
288 {
289 static bool last_char_was_cr = false;
290
291 // skip the \n in \r\n
292 if(last_char_was_cr && (value == '\n'))
293 {
294 last_char_was_cr = false;
295 return;
296 }
297
298 last_char_was_cr = value == '\r';
299 bool should_flush_cause_newline = false;
300 if (last_char_was_cr)
301 {
302 should_flush_cause_newline = true;
303 ee_sio_tx_fifo.push_back('\n');
304 }
305 else
306 {
307 should_flush_cause_newline = value == '\n';
308 ee_sio_tx_fifo.push_back(value);
309 }
310
311 // Check if the only thing in the buffer
312 if (ee_sio_tx_fifo.size() == 1024 || should_flush_cause_newline)
313 {
314 std::string output_string(ee_sio_tx_fifo.begin(), ee_sio_tx_fifo.end());
315
316 eeConLog(ShiftJIS_ConvertString(output_string.c_str()));
317 ee_sio_tx_fifo.clear();
318 }
319 return;
320 }
321
322 switch(mem & ~3)
323 {
324 case DMAC_STAT:
325 case INTC_STAT:
326 case INTC_MASK:
327 case DMAC_FAKESTAT:
328 DevCon.Warning ( "8bit write mem = %x value %x", mem, value );
329 _hwWrite32<page>(mem & ~3, (u32)value << (mem & 3) * 8);
330 return;
331 }
332
333 u32 merged = _hwRead32<page,false>(mem & ~0x03);
334 ((u8*)&merged)[mem & 0x3] = value;
335
336 _hwWrite32<page>(mem & ~0x03, merged);
337}
338
339template< uint page >

Callers

nothing calls this directly

Calls 8

ShiftJIS_ConvertStringFunction · 0.85
WarningMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected