From 8168a2721fbc1a7c55ca33f02f95918110b6c3b0 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Fri, 7 Jun 2019 16:56:41 -0400 Subject: [PATCH] pt3: make interrupt handlers consistent --- pt3_lib/interrupt_handler.s | 11 ++++++++++- pt3_player/interrupt_handler.s | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/pt3_lib/interrupt_handler.s b/pt3_lib/interrupt_handler.s index d8a4a80f..085682ef 100644 --- a/pt3_lib/interrupt_handler.s +++ b/pt3_lib/interrupt_handler.s @@ -10,9 +10,18 @@ ; It then calculates if it is a BRK or not (which trashes A) ; Then it sets up the stack like an interrupt and calls 0x3fe + ; Note: the IIc is much more complicated + ; its firmware tries to decode the proper source + ; based on various things, including screen hole values + ; we bypass that by switching out ROM and replacing the + ; $fffe vector with this, but that does mean we have + ; to be sure status flag and accumulator set properly + + TIME_OFFSET EQU 13 interrupt_handler: + php ; save status flags pha ; save A ; 3 ; A is saved in $45 by firmware txa @@ -147,10 +156,10 @@ exit_interrupt: tax ; restore X pla ; restore a ; 4 - ; on II+/IIe (but not IIc) we need to do this? interrupt_smc: lda $45 ; restore A + plp rti ; return from interrupt ; 6 diff --git a/pt3_player/interrupt_handler.s b/pt3_player/interrupt_handler.s index 800a8ab4..78691e18 100644 --- a/pt3_player/interrupt_handler.s +++ b/pt3_player/interrupt_handler.s @@ -10,6 +10,14 @@ ; It then calculates if it is a BRK or not (which trashes A) ; Then it sets up the stack like an interrupt and calls 0x3fe + ; Note: the IIc is much more complicated + ; its firmware tries to decode the proper source + ; based on various things, including screen hole values + ; we bypass that by switching out ROM and replacing the + ; $fffe vector with this, but that does mean we have + ; to be sure status flag and accumulator set properly + + TIME_OFFSET EQU 13 interrupt_handler: