git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit bb87842d220b1e315c9b381ae5329ebea715d831
parent 64bf656fb2afcb755bc866201313e9ce08179e98
Author: Michel Iwaniec <46843052+michel-iwaniec@users.noreply.github.com>
Date:   Thu,  6 Jun 2024 08:41:46 +0100

NES: Add comment for macro CRT0_WAIT_PPU to warn about Dendy missed-nmi quirk (#690)


Diffstat:
Mgbdk-lib/libc/targets/mos6502/nes/crt0.s17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/gbdk-lib/libc/targets/mos6502/nes/crt0.s b/gbdk-lib/libc/targets/mos6502/nes/crt0.s @@ -337,8 +337,21 @@ __crt0_setPalette: bne 1$ rts - -.macro CRT0_WAIT_PPU ?.loop +; +; Waits for vblank flag to be set. This macro should only be +; used during the PPU warm-up phase at reset, as a hardware +; flaw can cause the flag to be cleared in the register +; without returning a set flag on the CPU data bus. +; +; On Dendy-like Famiclones there is an additional problem +; that this pathological case can occur *every* frame if the wait +; loop is exactly 8 cycles long, causing a soft-lock at reset. +; For this reason, code before the "bpl .loop" instruction must +; be aligned so the branch does not cross a 256-byte page. +; +; https://www.nesdev.org/wiki/PPU_power_up_state +; +.macro CRT0_WAIT_PPU ?.loop; .loop: lda PPUSTATUS bpl .loop

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.