public function notifyScanline()
{
if ($this->actualScanLine == 0) {
$this->core->windowSourceLine = 0;
}
// determine the left edge of the window (160 if window is inactive)
$windowLeft = $this->core->gfxWindowDisplay && $this->core->memory[0xff4a] <= $this->actualScanLine ? min(160, $this->core->memory[0xff4b] - 7) : 160;
// step 1: background+window
$skippedAnything = $this->core->drawBackgroundForLine($this->actualScanLine, $windowLeft, 0);
// At this point, the high (alpha) byte in the frameBuffer is 0xff for colors 1,2,3 and
// 0x00 for color 0. Foreground sprites draw on all colors, background sprites draw on
// top of color 0 only.
// step 2: sprites
$this->core->drawSpritesForLine($this->actualScanLine);
// step 3: prio tiles+window
if ($skippedAnything) {
$this->core->drawBackgroundForLine($this->actualScanLine, $windowLeft, 0x80);
}
if ($windowLeft < 160) {
++$this->core->windowSourceLine;
}
}