aboutsummaryrefslogtreecommitdiffstats
path: root/main.s
diff options
context:
space:
mode:
Diffstat (limited to 'main.s')
-rw-r--r--main.s29
1 files changed, 27 insertions, 2 deletions
diff --git a/main.s b/main.s
index aa4d596..d59c52a 100644
--- a/main.s
+++ b/main.s
@@ -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: