changeset 848:c6ebca55eed3

Dir now uses -e and -x and deldir changed accordingly
author boisy
date Tue, 14 Jan 2003 19:58:02 +0000
parents c5ed817a59d0
children 9d87469f1f17
files level1/cmds/deldir.asm level1/cmds/dir.asm
diffstat 2 files changed, 184 insertions(+), 151 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/deldir.asm	Tue Jan 14 15:56:15 2003 +0000
+++ b/level1/cmds/deldir.asm	Tue Jan 14 19:58:02 2003 +0000
@@ -6,6 +6,7 @@
 * Ed.    Comments                                       Who YY/MM/DD
 * ------------------------------------------------------------------
 *   3    From Tandy OS-9 Level Two VR 02.00.01
+*   4    Updated to add -e instead of e to dir          BGP 03/01/14
 
          nam   Deldir
          ttl   Delete a directory
@@ -19,7 +20,7 @@
 tylg     set   Prgrm+Objct   
 atrv     set   ReEnt+rev
 rev      set   $01
-edition  set   3
+edition  set   4
 
          mod   eom,name,tylg,atrv,start,size
 
@@ -123,15 +124,17 @@
          fcc   "Deleting directory file. "
          fcb   C$LF
          fcc   "List directory, delete directory, or quit ? (l/d/q) "
+PromptL  equ   *-Prompt
 Cont     fcb   C$LF
          fcc   "Continue? (y/n) "
+ContL    equ   *-Cont
 
 PromptUser
          tstb  
          bne   L013E
          lda   #$01
          leax  <Prompt,pcr
-         ldy   #79
+         ldy   #PromptL
          os9   I$WritLn 
 L011B    bcs   L013E
          bsr   ReadKey
@@ -144,7 +147,7 @@
 L012A    bsr   L0145
 L012C    bcs   L013E
          leax  <Cont,pcr
-         ldy   #$0011
+         ldy   #ContL
          lda   #$01
          os9   I$WritLn 
          bcs   L013E
@@ -152,7 +155,7 @@
 L013E    rts   
 DIR      fcc   "DIR"
          fcb   C$CR
-DIROPTS  fcc   "E "
+DIROPTS  fcc   "-E "
 L0145    pshs  u
          leau  <buffer,u
          pshs  u
@@ -180,7 +183,7 @@
 
 ReadKey  leax  <buffer,u
          ldy   #80
-         lda   #$00
+         clra
          os9   I$ReadLn 
          bcs   L01B8
 L0187    lda   ,x+
--- a/level1/cmds/dir.asm	Tue Jan 14 15:56:15 2003 +0000
+++ b/level1/cmds/dir.asm	Tue Jan 14 19:58:02 2003 +0000
@@ -20,6 +20,7 @@
 
          ifp1
          use   defsfile
+         use   rbfdefs
          endc
 
 tylg     set   Prgrm+Objct   
@@ -29,19 +30,21 @@
 
          mod   eom,name,tylg,atrv,start,size
 
+         org   0
 u0000    rmb   2
-u0002    rmb   1
-u0003    rmb   1
-u0004    rmb   1
-u0005    rmb   1
+dircount rmb   1
+dirpath  rmb   1
+extended rmb   1
+addmode  rmb   1	additional mode
+rawpath  rmb   1
 u0006    rmb   2
 u0008    rmb   1
 u0009    rmb   1
-u000A    rmb   1
-u000B    rmb   1
+narrow   rmb   1
+bufptr   rmb   1
 u000C    rmb   1
-u000D    rmb   3
-u0010    rmb   3
+date     rmb   3
+time     rmb   3
 u0013    rmb   29
 u0030    rmb   1
 u0031    rmb   1
@@ -51,24 +54,25 @@
 u0036    rmb   6
 u003C    rmb   2
 u003E    rmb   2
-u0040    rmb   530
+linebuff rmb   530
 size     equ   .
 
 name     fcs   /Dir/
          fcb   edition
 
-L0011    fcb   C$LF
+DirOf    fcb   C$LF
          fcs   " Directory of "
-L0020    fcc   "."
+Dot      fcc   "."
          fcb   C$CR
-L0022    fcc   "@"
+Raw      fcc   "@"
          fcb   C$CR
-L0024    fcb   C$CR,C$LF
-         fcc   "Owner  Last modified   Attributes Sector Bytecount   Name"
+WHeader  fcb   C$CR,C$LF
+         fcc   "Owner  Last modified   Attributes Sector Bytecount Name"
          fcb   C$CR,C$LF
