changeset 1755:28d21787be81

test case for new as6809
author boisy
date Wed, 23 Mar 2005 03:21:28 +0000
parents 9092b25eeb4c
children a4f606d2f66e
files level1/cmds/tee.a
diffstat 1 files changed, 83 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/level1/cmds/tee.a	Wed Mar 23 03:21:28 2005 +0000
@@ -0,0 +1,83 @@
+;*******************************************************************
+; Tee - Split output to multiple devices
+;
+; $Id$
+;
+; Edt/Rev  YYYY/MM/DD  Modified by
+; Comment
+; ------------------------------------------------------------------
+;   2      ????/??/??
+; From Tandy OS-9 Level One VR 02.00.00.
+
+	.include	"/Users/boisy/Projects/nitros9/defs/const.d"
+	.include	"/Users/boisy/Projects/nitros9/defs/io.d"
+	.include	"/Users/boisy/Projects/nitros9/defs/ioman.d"
+	.include	"/Users/boisy/Projects/nitros9/defs/errno.d"
+	.include	"/Users/boisy/Projects/nitros9/defs/syscall.d"
+	.include	"/Users/boisy/Projects/nitros9/defs/module.d"
+
+         .module   tee,Prgrm+Objct,ReEnt+1,3,dsize
+
+	.area	DATA
+
+u0000:    .blkb   1
+parray:   .blkb   13
+pcount:   .blkb   1
+buff:     .blkb   256
+          .blkb   450
+dsize     ==      .
+
+start:   clrb  
+         clr   pcount,u		; clear path counter
+         cmpy  #0h0000		; any parameters?
+         lbeq  exitok		; exit if none
+         leay  parray,u		; else point Y to path array
+
+; Walk the command line parameters
+parse:   lda   ,x+
+         cmpa  #C$SPAC
+         beq   parse
+         cmpa  #C$COMA
+         beq   parse
+         cmpa  #C$CR
+         lbeq  parsex
+; We've found a file or device name
+         leax  -1,x
+         lda   #WRITE.
+         ldb   #PREAD.+UPDAT.
+         os9   I$Create 	; open a path to the device or file
+         bcs   exit		; branch if error
+         ldb   pcount,u		; else get path counter
+         sta   b,y		; save new path in the array offset
+         incb  			; increment counter
+         stb   pcount,u		; and save
+         bra   parse		; continue parsing command line
+parsex:  stb   pcount,u
+
+; Devices on command line are open, start pumping data
+L0044:   clra  
+         leax  buff,u
+         ldy   #256
+         os9   I$ReadLn 
+         bcc   L0057
+         cmpb  #E$EOF
+         beq   exitok
+         coma  
+         bra   exit
+L0057:   inca  
+         os9   I$WritLn 
+         tst   pcount,u
+         beq   L0044
+         clrb  
+L0060:   leay  parray,u
+         lda   b,y
+         leax  buff,u
+         ldy   #256
+         os9   I$WritLn 
+         bcs   exit
+         incb  
+         cmpb  pcount,u
+         bne   L0060
+         bra   L0044
+exitok:  clrb  
+exit:    os9   F$Exit