changeset 2287:e49532f2c754

Added CTRL-C CTRL-E for single read only (not multiread)
author boisy
date Tue, 29 Dec 2009 12:42:29 +0000
parents d3c1d1258b42
children a21f67727413
files level1/modules/scdwt.asm
diffstat 1 files changed, 179 insertions(+), 180 deletions(-) [+]
line wrap: on
line diff
--- a/level1/modules/scdwt.asm	Tue Dec 29 02:34:05 2009 +0000
+++ b/level1/modules/scdwt.asm	Tue Dec 29 12:42:29 2009 +0000
@@ -95,8 +95,8 @@
 			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
+; 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
@@ -119,13 +119,13 @@
 			
     		leas	2,s			; clean 3 DWsub args from stack 
 			
-* Check if we need to clean up IRQ
+; check if we need to clean up IRQ
 			bsr     CheckStats
     		beq		DumpVIRQ	;no more ports, lets bail
     		clrb
 			rts
 			
-* no more ports open.. are we the primary instance?
+; no more ports open... tear down ISR
 DumpVIRQ   	
 			IFGT    Level-1
 			ldy   	<D.DWStat
@@ -135,7 +135,7 @@
 			leay    DW.VIRQPkt,y
          	ldx   	#$0000		;code to delete VIRQ entry
          	os9   	F$VIRQ		;remove from VIRQ polling
-         	bcs   	ReleaseMem	;go
+
 DumpIRQ
 			IFGT    Level-1
 			ldx   	<D.DWStat
@@ -178,8 +178,8 @@
 			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
+; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
+;			leax    DW.StatTbl,x
 			ldb     #7
 CheckLoop   tst     ,x+
 			bne     CheckExit
@@ -200,14 +200,23 @@
 *
             
 * Default time packet
-DefTime         dtb
+DefTime     dtb
 
 Init		equ		*
 
- lda IT.PAR,y
-			pshs  cc,a        save IRQ/Carry status
-* link to subroutine module
-         	pshs	u				;preserve u since os9 link is coming up
+			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
@@ -223,44 +232,44 @@
          	puls  	x
          	stx   	<D.Proc
          	ENDC
-         	lbcs   	InitExBad
+         	lbcs   	InitEx
          	IFGT  	Level-1
          	sty   	<D.DWSubAddr
          	ELSE
          	sty   	>D.DWSubAddr
          	ENDC
-         	jsr   	,y			call DW init routine
+         	jsr   	,y				; call DW init routine
        	
-         	puls	u				;restore u
+			puls	u				; restore u
       	
+already
+; load stat address
 			IFGT    Level-1
 			ldx     <D.DWStat
 			ELSE
 			ldx     >D.DWStat
 			ENDC
-			bne     IRQok
+			bne     IRQok			; if non-zero, already been allocated
 
-* allocate DW stat page
+; allocate DW statics page
 			pshs    u
 			ldd     #$0100
 			os9     F$SRqMem
 			tfr     u,x
 			puls    u
-			lbcs    InitExBad
+			lbcs    InitEx
 			IFGT    Level-1
 			stx     <D.DWStat
 			ELSE
 			stx     >D.DWStat
 			ENDC
-* clear out 256 byte page at X
+; clear out 256 byte page at X
 			clrb
 loop@       clr     ,x+
 			decb
 			bne     loop@
         	
-* If here, we must install ISR
-     
-* Install the IRQ/VIRQ entry 
+; if here, we must install IRQ/VIRQ entry
 InstIRQ
 			IFGT    Level-1
 			ldx   	<D.DWStat
@@ -278,7 +287,7 @@
          	leay  	IRQSvc,pcr  	;IRQ service entry
          	os9   	F$IRQ			;install
 			puls    u
-         	bcs   	InitExBad   		;exit with error
+         	bcs   	InitEx   		;exit with error
          	ldd   	#$0003     		;lets try every 6 ticks (0.1 seconds) -- testing 3, gives better response in interactive things
 			IFGT    Level-1
 			ldx   	<D.DWStat
@@ -286,44 +295,41 @@
 			ldx   	>D.DWStat
 			ENDC
 			leax    DW.VIRQPkt,x
