changeset 827:6653afab1671

Made smaller, better!
author boisy
date Tue, 14 Jan 2003 02:58:01 +0000
parents 6c56dfe1de1c
children 064244c52232
files level1/cmds/iniz.asm
diffstat 1 files changed, 26 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/iniz.asm	Tue Jan 14 02:29:34 2003 +0000
+++ b/level1/cmds/iniz.asm	Tue Jan 14 02:58:01 2003 +0000
@@ -6,6 +6,7 @@
 * Ed.    Comments                                       Who YY/MM/DD
 * ------------------------------------------------------------------
 *   3    From Tandy OS-9 Level Two VR 02.00.01
+*   4    Tightened code, changed behavior slightly      BGP 03/01/13
 
          nam   Iniz
          ttl   Initialize a device
@@ -19,13 +20,15 @@
 tylg     set   Prgrm+Objct   
 atrv     set   ReEnt+rev
 rev      set   $01
-edition  set   3
+edition  set   4
+
+LINESIZE equ   80
 
          mod   eom,name,tylg,atrv,start,size
 
          org   0
-u0000    rmb   2
-readbuf  rmb   330
+readbuf  rmb   LINESIZE+1
+stack    rmb   64
 size     equ   .
 
 name     fcs   /Iniz/
@@ -34,55 +37,28 @@
 start    lda   ,x		get command line char
          cmpa  #C$CR		CR?
          beq   ReadnInz		branch if so
-         bsr   FindDevc		skip over spaces
-         bra   ExitOk		exit ok
-L001C    bsr   FindDevc		skip over spaces
-ReadnInz bsr   ReadLine
-         bcs   CheckEOF
-         lda   ,x
+InizDev  lda   ,x+
          cmpa  #C$CR
-         bne   L001C
-         ldb   #E$EOF
-CheckEOF cmpb  #E$EOF		end of file?
-         bne   ExitOk		branch if not
-ExitOk   clrb  
-         os9   F$Exit   
-
-ReadLine clra  
-         leax  readbuf,u
-         ldy   #80
-         os9   I$ReadLn 
-         bcc   L003E
-L003E    rts   
+         beq   ExitOk
+         cmpa  #C$SPAC
+         beq   InizDev
+         cmpa  #PDELIM		pathlist?
+         beq   AttachIt
+         leax  -1,x		else back up X
+AttachIt clra  
+         os9   I$Attach 	attach to the device at X
+         bcs   Exit		branch if error
+         bra   InizDev
 
-FindDevc lda   #C$SPAC		load A with space
-SkipLoop cmpa  ,x+		space at X?
-         beq   SkipLoop		keep going if so
-         leax  -$01,x		else back up X
-         stx   <u0000		and save
-         lda   #PDELIM		get path delim
-         cmpa  ,x		is this char at X?
-         bne   L0051		branch if not
-         leax  1,x		else skip over
-L0051    clra  
-         os9   I$Attach 	attach to the device at X
-         bcs   L0064		branch if error
-         lda   ,x+		get char at X
-         cmpa  #C$COMA		comma?
-         beq   FindDevc		branch if so
-         lda   ,-x		get byte at X-1
-         cmpa  #C$CR		CR?
-         bne   FindDevc		branch if not
-         rts   
-
-L0064    pshs  b		save error code
-         lda   #$02		stderr
-         ldx   <u0000
-         ldy   #80
-         os9   I$WritLn 
-         puls  b		pull error code from stack
-         os9   F$PErr   	print error
-         rts   
+ReadnInz clra			from stdin
+         leax  readbuf,u	point to read buffer
+         ldy   #LINESIZE	get LINESIZE bytes
+         os9   I$ReadLn 	read it!
+         bcc   InizDev		branch if error
+         cmpb  #E$EOF		end of file?
+         bne   Exit		branch if not
+ExitOk   clrb
+Exit     os9   F$Exit
 
          emod
 eom      equ   *