changeset 950:dbf9a6e913f4

Removed seemlingly useless code
author boisy
date Thu, 23 Jan 2003 22:21:51 +0000
parents cd215e8dce44
children 062d7f4e63b7
files level1/cmds/pd.asm
diffstat 1 files changed, 57 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/pd.asm	Thu Jan 23 02:53:18 2003 +0000
+++ b/level1/cmds/pd.asm	Thu Jan 23 22:21:51 2003 +0000
@@ -27,8 +27,8 @@
          org   0
 fildes   rmb   1
 bufptr   rmb   2
-dotdotfd rmb   3
-dotfd    rmb   3
+dotdotfd rmb   3		LSN of ..
+dotfd    rmb   3		LSN of .
 ddcopy   rmb   5
 dentry   rmb   160
 buffer   rmb   1
@@ -58,44 +58,45 @@
 rdmsg    fcc   "read error"
          fcb   C$CR
 
-start    leax  >buffer,u
-         lda   #C$CR
-         sta   ,x
-         stx   <bufptr
-         leax  >dot,pcr
-         bsr   open
-         sta   <fildes
-         lbsr  rdtwo
-         ldd   <dotdotfd
+start    leax  >buffer,u		point X to buffer
+         lda   #C$CR			get CR
+         sta   ,x			store at start of buffer
+         stx   <bufptr			store buffer pointer
+         leax  >dot,pcr			point to '.'
+         bsr   open			open directory
+         sta   <fildes			save path
+         lbsr  rdtwo			read '.' and '..' entries
+         ldd   <dotdotfd		get 24 bit LSN of ..
          std   <ddcopy
          lda   <dotdotfd+2
-         sta   <ddcopy+2
-L0052    bsr   L00C6
-         beq   L0079
-         leax  >dotdot,pcr
-         bsr   chdir
-         lda   <fildes
-         os9   I$Close  
-         bcs   L008D
-         leax  >dot,pcr
-         bsr   open
-         bsr   rdtwo
-         bsr   L00A8
+         sta   <ddcopy+2		and save copy
+L0052    bsr   AtRoot			are we at root?
+         beq   L0079			branch if so
+         leax  >dotdot,pcr		else point to '..'
+         bsr   chdir			change directory
+         lda   <fildes			get path to previous dir
+         os9   I$Close  		close it
+         bcs   Exit			branch if error
+         leax  >dot,pcr			point X to new current dir
+         bsr   open			open it
+         bsr   rdtwo			read . and .. entires of this dir
+         bsr   FindMtch			search for match
          bsr   L00E2
          ldd   <dotdotfd
          std   <ddcopy
          lda   <dotdotfd+2
          sta   <ddcopy+2
          bra   L0052
-L0079    lbsr  L00FB
-         ldx   <bufptr
-         ldy   #$0081
-         lda   #$01
-         os9   I$WritLn 
-         lda   <fildes
-         os9   I$Close  
+L0079    lbsr  GetDevNm			get device name
+         ldx   <bufptr			point to buffer
+         ldy   #$0081			get bytes to write
+         lda   #$01			to stdout
+         os9   I$WritLn 		write
+         lda   <fildes			get path
+         os9   I$Close  		close
          clrb  
-L008D    os9   F$Exit   
+Exit     os9   F$Exit   		and exit
+
          IFNE  PXD
 chdir    lda   #DIR.+EXEC.+READ.
          ELSE
@@ -105,6 +106,7 @@
          ENDC
          os9   I$ChgDir 
          rts   
+
          IFNE  PXD
 open     lda   #DIR.+EXEC.+READ.
          ELSE
@@ -115,22 +117,24 @@
          os9   I$Open   
          rts   
 
+* Read directory entry
 read32   lda   <fildes
          leax  dentry,u
          ldy   #DIR.SZ
          os9   I$Read   
          rts   
 
-L00A8    lda   <fildes
-         bsr   read32
-         bcs   L010F
-         leax  dentry,u
-         leax  <DIR.FD,x
-         leay  ddcopy,u
-         bsr   attop
-         bne   L00A8
+FindMtch lda   <fildes		get path to current dir
+         bsr   read32		read entry
+         bcs   CantRead		branch if error
+         leax  dentry,u		point to entry buffer
+         leax  <DIR.FD,x	point X to FD LSN
+         leay  ddcopy,u		point Y to copy of LSN
+         bsr   attop		compare the two
+         bne   FindMtch		keep reading until we find match
          rts   
 
+* Compare 3 bytes at X and Y
 attop    ldd   ,x++
          cmpd  ,y++
          bne   L00C5
@@ -138,9 +142,9 @@
          cmpa  ,y
 L00C5    rts   
 
-L00C6    leax  dotdotfd,u
-         leay  dotfd,u
-         bsr   attop   * check if we're at the top
+AtRoot   leax  dotdotfd,u	point X at .. entry
+         leay  dotfd,u		point Y at . entry
+         bsr   attop		check if we're at the top
          rts   
 
 rdtwo    bsr   read32  * read "." from directory
@@ -155,39 +159,35 @@
          sta   <dotdotfd+2
          rts   
 
+* Get name from directory entry
 L00E2    leax  dentry,u
 prsnam   os9   F$PrsNam 
-         bcs   L0109
+         bcs   IlglName
          ldx   <bufptr
 L00EB    lda   ,-y
-         anda  #$7F
-         sta   ,-x
+         anda  #$7F			mask hi bit
+         sta   ,-x			save
          decb  
          bne   L00EB
          lda   #PDELIM
          sta   ,-x
          stx   <bufptr
          rts   
-L00FB    lda   <fildes
+
+GetDevNm lda   <fildes
          ldb   #SS.DevNm
          leax  >sttbuf,u
          os9   I$GetStt 
          bsr   prsnam
          rts   
-L0109    leax  >badnam,pcr
-         bra   wrerr
-L010F    leax  >rdmsg,pcr
+
+IlglName leax  >badnam,pcr
          bra   wrerr
-L0115    lda   #$02
-         os9   I$Write  
-         bcs   L0128
-         rts   
-         bsr   L0115
-         leax  >cr,pcr
+
+CantRead leax  >rdmsg,pcr
 wrerr    lda   #$02
          os9   I$WritLn 
-L0128    ldb   #$00
-         os9   F$Exit   
+         os9   F$Exit
 
          emod
 eom      equ   *