changeset 2634:a34c08cdfcb2

Stable dwread/dwrite... pipeman also assembles.
author Boisy Pitre <boisy.pitre@nuance.com>
date Mon, 27 Feb 2012 19:54:55 -0600
parents 41313184bd78
children 1a75c932f607
files defs/atari.d defs/drivewire.d level1/atari/bootfiles/makefile level1/atari/bootroms/liber809.asm level1/atari/modules/dwread.asm level1/atari/modules/dwwrite.asm level1/modules/clock2_dw3.asm level1/modules/pipeman.asm
diffstat 8 files changed, 173 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/defs/atari.d	Sun Feb 26 23:34:13 2012 -0600
+++ b/defs/atari.d	Mon Feb 27 19:54:55 2012 -0600
@@ -216,6 +216,15 @@
 RANDOM	EQU	$D20A	;random number generator
 SERIN	EQU	$D20D	;serial port input
 IRQST	EQU	$D20E	;IRQ interrupt status
+IRQST.BREAKDOWN     equ  %10000000
+IRQST.KEYDOWN       equ  %01000000
+IRQST.SERINRDY      equ  %00100000
+IRQST.SEROUTNEEDED  equ  %00010000
+IRQST.SEROUTDONE    equ  %00001000
+IRQST.TIMER4        equ  %00000100
+IRQST.TIMER2        equ  %00000010
+IRQST.TIMER1        equ  %00000001
+
 SKSTAT	EQU	$D20F	;serial port and keyboard status
 
 *	Write Addresses
@@ -237,8 +246,22 @@
 POTGO	EQU	$D20B	;start potentiometer scan sequence
 SEROUT	EQU	$D20D	;serial port output
 IRQEN	EQU	$D20E	;IRQ interrupt enable
+IRQEN.BREAKDOWN     equ  %10000000
+IRQEN.KEYDOWN       equ  %01000000
+IRQEN.SERINRDY      equ  %00100000
+IRQEN.SEROUTNEEDED  equ  %00010000
+IRQEN.SEROUTDONE    equ  %00001000
+IRQEN.TIMER4        equ  %00000100
+IRQEN.TIMER2        equ  %00000010
+IRQEN.TIMER1        equ  %00000001
+
 SKCTL	EQU	$D20F	;serial port and keyboard control
-
+SKCTL.FORECEBREAK   equ  %10000000
+SKCTL.SERMODECTRLMASK equ  %01110000
+SKCTL.TWOTONEMODE   equ  %00001000
+SKCTL.FASTPOTSCAN   equ  %00000100
+SKCTL.KEYBRDSCAN    equ  %00000010
+SKCTL.KEYDEBOUNCE   equ  %00000001
 
 **	PIA Address Equates
 PIA	EQU	$D300	;PIA area
--- a/defs/drivewire.d	Sun Feb 26 23:34:13 2012 -0600
+++ b/defs/drivewire.d	Mon Feb 27 19:54:55 2012 -0600
@@ -22,8 +22,9 @@
 OP_RESET1   equ    $FE		Server Reset
 OP_RESET2   equ    $FF		Server Reset
 OP_RESET3   equ    $F8		Server Reset
-OP_DWINIT	equ	   'Z		DriveWire dw3 init/OS9 boot
+OP_DWINIT	  equ    'Z		DriveWire dw3 init/OS9 boot
 OP_TIME     equ    '#	 	Current time requested
+OP_SETTIME  equ    '$	 	Current time requested
 OP_INIT     equ    'I		Init routine called
 OP_READ     equ    'R		Read one sector
 OP_REREAD   equ    'r		Re-read one sector
@@ -74,8 +75,20 @@
 DW.VIRQPkt rmb   Vi.PkSz
 DW.VIRQNOP rmb   1
 
+
+*****************************************
+* dw3 subroutine module entry points
+*
+DW$Init   equ  0
+DW$Read   equ  3
+DW$Write  equ  6
+DW$Term   equ  9
+
+
+
+*****************************************
 * SCF Multi Terminal Driver Definitions
-
+*
          	org   	        V.SCF      	;V.SCF: free memory for driver to use
 SSigID          rmb             1              ;process ID for signal on data ready
 SSigSg          rmb             1              ;signal on data ready code
--- a/level1/atari/bootfiles/makefile	Sun Feb 26 23:34:13 2012 -0600
+++ b/level1/atari/bootfiles/makefile	Mon Feb 27 19:54:55 2012 -0600
@@ -11,13 +11,13 @@
 BOOTFILE_P1 = $(MD)/krnp2 $(MD)/init \
 		$(MD)/ioman $(MD)/scf.mn $(MD)/vtio.dr $(MD)/term.dt \
 		$(MD)/sysgo \
-		$(MD)/clock_60hz $(MD)/clock2_dw3 \
+		$(MD)/clock_60hz $(MD)/clock2_soft \
 		$(MD)/krn
 
 BOOTFILE_P2 = $(MD)/rbf.mn $(MD)/rbdw3.dr \
 		$(MD)/x0.dd $(MD)/x1.dd $(MD)/dw3.sb \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
-		$(CD)/shell_21 $(CD)/date
+		$(CD)/shell_21 $(CD)/ded
 
 BOOTFILES	= bootfile
 
--- a/level1/atari/bootroms/liber809.asm	Sun Feb 26 23:34:13 2012 -0600
+++ b/level1/atari/bootroms/liber809.asm	Mon Feb 27 19:54:55 2012 -0600
@@ -131,7 +131,7 @@
 green     clra
 gl@       inca
           sta  COLBK
-          lbsr  Wait
+          lbrn $0000
           cmpx ,s
           bra  gl@
 
--- a/level1/atari/modules/dwread.asm	Sun Feb 26 23:34:13 2012 -0600
+++ b/level1/atari/modules/dwread.asm	Mon Feb 27 19:54:55 2012 -0600
@@ -33,7 +33,7 @@
 inloop@
           ora       #%00100000
           sta       IRQEN
-          lda       1,s
+          lda       #$20
           clrb
 loop@
           subd      #$0001
--- a/level1/atari/modules/dwwrite.asm	Sun Feb 26 23:34:13 2012 -0600
+++ b/level1/atari/modules/dwwrite.asm	Mon Feb 27 19:54:55 2012 -0600
@@ -11,38 +11,54 @@
 *    Y  = 0
 *    All others preserved
 *
-SKSEND    equ   $23
-MSKSEND   equ   %00010000
-DWWrite        
+* Based on the hipatch source for the Atari and translated
+* into 6809 assembly language by Boisy G. Pitre.
+*
+RMSEND    equ       %11101111
+SKSEND    equ       $23
+MSKSEND   equ       %00010000
+IMSEND    equ       %00010000
+IMSCPL    equ       $08
+DWWrite
+          andcc     #^$01               ; clear carry to assume no error
           pshs      d,cc
-          orcc      #$50
-*          lda	    #SKSEND
-*          sta	    SKCTL
-*          sta	    SKRES
-          lda       D.IRQENSHDW
-byteloop@
-          ora       #%00001000
+; setup pokey
+          lda       #$28
+          sta       AUDCTL
+*          lda       #$A0
+          lda       #$A8
+          sta       AUDC4
+* short delay before send
+          clra
+shortdelay@
+          deca
+          bne       shortdelay@
+          orcc      #$50                ; mask interrupts
+          lda	     #SKSEND        	; set pokey to transmit data mode
+          sta	     SKCTL
+          sta	     SKRES
+          lda       #MSKSEND
           sta       IRQEN
           lda       ,x+
           sta       SEROUT
+          leay      -1,y
+          beq       ex@
+byteloop@
+          lda       ,x+
+          ldb       #IMSEND
 waitloop@
-          ldb       IRQST
-          bitb      #%00001000
+          bitb      IRQST
           bne       waitloop@
-          lbsr      Wait
-          lda       D.IRQENSHDW
-          sta       IRQEN
+          ldb       #RMSEND
+          stb       IRQEN
+          ldb       D.IRQENSHDW
+          orb       #MSKSEND
+          stb       IRQEN
+          sta       SEROUT
           leay      -1,y
           bne       byteloop@
 ex@
-          clrb
+          lda       #IMSCPL
+wt        bita      IRQST	; wait until transmit complete
+          bne       wt
           puls      cc,d,pc
-
-Wait
-          pshs      x
-          ldx       #$100
-wait@          
-          leax      -1,x
-          bne       wait@
-          puls      x,pc
-          
--- a/level1/modules/clock2_dw3.asm	Sun Feb 26 23:34:13 2012 -0600
+++ b/level1/modules/clock2_dw3.asm	Mon Feb 27 19:54:55 2012 -0600
@@ -12,88 +12,110 @@
 *   2      2010/01/02  Boisy G. Pitre
 * Saved some bytes by optimizing
 
-         nam   Clock2
-         ttl   DriveWire 3 RTC Driver
+          nam       Clock2
+          ttl       DriveWire 3 RTC Driver
 
-         ifp1            
-         use   defsfile  
-         endc            
+          ifp1            
+          use       defsfile  
+          use       drivewire.d  
+          endc            
 
-tylg     set   Sbrtn+Objct
-atrv     set   ReEnt+rev
-rev      set   $00
-edition  set   2
+tylg      set       Sbrtn+Objct
+atrv      set       ReEnt+rev
+rev       set       $00
+edition   set       2
 
 
-RTC.Base equ   $0000     
+RTC.Base  equ       $0000     
 
-         mod   eom,name,tylg,atrv,JmpTable,RTC.Base
+          mod       eom,name,tylg,atrv,JmpTable,RTC.Base
 
-name     fcs   "Clock2"  
-         fcb   edition
+name      fcs       "Clock2"  
+          fcb       edition
 
-subname  fcs   "dw3"
+subname   fcs       "dw3"
 
 * Three Entry Points:
 *   - Init
 *   - GetTime
 *   - SetTIme
 JmpTable                 
-         bra   Init
-         nop
-         bra   GetTime   	RTC Get Time
-         nop
-ex       rts			RTC Set Time
+          bra       Init
+          nop
+          bra       GetTime   	RTC Get Time
+
 
-GetTime  pshs  u,y,x,b
-         lda   #'#        Time packet
-	 sta   ,s
-	 leax  ,s
-	 ldy   #$0001
-         IFGT  Level-1
-         ldu   <D.DWSubAddr
-         ELSE
-         ldu   >D.DWSubAddr
-         ENDC
-         beq   UpdLeave      in case we failed to link it, just exit
-	 jsr   6,u
-* Consider the following optimization
-         ldx   #D.Year
-	 ldy   #$0006
-         jsr   3,u
-UpdLeave puls  b,x,y,u,pc
+SetTime   pshs      u,y,x,d
+          IFGT      Level-1
+          ldu       <D.DWSubAddr
+          ELSE
+          ldu       >D.DWSubAddr
+          ENDC
+          beq       UpdLeave      in case we failed to link it, just exit
+          ldx       #D.Year
+          ldd       4,x
+          pshs      d
+          ldd       2,x
+          pshs      d
+          ldd       ,x
+          pshs      d
+          lda       #OP_SETTIME
+          pshs      a
+          leax      ,s
+          ldy       #$0007
+          jsr       DW$Write,u
+          leas      7,s
+          bra       UpdLeave
+
+
+GetTime   pshs      u,y,x,d
+          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
+          jsr       DW$Read,u
+UpdLeave  puls      d,x,y,u,pc
 
 
 Init     
 * Check if subroutine already linked
-         IFGT    Level-1
-         ldx     <D.DWSubAddr
-         ELSE
-         ldx     >D.DWSubAddr
-         ENDC
-         bne     leave
-         IFGT    Level-1
-         ldx     <D.Proc
-         pshs    x
-         ldx     <D.SysPrc
-         stx     <D.Proc
-         ENDC
-         leax    subname,pcr
-         clra
-         os9     F$Link
-         IFGT    Level-1
-         puls    x
-         stx     <D.Proc
-         bcs     ex
-         sty     <D.DWSubAddr
-         ELSE
-         bcs     ex
-         sty     >D.DWSubAddr
-         ENDC
-         jmp     ,y			call initialization routine
-leave    rts
+          IFGT      Level-1
+          ldx       <D.DWSubAddr
+          ELSE
+          ldx       >D.DWSubAddr
+          ENDC
+          bne       leave
+          IFGT      Level-1
+          ldx       <D.Proc
+          pshs      x
+          ldx       <D.SysPrc
+          stx       <D.Proc
+          ENDC
+          leax      subname,pcr
+          clra
+          os9       F$Link
+          IFGT      Level-1
+          puls      x
+          stx       <D.Proc
+          bcs       leave
+          sty       <D.DWSubAddr
+          ELSE
+          bcs       leave
+          sty       >D.DWSubAddr
+          ENDC
+          jmp       ,y			call initialization routine
+leave     rts
 
-         emod          
-eom      equ   *         
-         end             
-
+          emod          
+eom       equ   *         
+          end             
--- a/level1/modules/pipeman.asm	Sun Feb 26 23:34:13 2012 -0600
+++ b/level1/modules/pipeman.asm	Mon Feb 27 19:54:55 2012 -0600
@@ -45,7 +45,7 @@
          ifp1
          use   defsfile
          use   pipedefs
-         use   scfdefs
+         use   scf.d
          endc
 
 tylg     set   FlMgr+Objct