mirror of
https://github.com/cc65/cc65.git
synced 2024-12-26 08:32:00 +00:00
Change the sematics of callirq and the existing interruptors: The interrupts
must now return carry set if the interrupt has been handled, and carry clear if not. The callirq routine will stop calling handlers with the first handler that claims to have handled the interrupt. callirq will return the carry flag to the caller as it came from the last interruptor called. git-svn-id: svn://svn.cc65.org/cc65/trunk@3491 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
2a688ef6fd
commit
cbdcab4fdb
@ -269,7 +269,9 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context
|
||||
; (so be careful).
|
||||
; (so be careful). The routine MUST return carry set if the interrupt has been
|
||||
; 'handled' - which means that the interrupt source is gone. Otherwise it
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||
@ -355,10 +357,11 @@ IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||
; Move the mouse pointer to the new X pos
|
||||
|
||||
tya
|
||||
jmp CMOVEY
|
||||
jsr CMOVEY
|
||||
|
||||
; Done
|
||||
|
||||
clc ; Interrupt not "handled"
|
||||
@SkipY: rts
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
|
@ -269,7 +269,9 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context
|
||||
; (so be careful).
|
||||
; (so be careful). The routine MUST return carry set if the interrupt has been
|
||||
; 'handled' - which means that the interrupt source is gone. Otherwise it
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda #$7F
|
||||
@ -381,9 +383,10 @@ IRQ: lda #$7F
|
||||
; Move the mouse pointer to the new X pos
|
||||
|
||||
tya
|
||||
jmp CMOVEY
|
||||
jsr CMOVEY
|
||||
|
||||
; Done
|
||||
|
||||
@SkipY: rts
|
||||
@SkipY: clc ; Interrupt not "handled"
|
||||
rts
|
||||
|
||||
|
@ -269,7 +269,9 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context
|
||||
; (so be careful).
|
||||
; (so be careful). The routine MUST return carry set if the interrupt has been
|
||||
; 'handled' - which means that the interrupt source is gone. Otherwise it
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||
@ -355,10 +357,11 @@ IRQ: lda SID_ADConv1 ; Get mouse X movement
|
||||
; Move the mouse pointer to the new X pos
|
||||
|
||||
tya
|
||||
jmp CMOVEY
|
||||
jsr CMOVEY
|
||||
|
||||
; Done
|
||||
|
||||
clc ; Interrupt not handled
|
||||
@SkipY: rts
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
|
@ -80,7 +80,9 @@ UNINSTALL:
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; IRQ entry point. Is called from the C layer as a subroutine in the
|
||||
; interrupt.
|
||||
; interrupt. The routine MUST return carry set if the interrupt has been
|
||||
; 'handled' - which means that the interrupt source is gone. Otherwise it
|
||||
; MUST return carry clear.
|
||||
|
||||
IRQ: ; cia 2 setup
|
||||
|
||||
@ -156,6 +158,8 @@ fire:
|
||||
lda #0
|
||||
sta $dc04
|
||||
|
||||
; We do never "handle" the interrupt, we use it just as a timer.
|
||||
clc
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
@ -269,7 +269,9 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context
|
||||
; (so be careful).
|
||||
; (so be careful). The routine MUST return carry set if the interrupt has been
|
||||
; 'handled' - which means that the interrupt source is gone. Otherwise it
|
||||
; MUST return carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda #$7F
|
||||
@ -381,9 +383,10 @@ IRQ: lda #$7F
|
||||
; Move the mouse pointer to the new X pos
|
||||
|
||||
tya
|
||||
jmp CMOVEY
|
||||
jsr CMOVEY
|
||||
|
||||
; Done
|
||||
|
||||
@SkipY: rts
|
||||
@SkipY: clc ; Interrupt not handled
|
||||
rts
|
||||
|
||||
|
@ -16,6 +16,11 @@
|
||||
; code avoids this by using locking mechanisms, but it's complex and
|
||||
; has a size and performance penalty.
|
||||
;
|
||||
; 3. Special semantics: An interruptor called by callirq must tell by
|
||||
; setting or resetting the carry flag if the interrupt has been handled
|
||||
; (which means that the interrupt is no longer active at the interrupt
|
||||
; source). callirq will call no other interruptors if this happens.
|
||||
;
|
||||
; As the normal condes routine, this one has the limitation of 127 table
|
||||
; entries.
|
||||
;
|
||||
@ -29,7 +34,9 @@
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
; Call all IRQ routines. The function needs to use self modifying code and
|
||||
; is thereforce placed in the data segment.
|
||||
; is thereforce placed in the data segment. It will return carry set if the
|
||||
; interrupt was handled and carry clear if not. The caller may choose to
|
||||
; ignore this at will.
|
||||
; NOTE: The routine must not be called if the table is empty!
|
||||
|
||||
.data
|
||||
@ -45,9 +52,9 @@ callirq_y:
|
||||
sta jmpvec+1 ; Modify code below
|
||||
sty index+1 ; Modify code below
|
||||
jmpvec: jsr $FFFF ; Patched at runtime
|
||||
bcs done ; Bail out if interrupt handled
|
||||
index: ldy #$FF ; Patched at runtime
|
||||
bne callirq_y
|
||||
rts
|
||||
|
||||
done: rts
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user