changeset 873:c70da2076f02

Added comments
author boisy
date Fri, 17 Jan 2003 03:13:13 +0000
parents ad7443c6b53d
children 80bfb21bb6a6
files level1/cmds/attr.asm
diffstat 1 files changed, 73 insertions(+), 73 deletions(-) [+]
line wrap: on
line diff
--- a/level1/cmds/attr.asm	Thu Jan 16 21:18:13 2003 +0000
+++ b/level1/cmds/attr.asm	Fri Jan 17 03:13:13 2003 +0000
@@ -53,80 +53,83 @@
          fcc   " opts: -d s r w e pr pw pe -a"
          fcb   C$CR
          ENDC
-L0052    fcb   C$LF
+NotOwner fcb   C$LF
          fcc   "You do not own that file."
          fcb   C$CR
-L006D    fcb   C$LF
+UseMkDir fcb   C$LF
          fcc   "Use Makdir to create a directory"
          fcb   C$CR
-L008F    fcb   C$LF
+DirNtEmt fcb   C$LF
          fcc   "ERROR; the directory is not empty"
          fcb   C$CR
-L00B2    fcc   "dsewrewr"
+Attrs    fcc   "dsewrewr"
          fcb   $FF
 
-start    stx   <parmptr   save param ptr
+start    stx   <parmptr		save param ptr
          clr   <u0007
          com   <u0007
+* Open file at X as file
          clra  
-         os9   I$Open     open file on commandline
-         bcc   L00D9      branch if ok
-         ldx   <parmptr   get saved param ptr
-         lda   #DIR.!READ. load perms
-         os9   I$Open     open as directory
-         bcc   L00D9      branch if ok
-         ldx   <parmptr   get param ptr
-         lda   #DIR.      load different perms
-         os9   I$Open     try one more time
-         bcs   L0114      branch if error
-L00D9    sta   <fpath     save off path
-         stx   <cmdperms  save updated parm ptr
-         leax  pathopts,u point X to buffer
-         ldb   #SS.Opt    load with status code
-         os9   I$GetStt   get status
-         bcs   L0114      branch if error
+         os9   I$Open		open file on commandline
+         bcc   L00D9		branch if ok
+* If error, try to open as directory with read permission
+         ldx   <parmptr		get saved param ptr
+         lda   #DIR.!READ.	load perms
+         os9   I$Open		open as directory
+         bcc   L00D9		branch if ok
+* One last time, try open as directory only
+         ldx   <parmptr		get param ptr
+         lda   #DIR.		load different perms
+         os9   I$Open		try one more time
+         bcs   L0114		branch if error
+L00D9    sta   <fpath		save off path
+         stx   <cmdperms	save updated parm ptr
+         leax  pathopts,u	point X to buffer
+         ldb   #SS.Opt		load with status code
+         os9   I$GetStt		get status
+         bcs   L0114		branch if error
          clrb  
-         lda   ,x         get path type
-         cmpa  #DT.RBF    check if rbf path
-         lbne  L01AC      branch if not
-         ldx   <parmptr   else get parm ptr
+         lda   ,x		get path type
+         cmpa  #DT.RBF		check if rbf path
+         lbne  ShowHelp		branch if not
+         ldx   <parmptr		else get parm ptr
          leay  <filename,u point to buffer
-         lda   ,x+        get file name character
-         cmpa  #PDELIM    path delimiter?
-         bne   L0106      no
-L00FA    sta   ,y+        else save char in Y
-         lda   ,x+        get next file name char
-         cmpa  #C$PERD    period?
-         bcs   L0106      branch if not
-         cmpa  #PDELIM    path delimiter?
-         bne   L00FA      branch if not
+         lda   ,x+		get file name character
+         cmpa  #PDELIM		path delimiter?
+         bne   L0106		no
+L00FA    sta   ,y+		else save char in Y
+         lda   ,x+		get next file name char
+         cmpa  #C$PERD		period?
+         bcs   L0106		branch if not
+         cmpa  #PDELIM		path delimiter?
+         bne   L00FA		branch if not
 L0106    lda   #PENTIR
          ldb   #C$SPAC
          std   ,y++
