Switcher

Changeset

11:4f0db3c74565
2015-08-16 Paul Boddie raw files shortlog changelog graph Added a subroutine to restore the previous interrupt handler.
switcher.oph (file)
     1.1 --- a/switcher.oph	Sun Jun 28 23:30:02 2015 +0200
     1.2 +++ b/switcher.oph	Sun Aug 16 21:49:17 2015 +0200
     1.3 @@ -96,6 +96,7 @@
     1.4      ; return here with the initial main program stack
     1.5  
     1.6  main_end:
     1.7 +    jsr restore_handler
     1.8      rts
     1.9  
    1.10  
    1.11 @@ -125,6 +126,18 @@
    1.12  
    1.13  
    1.14  
    1.15 +; restore the old interrupt handler address to IRQ1V
    1.16 +;
    1.17 +; affects: A
    1.18 +
    1.19 +restore_handler:
    1.20 +    sei
    1.21 +    .invoke mov16 old_handler, IRQ1V
    1.22 +    cli
    1.23 +    rts
    1.24 +
    1.25 +
    1.26 +
    1.27  ; handle interrupts
    1.28  ;
    1.29  ; affects: (temporary stack usage)