changeset 839:0303f3fa9df5

Changed e option to -e, optimized *slightly* This program could use more optimizations
author boisy
date Tue, 14 Jan 2003 14:45:41 +0000
parents 19ac91c8dbcf
children 72b6bd4532fc
files level2/cmds/mdir.asm
diffstat 1 files changed, 60 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/level2/cmds/mdir.asm	Tue Jan 14 14:27:57 2003 +0000
+++ b/level2/cmds/mdir.asm	Tue Jan 14 14:45:41 2003 +0000
@@ -6,6 +6,8 @@
 * Ed.    Comments                                       Who YY/MM/DD
 * ------------------------------------------------------------------
 * 7      Original Tandy/Microware version
+* 8      Changed option to -e, optimized slightly       BGP 03/01/14
+*        Could use greater optimization
 
          nam   MDir
          ttl   Show module information
@@ -19,7 +21,7 @@
 tylg     set   Prgrm+Objct   
 atrv     set   ReEnt+rev
 rev      set   $01
-edition  set   7
+edition  set   8
 
          mod   eom,name,tylg,atrv,start,size
 
@@ -29,7 +31,7 @@
 u0004    rmb   1
 u0005    rmb   3
 u0008    rmb   3
-u000B    rmb   1
+narrow   rmb   1
 u000C    rmb   1
 u000D    rmb   1
 u000E    rmb   80
@@ -43,15 +45,13 @@
 name     fcs   /MDir/
          fcb   edition
 
-L0012    fcc   "   Module Directory at"
-         fcb   $A0 
-L0029    fcs   "Block Offset Size Typ Rev Attr  Use Module Name"
-L0058    fcs   "----- ------ ---- --- --- ---- ---- ------------"
-L0088    fcs   "Blk Ofst Size Ty Rv At Uc  Name"
-L00A7    fcs   "___ ____ ____ __ __ __ __ ______"
-L00C7    fcc   "Lock"
-         fcb   $A0
-L00CC    fcs   "Lk"
+header   fcs   "   Module Directory at "
+header2  fcs   "Block Offset Size Typ Rev Attr  Use Module Name"
+header3  fcs   "----- ------ ---- --- --- ---- ---- ------------"
+sheader1 fcs   "Blk Ofst Size Ty Rv At Uc  Name"
+sheader2 fcs   "___ ____ ____ __ __ __ __ ______"
+lock     fcs   "Lock "
+slock    fcs   "Lk"
 
 start    pshs  u
          leau  >u1062,u
@@ -59,28 +59,26 @@
          cmpu  ,s
          bhi   L00D4
          puls  u
-         clr   <u000B
-         lda   #$0C
-         ldb   #$30
+         clr   <narrow
+         ldd   #$0C30
          std   <u000C
          stx   <u0000
          leax  u000E,u
          stx   <u0003
          lbsr  L02A3
-         lda   #$01
-         ldb   #$26
-         os9   I$GetStt 
-         bcc   L00FF
-         cmpb  #$D0
-         lbne  L0241
-         bra   L010C
-L00FF    cmpx  #$0032
-         bge   L010C
-         inc   <u000B
-         lda   #$0A
-         ldb   #$15
+         lda   #$01		standard output
+         ldb   #SS.ScSiz	get size of screen
+         os9   I$GetStt 	get it!
+         bcc   L00FF		branch if ok
+         cmpb  #E$UnkSvc	unknown service?
+         lbne  L0241		branch if not
+         bra   L010C		else ignore screen width test
+L00FF    cmpx  #50		compare against 50
+         bge   L010C		if greater or equal, go on
+         inc   <narrow		else set narrow flag
+         ldd   #$0A15
          std   <u000C
-L010C    leay  >L0012,pcr
+L010C    leay  >header,pcr	point to header
          lbsr  L0298
          leax  u0005,u
          os9   F$Time   
@@ -95,23 +93,23 @@
          puls  u
          leax  -$08,x
          ldy   <u0000
-         lda   ,y+
-         eora  #$45
-         anda  #$DF
+         ldd   ,y+
+         andb  #$DF
+         cmpd  #$2D45		-e option?
          bne   L018E
          lbsr  L02A3
-         tst   <u000B
+         tst   <narrow
          beq   L0149
-         leay  >L0088,pcr
+         leay  >sheader1,pcr
          bra   L014D
