changeset 2656:2ebf5e737ceb

Updated to address Atari port problems
author Boisy Pitre <boisy.pitre@nuance.com>
date Wed, 11 Apr 2012 21:21:22 -0500
parents ead54d2c06d4
children 90d13dbd887a
files defs/atari.d level1/atari/modules/dwread.asm level1/atari/modules/dwwrite.asm level1/atari/modules/vtio.asm level1/modules/clock.asm level1/modules/clock2_dw3.asm level1/modules/rbdw3.asm
diffstat 7 files changed, 96 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/defs/atari.d	Tue Apr 10 22:25:19 2012 -0500
+++ b/defs/atari.d	Wed Apr 11 21:21:22 2012 -0500
@@ -112,6 +112,14 @@
 * (Yes, we are stealing an existing variable that is so old it should be
 *  removed from os9defs)
 D.IRQENShdw    equ       D.WDBtDr
+D.ATARIFLAGS   equ       D.SWPage
+
+* The clock interrupt is driven by the unmaskable NMI.  Therefore,
+* the rbdw3 driver uses the DWIOSEMA flag in the D.ATARIFLAGS field as
+* a signal, setting it before doing an DW operation and clearing it after.
+* The clock ISR checks if this flag is set, and, if so, defers the OP_TIME
+* command to the server.
+DWIOSEMA       equ       %10000000
 
 
 ********************************************************************
--- a/level1/atari/modules/dwread.asm	Tue Apr 10 22:25:19 2012 -0500
+++ b/level1/atari/modules/dwread.asm	Wed Apr 11 21:21:22 2012 -0500
@@ -24,7 +24,7 @@
 *          ora       #%00100000
 * enable the serial input interrupt
           
-          ldb       SERIN               read what is in the buffer
+          ldb  SERIN               read what is in the buffer
           lda	#$13
           sta	SKCTL
           sta	SKRES
@@ -56,19 +56,11 @@
           bne       inloop@
           stx       4,s
 bye
-          bsr       CleanUp
+          sta	     SKRES          clear framing or data input overrun bits
           puls      cc,a,x,y,u,pc
 outtahere@
-          clr       SKRES          clear framing or data input overrun bits
-          bsr       CleanUp
+          sta	     SKRES          clear framing or data input overrun bits
           puls      cc,a
           stx       2,s
           orcc      #$01
           puls      x,y,u,pc
-          
-CleanUp   lda       #$40
-          lda	#$23
-          sta	SKCTL
-          sta	SKRES
-*          sta       AUDC4	reset POKEY
-          rts
--- a/level1/atari/modules/dwwrite.asm	Tue Apr 10 22:25:19 2012 -0500
+++ b/level1/atari/modules/dwwrite.asm	Wed Apr 11 21:21:22 2012 -0500
@@ -15,7 +15,7 @@
 * into 6809 assembly language by Boisy G. Pitre.
 *
 RMSEND    equ       %11101111
-SKSEND    equ       $23
+SKSEND    equ       %00100011
 MSKSEND   equ       %00010000
 IMSEND    equ       %00010000
 IMSCPL    equ       $08
--- a/level1/atari/modules/vtio.asm	Tue Apr 10 22:25:19 2012 -0500
+++ b/level1/atari/modules/vtio.asm	Wed Apr 11 21:21:22 2012 -0500
@@ -523,9 +523,8 @@
 		orb	#%11000000
 		sta	IRQEN
 		stb	D.IRQENShdw
-		puls cc
 		stb	IRQEN
-		rts
+		puls cc,pc
 		
 ATASCI	fcb	$6C,$6A,$3B,$80,$80,$6B,$2B,$2A ;LOWER CASE
 		fcb	$6F,$80,$70,$75,$0D,$69,$2D,$3D
--- a/level1/modules/clock.asm	Tue Apr 10 22:25:19 2012 -0500
+++ b/level1/modules/clock.asm	Wed Apr 11 21:21:22 2012 -0500
@@ -150,7 +150,7 @@
           IFNE atari
 * Atari - Tell ANTIC to assert NMI on Vertical Blank
      	lda     #$40
-     	sta     $D40E		enable VBlank NMI
+     	sta     NMIEN		enable VBlank NMI
           rts
           ELSE
          ldx   #PIA0Base  point to PIA0
@@ -183,9 +183,8 @@
          clra            
          tfr   a,dp       set direct page to zero
          IFNE  atari
-          sta   $D40F     clear NMI interrupt
-         ELSE
-         tst   PIA0Base+3 get hw byte
+         sta   NMIRES     clear NMI interrupt
+         ELSE         tst   PIA0Base+3 get hw byte
          bmi   L0032      branch if sync flag on
          jmp   [>D.SvcIRQ] else service other possible IRQ
 L0032    tst   PIA0Base+2 clear interrupt
--- a/level1/modules/clock2_dw3.asm	Tue Apr 10 22:25:19 2012 -0500
+++ b/level1/modules/clock2_dw3.asm	Wed Apr 11 21:21:22 2012 -0500
@@ -46,6 +46,10 @@
           nop
 
 SetTime   pshs      u,y,x,d
