diff --git a/mockingboard/ksp_theme_6ch.s b/mockingboard/ksp_theme_6ch.s index a370d951..1f405dbf 100644 --- a/mockingboard/ksp_theme_6ch.s +++ b/mockingboard/ksp_theme_6ch.s @@ -352,7 +352,8 @@ forever_loop: ; Then it sets up the stack like an interrupt and calls 0x3fe interrupt_handler: - pha ; save A +; pha ; save A + ; A saved by firmware to $45 txa pha tya @@ -549,10 +550,13 @@ done_left_interrupt: done_interrupt: pla - tay - pla - tax + tay ; restore Y + pla + tax ; restore X + + lda $45 ; restore A + rti diff --git a/mockingboard/ksp_theme_interrupt.s b/mockingboard/ksp_theme_interrupt.s index d76fc0bf..542084e7 100644 --- a/mockingboard/ksp_theme_interrupt.s +++ b/mockingboard/ksp_theme_interrupt.s @@ -338,8 +338,13 @@ forever_loop: ; Then it sets up the stack like an interrupt and calls 0x3fe interrupt_handler: - pha ; save A - ; Should we save X and Y too? +; pha ; firmware saves A to $45 for us + txa ; save X + pha + tya + pha ; save Y + + bit $C404 ; can clear 6522 interrupt by reading T1C-L @@ -437,6 +442,12 @@ not_done: done_interrupt: pla + tay ; restore y + pla + tax ; restore X + + lda $45 ; restore A + rti diff --git a/mockingboard/mock_test.dsk b/mockingboard/mock_test.dsk index 4a32fd69..c03ccf25 100644 Binary files a/mockingboard/mock_test.dsk and b/mockingboard/mock_test.dsk differ