-         	std   	Vi.Rst,x		;reset count
-			tfr     x,y             ;move VIRQ software packet to Y
-tryagain  	ldx   	#$0001     		;code to install new VIRQ
-         	os9   	F$VIRQ			;install
-         	bcc   	IRQok1st   		;no error, continue
+         	std   	Vi.Rst,x		; reset count
+			tfr     x,y             ; move VIRQ software packet to Y
+tryagain  	ldx   	#$0001     		; code to install new VIRQ
+         	os9   	F$VIRQ			; install
+         	bcc   	IRQok   		; no error, continue
             cmpb    #E$UnkSvc
-			bne     InitExBad
-* If we get an E$UnkSvc error, then clock has not been initialized, so do it here
+			bne     InitEx
+; if we get an E$UnkSvc error, then clock has not been initialized, so do it here
             leax    DefTime,pcr
             os9     F$STime
 			bra     tryagain        ; note: this has the slim potential of looping forever
          	
-IRQok1st	
 IRQok
 			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
+; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
+;			leax    DW.StatTbl,x
 			tfr     u,d
-	        ldb		<V.PORT+1,u		;get our port #
-			sta		b,x				;store in table
+	        ldb		<V.PORT+1,u		; get our port #
+			sta		b,x				; store in table
 	
-			* 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
+; 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
 
-			* tell DW we have a new port opening
-			ldb		1,s		; get our port mode from stack
-			pshs    b
+; 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
@@ -337,44 +343,38 @@
 			ENDC
     		jsr     6,u      		; call DWrite
     		
-			*for now setstat does not respond    		
-    		leas	3,s				;clean dw args off stack
+    		leas	2,s				; clean dw args off stack (leave port mode)
     		
 InitEx		equ		*
-			puls	cc,a,pc
-InitExBad
-			puls cc,a
-			orcc  #Carry
-			rts
+			puls	a,pc
 
-* drivewire info
+; drivewire info
 dw3name  	fcs  	/dw3/
 
 
 
-***********************************************************************
-* Interrupt handler  - Much help from Darren Atkinson
-
+; ***********************************************************************
+; Interrupt handler  - Much help from Darren Atkinson
 			
-IRQMulti3   anda    #$1F		;mask first 5 bits, a is now port #+1
-  			deca				;we pass +1 to use 0 for no data
-            pshs    a			;save port #
-         	cmpb	RxGrab,u	;compare room in buffer to server's byte
-           	bhs		IRQM06		;room left >= server's bytes, no problem
+IRQMulti3   anda    #$1F		; mask first 5 bits, a is now port #+1
+  			deca				; we pass +1 to use 0 for no data
+            pshs    a			; save port #
+         	cmpb	RxGrab,u	; compare room in buffer to server's byte
+           	bhs		IRQM06		; room left >= server's bytes, no problem
   					
-           	stb		RxGrab,u	;else replace with room left in our buffer
+           	stb		RxGrab,u	; else replace with room left in our buffer
   			
            	* also limit to end of buffer
-IRQM06		ldd		RxBufEnd,u	;end addr of buffer
-			subd	RxBufPut,u	;subtract current write pointer, result is # bytes left going forward in buff.
+IRQM06		ldd		RxBufEnd,u	; end addr of buffer
+			subd	RxBufPut,u	; subtract current write pointer, result is # bytes left going forward in buff.
 
-IRQM05		cmpb	RxGrab,u	;compare b (room left) to grab bytes  
-			bhs		IRQM03		;branch if we have room for grab bytes
+IRQM05		cmpb	RxGrab,u	; compare b (room left) to grab bytes  
+			bhs		IRQM03		; branch if we have room for grab bytes
 			
-			stb		RxGrab,u	;else set grab to room left
+			stb		RxGrab,u	; else set grab to room left
 			
 			* send multiread req
-IRQM03		puls    a			;port # is on stack
+IRQM03		puls    a			; port # is on stack
 			ldb		RxGrab,u
 
 			pshs	u
@@ -398,7 +398,7 @@
     		ldx		,s			; pointer to this port's area (from U prior), leave it on stack
     		ldb		RxGrab,x	; set B to grab bytes
     		clra				; 0 in high byte		
-    		tfr		d,y			;set # bytes for DW
+    		tfr		d,y			; set # bytes for DW
     		
     		ldx    RxBufPut,x	; point X to insert position in this port's buffer
     		* receive response
@@ -408,19 +408,19 @@
 			
 			puls	u
 			ldb		RxGrab,u	; our grab bytes
-
+ 
 			* set new RxBufPut
