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

Function RefreshLine

src/ppu.cpp:1094–1225  ·  view source on GitHub ↗

lasttile is really "second to last tile."

Source from the content-addressed store, hash-verified

1092
1093// lasttile is really "second to last tile."
1094static void RefreshLine(int lastpixel) {
1095 static uint32 pshift[2];
1096 static uint32 atlatch;
1097 uint32 smorkus = RefreshAddr;
1098
1099 #define RefreshAddr smorkus
1100 uint32 vofs;
1101 int X1;
1102
1103 uint8 *P = Pline;
1104 int lasttile = lastpixel >> 3;
1105 int numtiles;
1106 static int norecurse = 0; // Yeah, recursion would be bad.
1107 // PPU_hook() functions can call
1108 // mirroring/chr bank switching functions,
1109 // which call FCEUPPU_LineUpdate, which call this
1110 // function.
1111 if (norecurse) return;
1112
1113 if (sphitx != 0x100 && !(PPU_status & 0x40)) {
1114 if ((sphitx < (lastpixel - 16)) && !(sphitx < ((lasttile - 2) * 8)))
1115 lasttile++;
1116 }
1117
1118 if (lasttile > 34) lasttile = 34;
1119 numtiles = lasttile - firsttile;
1120
1121 if (numtiles <= 0) return;
1122
1123 P = Pline;
1124
1125 vofs = 0;
1126
1127 if(PEC586Hack)
1128 vofs = ((RefreshAddr & 0x200) << 3) | ((RefreshAddr >> 12) & 7);
1129 else
1130 vofs = ((PPU[0] & 0x10) << 8) | ((RefreshAddr >> 12) & 7);
1131
1132 if (!ScreenON && !SpriteON) {
1133 uint32 tem;
1134 tem = READPAL(0) | (READPAL(0) << 8) | (READPAL(0) << 16) | (READPAL(0) << 24);
1135 tem |= 0x40404040;
1136 FCEU_dwmemset(Pline, tem, numtiles * 8);
1137 P += numtiles * 8;
1138 Pline = P;
1139
1140 firsttile = lasttile;
1141
1142 #define TOFIXNUM (272 - 0x4)
1143 if (lastpixel >= TOFIXNUM && tofix) {
1144 Fixit1();
1145 tofix = 0;
1146 }
1147
1148 if ((lastpixel - 16) >= 0) {
1149 InputScanlineHook(Plinef, spork ? sprlinebuf : 0, linestartts, lasttile * 8 - 16);
1150 }
1151 return;

Callers 2

FCEUPPU_LineUpdateFunction · 0.85
EndRLFunction · 0.85

Calls 3

Fixit1Function · 0.85
InputScanlineHookFunction · 0.85
ifFunction · 0.70

Tested by

no test coverage detected