MCPcopy Create free account
hub / github.com/TASEmulators/fceux / DoLine

Function DoLine

src/ppu.cpp:1314–1401  ·  view source on GitHub ↗

Ugh ugh ugh.

Source from the content-addressed store, hash-verified

1312
1313void MMC5_hb(int); //Ugh ugh ugh.
1314static void DoLine(void) {
1315 if (scanline >= 240 && scanline != totalscanlines) {
1316 X6502_Run(256 + 69);
1317 scanline++;
1318 X6502_Run(16);
1319 return;
1320 }
1321
1322 int x;
1323 uint8 *target = XBuf + ((scanline < 240 ? scanline : 240) << 8);
1324 u8* dtarget = XDBuf + ((scanline < 240 ? scanline : 240) << 8);
1325
1326 if (MMC5Hack) MMC5_hb(scanline);
1327
1328 X6502_Run(256);
1329 EndRL();
1330
1331 if (!renderbg) {// User asked to not display background data.
1332 uint32 tem;
1333 uint8 col;
1334 if (gNoBGFillColor == 0xFF)
1335 col = READPAL(0);
1336 else col = gNoBGFillColor;
1337 tem = col | (col << 8) | (col << 16) | (col << 24);
1338 tem |= 0x40404040;
1339 FCEU_dwmemset(target, tem, 256);
1340 }
1341
1342 if (SpriteON)
1343 CopySprites(target);
1344
1345 //greyscale handling (mask some bits off the color) ? ? ?
1346 if (ScreenON || SpriteON)
1347 {
1348 if (PPU[1] & 0x01) {
1349 for (x = 63; x >= 0; x--)
1350 *(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) & 0x30303030;
1351 }
1352 }
1353
1354 //some pathetic attempts at deemph
1355 if ((PPU[1] >> 5) == 0x7) {
1356 for (x = 63; x >= 0; x--)
1357 *(uint32*)&target[x << 2] = ((*(uint32*)&target[x << 2]) & 0x3f3f3f3f) | 0xc0c0c0c0;
1358 } else if (PPU[1] & 0xE0)
1359 for (x = 63; x >= 0; x--)
1360 *(uint32*)&target[x << 2] = (*(uint32*)&target[x << 2]) | 0x40404040;
1361 else
1362 for (x = 63; x >= 0; x--)
1363 *(uint32*)&target[x << 2] = ((*(uint32*)&target[x << 2]) & 0x3f3f3f3f) | 0x80808080;
1364
1365 //write the actual deemph
1366 for (x = 63; x >= 0; x--)
1367 *(uint32*)&dtarget[x << 2] = ((PPU[1]>>5)<<0)|((PPU[1]>>5)<<8)|((PPU[1]>>5)<<16)|((PPU[1]>>5)<<24);
1368
1369 sphitx = 0x100;
1370
1371 if (ScreenON || SpriteON)

Callers 1

FCEUPPU_LoopFunction · 0.85

Calls 9

X6502_RunFunction · 0.85
MMC5_hbFunction · 0.85
EndRLFunction · 0.85
CopySpritesFunction · 0.85
FetchSpriteDataFunction · 0.85
Fixit2Function · 0.85
RefreshSpritesFunction · 0.85
ResetRLFunction · 0.85
FCEUD_UpdateNTViewFunction · 0.50

Tested by

no test coverage detected