-L0149    leay  >L0029,pcr
+L0149    leay  >header2,pcr
 L014D    lbsr  L0298
          lbsr  L02A3
-         tst   <u000B
+         tst   <narrow
          beq   L015D
-         leay  >L00A7,pcr
+         leay  >sheader2,pcr
          bra   L0161
-L015D    leay  >L0058,pcr
+L015D    leay  >header3,pcr
 L0161    lbsr  L0298
          lbsr  L02A3
          leax  <u0062,u
@@ -139,31 +137,31 @@
          lbeq  L0238
          tfr   d,y
          ldd   ,y
-         tst   <u000B
+         tst   <narrow
          beq   L01B1
          lbsr  L0285
          lbsr  L024C
          bra   L01B4
 L01B1    lbsr  L0244
-L01B4    tst   <u000B
+L01B4    tst   <narrow
          bne   L01BE
          lbsr  L0285
          lbsr  L0285
 L01BE    ldd   $04,x
          lbsr  L0244
-         tst   <u000B
+         tst   <narrow
          bne   L01CA
          lbsr  L0285
 L01CA    lbsr  L02DE
          leay  >u10A2,u
          ldd   $02,y
          bsr   L0244
-         tst   <u000B
+         tst   <narrow
          bne   L01DC
          lbsr  L0285
 L01DC    lda   $06,y
          bsr   L0252
-         tst   <u000B
+         tst   <narrow
          bne   L01E7
          lbsr  L0285
 L01E7    lda   $07,y
@@ -172,7 +170,7 @@
          ldb   $07,y
          lda   #$72
          lbsr  L0291
-         tst   <u000B
+         tst   <narrow
          bne   L0207
          lda   #$3F
          lbsr  L0291
@@ -184,14 +182,14 @@
          ldd   $06,x
          cmpd  #$FFFF
          bne   L0223
-         tst   <u000B
+         tst   <narrow
          beq   L021B
-         leay  >L00CC,pcr
+         leay  >slock,pcr
          bra   L021F
-L021B    leay  >L00C7,pcr
+L021B    leay  >lock,pcr
 L021F    bsr   L0298
          bra   L0230
-L0223    tst   <u000B
+L0223    tst   <narrow
          beq   L022E
          lbsr  L0285
          bsr   L024C
@@ -233,57 +231,60 @@
 L0271    tst   <u0002
          bmi   L0277
          bne   L027B
-L0277    lda   #$20
+L0277    lda   #C$SPAC
          bra   L0287
-L027B    adda  #$30
-         cmpa  #$39
+L027B    adda  #'0
+         cmpa  #'9
          bls   L0287
          adda  #$07
          bra   L0287
-L0285    lda   #$20
+L0285    lda   #C$SPAC
 L0287    pshs  x
          ldx   <u0003
          sta   ,x+
          stx   <u0003
          puls  pc,x
+
 L0291    rolb  
          bcs   L0287
-         lda   #$2E
+         lda   #'.
          bra   L0287
+
 L0298    lda   ,y
          anda  #$7F
          bsr   L0287
          lda   ,y+
          bpl   L0298
          rts   
+
 L02A3    pshs  y,x,a
-         lda   #$0D
+         lda   #C$CR
          bsr   L0287
          leax  u000E,u
          stx   <u0003
-         ldy   #$0050
+         ldy   #80
          lda   #$01
          os9   I$WritLn 
          puls  pc,y,x,a
 L02B8    bsr   L02C0
          bsr   L02BC
-L02BC    lda   #$3A
+L02BC    lda   #':
          bsr   L0287
 L02C0    ldb   ,x+
          lda   #$2F
 L02C4    inca  
-         subb  #$64
+         subb  #100
          bcc   L02C4
-         cmpa  #$30
+         cmpa  #'0
          beq   L02CF
          bsr   L0287
 L02CF    lda   #$3A
 L02D1    deca  
-         addb  #$0A
+         addb  #10
          bcc   L02D1
          bsr   L0287
          tfr   b,a
-         adda  #$30
+         adda  #'0
          bra   L0287
 L02DE    pshs  u,x
          bsr   L0308
@@ -297,7 +298,7 @@
          puls  b,a
          ldu   $02,s
          leau  >u1062,u
-         ldy   #$0040
+         ldy   #64
          os9   F$CpyMem 
          tfr   u,y
          puls  pc,u,x