From 531bb4cf134949e6207b10292f2cc621ab08c02b Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Mon, 20 Nov 2023 18:37:04 -0800 Subject: [PATCH] Fix bad sp and writing to zp0 --- sw/kernel/devices/interrupt_controller.s | 2 +- sw/test_code/devices_setup_test/main.s | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sw/kernel/devices/interrupt_controller.s b/sw/kernel/devices/interrupt_controller.s index b7cf594..4c45167 100644 --- a/sw/kernel/devices/interrupt_controller.s +++ b/sw/kernel/devices/interrupt_controller.s @@ -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 diff --git a/sw/test_code/devices_setup_test/main.s b/sw/test_code/devices_setup_test/main.s index 4b97c79..60528df 100644 --- a/sw/test_code/devices_setup_test/main.s +++ b/sw/test_code/devices_setup_test/main.s @@ -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 \ No newline at end of file