-			ldx 	RxBufPut,u	;current write pointer
-			abx					;add b (# bytes) to RxBufPut
-			cmpx  	RxBufEnd,u 	;end of Rx buffer?
-			blo   	IRQM04		;no, go keep laydown pointer
-			ldx   	RxBufPtr,u 	;get Rx buffer start address
-IRQM04   	stx   	RxBufPut,u 	;set new Rx data laydown pointer
+			ldx 	RxBufPut,u	; current write pointer
+			abx					; add b (# bytes) to RxBufPut
+			cmpx  	RxBufEnd,u 	; end of Rx buffer?
+			blo   	IRQM04		; no, go keep laydown pointer
+			ldx   	RxBufPtr,u 	; get Rx buffer start address
+IRQM04   	stx   	RxBufPut,u 	; set new Rx data laydown pointer
 
 			* set new RxDatLen
 			ldb		RxDatLen,u
 			addb	RxGrab,u
-			stb		RxDatLen,u	;store new value
+			stb		RxDatLen,u	; store new value
 			
 			bra     CkSuspnd
 			
@@ -429,24 +429,24 @@
            	stb		RxGrab,u	
            	
   			* limit server bytes to bufsize - datlen
-  			ldb		RxBufSiz,u	;size of buffer
-           	subb	RxDatLen,u	;current bytes in buffer
-           	bne		IRQMulti3	;continue, we have some space in buffer
+  			ldb		RxBufSiz,u	; size of buffer
+           	subb	RxDatLen,u	; current bytes in buffer
+           	bne		IRQMulti3	; continue, we have some space in buffer
   			* no room in buffer
   			tstb
   			bne		CkSuspnd
   			bra		IRQExit
   			
 
-**** IRQ ENTRY POINT
+; **** IRQ ENTRY POINT
 IRQSvc		equ		*
-			pshs  	cc,dp 		;save system cc,DP
-			orcc	#IntMasks	;mask interrupts
+			pshs  	cc,dp 		; save system cc,DP
+			orcc	#IntMasks	; mask interrupts
 			
 			* mark VIRQ handled (note U is pointer to our VIRQ packet in DP)
-			lda   	Vi.Stat,u	;VIRQ status register
-			anda  	#^Vi.IFlag 	;clear flag in VIRQ status register
-			sta   	Vi.Stat,u	;save it...
+			lda   	Vi.Stat,u	; VIRQ status register
+			anda  	#^Vi.IFlag 	; clear flag in VIRQ status register
+			sta   	Vi.Stat,u	; save it...
 			
 			* poll server for incoming serial data
  			
@@ -456,7 +456,7 @@
 			leax    ,s     		; point X to stack 
 			ldy     #1          ; 1 byte to send
     
-			IFGT  Level-1
+			IFGT	Level-1
 			ldu   	<D.DWSubAddr
 			ELSE
 			ldu   	>D.DWSubAddr
@@ -464,7 +464,7 @@
     		jsr     6,u      	; call DWrite
     		
     		* receive response
-    		leas	-1,s		;one more byte to fit response
+    		leas	-1,s		; one more byte to fit response
 			leax    ,s   		; point X to stack head
 			ldy     #2    		; 2 bytes to retrieve
 			jsr     3,u    		; call DWRead
@@ -477,20 +477,20 @@
      		ldd     ,s++     	; pull returned status byte into A,data into B (set Z if zero, N if multiread)
   			beq   	IRQExit  	; branch if D = 0 (nothing to do)
 
-* save back D on stack and build our U
+; save back D on stack and build our U
             pshs    d
-  			anda    #$1F		;mask first 5 bits, a is now port #+1
-  			deca				;we pass +1 to use 0 for no data
-* here we set U to the static storage area of the device we are working with
+  			anda    #$1F		; mask first 5 bits, a is now port #+1
+  			deca				; we pass +1 to use 0 for no data
+; here we set U to the static storage area of the device we are working with
 			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
+; cheat: we know DW.StatTbl is at offset $00 from D.DWStat, do not bother with leax
+;			leax    DW.StatTbl,x
 			lda     a,x
-			bne		IRQCont		;if A is 0, then this device is not active, so exit
+			bne		IRQCont		; if A is 0, then this device is not active, so exit
             puls    d
 			bra     IRQExit
 IRQCont
@@ -501,41 +501,40 @@
   			
   			bmi		IRQMulti	; branch for multiread
   			
-* put byte B in port As buffer - optimization help from Darren Atkinson       
-IRQPutCh   	ldx     RxBufPut,u	;point X to the data buffer
+; put byte B in port As buffer - optimization help from Darren Atkinson       
+IRQPutCh   	ldx     RxBufPut,u	; point X to the data buffer
         
-* process interrupt/quit characters here
-* note we will have to do this in the multiread (ugh)                     
-*                  lda  #S$Intrpt
-*		  cmpb V.INTR,u
-*                  bne  test2
-test2
-*                  lda  #S$Abort
-*                  cmpb V.QUIT,u
-*                  bne store
-*                  ldb  V.LPRC,u
-*                  exg  a,b
-*                  os9  F$Send 
-*                  bra  IRQExit
+; process interrupt/quit characters here
+; note we will have to do this in the multiread (ugh)
+			tfr		b,a			; put byte in A
+			ldb		#S$Intrpt
+			cmpa	V.INTR,u
+			beq		send@
+			ldb		#S$Abort
+			cmpa	V.QUIT,u
+			bne		store
+send@		lda		V.LPRC,u
+			os9		F$Send 
+			bra		IRQExit
  
 store
 			* store our data byte
 			stb    	,x+     	; store and increment buffer pointer
         
 			* adjust RxBufPut	
-			cmpx  	RxBufEnd,u 	;end of Rx buffer?
-			blo   	IRQSkip1	;no, go keep laydown pointer
-			ldx   	RxBufPtr,u 	;get Rx buffer start address
-IRQSkip1   	stx   	RxBufPut,u 	;set new Rx data laydown pointer
+			cmpx  	RxBufEnd,u 	; end of Rx buffer?
+			blo   	IRQSkip1	; no, go keep laydown pointer
+			ldx   	RxBufPtr,u 	; get Rx buffer start address
+IRQSkip1   	stx   	RxBufPut,u 	; set new Rx data laydown pointer
 
 			* increment RxDatLen
 			inc		RxDatLen,u
 
 
   			* check if we have a process waiting for data	
-CkSuspnd   	lda   	<V.WAKE,u   	;V.WAKE?
-			beq   	IRQExit   	;no
-			clr 	<V.WAKE,u		;clear V.WAKE
+CkSuspnd   	lda   	<V.WAKE,u  	; V.WAKE?
+			beq   	IRQExit   	; no
+			clr 	<V.WAKE,u	; clear V.WAKE
 			
 			* wake up waiter for read
 			IFEQ  	Level-1
@@ -543,14 +542,14 @@
 			os9   	F$Send
 			ELSE
 			clrb
-			tfr   	d,x            ;copy process descriptor pointer
-			lda   	P$State,x      ;get state flags
-			anda  	#^Suspend      ;clear suspend state
-			sta   	P$State,x      ;save state flags
+			tfr   	d,x         ; copy process descriptor pointer
+			lda   	P$State,x   ; get state flags
+			anda  	#^Suspend   ; clear suspend state
+			sta   	P$State,x   ; save state flags
 			ENDC
 
 IRQExit
-IRQExit2  	puls  	cc,dp,pc		;restore interrupts cc,dp, return
+IRQExit2  	puls  	cc,dp,pc	; restore interrupts cc,dp, return
          
 
 			
@@ -568,12 +567,12 @@
 *
 * 
 Write    	equ   	*
-         	pshs	a				; character to send on stack
-         	ldb		V.PORT+1,u		;port number into B
+         	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)
+         	ldy   	#$0003		; 3 bytes to send.. ugh.  need WRITEM (data mode)
          	IFGT  	Level-1
          	ldu   	<D.DWSubAddr
          	ELSE
@@ -588,57 +587,57 @@
 * Read - my crazy attempt #4
 
 Read    	equ  	*
-			pshs  	cc,dp          save IRQ/Carry status, system DP
+			pshs  	cc,dp       ; save IRQ/Carry status, system DP
 
-ReadChr		orcc	#$50		;mask interrupts
+ReadChr		orcc	#$50		; mask interrupts
 			
-			lda   	RxDatLen,u 	;get our Rx buffer count
-			beq   	ReadSlp 	;no data, go sleep while waiting for new Rx data...
+			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
+			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
+			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
+			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
+			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
+           	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
+ReadSlp2   	lda   	>D.Proc    	; process descriptor address MSB
+           	sta   	<V.WAKE,u   ; save MSB in V.WAKE
            	clrb
-           	tfr		d,x			;process descriptor address
+           	tfr		d,x			; process descriptor address
            	IFNE  	H6309
-           	oim   	#Suspend,P$State,x 	;suspend
+           	oim   	#Suspend,P$State,x 	; suspend
            	ELSE
            	ldb   	P$State,x
            	orb   	#Suspend
-           	stb   	P$State,x 	;suspend
+           	stb   	P$State,x 	; suspend
            	ENDC
-           	lbsr  Sleep1		;sleep level 2 style
+           	lbsr	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$Intrpt  	;(interrupt only)
-           	lbls  	ErrExit    	;yes, go do it...
+           	ldx   	>D.Proc		; process descriptor address
+           	ldb   	P$Signal,x 	; pending signal for this process?
+           	beq   	ChkState  	; no, go check process state...
+           	cmpb  	#S$Intrpt  	; (interrupt only)
+           	lbls  	ErrExit    	; yes, go do it...
 
 ChkState   	equ   	*
 			* have we been condemned to die?
@@ -648,34 +647,34 @@
           	ldb   	P$State,x
            	bitb  	#Condem
            	ENDC
-           	bne   	PrAbtErr 	;yes, go do it...
+           	bne   	PrAbtErr 	; yes, go do it...
            	
            	* check that our waiter byte was cleared by ISR instance
-			lda		<V.WAKE,u		;our waiter byte
-			beq		ReadChr		;0 = its our turn, go get a character 
-           	bra   	ReadSlp		;false alarm, go back to sleep
+			lda		<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
+PrAbtErr	ldb   	#E$PrcAbt	; set error code
 
 ErrExit    	equ  	*
            	IFNE  	H6309
-           	oim   	#Carry,,s 	;set carry
+           	oim   	#Carry,,s 	; set carry
            	ELSE
            	lda   	,s
            	ora   	#Carry
            	sta   	,s
            	ENDC
-           	puls 	cc,dp,pc 	;restore CC, system DP, return
+           	puls 	cc,dp,pc 	; restore CC, system DP, return
 
            	IFEQ  	Level-1
-Sleep0     	ldx   	#$0			;sleep till ISR wakes us
+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
+Sleep1     	ldx   	#$1			; just sleep till end of slice, we are suspended (level 2)             
+TimedSlp	andcc 	#^Intmasks  ; enable IRQs
 			os9   	F$Sleep
-           	rts          		;return
+           	rts          		; return
 
 
 **********************************************************************
@@ -691,21 +690,21 @@
 *    B  = error code 
 *
 
-GetStt		clrb    			;default to no error...
-			pshs  	cc,dp  		;save IRQ/Carry status,system DP
+GetStt		clrb    			; default to no error...
+			pshs  	cc,dp  		; save IRQ/Carry status,system DP
            
-        	ldx   	PD.RGS,y	;caller's register stack pointer
+        	ldx   	PD.RGS,y	; caller's register stack pointer
         	cmpa  	#SS.EOF		
-        	beq   	GSExitOK 	;SCF devices never return EOF
+        	beq   	GSExitOK 	; SCF devices never return EOF
            
         	cmpa  	#SS.Ready
-        	bne   	GetScSiz	;next check
+        	bne   	GetScSiz	; 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         
+        	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 
@@ -722,15 +721,15 @@
            	std   	R$X,x
            	ldb   	IT.ROW,u
            	std   	R$Y,x
-           	puls  	cc,dp,pc	;restore Carry status, system DP, return
+           	puls  	cc,dp,pc	; restore Carry status, system DP, return
 
 GetComSt   	cmpa  	#SS.ComSt
-           	lbne  	UnSvcErr	;no, we have no more answers, report error
-           	ldd   	FlowCtrl,u	;flow control info
+           	lbne  	UnSvcErr	; no, we have no more answers, report error
+           	ldd   	FlowCtrl,u	; flow control info
            	std   	R$Y,x
-           	clra                 ;default to DCD and DSR enabled
-           	sta   	R$B,x		;set 6551 ACIA style DCD/DSR status in caller's [B]
-           	puls  	cc,dp,pc	;restore Carry status, system DP, return			
+           	clra                ; default to DCD and DSR enabled
+           	sta   	R$B,x		; set 6551 ACIA style DCD/DSR status in caller's [B]
+           	puls  	cc,dp,pc	; restore Carry status, system DP, return			
 
 *************************************************************************         
 * SetStat
@@ -746,7 +745,7 @@
 *  
 * also needs much work
 SetStt   
-Close    cmpa  #SS.Close	close the device?
+Close    cmpa  #SS.Close		; close the device?
          bne   L0173
          lda   #OP_NOP	
          pshs  a