-         fcc   "----- ---------------- ---------- ------ --------- ----------"
+         fcc   "----- ---------------- ---------- ------ --------- ----"
          fcb   C$CR,C$LF
-L00A0    fcb   C$CR,C$LF
+WHeaderL equ   *-WHeader
+NHeader  fcb   C$CR,C$LF
          fcc   "Modified on  Owner   Name"
          fcb   C$CR,C$LF
          fcc   "  Attr     Sector     Size"
@@ -76,94 +80,95 @@
          fcc   "==============================="
          fcb   C$CR
          fcb   C$LF
+NHeaderL equ   *-NHeader
 
-start    leay  <u0040,u
-         sty   <u000B
-         clr   <u0004
-         clr   <u0003
-         clr   <u000A
-         lda   #$10
-         ldb   #$30
+start    leay  <linebuff,u	get ptr to line buffer
+         sty   <bufptr		and save it
+         clr   <addmode
+         clr   <extended
+         clr   <narrow
+         clr   <dircount
+         ldd   #$1030
          std   <u0008
          pshs  y,x,b,a
          lda   #$01
-         ldb   #$26
-         os9   I$GetStt 
-         bcc   L0120
-         cmpb  #$D0
-         beq   L012D
+         ldb   #SS.ScSiz	we want screen size
+         os9   I$GetStt 	get it
+         bcc   L0120		branch if gotten
+         cmpb  #E$UnkSvc	unknown service error?
+         beq   NoScSiz		branch if so
          puls  y,x,b,a
          lbra  L0268
-L0120    cmpx  #$0040
-         bge   L012D
-         inc   <u000A
-         lda   #$0A
-         ldb   #$14
+L0120    cmpx  #64		at least this wide?
+         bge   NoScSiz		branch if so
+         inc   <narrow
+         ldd   #$0A14
          std   <u0008
-L012D    puls  y,x,b,a
-         lbsr  L0370
-         lda   ,-x
-         cmpa  #$0D
-         bne   L013C
-         leax  >L0020,pcr
-L013C    stx   <u0000
-         lda   #$81
-         ora   <u0004
-         pshs  x,a
+NoScSiz  puls  y,x,b,a
+         pshs  x		save start of command line
+         lbsr  GetOpts		parse for options
+         puls  x		get start of command line
+         lbsr  SkipSpcs		skip any spaces
+         cmpa  #C$CR		any dir names?
+         bne   opendir		branch if so
+         leax  >Dot,pcr		else assume dot
+opendir  stx   <u0000
+         lda   #DIR.+READ.
+         ora   <addmode
+         pshs  x,a		preserve mode, dir name
          os9   I$Open   
-         sta   <u0002
-         puls  x,a
+         sta   <dirpath
+         puls  x,a		get mode, dir name
          lbcs  L0268
-         os9   I$ChgDir 
-         lbcs  L0268
-         pshs  x
-         leay  >L0011,pcr
+         os9   I$ChgDir 	change to dir
+         lbcs  L0268		branch if error
+         pshs  x		X now points just past name
+         leay  >DirOf,pcr
          lbsr  L02E6
          ldx   <u0000
 L0161    lda   ,x+
-         lbsr  L02B7
+         lbsr  PutNBuf
          cmpx  ,s
          bcs   L0161
          leas  $02,s
-         lbsr  L0370
-         lbsr  L02B5
-         lbsr  L02B5
-         leax  u000D,u
+         lbsr  PutSpace
+         lbsr  PutSpace
+         leax  date,u
          os9   F$Time   
-         leax  <u0010,u
+         leax  <time,u
          lbsr  L0328
          lbsr  L02F5
-         tst   <u0003
+         tst   <extended
          beq   L01B3
-         lda   #$01
-         ora   <u0004
-         leax  >L0022,pcr
+         lda   #READ.
+         ora   <addmode
+         leax  >Raw,pcr
          os9   I$Open   
          lbcs  L0268
-         sta   <u0005
-         tst   <u000A
+         sta   <rawpath
+         tst   <narrow
          bne   L01A6
-         leax  >L0024,pcr
-         ldy   #$007C
+         leax  >WHeader,pcr
+         ldy   #WHeaderL
          bra   L01AE
-L01A6    leax  >L00A0,pcr
-         ldy   #$005A
+L01A6    leax  >NHeader,pcr
+         ldy   #NHeaderL
 L01AE    lda   #$01
          os9   I$Write  
