changeset 917:06b4b630cbaf

Added comments
author boisy
date Sun, 19 Jan 2003 06:02:43 +0000
parents 76583cb0182f
children 66fe834fdbb9
files level1/cmds/tsmon.asm
diffstat 1 files changed, 49 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/tsmon.asm	Sat Jan 18 22:31:07 2003 +0000
+++ b/level1/cmds/tsmon.asm	Sun Jan 19 06:02:43 2003 +0000
@@ -23,63 +23,64 @@
 
          mod   eom,name,tylg,atrv,start,size
 
-u0000    rmb   1
-u0001    rmb   2
-u0003    rmb   2
-u0005    rmb   451
+         org   0
+childid  rmb   1
+parmptr  rmb   2
+parmlen  rmb   2
+inbuff   rmb   451
 size     equ   .
 
 name     fcs   /Tsmon/
          fcb   edition
 
-L0013    fcc   "LOGIN"
-L0018    fcb   C$CR
+Login    fcc   "LOGIN"
+LoginPrm fcb   C$CR
 
-L0019    rti
+IcptRtn  rti
 
-start    stx   <u0001
-         std   <u0003
-         leax  <L0019,pcr
-         os9   F$Icpt   
-L0024    ldx   <u0001
-         ldd   <u0003
-         cmpd  #$0002
+start    stx   <parmptr			save parameter pointer
+         std   <parmlen			save parameter length
+         leax  <IcptRtn,pcr		point to intercept routine
+         os9   F$Icpt   		and set it
+L0024    ldx   <parmptr			get pointer to parameter
+         ldd   <parmlen			and length
+         cmpd  #$0002			
          bcs   L0052
-         lda   ,x
-         cmpa  #C$CR
-         beq   L0052
-         clra  
-         os9   I$Close  
+         lda   ,x			get byte at command line
+         cmpa  #C$CR			cr?
+         beq   L0052			if so, branch
+         clra  				stdin
+         os9   I$Close  		close it
          lda   #UPDAT.
-         os9   I$Open   
-         bcs   L007B
-         inca  
-         os9   I$Close  
-         inca  
-         os9   I$Close  
-         clra  
-         os9   I$Dup    
-         bcs   L007B
-         os9   I$Dup    
-         bcs   L007B
-L0052    clra  
-         leax  u0005,u
-         ldy   #$0001
-         os9   I$ReadLn 
-         bcs   L0024
-         lda   #$01
-         clrb  
-         leax  <L0013,pcr
-         leau  <L0018,pcr
-         ldy   #$0000
-         os9   F$Fork   
-         bcs   L0024
-         sta   <u0000
-L0072    os9   F$Wait   
-         cmpa  <u0000
-         bne   L0072
-         bra   L0024
-L007B    os9   F$Exit   
+         os9   I$Open   		open device on command line
+         bcs   Exit			branch if error
+         inca  				A = 1
+         os9   I$Close  		close stdout
+         inca  				A = 2
+         os9   I$Close  		close stderr
+         clra  				stdin path
+         os9   I$Dup    		dup to stdout
+         bcs   Exit			branch if error
+         os9   I$Dup    		dup to stderr
+         bcs   Exit			branch if error
+L0052    clra  				stdin
+         leax  inbuff,u			point to buffer
+         ldy   #$0001			read 1 byte
+         os9   I$ReadLn 		read line
+         bcs   L0024			branch if error
+         lda   #Objct			object
+         clrb  				no additional mem
+         leax  <Login,pcr		point to login
+         leau  <LoginPrm,pcr		and to parameters
+         ldy   #$0000			parameter size
+         os9   F$Fork   		fork program
+         bcs   L0024			branch if error
+         sta   <childid			else save process ID of child
+L0072    os9   F$Wait   		wait for it to finish
+         cmpa  <childid			same as PID we forked?
+         bne   L0072			if not, wait more
+         bra   L0024			else go back
+Exit     os9   F$Exit   		exit
 
          emod
 eom      equ   *