From: Greg King Date: Wed, 26 Aug 2015 23:29:39 +0000 (-0400) Subject: Fixed bugs in the interface for C-level interrupt handlers. X-Git-Tag: V2.16~237^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9c55bd1c96e1910d0d46e66abd4fa2fe7fdadf4a;p=cc65 Fixed bugs in the interface for C-level interrupt handlers. * Added an important ".code" directive. * Import a linker-created zero-page symbol as an absolute address; then, convert it to zero-page when it is used. Fixes bug report #198. --- diff --git a/libsrc/common/interrupt.s b/libsrc/common/interrupt.s index e1d53d6dc..950d3d787 100644 --- a/libsrc/common/interrupt.s +++ b/libsrc/common/interrupt.s @@ -1,5 +1,6 @@ ; -; Oliver Schmidt, 2012-01-18 +; 2012-01-18, Oliver Schmidt +; 2015-08-22, Greg King ; ; void __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size); ; void reset_irq (void); @@ -7,8 +8,7 @@ .export _set_irq, _reset_irq .interruptor clevel_irq, 1 ; Export as low priority IRQ handler - .import popax - .importzp __ZP_START__ + .import popax, __ZP_START__ .include "zeropage.inc" @@ -31,6 +31,8 @@ zpsave: .res zpsavespace ; --------------------------------------------------------------------------- +.code + .proc _set_irq ; Keep clevel_irq from being called right now @@ -77,7 +79,7 @@ zpsave: .res zpsavespace ; Save our zero page locations @L1: ldx #.sizeof(::zpsave)-1 -@L2: lda __ZP_START__,x +@L2: lda <__ZP_START__,x sta zpsave,x dex bpl @L2 @@ -94,7 +96,7 @@ zpsave: .res zpsavespace ; Copy back our zero page content ldx #.sizeof(::zpsave)-1 @L3: ldy zpsave,x - sty __ZP_START__,x + sty <__ZP_START__,x dex bpl @L3 @@ -103,4 +105,3 @@ zpsave: .res zpsavespace rts .endproc -