ksp_theme: fix interrupt bug on older Apple IIs

This commit is contained in:
Vince Weaver 2018-09-04 12:51:13 -04:00
parent 762ebf13fe
commit 42e4f41997
3 changed files with 21 additions and 6 deletions

View File

@ -352,7 +352,8 @@ forever_loop:
; Then it sets up the stack like an interrupt and calls 0x3fe ; Then it sets up the stack like an interrupt and calls 0x3fe
interrupt_handler: interrupt_handler:
pha ; save A ; pha ; save A
; A saved by firmware to $45
txa txa
pha pha
tya tya
@ -549,10 +550,13 @@ done_left_interrupt:
done_interrupt: done_interrupt:
pla pla
tay tay ; restore Y
pla
tax
pla pla
tax ; restore X
lda $45 ; restore A
rti rti

View File

@ -338,8 +338,13 @@ forever_loop:
; Then it sets up the stack like an interrupt and calls 0x3fe ; Then it sets up the stack like an interrupt and calls 0x3fe
interrupt_handler: interrupt_handler:
pha ; save A ; pha ; firmware saves A to $45 for us
; Should we save X and Y too? txa ; save X
pha
tya
pha ; save Y
bit $C404 ; can clear 6522 interrupt by reading T1C-L bit $C404 ; can clear 6522 interrupt by reading T1C-L
@ -437,6 +442,12 @@ not_done:
done_interrupt: done_interrupt:
pla pla
tay ; restore y
pla
tax ; restore X
lda $45 ; restore A
rti rti

Binary file not shown.