From 3165f65377fd419c699bd6456e560ddca8af72d3 Mon Sep 17 00:00:00 2001 From: MonstersGoBoom <30197659+JettMonstersGoBoom@users.noreply.github.com> Date: Thu, 23 Mar 2023 08:22:19 -0400 Subject: [PATCH] corrected oam_clear to be off screen added nstc/pal detection. --- include/nes/neslib.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/include/nes/neslib.c b/include/nes/neslib.c index 4bac40b..872573c 100644 --- a/include/nes/neslib.c +++ b/include/nes/neslib.c @@ -94,6 +94,24 @@ int main(void) ppu.scroll = 0x00; ppu.oamaddr = 0x00; + // detech PAL or NTSC based on Blarg code. + + ppu_wait_nmi(); + + __asm { + ldx #52 + ldy #24 + system_check_wait: + dex + bne system_check_wait + dey + bne system_check_wait + + lda $2002 + and #$80 + sta NTSC_MODE + } + nes_game(); return 0; @@ -266,7 +284,7 @@ void oam_clear(void) { char i = 0; do { - OAM_BUF[i] = 0; + OAM_BUF[i] = 255; // off screen not top corner. i += 4; } while (i); }