Fix bad sp and writing to zp0

This commit is contained in:
Byron Lathi
2023-11-20 18:37:04 -08:00
parent e6a16b0c73
commit 531bb4cf13
2 changed files with 11 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ loop:
lda IRQ_DAT_ADDR
sta tmp1
pla
and $07 ; A is now 0-7
and #$07 ; A is now 0-7
tax
inx ; X is now 1-8
lda #$01

View File

@@ -5,6 +5,10 @@
.import _init_interrupt_controller
.import _init_rtc
.zeropage
finish: .res 1
.code
_nmi_int:
@@ -16,13 +20,18 @@ _init:
ldx #$ff
txs
LDA #<(__STACKSTART__ + __STACKSIZE__)
STA sp
LDA #>(__STACKSTART__ + __STACKSIZE__)
STA sp+1
jsr _init_interrupt_controller
jsr _init_rtc
; enable interrupt 0
lda #$00
jsr pusha
lda #$1
lda #$0
jsr _enable_irq
@end: bra @end