1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-04 13:29:35 +00:00

When disabling interrupts, restore original interrupt flag afterwards.

This commit is contained in:
Christian Groessler 2014-01-04 20:05:57 +01:00
parent d742eeca9f
commit d614fc4e64

View File

@ -122,6 +122,7 @@ INSTALL:
; need to do that here, because our mouse interrupt handler doesn't set the ; need to do that here, because our mouse interrupt handler doesn't set the
; mouse position if it hasn't changed. ; mouse position if it hasn't changed.
php
sei sei
jsr CHIDE jsr CHIDE
lda XPos lda XPos
@ -130,7 +131,7 @@ INSTALL:
lda YPos lda YPos
ldx YPos+1 ldx YPos+1
jsr CMOVEY jsr CMOVEY
cli plp
; Done, return zero (= MOUSE_ERR_OK) ; Done, return zero (= MOUSE_ERR_OK)
@ -152,9 +153,10 @@ UNINSTALL = HIDE ; Hide cursor on exit
; No return code required. ; No return code required.
HIDE: dec visible HIDE: dec visible
php
sei sei
jsr CHIDE jsr CHIDE
cli plp
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
@ -165,9 +167,10 @@ HIDE: dec visible
; No return code required. ; No return code required.
SHOW: inc visible SHOW: inc visible
php
sei sei
jsr CSHOW jsr CSHOW
cli plp
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
@ -181,6 +184,7 @@ SETBOX: sta ptr1
stx ptr1+1 ; Save data pointer stx ptr1+1 ; Save data pointer
ldy #.sizeof (MOUSE_BOX)-1 ldy #.sizeof (MOUSE_BOX)-1
php
sei sei
@L1: lda (ptr1),y @L1: lda (ptr1),y
@ -188,7 +192,7 @@ SETBOX: sta ptr1
dey dey
bpl @L1 bpl @L1
cli plp
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
@ -199,6 +203,7 @@ GETBOX: sta ptr1
stx ptr1+1 ; Save data pointer stx ptr1+1 ; Save data pointer
ldy #.sizeof (MOUSE_BOX)-1 ldy #.sizeof (MOUSE_BOX)-1
php
sei sei
@L1: lda XMin,y @L1: lda XMin,y
@ -206,7 +211,7 @@ GETBOX: sta ptr1
dey dey
bpl @L1 bpl @L1
cli plp
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
@ -217,7 +222,8 @@ GETBOX: sta ptr1
; the screen). No return code required. ; the screen). No return code required.
; ;
MOVE: sei ; No interrupts MOVE: php
sei ; No interrupts
pha pha
txa txa
@ -246,7 +252,7 @@ MOVE: sei ; No interrupts
jsr CSHOW jsr CSHOW
@Ret: cli ; Allow interrupts @Ret: plp ; Restore interrupt flag
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
@ -263,6 +269,7 @@ BUTTONS:
POS: ldy #MOUSE_POS::XCOORD ; Structure offset POS: ldy #MOUSE_POS::XCOORD ; Structure offset
php
sei ; Disable interrupts sei ; Disable interrupts
lda XPos ; Transfer the position lda XPos ; Transfer the position
sta (ptr1),y sta (ptr1),y
@ -273,7 +280,7 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset
iny iny
sta (ptr1),y sta (ptr1),y
lda YPos+1 lda YPos+1
cli ; Enable interrupts plp ; Restore interrupt flag
iny iny
sta (ptr1),y ; Store last byte sta (ptr1),y ; Store last byte