mirror of
https://github.com/cc65/cc65.git
synced 2025-02-10 09:31:08 +00:00
Apple2: Don't forcefully re-enable IRQ
Avoid enabling IRQ after disabling them in driver code, remember previous state instead (in case user had them disabled already).
This commit is contained in:
parent
162bc6b305
commit
852b622c43
@ -155,6 +155,7 @@ next: inc ptr1+1
|
|||||||
; Disable interrupts now because setting the slot number makes
|
; Disable interrupts now because setting the slot number makes
|
||||||
; the IRQ handler (maybe called due to some non-mouse IRQ) try
|
; the IRQ handler (maybe called due to some non-mouse IRQ) try
|
||||||
; calling the firmware which isn't correctly set up yet
|
; calling the firmware which isn't correctly set up yet
|
||||||
|
php
|
||||||
sei
|
sei
|
||||||
|
|
||||||
; Convert to and save slot number
|
; Convert to and save slot number
|
||||||
@ -211,7 +212,7 @@ next: inc ptr1+1
|
|||||||
common: jsr firmware
|
common: jsr firmware
|
||||||
|
|
||||||
; Enable interrupts and return success
|
; Enable interrupts and return success
|
||||||
cli
|
plp
|
||||||
lda #<MOUSE_ERR_OK
|
lda #<MOUSE_ERR_OK
|
||||||
ldx #>MOUSE_ERR_OK
|
ldx #>MOUSE_ERR_OK
|
||||||
rts
|
rts
|
||||||
@ -220,6 +221,7 @@ common: jsr firmware
|
|||||||
; No return code required (the driver is removed from memory on return).
|
; No return code required (the driver is removed from memory on return).
|
||||||
UNINSTALL:
|
UNINSTALL:
|
||||||
; Hide cursor
|
; Hide cursor
|
||||||
|
php
|
||||||
sei
|
sei
|
||||||
jsr CHIDE
|
jsr CHIDE
|
||||||
|
|
||||||
@ -249,7 +251,8 @@ SETBOX:
|
|||||||
; Apple II Mouse TechNote #1, Interrupt Environment with the Mouse:
|
; Apple II Mouse TechNote #1, Interrupt Environment with the Mouse:
|
||||||
; "Disable interrupts before placing position information in the
|
; "Disable interrupts before placing position information in the
|
||||||
; screen holes."
|
; screen holes."
|
||||||
: sei
|
: php
|
||||||
|
sei
|
||||||
|
|
||||||
; Set low clamp
|
; Set low clamp
|
||||||
lda (ptr1),y
|
lda (ptr1),y
|
||||||
@ -298,6 +301,7 @@ GETBOX:
|
|||||||
; the screen). No return code required.
|
; the screen). No return code required.
|
||||||
MOVE:
|
MOVE:
|
||||||
ldy slot
|
ldy slot
|
||||||
|
php
|
||||||
sei
|
sei
|
||||||
|
|
||||||
; Set y
|
; Set y
|
||||||
@ -328,9 +332,10 @@ MOVE:
|
|||||||
; no special action is required besides hiding the mouse cursor.
|
; no special action is required besides hiding the mouse cursor.
|
||||||
; No return code required.
|
; No return code required.
|
||||||
HIDE:
|
HIDE:
|
||||||
|
php
|
||||||
sei
|
sei
|
||||||
jsr CHIDE
|
jsr CHIDE
|
||||||
cli
|
plp
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; SHOW: Is called to show the mouse cursor. The mouse kernel manages a
|
; SHOW: Is called to show the mouse cursor. The mouse kernel manages a
|
||||||
@ -339,9 +344,10 @@ HIDE:
|
|||||||
; no special action is required besides enabling the mouse cursor.
|
; no special action is required besides enabling the mouse cursor.
|
||||||
; No return code required.
|
; No return code required.
|
||||||
SHOW:
|
SHOW:
|
||||||
|
php
|
||||||
sei
|
sei
|
||||||
jsr CSHOW
|
jsr CSHOW
|
||||||
cli
|
plp
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; BUTTONS: Return the button mask in A/X.
|
; BUTTONS: Return the button mask in A/X.
|
||||||
@ -360,12 +366,13 @@ POS:
|
|||||||
; struct pointed to by ptr1. No return code required.
|
; struct pointed to by ptr1. No return code required.
|
||||||
INFO:
|
INFO:
|
||||||
ldy #.sizeof(MOUSE_INFO)-1
|
ldy #.sizeof(MOUSE_INFO)-1
|
||||||
copy: sei
|
copy: php
|
||||||
|
sei
|
||||||
: lda info,y
|
: lda info,y
|
||||||
sta (ptr1),y
|
sta (ptr1),y
|
||||||
dey
|
dey
|
||||||
bpl :-
|
bpl :-
|
||||||
cli
|
plp
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
|
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
|
||||||
|
@ -304,8 +304,9 @@ IIgs:
|
|||||||
|
|
||||||
ldx Channel
|
ldx Channel
|
||||||
|
|
||||||
; Deactivate interrupts
|
php ; Deactivate interrupts
|
||||||
sei
|
sei ; if enabled
|
||||||
|
|
||||||
ldy #WR_MASTER_IRQ_RST
|
ldy #WR_MASTER_IRQ_RST
|
||||||
lda #MASTER_IRQ_SHUTDOWN
|
lda #MASTER_IRQ_SHUTDOWN
|
||||||
jsr writeSCCReg
|
jsr writeSCCReg
|
||||||
@ -334,7 +335,7 @@ IIgs:
|
|||||||
ldx #$00
|
ldx #$00
|
||||||
stx Opened ; Mark port as closed
|
stx Opened ; Mark port as closed
|
||||||
|
|
||||||
cli
|
plp ; Reenable interrupts if needed
|
||||||
: txa ; Promote char return value
|
: txa ; Promote char return value
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@ -352,7 +353,8 @@ getClockSource:
|
|||||||
; Must return an SER_ERR_xx code in a/x.
|
; Must return an SER_ERR_xx code in a/x.
|
||||||
|
|
||||||
SER_OPEN:
|
SER_OPEN:
|
||||||
sei
|
php ; Deactivate interrupts
|
||||||
|
sei ; if enabled
|
||||||
|
|
||||||
; Check if the handshake setting is valid
|
; Check if the handshake setting is valid
|
||||||
ldy #SER_PARAMS::HANDSHAKE ; Handshake
|
ldy #SER_PARAMS::HANDSHAKE ; Handshake
|
||||||
@ -497,9 +499,9 @@ BaudOK:
|
|||||||
lda #SER_ERR_OK
|
lda #SER_ERR_OK
|
||||||
|
|
||||||
SetupOut:
|
SetupOut:
|
||||||
|
plp ; Reenable interrupts if needed
|
||||||
ldx #$00 ; Promote char return value
|
ldx #$00 ; Promote char return value
|
||||||
sty Opened
|
sty Opened
|
||||||
cli
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
|
@ -29,7 +29,8 @@ iigs: bit RDVBLBAR
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
; Apple IIc TechNote #9, Detecting VBL
|
; Apple IIc TechNote #9, Detecting VBL
|
||||||
iic: sei
|
iic: php
|
||||||
|
sei
|
||||||
sta IOUDISOFF
|
sta IOUDISOFF
|
||||||
lda RDVBLMSK
|
lda RDVBLMSK
|
||||||
bit ENVBL
|
bit ENVBL
|
||||||
@ -40,7 +41,7 @@ iic: sei
|
|||||||
bcs :+ ; VBL interrupts were already enabled
|
bcs :+ ; VBL interrupts were already enabled
|
||||||
bit DISVBL
|
bit DISVBL
|
||||||
: sta IOUDISON ; IIc Tech Ref Man: The firmware normally leaves IOUDIS on.
|
: sta IOUDISON ; IIc Tech Ref Man: The firmware normally leaves IOUDIS on.
|
||||||
cli
|
plp
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endif ; __APPLE2ENH__
|
.endif ; __APPLE2ENH__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user