diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-06 04:11:45 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-06 04:11:45 -0400 |
commit | 3dd432577e3dbca911d968f3d3af5a78ad79626e (patch) | |
tree | ee501a7a725a1902a127ab3cc91f65776bb378a4 | |
parent | cc3a1fb8164c606d29480f990275b553c96543c9 (diff) | |
download | nes-project-skeleton-3dd432577e3dbca911d968f3d3af5a78ad79626e.tar.gz nes-project-skeleton-3dd432577e3dbca911d968f3d3af5a78ad79626e.zip |
shouldn't do everything in the NMI interrupt - only drawing should
happen there in order to make sure that gets done during vblank,
everything else should happen in the main loop
-rw-r--r-- | main.s | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -17,6 +17,7 @@ BANKS 1 .ENUM $0000 buttons_pressed DB +sleeping DB .ENDE @@ -66,6 +67,7 @@ clrmem: ; initialize variables in ram LDA #$00 STA buttons_pressed + STA sleeping vblankwait2: ; Second wait for vblank, PPU is ready after this BIT $2002 @@ -93,11 +95,34 @@ LoadPalettesLoop: STA $2000 loop: + INC sleeping +sleep: + LDA sleeping + BNE sleep + + JSR read_controller1 + + ; game logic + JMP loop NMI: - JSR read_controller1 - ; ... + PHA + TXA + PHA + TYA + PHA + + ; drawing code + + LDA #$00 + STA sleeping + + PLA + TAY + PLA + TAX + PLA RTI read_controller1: |