]> git.sur5r.net Git - cc65/commitdiff
Merge pull request #78 from groessler/something_to_pull
authorOliver Schmidt <ol.sc@web.de>
Thu, 30 Jan 2014 08:20:53 +0000 (00:20 -0800)
committerOliver Schmidt <ol.sc@web.de>
Thu, 30 Jan 2014 08:20:53 +0000 (00:20 -0800)
change mouse drivers to be more "floppy access" friendly

asminc/atari.inc
libsrc/atari/mou/atrst.s

index da926af813b95b627dd28c417b6d1a21d31834ac..7b647fd0a29c802cf17d545cd2fc16d9c41f59f1 100644 (file)
@@ -318,7 +318,7 @@ APPMHI  = $0E           ;APPLICATIONS MEMORY HI LIMIT
 
 INTZBS  = $10           ;INTERRUPT HANDLER
 
-POKMSK  = $10           ;SYSTEM MASK FOR POKEY IRQ ENABLE
+POKMSK  = $10           ;SYSTEM MASK FOR POKEY IRQ ENABLE (shadow of IRQEN)
 BRKKEY  = $11           ;BREAK KEY FLAG
 RTCLOK  = $12           ;REAL TIME CLOCK (IN 16 MSEC UNITS>
 BUFADR  = $15           ;INDIRECT BUFFER ADDRESS REGISTER
index 116cecee2f4a573829569bae93305466d00e63c7..773e171e1edb4b24756e7010a11ef744facf9dd3 100644 (file)
@@ -446,6 +446,14 @@ IOCTL:  lda     #<MOUSE_ERR_INV_IOCTL     ; We don't support ioclts for now
 
 IRQ:
 
+; Turn mouse polling IRQ back on in case it disabled itself due to CRITIC
+; flag being set.
+
+        lda     POKMSK
+        ora     #%00000001              ; timer 1 enable
+        sta     POKMSK
+        sta     IRQEN
+
 ; Check for a pressed button and place the result into Buttons
 
         ldx     #0
@@ -514,7 +522,12 @@ IRQ:
 ; T1Han: Local IRQ routine to poll mouse
 ;
 
-T1Han:  tya
+T1Han:  lda     CRITIC                  ; if CRITIC flag is set, disable the
+        bne     disable_me              ; high frequency polling IRQ, in order
+                                        ; not to interfere with SIO I/O (e.g.
+                                        ; floppy access)
+
+        tya
         pha
         txa
         pha
@@ -695,3 +708,22 @@ mmexit: sty     oldval
         pla
         rti
 .endif
+
+
+; Disable the interrupt source which caused us to be called.
+; The interrupt will be enabled again by the "IRQ" routine.
+; The "IRQ" routine, despite its name, is called from the
+; vertical blank NMI interrupt *only* if the CRITIC flag has
+; been cleared.
+
+disable_me:
+        lda     POKMSK
+        and     #%11111110              ; timer 1 disable
+        sta     IRQEN
+        sta     POKMSK
+.ifdef  __ATARIXL__
+        rts
+.else
+        pla
+        rti
+.endif