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.
This commit is contained in:
parent
a85ac88fca
commit
9c55bd1c96
1 changed files with 7 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue