changeset 2324:ccd33b48321a

Renamed scdwt to scdwn, t/u to n descriptors
author boisy
date Tue, 12 Jan 2010 21:43:57 +0000
parents 190820cc58f0
children c8aeac0c5fd1
files level1/coco/bootfiles/makefile level1/coco/modules/makefile level1/modules/dwtdesc.asm level1/modules/scdwn.asm level1/modules/scdwndesc.asm level1/modules/scdwt.asm level2/coco3/bootfiles/makefile level2/coco3/modules/makefile level2/coco3_6309/bootfiles/makefile level2/coco3_6309/modules/makefile
diffstat 10 files changed, 700 insertions(+), 702 deletions(-) [+]
line wrap: on
line diff
--- a/level1/coco/bootfiles/makefile	Tue Jan 12 12:45:33 2010 +0000
+++ b/level1/coco/bootfiles/makefile	Tue Jan 12 21:43:57 2010 +0000
@@ -61,9 +61,9 @@
 		$(MD)/rbdw3.dr $(MD)/dw3_coco1.sb \
 		$(MD)/ddx0.dd $(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd \
 		$(MD)/scf.mn \
-		$(MD)/scdwt.dr $(MD)/term_scdwt.dt \
-		$(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-		$(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
+		$(MD)/scdwn.dr $(MD)/term_scdwn.dt \
+		$(MD)/n1_scdwn.dd $(MD)/n2_scdwn.dd $(MD)/n3_scdwn.dd \
+		$(MD)/n4_scdwn.dd $(MD)/n5_scdwn.dd $(MD)/n6_scdwn.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3 \
@@ -76,9 +76,9 @@
 		$(MD)/ddx0.dd $(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd \
 		$(MD)/scf.mn \
 		$(MD)/vtio.dr $(MD)/covdg.io $(MD)/term32.dt \
-		$(MD)/scdwt.dr $(MD)/t0_scdwt.dd \
-		$(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-		$(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
+		$(MD)/scdwn.dr $(MD)/n0_scdwn.dd \
+		$(MD)/n1_scdwn.dd $(MD)/n2_scdwn.dd $(MD)/n3_scdwn.dd \
+		$(MD)/n4_scdwn.dd $(MD)/n5_scdwn.dd $(MD)/n6_scdwn.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3 \
@@ -89,9 +89,9 @@
 		$(MD)/rbdw3.dr $(MD)/dw3.sb \
 		$(MD)/ddx0.dd $(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd \
 		$(MD)/scf.mn \
-		$(MD)/scdwt.dr $(MD)/term_scdwt.dt \
-                $(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-                $(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
+		$(MD)/scdwn.dr $(MD)/term_scdwn.dt \
+                $(MD)/n1_scdwn.dd $(MD)/n2_scdwn.dd $(MD)/n3_scdwn.dd \
+                $(MD)/n4_scdwn.dd $(MD)/n5_scdwn.dd $(MD)/n6_scdwn.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3 \
@@ -104,9 +104,9 @@
 		$(MD)/ddx0.dd $(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd \
 		$(MD)/scf.mn \
 		$(MD)/vtio.dr $(MD)/covdg.io $(MD)/term32.dt \
-		$(MD)/scdwt.dr $(MD)/t0_scdwt.dd \
-                $(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-                $(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
+		$(MD)/scdwn.dr $(MD)/n0_scdwn.dd \
+                $(MD)/n1_scdwn.dd $(MD)/n2_scdwn.dd $(MD)/n3_scdwn.dd \
+                $(MD)/n4_scdwn.dd $(MD)/n5_scdwn.dd $(MD)/n6_scdwn.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3 \
@@ -131,9 +131,9 @@
 		$(MD)/ddx0.dd $(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd \
 		$(MD)/scf.mn \
 		$(MD)/vtio.dr $(MD)/cohr.io $(MD)/term51.dt \
-		$(MD)/scdwt.dr $(MD)/t0_scdwt.dd \
-                $(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-                $(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
+		$(MD)/scdwn.dr $(MD)/n0_scdwn.dd \
+                $(MD)/n1_scdwn.dd $(MD)/n2_scdwn.dd $(MD)/n3_scdwn.dd \
+                $(MD)/n4_scdwn.dd $(MD)/n5_scdwn.dd $(MD)/n6_scdwn.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3 \
@@ -146,9 +146,9 @@
 		$(MD)/ddx0.dd $(MD)/x1.dd $(MD)/x2.dd $(MD)/x3.dd \
 		$(MD)/scf.mn \
 		$(MD)/vtio.dr $(MD)/cohr.io $(MD)/term51.dt \
-		$(MD)/scdwt.dr $(MD)/t0_scdwt.dd \
-                $(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-                $(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
+		$(MD)/scdwn.dr $(MD)/n0_scdwn.dd \
+                $(MD)/n1_scdwn.dd $(MD)/n2_scdwn.dd $(MD)/n3_scdwn.dd \
+                $(MD)/n4_scdwn.dd $(MD)/n5_scdwn.dd $(MD)/n6_scdwn.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3 \
--- a/level1/coco/modules/makefile	Tue Jan 12 12:45:33 2010 +0000
+++ b/level1/coco/modules/makefile	Tue Jan 12 21:43:57 2010 +0000
@@ -43,10 +43,10 @@
 		nil.dd p_scbbp.dd p_scdwp.dd pipe.dd ssp.dd \
 		term_scbbt.dt term_sc6551.dt t1_scbbt.dd t2_sc6551.dd t3_sc6551.dd \
 		term32.dt term51.dt \
-		scdwt.dr term_scdwt.dt t0_scdwt.dd t1_scdwt.dd t2_scdwt.dd \
-		t3_scdwt.dd t4_scdwt.dd t5_scdwt.dd t6_scdwt.dd t7_scdwt.dd \
-		u0_scdwt.dd u1_scdwt.dd u2_scdwt.dd u3_scdwt.dd u4_scdwt.dd \
-		u5_scdwt.dd u6_scdwt.dd
+		scdwn.dr term_scdwn.dt n0_scdwn.dd n1_scdwn.dd n2_scdwn.dd \
+		n3_scdwn.dd n4_scdwn.dd n5_scdwn.dd n6_scdwn.dd n7_scdwn.dd \
+		n8_scdwn.dd n9_scdwn.dd n10_scdwn.dd n11_scdwn.dd n12_scdwn.dd \
+		n13_scdwn.dd n14_scdwn.dd
 
 PIPE		= pipeman.mn \
 		piper.dr \
@@ -143,53 +143,53 @@
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) $(DSDD80) -aDNum=2
 
 # DriveWire 3 SCF descriptors
-term_scdwt.dt: dwtdesc.asm
+term_scdwn.dt: scdwndesc.asm
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aTERM=1 -aAddr=0
 
-t0_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=0 -aTNum=0
+n0_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=0
 
-t1_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=1 -aTNum=1
+n1_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=1
 
-t2_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=2 -aTNum=2
+n2_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=2
 
-t3_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=3 -aTNum=3
+n3_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=3
 
-t4_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=4 -aTNum=4
+n4_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=4
 
-t5_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=5 -aTNum=5
+n5_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=5
 
-t6_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=6 -aTNum=6
+n6_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=6
 
-t7_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=7 -aTNum=7
+n7_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=7
 
-u0_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=8 -aUTIL=1 -aTNum=0
+n8_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=8 -aUTIL=1
 
-u1_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=9 -aUTIL=1 -aTNum=1
+n9_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=9 -aUTIL=1
 
-u2_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=10 -aUTIL=1 -aTNum=2
+n10_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=10 -aUTIL=1
 
-u3_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=11 -aUTIL=1 -aTNum=3
+n11_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=11 -aUTIL=1
 
-u4_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=12 -aUTIL=1 -aTNum=4
+n12_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=12 -aUTIL=1
 
-u5_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=13 -aUTIL=1 -aTNum=5
+n13_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=13 -aUTIL=1
 
-u6_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=14 -aUTIL=1 -aTNum=6
+n14_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=14 -aUTIL=1
 
 # DriveWire 3 RBF descriptors
 ddx0.dd: dwdesc.asm
--- a/level1/modules/dwtdesc.asm	Tue Jan 12 12:45:33 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-********************************************************************
-* DWTDesc - Drivewire Virtual Serial Device Descriptor
-*
-* $Id$
-*
-* Edt/Rev  YYYY/MM/DD  Modified by
-* Comment
-* ------------------------------------------------------------------
-*   0.3    2009/12/??  Aaron Wolfe
-* ADded SHARE. bit to mode.
-*
-*   0.4    2009/12/27  Boisy G. Pitre
-* Removed SHARE. bit from mode because of tsmon issues.
-*
-*   0.5    2009/12/29  Boisy G. Pitre
-* Made U and T descriptor templates. Backspace is now $7F for
-* telnet clients which are likely to access the T ports.
-*
-* This descriptor has slightly different defaults, intended to be used as 
-* the channel for the DriveWire utilities
-
-         nam   DWTDesc
-         ttl   DriveWire Virtual Serial Device Descriptor
-
-         ifp1  
-         use   defsfile
-         endc  
-
-tylg     set   Devic+Objct
-atrv     set   ReEnt+rev
-rev      set   $05
-
-         mod   eom,name,tylg,atrv,mgrnam,drvnam
-
-         IFNE  UTIL
-         fcb   UPDAT.+SHARE.   	mode byte (share set to prevent multiple access on /T0)
-         ELSE
-         fcb   UPDAT.    	mode byte
-         ENDC
-         fcb   HW.Page    extended controller address
-         fdb   $FF00+Addr      physical controller address
-         fcb   initsize-*-1 initilization table size
-         fcb   DT.SCF     device type:0=scf,1=rbf,2=pipe,3=scf
-         IFNE  UTIL
-         fcb   $00,$00,$00,$00,$00,$00,$00,$00
-         fcb   $00,$00,$00,$00,$00,$00,$00,$00
-         fcb   $00,$00,$00
-         ELSE
-         fcb   $00        case:0=up&lower,1=upper only
-         fcb   $01        backspace:0=bsp,1=bsp then sp & bsp
-         fcb   $00        delete:0=bsp over line,1=return
-         fcb   $01        echo:0=no echo
-         fcb   $01        auto line feed:0=off
-         fcb   $00        end of line null count
-         fcb   $00        pause:0=no end of page pause
-         fcb   24         lines per page (not a safe assumption anymore!)
-         fcb   $7F        backspace character (on most telnet clients)
-         fcb   C$DEL      delete line character
-         fcb   C$CR       end of record character
-         fcb   C$EOF      end of file character
-         fcb   C$RPRT     reprint line character
-         fcb   C$RPET     duplicate last line character
-         fcb   C$PAUS     pause character
-         fcb   C$INTR     interrupt character
-         fcb   C$QUIT     quit character
-         fcb   C$BSP      backspace echo character
-         fcb   C$BELL     line overflow character (bell)
-         ENDC
-         IFNE  UTIL
-         fcb   $03        mode byte for utility descriptor
-	 ELSE
-         fcb   $00        mode byte for terminal descriptor
-	 ENDC
-         fcb   B600       baud rate (not used, maybe future assignment?)
-         fdb   name       copy of descriptor name address
-         fcb   $00        acia xon char (not used, maybe future assignment?)
-         fcb   $00        acia xoff char (not used, maybe future assignment?)
-         fcb   80         (szx) number of columns for display
-         fcb   24         (szy) number of rows for display
-initsize equ   *
-
-         IFNE  TERM
-name     fcs   /Term/
-         ELSE
-	 IFNE  UTIL
-name     fcc   /U/
-	 ELSE
-name     fcc   /T/
-         ENDC
-         fcb   176+TNum
-         ENDC
-mgrnam   fcs   /SCF/
-drvnam   fcs   /scdwt/
-
-         emod  
-eom      equ   *
-         end   
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/modules/scdwn.asm	Tue Jan 12 21:43:57 2010 +0000
@@ -0,0 +1,475 @@
+********************************************************************
+* scdwn - CoCo DriveWire Network Driver
+*
+* $Id$
+*
+* Edt/Rev  YYYY/MM/DD  Modified by
+* Comment
+* ------------------------------------------------------------------
+*   1      2009/11/30  Aaron Wolfe
+* Started
+*
+*          2009/12/28  Boisy G. Pitre
+* Modified so that F$STime is called if we get an error on calling
+* F$VIRQ (which means the clock module has not be initialized)
+*
+*          2009/12/31  Boisy G. Pitre
+* Fixed crash in Init where F$Link failure would not clean up stack
+*
+*          2010/01/03  Boisy G. Pitre
+* Moved IRQ stuff into DW3 subroutine module
+
+         	nam   	scdwn
+         	ttl   	CoCo DriveWire Network Driver
+
+         	ifp1
+         	use   	defsfile
+         	use   	dwdefs.d
+         	endc
+
+
+tylg     	set   	Drivr+Objct   
+atrv     	set   	ReEnt+Rev
+rev      	set   	$00
+edition  	set   	1
+
+* Note: driver memory defined in dwdefs.d
+         	mod   	eom,name,tylg,atrv,start,SCFDrvMemSz
+
+* module info         	
+         	fcb   	READ.+WRITE.	;driver access modes
+name     	fcs   	/scdwn/		;driver name
+         	fcb   	edition   	;driver edition 
+
+* dispatch calls            
+start    	equ   	*
+         	lbra  	Init
+         	lbra  	Read
+         	lbra  	Write
+         	lbra  	GetStat
+         	lbra  	SetStat
+	 	
+***********************************************************************
+* Term
+*
+* shut down the driver.
+* should close only the correct port, tell server to close the port,
+* and remove irq handler when no ports are left 
+*
+* Entry:
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code   
+Term     	equ   	*
+          lda       <V.PORT+1,u		;get our port #
+          pshs 	a				;port # on stack
+          * clear statics table entry
+          IFGT      Level-1
+          ldx   	<D.DWStat
+          ELSE
+          ldx   	>D.DWStat
+          ENDC
+          beq       tell
+; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
+;		leax      DW.StatTbl,x
+          clr		a,x				;clear out
+
+          ; tell server
+tell
+          lda       #OP_SERTERM ; load command
+          pshs   	a      		; command store on stack
+          leax      ,s     		; point X to stack 
+          ldy       #2          ; 2 bytes to send 
+
+          pshs      u
+
+          IFGT      Level-1
+          ldu   	<D.DWSubAddr
+          ELSE
+          ldu   	>D.DWSubAddr
+          ENDC
+          beq       nosub		
+    		jsr       6,u      	; call DWrite
+
+nosub
+          puls      u
+    		leas      2,s			; clean 3 DWsub args from stack 
+    		clrb
+          rts
+
+***********************************************************************
+* Init
+*
+* Entry:
+*    Y  = address of device descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code
+*
+            
+Init		equ		*
+
+          lda		IT.PAR,y
+          pshs      a				; save parity byte for later
+
+; link to subroutine module
+; has the link already been done?
+          IFGT      Level-1
+          ldx       <D.DWSubAddr
+          ELSE
+          ldx       >D.DWSubAddr
+          ENDC
+          bne       already			; if so, do not bother
+			
+         	pshs      u				; preserve u since os9 link is coming up
+
+          IFGT  	Level-1
+         	ldx   	<D.Proc
+         	pshs  	x
+         	ldx   	<D.SysPrc
+         	stx   	<D.Proc
+         	ENDC
+         	clra
+         		
+         	leax  	dw3name,pcr
+         	os9   	F$Link
+         	IFGT  	Level-1
+         	puls  	x
+         	stx   	<D.Proc
+         	ENDC
+         	bcs   	InitEx2
+         	IFGT  	Level-1
+         	sty   	<D.DWSubAddr
+         	ELSE
+         	sty   	>D.DWSubAddr
+         	ENDC
+         	jsr   	,y				; call DW init routine
+       	
+          puls	u                        ; restore u
+      	
+already
+; tell DW we have a new port opening (port mode already on stack)
+          ldb		<V.PORT+1,u		; get our port #			
+          lda       #OP_SERINIT         ; command 
+          pshs   	d      			; command + port # on stack
+          leax      ,s     			; point X to stack 
+          ldy       #3                  ; # of bytes to send
+			
+          pshs u
+          IFGT      Level-1
+          ldu   	<D.DWSubAddr
+          ELSE
+          ldu   	>D.DWSubAddr
+          ENDC
+    		jsr       6,u                 ; call DWrite
+          puls      u
+    		
+; set up local buffer
+          ldb   	#RxBufDSz      	; default Rx buffer size
+          leax  	RxBuff,u       	; default Rx buffer address
+          stb   	RxBufSiz,u     	; save Rx buffer size
+          stx   	RxBufPtr,u     	; save Rx buffer address
+          stx   	RxBufGet,u          ; set initial Rx buffer input address
+          stx   	RxBufPut,u          ; set initial Rx buffer output address
+          abx  					; add buffer size to buffer start..
+          stx   	RxBufEnd,u     	; save Rx buffer end address
+
+          tfr       u,d                 ; (A = high page of statics)
+          puls      b
+          puls      b                   ; (B = port number)
+          IFGT      Level-1
+          ldx       <D.DWStat
+          ELSE
+          ldx       >D.DWStat
+          ENDC
+; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
+;		leax      DW.StatTbl,x
+          sta       b,x
+InitEx	equ		*
+          puls      a,pc
+InitEx2
+          puls      u
+          puls      a,pc
+
+; drivewire info
+dw3name  	fcs  	/dw3/
+
+
+*****************************************************************************
+* Write
+*
+* Entry:
+*    A  = character to write
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code
+* 
+Write    	equ   	*
+         	pshs      a			; character to send on stack
+         	ldb		<V.PORT+1,u	; port number into B
+         	lda   	#OP_SERWRITE	; put command into A
+         	pshs  	d
+         	leax  	,s
+         	ldy   	#$0003		; 3 bytes to send.. ugh.  need WRITEM (data mode)
+         	IFGT  	Level-1
+         	ldu   	<D.DWSubAddr
+         	ELSE
+         	ldu   	>D.DWSubAddr
+         	ENDC
+         	jsr   	6,u
+WriteOK   clrb
+WriteExit puls      a,x,pc		; clean stack, return
+
+	
+*************************************************************************************
+* Read
+*
+* Entry:
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    A  = character read
+*    CC = carry set on error
+*    B  = error code
+*
+Read    	equ  	*
+          pshs  	cc,dp       ; save IRQ/Carry status, system DP
+
+ReadChr	orcc      #IntMasks	; mask interrupts
+          
+          lda   	RxDatLen,u 	; get our Rx buffer count
+          beq   	ReadSlp 	; no data, go sleep while waiting for new Rx data...
+			
+          ; we have data waiting
+          deca				; one less byte in buffer
+          sta   	RxDatLen,u 	; save new Rx data count
+          
+          ldx   	RxBufGet,u 	; current Rx buffer pickup position
+          lda   	,x+       	; get Rx character, set up next pickup position
+          
+          cmpx  	RxBufEnd,u 	; end of Rx buffer?
+          blo   	ReadChr1   	; no, keep pickup pointer
+          ldx   	RxBufPtr,u 	; get Rx buffer start address
+ReadChr1 	stx   	RxBufGet,u	; set new Rx data pickup pointer
+			
+          ; return to caller
+          puls  	cc,dp,pc   	; recover IRQ/Carry status, system DP, return with character in A
+
+ReadSlp	equ		*
+
+          IFEQ  	Level-1
+ReadSlp2 	lda   	<V.BUSY,u
+          sta   	<V.WAKE,u	; store process id in this port's entry in the waiter table
+          lbsr  	Sleep0     	; sleep level 1 style
+          ELSE
+ReadSlp2   lda   	>D.Proc    	; process descriptor address MSB
+          sta   	<V.WAKE,u   ; save MSB in V.WAKE
+          clrb
+          tfr		d,x			; process descriptor address
+          IFNE  	H6309
+          oim   	#Suspend,P$State,x 	; suspend
+          ELSE
+          ldb   	P$State,x
+          orb   	#Suspend
+          stb   	P$State,x 	; suspend
+          ENDC
+          bsr		Sleep1		; sleep level 2 style
+          ENDC
+          
+          ; we have been awakened..
+          
+          ; check for signals
+          ldx   	>D.Proc		; process descriptor address
+          ldb   	P$Signal,x 	; pending signal for this process?
+          beq   	ChkState  	; no, go check process state...
+          cmpb  	#S$Peer  	; (S$Peer or lower)
+          bls  	ErrExit    	; yes, go do it...
+
+ChkState 	equ   	*
+          ; have we been condemned to die?
+          IFNE  	H6309
+          tim   	#Condem,P$State,x
+          ELSE
+          ldb   	P$State,x
+          bitb  	#Condem
+          ENDC
+          bne   	PrAbtErr 	; yes, go do it...
+          
+          ; check that our waiter byte was cleared by ISR instance
+          tst		<V.WAKE,u	; our waiter byte
+          beq		ReadChr		; 0 = its our turn, go get a character 
+          bra   	ReadSlp		; false alarm, go back to sleep
+
+PrAbtErr	ldb   	#E$PrcAbt	; set error code
+
+ErrExit  	equ  	*
+          IFNE  	H6309
+          oim   	#Carry,,s 	; set carry
+          ELSE
+          lda   	,s
+          ora   	#Carry
+          sta   	,s
+          ENDC
+          puls 	cc,dp,pc 	; restore CC, system DP, return
+
+          IFEQ  	Level-1
+Sleep0   	ldx   	#$0			; sleep till ISR wakes us
+          bra   	TimedSlp
+          ENDC
+
+Sleep1    ldx   	#$1			; just sleep till end of slice, we are suspended (level 2)             
+TimedSlp	andcc 	#^Intmasks     ; enable IRQs
+          os9   	F$Sleep
+          clr       <V.WAKE,u
+          rts                      ; return
+
+
+**********************************************************************
+* GetStat - heavily borrowed from sc6551
+*
+* Entry:
+*    A  = function code
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code 
+*
+GetStat
+          clrb                     ; default to no error...
+          pshs  	cc,dp  		; save IRQ/Carry status,system DP
+           
+        	ldx   	PD.RGS,y       ; caller's register stack pointer
+        	cmpa  	#SS.EOF		
+        	beq   	GSExitOK       ; SCF devices never return EOF
+           
+        	cmpa  	#SS.Ready
+        	bne   	Advertise      ; next check
+           	
+        	; SS.Ready
+        	lda   	RxDatLen,u	; get Rx data length
+        	beq   	NRdyErr    	; none, go report error
+        	sta   	R$B,x		; set Rx data available in caller's [B]
+GSExitOK	puls  	cc,dp,pc       ; restore Carry status, system DP, return         
+         
+NRdyErr	ldb  	#E$NotRdy         
+          bra		ErrExit		; return error code 
+
+UnSvcErr 	ldb   	#E$UnkSvc
+          bra   	ErrExit		; return error code			
+			
+; We advertise all of our SERGETSTAT calls (except SS.Ready) to the server
+Advertise
+          ldb		#OP_SERGETSTAT
+          bsr		SendStat
+
+; Note: Here we could somehow obtain the size of the terminal window from the server
+GetScSiz  cmpa  	#SS.ScSiz
+          bne   	GetComSt	; next check
+          ldu   	PD.DEV,y
+          ldu   	V$DESC,u	; device descriptor
+          clra
+          ldb   	IT.COL,u	; return screen size
+          std   	R$X,x
+          ldb   	IT.ROW,u
+          std   	R$Y,x
+          puls  	cc,dp,pc	; restore Carry status, system DP, return
+
+GetComSt  cmpa  	#SS.ComSt
+          bne  	UnSvcErr	; no, we have no more answers, report error
+          ldd   	#$0000		; not used, return $0000
+          std   	R$Y,x
+          sta   	R$B,x
+          puls  	cc,dp,pc	; restore Carry status, system DP, return			
+
+* Advertise Stat Code to server
+* A = Function Code
+* B = OP_SERGETSTAT or OP_SERSETSTAT
+SendStat
+; advertise our GetStt code to the server
+          pshs      a,y,x,u
+          leas      -3,s
+          leax      ,s
+          stb		,x
+          sta		2,x
+          ldb		V.PORT+1,u
+          stb		1,x
+          ldy		#$0003
+          IFGT      LEVEL-1
+          ldu		<D.DWSubAddr
+          ELSE
+          ldu		>D.DWSubAddr
+          ENDC
+          jsr		6,u                    
+          leas      3,s
+          puls      a,y,x,u,pc
+
+*************************************************************************         
+* SetStat
+*
+* Entry:
+*    A  = function code
+*    Y  = address of path descriptor
+*    U  = address of device memory area
+*
+* Exit:
+*    CC = carry set on error
+*    B  = error code 
+*
+SetStat  
+		ldb       #OP_SERSETSTAT
+		bsr       SendStat
+		cmpa      #SS.ComSt
+		bne       donebad
+		leax      PD.OPT,y
+		ldy       #OPTCNT
+		IFGT      LEVEL-1
+		ldu       <D.DWSubAddr
+		ELSE
+		ldu       >D.DWSubAddr
+		ENDC
+		jsr       6,u
+          clrb
+          rts
+
+          IFEQ      1
+SetPortSig    
+          cmpa      #SS.PortSig
+          bne       SetPortRel
+          lda       PD.CPR,y       current process ID
+          ldb       R$X+1,x        LSB of [X] is signal code
+          std       <PortSigPID
+          clrb
+          rts
+SetPortRel 
+          cmpa      #SS.PortRel
+          bne       donebad
+          leax      PortSigPID,u
+          bsr       ReleaSig
+          clrb
+          rts
+          ENDC
+donebad	comb
+		ldb       #E$UnkSVc
+		rts
+          
+ReleaSig  pshs    cc             save IRQ enable status
+          orcc    #IntMasks      disable IRQs while releasing signal
+          lda     PD.CPR,y       get current process ID
+          suba    ,x             same as signal process ID?
+          bne     NoReleas       no, go return...
+          sta     ,x             clear this signal's process ID
+NoReleas  puls    cc,pc          restore IRQ enable status, return
+
+		emod
+eom		equ		*
+		end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/modules/scdwndesc.asm	Tue Jan 12 21:43:57 2010 +0000
@@ -0,0 +1,102 @@
+********************************************************************
+* scdwdesc - Drivewire Network Device Descriptor
+*
+* $Id$
+*
+* Edt/Rev  YYYY/MM/DD  Modified by
+* Comment
+* ------------------------------------------------------------------
+*   0.3    2009/12/??  Aaron Wolfe
+* ADded SHARE. bit to mode.
+*
+*   0.4    2009/12/27  Boisy G. Pitre
+* Removed SHARE. bit from mode because of tsmon issues.
+*
+*   0.5    2009/12/29  Boisy G. Pitre
+* Made U and T descriptor templates. Backspace is now $7F for
+* telnet clients which are likely to access the T ports.
+*
+* This descriptor has slightly different defaults, intended to be used as 
+* the channel for the DriveWire utilities
+*
+*   0.6    2010/01/12  Boisy G. Pitre
+* Renamed.
+
+         nam   scdwdesc
+         ttl   DriveWire network Device Descriptor
+
+         ifp1  
+         use   defsfile
+         endc  
+
+tylg     set   Devic+Objct
+atrv     set   ReEnt+rev
+rev      set   $05
+
+         mod   eom,name,tylg,atrv,mgrnam,drvnam
+
+         IFNE  UTIL
+         fcb   UPDAT.+SHARE.   	mode byte (share set to prevent multiple access on /T0)
+         ELSE
+         fcb   UPDAT.    	mode byte
+         ENDC
+         fcb   HW.Page    extended controller address
+         fdb   $FF00+Addr      physical controller address
+         fcb   initsize-*-1 initilization table size
+         fcb   DT.SCF     device type:0=scf,1=rbf,2=pipe,3=scf
+         IFNE  UTIL
+         fcb   $00,$00,$00,$00,$00,$00,$00,$00
+         fcb   $00,$00,$00,$00,$00,$00,$00,$00
+         fcb   $00,$00,$00
+         ELSE
+         fcb   $00        case:0=up&lower,1=upper only
+         fcb   $01        backspace:0=bsp,1=bsp then sp & bsp
+         fcb   $00        delete:0=bsp over line,1=return
+         fcb   $01        echo:0=no echo
+         fcb   $01        auto line feed:0=off
+         fcb   $00        end of line null count
+         fcb   $00        pause:0=no end of page pause
+         fcb   24         lines per page (not a safe assumption anymore!)
+         fcb   $7F        backspace character (on most telnet clients)
+         fcb   C$DEL      delete line character
+         fcb   C$CR       end of record character
+         fcb   C$EOF      end of file character
+         fcb   C$RPRT     reprint line character
+         fcb   C$RPET     duplicate last line character
+         fcb   C$PAUS     pause character
+         fcb   C$INTR     interrupt character
+         fcb   C$QUIT     quit character
+         fcb   C$BSP      backspace echo character
+         fcb   C$BELL     line overflow character (bell)
+         ENDC
+         IFNE  UTIL
+         fcb   $03        mode byte for utility descriptor
+	 ELSE
+         fcb   $00        mode byte for terminal descriptor
+	 ENDC
+         fcb   B600       baud rate (not used, maybe future assignment?)
+         fdb   name       copy of descriptor name address
+         fcb   $00        acia xon char (not used, maybe future assignment?)
+         fcb   $00        acia xoff char (not used, maybe future assignment?)
+         fcb   80         (szx) number of columns for display
+         fcb   24         (szy) number of rows for display
+initsize equ   *
+
+         IFNE  TERM
+name     fcs   /Term/
+         ELSE
+name     fcc   /N/
+         IFGT  Addr-9
+         fcc   '1'
+         fcb   176+Addr-10
+         ELSE
+         fcb   176+Addr
+         ENDC
+         ENDC
+mgrnam   fcs   /SCF/
+drvnam   fcs   /scdwn/
+
+         emod  
+eom      equ   *
+         end   
+
--- a/level1/modules/scdwt.asm	Tue Jan 12 12:45:33 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-********************************************************************
-* scdwt - CoCo DriveWire Virtual Serial Driver
-*
-* $Id$
-*
-* Edt/Rev  YYYY/MM/DD  Modified by
-* Comment
-* ------------------------------------------------------------------
-*   1      2009/11/30  Aaron Wolfe
-* Started
-*
-*          2009/12/28  Boisy G. Pitre
-* Modified so that F$STime is called if we get an error on calling
-* F$VIRQ (which means the clock module has not be initialized)
-*
-*          2009/12/31  Boisy G. Pitre
-* Fixed crash in Init where F$Link failure would not clean up stack
-*
-*          2010/01/03  Boisy G. Pitre
-* Moved IRQ stuff into DW3 subroutine module
-
-         	nam   	scdwt
-         	ttl   	CoCo DriveWire Virtual Serial Driver
-
-         	ifp1
-         	use   	defsfile
-         	use   	dwdefs.d
-         	endc
-
-
-tylg     	set   	Drivr+Objct   
-atrv     	set   	ReEnt+Rev
-rev      	set   	$00
-edition  	set   	1
-
-* Note: driver memory defined in dwdefs.d
-         	mod   	eom,name,tylg,atrv,start,SCFDrvMemSz
-
-* module info         	
-         	fcb   	READ.+WRITE.	;driver access modes
-name     	fcs   	/scdwt/		;driver name
-         	fcb   	edition   	;driver edition 
-
-* dispatch calls            
-start    	equ   	*
-         	lbra  	Init
-         	lbra  	Read
-         	lbra  	Write
-         	lbra  	GetStat
-         	lbra  	SetStat
-	 	
-***********************************************************************
-* Term
-*
-* shut down the driver.
-* should close only the correct port, tell server to close the port,
-* and remove irq handler when no ports are left 
-*
-* Entry:
-*    U  = address of device memory area
-*
-* Exit:
-*    CC = carry set on error
-*    B  = error code   
-Term     	equ   	*
-          lda       <V.PORT+1,u		;get our port #
-          pshs 	a				;port # on stack
-          * clear statics table entry
-          IFGT      Level-1
-          ldx   	<D.DWStat
-          ELSE
-          ldx   	>D.DWStat
-          ENDC
-          beq       tell
-; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
-;		leax      DW.StatTbl,x
-          clr		a,x				;clear out
-
-          ; tell server
-tell
-          lda       #OP_SERTERM ; load command
-          pshs   	a      		; command store on stack
-          leax      ,s     		; point X to stack 
-          ldy       #2          ; 2 bytes to send 
-
-          pshs      u
-
-          IFGT      Level-1
-          ldu   	<D.DWSubAddr
-          ELSE
-          ldu   	>D.DWSubAddr
-          ENDC
-          beq       nosub		
-    		jsr       6,u      	; call DWrite
-
-nosub
-          puls      u
-    		leas      2,s			; clean 3 DWsub args from stack 
-    		clrb
-          rts
-
-***********************************************************************
-* Init
-*
-* Entry:
-*    Y  = address of device descriptor
-*    U  = address of device memory area
-*
-* Exit:
-*    CC = carry set on error
-*    B  = error code
-*
-            
-Init		equ		*
-
-          lda		IT.PAR,y
-          pshs      a				; save parity byte for later
-
-; link to subroutine module
-; has the link already been done?
-          IFGT      Level-1
-          ldx       <D.DWSubAddr
-          ELSE
-          ldx       >D.DWSubAddr
-          ENDC
-          bne       already			; if so, do not bother
-			
-         	pshs      u				; preserve u since os9 link is coming up
-
-          IFGT  	Level-1
-         	ldx   	<D.Proc
-         	pshs  	x
-         	ldx   	<D.SysPrc
-         	stx   	<D.Proc
-         	ENDC
-         	clra
-         		
-         	leax  	dw3name,pcr
-         	os9   	F$Link
-         	IFGT  	Level-1
-         	puls  	x
-         	stx   	<D.Proc
-         	ENDC
-         	bcs   	InitEx2
-         	IFGT  	Level-1
-         	sty   	<D.DWSubAddr
-         	ELSE
-         	sty   	>D.DWSubAddr
-         	ENDC
-         	jsr   	,y				; call DW init routine
-       	
-          puls	u                        ; restore u
-      	
-already
-; tell DW we have a new port opening (port mode already on stack)
-          ldb		<V.PORT+1,u		; get our port #			
-          lda       #OP_SERINIT         ; command 
-          pshs   	d      			; command + port # on stack
-          leax      ,s     			; point X to stack 
-          ldy       #3                  ; # of bytes to send
-			
-          pshs u
-          IFGT      Level-1
-          ldu   	<D.DWSubAddr
-          ELSE
-          ldu   	>D.DWSubAddr
-          ENDC
-    		jsr       6,u                 ; call DWrite
-          puls      u
-    		
-; set up local buffer
-          ldb   	#RxBufDSz      	; default Rx buffer size
-          leax  	RxBuff,u       	; default Rx buffer address
-          stb   	RxBufSiz,u     	; save Rx buffer size
-          stx   	RxBufPtr,u     	; save Rx buffer address
-          stx   	RxBufGet,u          ; set initial Rx buffer input address
-          stx   	RxBufPut,u          ; set initial Rx buffer output address
-          abx  					; add buffer size to buffer start..
-          stx   	RxBufEnd,u     	; save Rx buffer end address
-
-          tfr       u,d                 ; (A = high page of statics)
-          puls      b
-          puls      b                   ; (B = port number)
-          IFGT      Level-1
-          ldx       <D.DWStat
-          ELSE
-          ldx       >D.DWStat
-          ENDC
-; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
-;		leax      DW.StatTbl,x
-          sta       b,x
-InitEx	equ		*
-          puls      a,pc
-InitEx2
-          puls      u
-          puls      a,pc
-
-; drivewire info
-dw3name  	fcs  	/dw3/
-
-
-*****************************************************************************
-* Write
-*
-* Entry:
-*    A  = character to write
-*    Y  = address of path descriptor
-*    U  = address of device memory area
-*
-* Exit:
-*    CC = carry set on error
-*    B  = error code
-* 
-Write    	equ   	*
-         	pshs      a			; character to send on stack
-         	ldb		<V.PORT+1,u	; port number into B
-         	lda   	#OP_SERWRITE	; put command into A
-         	pshs  	d
-         	leax  	,s
-         	ldy   	#$0003		; 3 bytes to send.. ugh.  need WRITEM (data mode)
-         	IFGT  	Level-1
-         	ldu   	<D.DWSubAddr
-         	ELSE
-         	ldu   	>D.DWSubAddr
-         	ENDC
-         	jsr   	6,u
-WriteOK   clrb
-WriteExit puls      a,x,pc		; clean stack, return
-
-	
-*************************************************************************************
-* Read
-*
-* Entry:
-*    Y  = address of path descriptor
-*    U  = address of device memory area
-*
-* Exit:
-*    A  = character read
-*    CC = carry set on error
-*    B  = error code
-*
-Read    	equ  	*
-          pshs  	cc,dp       ; save IRQ/Carry status, system DP
-
-ReadChr	orcc      #IntMasks	; mask interrupts
-          
-          lda   	RxDatLen,u 	; get our Rx buffer count
-          beq   	ReadSlp 	; no data, go sleep while waiting for new Rx data...
-			
-          ; we have data waiting
-          deca				; one less byte in buffer
-          sta   	RxDatLen,u 	; save new Rx data count
-          
-          ldx   	RxBufGet,u 	; current Rx buffer pickup position
-          lda   	,x+       	; get Rx character, set up next pickup position
-          
-          cmpx  	RxBufEnd,u 	; end of Rx buffer?
-          blo   	ReadChr1   	; no, keep pickup pointer
-          ldx   	RxBufPtr,u 	; get Rx buffer start address
-ReadChr1 	stx   	RxBufGet,u	; set new Rx data pickup pointer
-			
-          ; return to caller
-          puls  	cc,dp,pc   	; recover IRQ/Carry status, system DP, return with character in A
-
-ReadSlp	equ		*
-
-          IFEQ  	Level-1
-ReadSlp2 	lda   	<V.BUSY,u
-          sta   	<V.WAKE,u	; store process id in this port's entry in the waiter table
-          lbsr  	Sleep0     	; sleep level 1 style
-          ELSE
-ReadSlp2   lda   	>D.Proc    	; process descriptor address MSB
-          sta   	<V.WAKE,u   ; save MSB in V.WAKE
-          clrb
-          tfr		d,x			; process descriptor address
-          IFNE  	H6309
-          oim   	#Suspend,P$State,x 	; suspend
-          ELSE
-          ldb   	P$State,x
-          orb   	#Suspend
-          stb   	P$State,x 	; suspend
-          ENDC
-          bsr		Sleep1		; sleep level 2 style
-          ENDC
-          
-          ; we have been awakened..
-          
-          ; check for signals
-          ldx   	>D.Proc		; process descriptor address
-          ldb   	P$Signal,x 	; pending signal for this process?
-          beq   	ChkState  	; no, go check process state...
-          cmpb  	#S$Peer  	; (S$Peer or lower)
-          bls  	ErrExit    	; yes, go do it...
-
-ChkState 	equ   	*
-          ; have we been condemned to die?
-          IFNE  	H6309
-          tim   	#Condem,P$State,x
-          ELSE
-          ldb   	P$State,x
-          bitb  	#Condem
-          ENDC
-          bne   	PrAbtErr 	; yes, go do it...
-          
-          ; check that our waiter byte was cleared by ISR instance
-          tst		<V.WAKE,u	; our waiter byte
-          beq		ReadChr		; 0 = its our turn, go get a character 
-          bra   	ReadSlp		; false alarm, go back to sleep
-
-PrAbtErr	ldb   	#E$PrcAbt	; set error code
-
-ErrExit  	equ  	*
-          IFNE  	H6309
-          oim   	#Carry,,s 	; set carry
-          ELSE
-          lda   	,s
-          ora   	#Carry
-          sta   	,s
-          ENDC
-          puls 	cc,dp,pc 	; restore CC, system DP, return
-
-          IFEQ  	Level-1
-Sleep0   	ldx   	#$0			; sleep till ISR wakes us
-          bra   	TimedSlp
-          ENDC
-
-Sleep1    ldx   	#$1			; just sleep till end of slice, we are suspended (level 2)             
-TimedSlp	andcc 	#^Intmasks     ; enable IRQs
-          os9   	F$Sleep
-          clr       <V.WAKE,u
-          rts                      ; return
-
-
-**********************************************************************
-* GetStat - heavily borrowed from sc6551
-*
-* Entry:
-*    A  = function code
-*    Y  = address of path descriptor
-*    U  = address of device memory area
-*
-* Exit:
-*    CC = carry set on error
-*    B  = error code 
-*
-GetStat
-          clrb                     ; default to no error...
-          pshs  	cc,dp  		; save IRQ/Carry status,system DP
-           
-        	ldx   	PD.RGS,y       ; caller's register stack pointer
-        	cmpa  	#SS.EOF		
-        	beq   	GSExitOK       ; SCF devices never return EOF
-           
-        	cmpa  	#SS.Ready
-        	bne   	Advertise      ; next check
-           	
-        	; SS.Ready
-        	lda   	RxDatLen,u	; get Rx data length
-        	beq   	NRdyErr    	; none, go report error
-        	sta   	R$B,x		; set Rx data available in caller's [B]
-GSExitOK	puls  	cc,dp,pc       ; restore Carry status, system DP, return         
-         
-NRdyErr	ldb  	#E$NotRdy         
-          bra		ErrExit		; return error code 
-
-UnSvcErr 	ldb   	#E$UnkSvc
-          bra   	ErrExit		; return error code			
-			
-; We advertise all of our SERGETSTAT calls (except SS.Ready) to the server
-Advertise
-          ldb		#OP_SERGETSTAT
-          bsr		SendStat
-
-; Note: Here we could somehow obtain the size of the terminal window from the server
-GetScSiz  cmpa  	#SS.ScSiz
-          bne   	GetComSt	; next check
-          ldu   	PD.DEV,y
-          ldu   	V$DESC,u	; device descriptor
-          clra
-          ldb   	IT.COL,u	; return screen size
-          std   	R$X,x
-          ldb   	IT.ROW,u
-          std   	R$Y,x
-          puls  	cc,dp,pc	; restore Carry status, system DP, return
-
-GetComSt  cmpa  	#SS.ComSt
-          bne  	UnSvcErr	; no, we have no more answers, report error
-          ldd   	#$0000		; not used, return $0000
-          std   	R$Y,x
-          sta   	R$B,x
-          puls  	cc,dp,pc	; restore Carry status, system DP, return			
-
-* Advertise Stat Code to server
-* A = Function Code
-* B = OP_SERGETSTAT or OP_SERSETSTAT
-SendStat
-; advertise our GetStt code to the server
-          pshs      a,y,x,u
-          leas      -3,s
-          leax      ,s
-          stb		,x
-          sta		2,x
-          ldb		V.PORT+1,u
-          stb		1,x
-          ldy		#$0003
-          IFGT      LEVEL-1
-          ldu		<D.DWSubAddr
-          ELSE
-          ldu		>D.DWSubAddr
-          ENDC
-          jsr		6,u                    
-          leas      3,s
-          puls      a,y,x,u,pc
-
-*************************************************************************         
-* SetStat
-*
-* Entry:
-*    A  = function code
-*    Y  = address of path descriptor
-*    U  = address of device memory area
-*
-* Exit:
-*    CC = carry set on error
-*    B  = error code 
-*
-SetStat  
-		ldb       #OP_SERSETSTAT
-		bsr       SendStat
-		cmpa      #SS.ComSt
-		bne       donebad
-		leax      PD.OPT,y
-		ldy       #OPTCNT
-		IFGT      LEVEL-1
-		ldu       <D.DWSubAddr
-		ELSE
-		ldu       >D.DWSubAddr
-		ENDC
-		jsr       6,u
-          clrb
-          rts
-
-          IFEQ      1
-SetPortSig    
-          cmpa      #SS.PortSig
-          bne       SetPortRel
-          lda       PD.CPR,y       current process ID
-          ldb       R$X+1,x        LSB of [X] is signal code
-          std       <PortSigPID
-          clrb
-          rts
-SetPortRel 
-          cmpa      #SS.PortRel
-          bne       donebad
-          leax      PortSigPID,u
-          bsr       ReleaSig
-          clrb
-          rts
-          ENDC
-donebad	comb
-		ldb       #E$UnkSVc
-		rts
-          
-ReleaSig  pshs    cc             save IRQ enable status
-          orcc    #IntMasks      disable IRQs while releasing signal
-          lda     PD.CPR,y       get current process ID
-          suba    ,x             same as signal process ID?
-          bne     NoReleas       no, go return...
-          sta     ,x             clear this signal's process ID
-NoReleas  puls    cc,pc          restore IRQ enable status, return
-
-		emod
-eom		equ		*
-		end
--- a/level2/coco3/bootfiles/makefile	Tue Jan 12 12:45:33 2010 +0000
+++ b/level2/coco3/bootfiles/makefile	Tue Jan 12 21:43:57 2010 +0000
@@ -24,9 +24,6 @@
 		$(MD)/term_win80.dt \
 		$(MD)/w.dw $(MD)/w1.dw $(MD)/w2.dw $(MD)/w3.dw $(MD)/w4.dw \
 		$(MD)/w5.dw $(MD)/w6.dw $(MD)/w7.dw \
-		$(MD)/scdwt.dr $(MD)/t0_scdwt.dd \
-                $(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-                $(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3
--- a/level2/coco3/modules/makefile	Tue Jan 12 12:45:33 2010 +0000
+++ b/level2/coco3/modules/makefile	Tue Jan 12 21:43:57 2010 +0000
@@ -55,10 +55,10 @@
 		w8.dw w9.dw w10.dw w11.dw w12.dw w13.dw w14.dw w15.dw \
 		v1.dw v2.dw v3.dw v4.dw v5.dw \
 		v6.dw v7.dw \
-		scdwt.dr term_scdwt.dt t0_scdwt.dd t1_scdwt.dd t2_scdwt.dd t3_scdwt.dd \
-                t4_scdwt.dd t5_scdwt.dd t6_scdwt.dd t7_scdwt.dd \
-		u0_scdwt.dd u1_scdwt.dd u2_scdwt.dd u3_scdwt.dd \
-                u4_scdwt.dd u5_scdwt.dd u6_scdwt.dd
+		scdwn.dr term_scdwn.dt n0_scdwn.dd n1_scdwn.dd n2_scdwn.dd n3_scdwn.dd \
+                n4_scdwn.dd n5_scdwn.dd n6_scdwn.dd n7_scdwn.dd \
+		n8_scdwn.dd n9_scdwn.dd n10_scdwn.dd n11_scdwn.dd \
+                n12_scdwn.dd n13_scdwn.dd n14_scdwn.dd
 
 PIPE		= pipeman.mn pipeman_named.mn \
 		piper.dr \
@@ -195,53 +195,53 @@
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aRAMSize=192 -aDD=1
 
 # DriveWire 3 SCF descriptors
-term_scdwt.dt: dwtdesc.asm
+term_scdwn.dt: scdwndesc.asm
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aTERM=1 -aAddr=0
 
-t0_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=0 -aTNum=0
+n0_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=0
 
-t1_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=1 -aTNum=1
+n1_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=1
 
-t2_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=2 -aTNum=2
+n2_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=2
 
-t3_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=3 -aTNum=3
+n3_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=3
 
-t4_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=4 -aTNum=4
+n4_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=4
 
-t5_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=5 -aTNum=5
+n5_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=5
 
-t6_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=6 -aTNum=6
+n6_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=6
 
-t7_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=7 -aTNum=7
+n7_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=7
 
-u0_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=8 -aUTIL=1 -aTNum=0
+n8_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=8 -aUTIL=1
 
-u1_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=9 -aUTIL=1 -aTNum=1
+n9_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=9 -aUTIL=1
 
-u2_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=10 -aUTIL=1 -aTNum=2
+n10_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=10 -aUTIL=1
 
-u3_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=11 -aUTIL=1 -aTNum=3
+n11_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=11 -aUTIL=1
 
-u4_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=12 -aUTIL=1 -aTNum=4
+n12_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=12 -aUTIL=1
 
-u5_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=13 -aUTIL=1 -aTNum=5
+n13_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=13 -aUTIL=1
 
-u6_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=14 -aUTIL=1 -aTNum=6
+n14_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=14 -aUTIL=1
 
 # DriveWire 3 RBF descriptors
 ddx0.dd: dwdesc.asm
--- a/level2/coco3_6309/bootfiles/makefile	Tue Jan 12 12:45:33 2010 +0000
+++ b/level2/coco3_6309/bootfiles/makefile	Tue Jan 12 21:43:57 2010 +0000
@@ -24,9 +24,6 @@
 		$(MD)/term_win80.dt \
 		$(MD)/w.dw $(MD)/w1.dw $(MD)/w2.dw $(MD)/w3.dw $(MD)/w4.dw \
 		$(MD)/w5.dw $(MD)/w6.dw $(MD)/w7.dw \
-		$(MD)/scdwt.dr $(MD)/t0_scdwt.dd \
-                $(MD)/t1_scdwt.dd $(MD)/t2_scdwt.dd $(MD)/t3_scdwt.dd \
-                $(MD)/t4_scdwt.dd $(MD)/t5_scdwt.dd $(MD)/t6_scdwt.dd \
 		$(MD)/scdwp.dr $(MD)/p_scdwp.dd \
 		$(MD)/pipeman.mn $(MD)/piper.dr $(MD)/pipe.dd \
 		$(MD)/clock_60hz $(MD)/clock2_dw3
--- a/level2/coco3_6309/modules/makefile	Tue Jan 12 12:45:33 2010 +0000
+++ b/level2/coco3_6309/modules/makefile	Tue Jan 12 21:43:57 2010 +0000
@@ -55,10 +55,10 @@
 		w8.dw w9.dw w10.dw w11.dw w12.dw w13.dw w14.dw w15.dw \
 		v1.dw v2.dw v3.dw v4.dw v5.dw \
 		v6.dw v7.dw \
-		scdwt.dr term_scdwt.dt t0_scdwt.dd t1_scdwt.dd t2_scdwt.dd t3_scdwt.dd \
-                t4_scdwt.dd t5_scdwt.dd t6_scdwt.dd t7_scdwt.dd \
-		u0_scdwt.dd u1_scdwt.dd u2_scdwt.dd u3_scdwt.dd \
-                u4_scdwt.dd u5_scdwt.dd u6_scdwt.dd
+		scdwn.dr term_scdwn.dt n0_scdwn.dd n1_scdwn.dd n2_scdwn.dd n3_scdwn.dd \
+                n4_scdwn.dd n5_scdwn.dd n6_scdwn.dd n7_scdwn.dd \
+		n8_scdwn.dd n9_scdwn.dd n10_scdwn.dd n11_scdwn.dd \
+                n12_scdwn.dd n13_scdwn.dd n14_scdwn.dd
 
 PIPE		= pipeman.mn pipeman_named.mn \
 		piper.dr \
@@ -195,53 +195,53 @@
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aRAMSize=192 -aDD=1
 
 # DriveWire 3 SCF descriptors
-term_scdwt.dt: dwtdesc.asm
+term_scdwn.dt: scdwndesc.asm
 	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aTERM=1 -aAddr=0
 
-t0_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=0 -aTNum=0
+n0_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=0
 
-t1_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=1 -aTNum=1
+n1_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=1
 
-t2_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=2 -aTNum=2
+n2_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=2
 
-t3_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=3 -aTNum=3
+n3_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=3
 
-t4_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=4 -aTNum=4
+n4_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=4
 
-t5_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=5 -aTNum=5
+n5_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=5
 
-t6_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=6 -aTNum=6
+n6_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=6
 
-t7_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=7 -aTNum=7
+n7_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=7
 
-u0_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=8 -aUTIL=1 -aTNum=0
+n8_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=8 -aUTIL=1
 
-u1_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=9 -aUTIL=1 -aTNum=1
+n9_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=9 -aUTIL=1
 
-u2_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=10 -aUTIL=1 -aTNum=2
+n10_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=10 -aUTIL=1
 
-u3_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=11 -aUTIL=1 -aTNum=3
+n11_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=11 -aUTIL=1
 
-u4_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=12 -aUTIL=1 -aTNum=4
+n12_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=12 -aUTIL=1
 
-u5_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=13 -aUTIL=1 -aTNum=5
+n13_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=13 -aUTIL=1
 
-u6_scdwt.dd: dwtdesc.asm
-	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=14 -aUTIL=1 -aTNum=6
+n14_scdwn.dd: scdwndesc.asm
+	$(AS) $< $(ASOUT)$@ $(AFLAGS) -aAddr=14 -aUTIL=1
 
 # DriveWire 3 RBF descriptors
 ddx0.dd: dwdesc.asm