-L01B3    lda   <u0002
+L01B3    lda   <dirpath
          ldx   #$0000
          pshs  u
-         ldu   #$0040
+         ldu   #DIR.SZ*2
          os9   I$Seek   
          puls  u
          lbra  L0253
 L01C5    tst   <u0013
          lbeq  L0253
-         tst   <u0003
+         tst   <extended
          bne   L01E8
          leay  <u0013,u
          lbsr  L02E6
-L01D5    lbsr  L02B5
+L01D5    lbsr  PutSpace
          ldb   <u000C
          subb  #$40
          cmpb  <u0009
@@ -177,7 +182,7 @@
          clrb  
          tfr   d,u
          ldx   <u0030
-         lda   <u0005
+         lda   <rawpath
          os9   I$Seek   
          puls  u
          bcs   L0268
@@ -185,17 +190,17 @@
          ldy   #$000D
          os9   I$Read   
          bcs   L0268
-         tst   <u000A
+         tst   <narrow
          bne   L0231
          ldd   <u0034
          clr   <u0006
          bsr   L0274
-         lbsr  L02B5
+         lbsr  PutSpace
          lbsr  L030B
-         lbsr  L02B5
+         lbsr  PutSpace
          lbsr  L02D3
-         lbsr  L02B5
-         lbsr  L02B5
+         lbsr  PutSpace
+         lbsr  PutSpace
          bsr   L026E
          bsr   L0280
          leay  <u0013,u
@@ -206,26 +211,26 @@
          ldd   <u0034
          clr   <u0006
          bsr   L0274
-         bsr   L02B5
+         bsr   PutSpace
          leay  <u0013,u
          lbsr  L02E6
          lbsr  L02F5
          lbsr  L02D3
-         bsr   L02B5
-         bsr   L02B5
+         bsr   PutSpace
+         bsr   PutSpace
          bsr   L026E
          bsr   L0280
          lbsr  L02F5
 L0253    leax  <u0013,u
-         ldy   #$0020
-         lda   <u0002
+         ldy   #DIR.SZ
+         lda   <dirpath
          os9   I$Read   
          lbcc  L01C5
-         cmpb  #$D3
+         cmpb  #E$EOF
          bne   L0268
          clrb  
 L0268    lbsr  L02F5
-         os9   F$Exit   
+Exit     os9   F$Exit   
 L026E    lda   <u0030
          bsr   L0298
          ldd   <u0031
@@ -234,12 +239,12 @@
          bsr   L028E
          inc   <u0006
          bsr   L029C
-         bra   L02B5
+         bra   PutSpace
 L0280    ldd   <u003C
          bsr   L0298
          tfr   b,a
          bsr   L029A
-         bsr   L02B5
+         bsr   PutSpace
          ldd   <u003E
          bra   L0274
 L028E    pshs  a
@@ -257,48 +262,50 @@
          sta   <u0006
 L02A3    tst   <u0006
          bne   L02AB
-         lda   #$20
-         bra   L02B7
-L02AB    adda  #$30
-         cmpa  #$39
-         bls   L02B7
+         lda   #C$SPAC
+         bra   PutNBuf
+L02AB    adda  #'0
+         cmpa  #'9
+         bls   PutNBuf
          adda  #$07
-         bra   L02B7
-L02B5    lda   #$20
-L02B7    pshs  x
-         ldx   <u000B
-         cmpx  #$0090
-         bne   L02C4
+         bra   PutNBuf
+PutSpace lda   #C$SPAC
+
+PutNBuf  pshs  x		save caller's X
+         ldx   <bufptr		get buffer next pointer
+         cmpx  #$0090		past end?
+         bne   PutOk		branch if not
          bsr   L02F1
-         ldx   <u000B
-L02C4    sta   ,x+
-         stx   <u000B
-         puls  pc,x
+         ldx   <bufptr		get pointer
+PutOk    sta   ,x+		save A
+         stx   <bufptr		and update pointer
+         puls  pc,x		return
+
 L02CA    fcc   "dsewrewr"
          fcb    $FF
 L02D3    fcb    $D6,$33,$30,$8C,$F2
          lda   ,x+
 L02DA    lslb  
          bcs   L02DF
-         lda   #$2D
-L02DF    bsr   L02B7
+         lda   #'-
+L02DF    bsr   PutNBuf
          lda   ,x+
          bpl   L02DA
          rts   
 L02E6    lda   ,y
          anda  #$7F