+          IFNE      atari
+          tst       D.ATARIFLAGS
+          bmi       UpdLeave
+          ENDC
           IFGT      Level-1
           ldu       <D.DWSubAddr
           ELSE
@@ -63,18 +67,21 @@
           jsr       DW$Write,u
           bra       UpdLeave
 
-GetTime   pshs      u,y,x,d
+GetTime 
+          lda       #OP_TIME        Time packet
+          pshs      u,y,x,d
+          IFNE      atari
+          tst       D.ATARIFLAGS
+          bmi       UpdLeave
+          ENDC
           IFGT      Level-1
           ldu       <D.DWSubAddr
           ELSE
           ldu       >D.DWSubAddr
           ENDC
           beq       UpdLeave      in case we failed to link it, just exit
-          lda       #OP_TIME        Time packet
-          sta       ,s
           leax      ,s
           ldy       #$0001
-          beq       UpdLeave      in case we failed to link it, just exit
           jsr       DW$Write,u
           ldx       #D.Year
           ldy       #$0006
--- a/level1/modules/rbdw3.asm	Tue Apr 10 22:25:19 2012 -0500
+++ b/level1/modules/rbdw3.asm	Wed Apr 11 21:21:22 2012 -0500
@@ -77,25 +77,35 @@
 *    B  = error code
 *
 Term
-          clrb
-          pshs cc
+         clrb
+         pshs cc
 * Send OP_TERM to the server
           IFGT  LEVEL-1
-          ldu   <D.DWSubAddr
-          ELSE
-          ldu   >D.DWSubAddr
-          ENDC
+         ldu   <D.DWSubAddr
+         ELSE
+         ldu   >D.DWSubAddr
+         ENDC
 * Fix crash in certain cases
-          beq   no@
-          ldy   #$0001
-          lda   #OP_TERM
-          pshs a
-          leax ,s
-          orcc  #IntMasks
-          jsr   DW$Write,u
-          clrb
-          puls a
-no@       puls cc,pc
+         beq   no@
+         ldy   #$0001
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         ora   #DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
+         lda   #OP_TERM
+         pshs a
+         leax ,s
+         orcc  #IntMasks
+         jsr   DW$Write,u
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         anda  #^DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
+         clrb
+         puls a
+no@      puls cc,pc
 
 * Init
 *
@@ -148,12 +158,22 @@
          stu   >D.DWSubAddr
          ENDC
 * Initialize the low level device
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         ora   #DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
          jsr   DW$Init,u
          lda   #OP_INIT
          sta   ,s
          leax  ,s
          ldy   #$0001
          jsr   DW$Write,u
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         anda  #^DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
          clrb
 
 InitEx
@@ -213,13 +233,18 @@
          ldb   #E$Unit
          bra   ReadEr2
 Read1    sta   driveno,u
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         ora   #DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
          lda   #OP_READEX		load A with READ opcode
          
 Read2
          ldb   driveno,u
          leax  ,s
          std   ,x
-         ldy    #5 
+         ldy   #5 
          IFGT  LEVEL-1
          ldu   <D.DWSubAddr
          ELSE
@@ -244,9 +269,9 @@
          leax  ,s
          ldy   #$0001
          jsr   DW$Read,u
+         puls  d
          bcs   ReadEr0			branch if we timed out
          bne   ReadEr0
-         puls  d
          tfr   a,b				transfer byte to B (in case of error)
          tstb					is it zero?
          beq   ReadEx			if not, exit with error
@@ -258,12 +283,17 @@
          
          lda   #OP_REREADEX		reread opcode
          bra   Read2			and try getting sector again
-ReadEr0 puls  d
+ReadEr0 
 ReadEr1  ldb   #E$Read			read error
 ReadEr2  lda   9,s
          ora   #Carry
          sta   9,s
 ReadEx   leas  5,s
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         anda  #^DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
          puls  y,u
          puls  cc,pc
 
@@ -283,6 +313,11 @@
          sta   retries,u
          pshs  cc
          pshs  u,y,x,b,a,cc
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         ora   #DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
 * Send out op code and 3 byte LSN
          lda   PD.DRV,y
          cmpa  #NumDrvs
@@ -340,6 +375,11 @@
          ora   #Carry
          sta   9,s
 WritEx   leas  5,s
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         anda  #^DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
          puls  y,u
          puls  cc,pc
  
@@ -373,6 +413,11 @@
 *    B  = error code
 *
 GetStat  
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         ora   #DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
          lda   #OP_GETSTA
          clrb				clear Carry
          pshs  cc			and push CC on stack
@@ -391,6 +436,11 @@
          ENDC
          jsr   6,u
          leas  3,s
+         IFNE  atari
+         lda   D.ATARIFLAGS
+         anda  #^DWIOSEMA
+         sta   D.ATARIFLAGS
+         ENDC
          puls  cc,pc
 		 
          emod