mirror of
https://github.com/cc65/cc65.git
synced 2024-07-05 21:29:03 +00:00
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,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 __fastcall__ set_irq (irq_handler f, void *stack_addr, size_t stack_size);
|
||||||
; void reset_irq (void);
|
; void reset_irq (void);
|
||||||
@ -7,8 +8,7 @@
|
|||||||
|
|
||||||
.export _set_irq, _reset_irq
|
.export _set_irq, _reset_irq
|
||||||
.interruptor clevel_irq, 1 ; Export as low priority IRQ handler
|
.interruptor clevel_irq, 1 ; Export as low priority IRQ handler
|
||||||
.import popax
|
.import popax, __ZP_START__
|
||||||
.importzp __ZP_START__
|
|
||||||
|
|
||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
|
||||||
@ -31,6 +31,8 @@ zpsave: .res zpsavespace
|
|||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
.proc _set_irq
|
.proc _set_irq
|
||||||
|
|
||||||
; Keep clevel_irq from being called right now
|
; Keep clevel_irq from being called right now
|
||||||
@ -77,7 +79,7 @@ zpsave: .res zpsavespace
|
|||||||
|
|
||||||
; Save our zero page locations
|
; Save our zero page locations
|
||||||
@L1: ldx #.sizeof(::zpsave)-1
|
@L1: ldx #.sizeof(::zpsave)-1
|
||||||
@L2: lda __ZP_START__,x
|
@L2: lda <__ZP_START__,x
|
||||||
sta zpsave,x
|
sta zpsave,x
|
||||||
dex
|
dex
|
||||||
bpl @L2
|
bpl @L2
|
||||||
@ -94,7 +96,7 @@ zpsave: .res zpsavespace
|
|||||||
; Copy back our zero page content
|
; Copy back our zero page content
|
||||||
ldx #.sizeof(::zpsave)-1
|
ldx #.sizeof(::zpsave)-1
|
||||||
@L3: ldy zpsave,x
|
@L3: ldy zpsave,x
|
||||||
sty __ZP_START__,x
|
sty <__ZP_START__,x
|
||||||
dex
|
dex
|
||||||
bpl @L3
|
bpl @L3
|
||||||
|
|
||||||
@ -103,4 +105,3 @@ zpsave: .res zpsavespace
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user