-         bsr   L02B7
+         bsr   PutNBuf
          lda   ,y+
          bpl   L02E6
          rts   
 L02F1    pshs  y,x,b,a
          bra   L02FB
 L02F5    pshs  y,x,b,a
-         lda   #$0D
-         bsr   L02B7
-L02FB    leax  <u0040,u
-         stx   <u000B
-         ldy   #$0050
+         lda   #C$CR
+         bsr   PutNBuf
+L02FB    leax  <linebuff,u
+         stx   <bufptr
+         ldy   #80
          lda   #$01
          os9   I$WritLn 
          puls  pc,y,x,b,a
@@ -306,32 +313,32 @@
 L030E    bsr   L0338
          bsr   L0324
          bsr   L0324
-         bsr   L02B5
+         bsr   PutSpace
          bsr   L034F
-         tst   <u000A
+         tst   <narrow
          beq   L0320
          bsr   L034F
-         bra   L02B5
+         bra   PutSpace
 L0320    bsr   L0332
-         bra   L02B5
-L0324    lda   #$2F
+         bra   PutSpace
+L0324    lda   #'/
          bra   L0334
-L0328    tst   <u000A
+L0328    tst   <narrow
          bne   L0330
-         leax  u000D,u
+         leax  date,u
          bra   L030E
 L0330    bsr   L034F
-L0332    lda   #$3A
-L0334    bsr   L02B7
+L0332    lda   #':
+L0334    bsr   PutNBuf
          bra   L034F
 L0338    lda   #$AE
          ldb   ,x
 L033C    inca  
-         subb  #$64
+         subb  #100
          bcc   L033C
          stb   ,x
          tfr   a,b
-         tst   <u000A
+         tst   <narrow
          bne   L034B
          bsr   L035F
 L034B    ldb   ,x+
@@ -339,42 +346,65 @@
 L034F    ldb   ,x+
          lda   #$2F
 L0353    inca  
-         subb  #$64
+         subb  #100
          bcc   L0353
-         cmpa  #$30
+         cmpa  #'0
          beq   L035F
-         lbsr  L02B7
+         lbsr  PutNBuf
 L035F    lda   #$3A
 L0361    deca  
-         addb  #$0A
+         addb  #10
          bcc   L0361
-         lbsr  L02B7
+         lbsr  PutNBuf
          tfr   b,a
-         adda  #$30
-         lbra  L02B7
-L0370    ldd   ,x+
-         cmpa  #$20
-         beq   L0370
-         cmpa  #$2C
-         beq   L0370
-         eora  #$45
-         anda  #$DF
-         bne   L0388
-         cmpb  #$30
-         bcc   L039A
-         inc   <u0003
-         bra   L0370
-L0388    lda   -$01,x
-         eora  #$58
-         anda  #$DF
-         bne   L039A
-         cmpb  #$30
-         bcc   L039A
-         lda   #$04
-         sta   <u0004
-         bra   L0370
+         adda  #'0
+         lbra  PutNBuf
+
+* Entry: X = ptr to line to start parsing
+GetOpts  lda   ,x+		get next char on cmd line
+         cmpa  #C$CR		CR?
+         beq   L039A		yep, return
+         cmpa  #'-		option?
+         beq   GetDash		branch if not
+* Must be dir name, skip
+         inc   <dircount
+         bsr   SkipNSpc		skip spaces
+ChkDash  bsr   SkipSpcs		skip spaces
+         bra   GetOpts		and resart parsing
 L039A    rts   
 
+GetDash  lda   #C$SPAC
+         sta   -1,x
+GetDash2 ldd   ,x+
+         ora   #$20		make lowercase
+IsItE    cmpa  #'e		extended dir?
+         bne   IsItX
+         sta   <extended
+         bra   FixCmdLn
+IsItX    cmpa  #'x
+         lbne  Exit		bad option, just exit
+         lda   #EXEC.
+         sta   <addmode
+FixCmdLn lda   #C$SPAC
+         sta   -1,x
+         cmpb  #'0
+         lblt  ChkDash
+         bra   GetDash
+
+SkipSpcs lda   ,x+
+         cmpa  #C$SPAC
+         beq   SkipSpcs
+         leax  -1,x
+         rts
+   
+SkipNSpc lda   ,x+
+         cmpa  #C$SPAC
+         beq   SkipNRTS
+         cmpa  #C$CR
+         bne   SkipNSpc
+SkipNRTS leax  -1,x
+         rts
+   
          emod
 eom      equ   *
          end