changeset 1332:80f15c027ebb

Improved ngu somewhat
author boisy
date Sun, 07 Sep 2003 19:29:52 +0000
parents 0a3500c747de
children 534d7fbf274a
files level1/cmds/makefile level1/cmds/ngu.asm
diffstat 2 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/makefile	Sun Sep 07 00:53:51 2003 +0000
+++ b/level1/cmds/makefile	Sun Sep 07 19:29:52 2003 +0000
@@ -11,7 +11,7 @@
 		date dcheck debug ded deiniz del deldir devs dir disasm \
 		display dmode dsave dump echo edit error exbin exmode format \
 		free grfo help ident iniz irqs link list load login makdir \
-		mdir merge mfree os9gen park prompt printerr procs pwd pxd \
+		mdir merge mfree os9gen padrom park prompt printerr procs pwd pxd \
 		rename runb save setime shell sleep tee tmode touch tsmon \
 		tuneport unlink verify xmode
 SUBS		= gfx inkey syscall
--- a/level1/cmds/ngu.asm	Sun Sep 07 00:53:51 2003 +0000
+++ b/level1/cmds/ngu.asm	Sun Sep 07 19:29:52 2003 +0000
@@ -64,7 +64,7 @@
 * Module header definitions
 tylg     set   Prgrm+Objct   
 atrv     set   ReEnt+rev
-rev      set   $01
+rev      set   $00
 edition  set   1
 
          mod   eom,name,tylg,atrv,start,size
@@ -185,8 +185,7 @@
          lbsr  SkipNSpc         move past the argument
 ChkDash  lbsr  SkipSpcs         and any following spaces
          bra   GetChar          start processing again
-GetDash  lda   #C$SPAC		get a space char
-         sta   -1,x		and wipe out the dash from the cmd line
+GetDash  clr   -1,x		and wipe out the dash from the cmd line
 GetDash2 ldd   ,x+		load option char and char following
          ora   #$20		make lowercase
 IsItA    cmpa  #'a		is it this option?
@@ -204,11 +203,12 @@
          cmpb  #'=		2nd char =?
          lbne  ShowHelp		show help if not
          inc   <coptflg		else tag this option as parsed
-         ldb   #C$SPAC		get space
-         stb   -$01,x		write over c
-         stb   ,x+		and = sign, inc X to dest dir
+*         ldb   #C$SPAC		get space
+         clr   -$01,x		write over c
+         clr   ,x+		and = sign, inc X to dest dir
 * check for valid char after -c=
          lda   ,x
+         lbeq  ShowHelp         
          cmpa  #C$SPAC
          lbeq  ShowHelp         
          cmpa  #C$CR
@@ -217,13 +217,14 @@
          tfr   y,d		transfer Y to D
          addd  #COPTSIZ
          pshs  b,a		save updated ptr value
-         ldb   #C$SPAC		get space
 L0339    lda   ,x		get byte at X
-         stb   ,x+		store space at X and inc
+         clr   ,x+		store nul byte at X and inc
          sta   ,y+		save loaded byte at Y and inc
          cmpy  ,s		are we at end?
          beq   L035D		branch if so (buffer too small)
-         cmpa  #C$SPAC		else is char in A a space?
+         tsta			else is char in A a nul byte?
+         beq   L0350		branch if so
+         cmpa  #C$SPAC		a space?
          beq   L0350		branch if so
          cmpa  #C$CR		cr?
          bne   L0339		get next byte if not
@@ -235,8 +236,7 @@
          ldb   #$BF		else buffer size too small
          orcc  #Carry
          lbra  Exit
-FixCmdLn lda   #C$SPAC		get space
-         sta   -$01,x		and wipe out option character
+FixCmdLn clr   -$01,x		and wipe out option character
          cmpb  #'0
          lblt  ChkDash		start dash option processing again
          lbra  GetDash		possibly another option following?
@@ -264,7 +264,7 @@
 * if your utility requires a non-option on the command line.
 DoNGU    tst   <filecnt		we should have at least one file on cmdline
          lbeq  ShowHelp		if not, exit with error
-         ldx   <parmptr		get our parameter pointer off stack
+         ldx   <parmptr		get our parameter pointer
 DoLoop   lbsr  SkipSpcs		skip any leading spaces
          cmpa  #C$CR		end of parameters?
          beq   ExitOk		if so, end the utility
@@ -305,13 +305,14 @@
 * starting at X
 *
 * Entry:
-*   X = ptr to string (space, comma or CR terminated)
+*   X = ptr to string (space, nul byte or CR terminated)
 * Exit:
 *   Y = length of string
 *   X = ptr to byte after string
 StrLen   pshs  a
          ldy   #$0000
 StrLenLp lda   ,x+
+         beq   StrLenEx
          cmpa  #C$SPAC
          beq   StrLenEx
          cmpa  #C$CR
@@ -333,6 +334,7 @@
 StrCpy   pshs  u
          ldu   #$0000
 CopyFnLp lda   ,x+
+         beq   CopyFnEx
          cmpa  #C$SPAC
          beq   CopyFnEx
          cmpa  #C$CR
@@ -343,7 +345,7 @@
 CopyFnEx tfr   u,d
          puls  u,pc
 
-* This routine skip over spaces and commas
+* This routine skip over spaces and nul bytes
 *
 * Entry:
 *   X = ptr to data to parse
@@ -351,12 +353,13 @@
 *   X = ptr to first non-whitespace char
 *   A = non-whitespace char
 SkipSpcs lda   ,x+
+         beq   SkipSpcs
          cmpa  #C$SPAC
          beq   SkipSpcs
          leax  -1,x
          rts
 
-* This routine skips over everything but spaces, commas and CRs
+* This routine skips over everything but spaces, nul bytes and CRs
 *
 * Entry:
 *   X = ptr to data to parse
@@ -364,6 +367,7 @@
 *   X = ptr to first whitespace char
 *   A = whitespace char
 SkipNSpc lda   ,x+
+         beq   EatOut
          cmpa  #C$SPAC
          beq   EatOut
          cmpa  #C$CR