-         leax  <filename,u point X to filename
-         lda   #READ.!WRITE. load perms
-         os9   I$Open     open in raw mode
-L0114    lbcs  L01AC      branch if error
+         leax  <filename,u	point X to filename
+         lda   #READ.!WRITE.	load perms
+         os9   I$Open		open in raw mode
+L0114    lbcs  ShowHelp		branch if error
          sta   <rawpath
          lda   <fpath
          clr   <u001F,u
          pshs  u
-         ldx   <u001C,u   get MS 16 bits
-         ldu   <u001E,u   get LS 16 bits
-         lda   <rawpath   get path
-         os9   I$Seek     seek
+         ldx   <u001C,u		get MS 16 bits
+         ldu   <u001E,u		get LS 16 bits
+         lda   <rawpath		get path
+         os9   I$Seek		seek
          puls  u
-         bcs   L01AC      branch if error
-         leax  <fdesc,u   point to buffer
+         bcs   ShowHelp		branch if error
+         leax  <fdesc,u		point to buffer
          ldy   #FD.SEG
          os9   I$Read
-         bcs   L01AC
-         os9   F$ID       get ID
-         cmpy  #$0000     super user?
-         beq   L014B      branch if so
-         cmpy  <fdesc+FD.OWN,u is user same as file's owner?
-         bne   L01C1      branch if not
-L014B    ldx   <cmdperms  point to perms on cmd line
+         bcs   ShowHelp
+         os9   F$ID		get ID
+         cmpy  #$0000		super user?
+         beq   L014B		branch if so
+         cmpy  <fdesc+FD.OWN,u	is user same as file's owner?
+         bne   L01C1		branch if not
+L014B    ldx   <cmdperms	point to perms on cmd line
          lbsr  L021D
          bcs   L018B
 L0152    lbsr  L021D
@@ -134,27 +137,27 @@
          clrb  
          lda   ,x
          cmpa  #C$CR
-         bne   L01AC
+         bne   ShowHelp
          pshs  u
          ldx   <u001C,u
          ldu   <u001E,u
          lda   <rawpath
-         os9   I$Seek     seek
+         os9   I$Seek		seek
          puls  u
-         bcs   L01AC      branch if error
-         leax  <fdesc,u   point to file desc
-         ldy   #1         only 1 byte
-         os9   I$Write    write out new attributes
-         bcs   L01AC      branch if error
-         os9   I$Close    close file
-         bcs   L01AC      branch if error
-         lda   <fpath     get file path
-         os9   I$Close    close file
-         bcs   L01AC      branch if error
+         bcs   ShowHelp		branch if error
+         leax  <fdesc,u		point to file desc
+         ldy   #1		only 1 byte
+         os9   I$Write		write out new attributes
+         bcs   ShowHelp		branch if error
+         os9   I$Close		close file
+         bcs   ShowHelp		branch if error
+         lda   <fpath		get file path
+         os9   I$Close		close file
+         bcs   ShowHelp		branch if error
          ldb   <u0007
          beq   L01BE
-L018B    ldb   <fdesc,u   get attribute
-         leax  >L00B2,pcr
+L018B    ldb   <fdesc,u		get attribute
+         leax  >Attrs,pcr
          leay  <u0078,u
          lda   ,x+
 L0197    lslb  
@@ -169,7 +172,7 @@
          clrb  
          bra   L01B0
          IFNE  DOHELP
-L01AC    leax  >HelpMsg,pcr
+ShowHelp leax  >HelpMsg,pcr
          ENDC
 L01B0    pshs  b
          lda   #2
@@ -177,14 +180,11 @@
          os9   I$WritLn
          comb  
          puls  b
-         IFEQ  DOHELP
-L01AC    equ   *
-         ENDC
 L01BE    os9   F$Exit
 L01C1    clrb  
-         leax  >L0052,pcr
+         leax  >NotOwner,pcr
          bra   L01B0
-L01C8    leax  >L006D,pcr
+L01C8    leax  >UseMkDir,pcr
          clrb  
          bra   L01B0
 L01CF    pshs  u,y,x
@@ -200,12 +200,12 @@
          bcs   L01F7
          tst   ,x
          beq   L01E0
-         leax  >L008F,pcr
+         leax  >DirNtEmt,pcr
          clrb  
          bra   L01B0
 L01F7    puls  u,y,x
          cmpb  #E$EOF
-         bne   L01AC
+         bne   ShowHelp
          rts   
 L01FE    fdb   $ff41
          fdb   $ff80,$44ff,$4053,$ff01,$52ff,$0257,$ff04,$45ff