changeset 1633:457765ff46f9

minor optimizations
author boisy
date Mon, 12 Jul 2004 03:19:07 +0000
parents 93d5b9ff0f4a
children 5ecf6e023a64
files level2/cmds/smap.asm
diffstat 1 files changed, 63 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/level2/cmds/smap.asm	Mon Jul 12 03:15:19 2004 +0000
+++ b/level2/cmds/smap.asm	Mon Jul 12 03:19:07 2004 +0000
@@ -1,4 +1,4 @@
-********************************************************************
+*******************************************************************
 * SMap - Show System Memory Map
 *
 * $Id$
@@ -26,54 +26,55 @@
          mod   eom,name,tylg,atrv,start,size
 
 u0000    rmb   1
-u0001    rmb   3
-u0004    rmb   1
+decbuff  rmb   3		decimal buffer (100, 10, 1s place)
+free     rmb   1		number of free 256 byte pages in system memory
 u0005    rmb   1
 u0006    rmb   1
-u0007    rmb   1
+wrbuf    rmb   1
 u0008    rmb   6
 u000E    rmb   1
-u000F    rmb   456
+memmap   rmb   256
+         rmb   200
 size     equ   .
 
 name	 fcs   /SMap/
          fcb   edition
 
 H1       fcc   "    0 1 2 3 4 5 6 7 8 9 A B C D E F"
-         fcb   C$CR
+CrRt     fcb   C$CR
 H1L      equ   *-H1
 H2       fcc   " #  = = = = = = = = = = = = = = = ="
-         fcb   C$CR
+*         fcb   C$CR
 H2L      equ   *-H2
-L005A    fcb   $00,$00,$00,$00
+SysDat   fcb   $00,$00,$00,$00
 
-start    lbsr  L0170
-         leax  >H1,pcr
+start    lbsr  WriteCR			Write a carriage return to standard out
+         leax  <H1,pcr			point to header 1
          lda   #$01
          ldy   #H1L
-         os9   I$WritLn 
-         leax  >H2,pcr
+         os9   I$WritLn 		and write it to standard out
+         leax  <H2,pcr			same with header 2
          ldy   #H2L
          os9   I$Write  
-         leax  >L005A,pcr
+         leax  <SysDat,pcr
          tfr   x,d
-         ldx   #$004E
-         ldy   #$0002
-         pshs  u
-         leau  u000F,u
-         os9   F$CpyMem 
-         puls  u
-         lbcs  L013F
-         ldx   u000F,u
-         ldy   #$0100
-         pshs  u
-         leau  u000F,u
-         os9   F$CpyMem 
-         puls  u
-         lbcs  L013F
+         ldx   #D.SysMem		point to System Memory global
+         ldy   #$0002			get 2 byte pointer into system RAM
+         pshs  u			save statics
+         leau  memmap,u			point to destination
+         os9   F$CpyMem 		get it
+         puls  u			restore statics
+         lbcs  L013F			branch if error
+         ldx   memmap,u			get pointer into system memory table in system space
+         ldy   #256			all 256 bytes
+         pshs  u			save statics
+         leau  memmap,u			point to destination
+         os9   F$CpyMem 		copy memory
+         puls  u			restore statics
+         lbcs  L013F			branch if error
          clr   <u000E
-         clr   <u0004
-         leax  u000F,u
+         clr   <free			clear free counter
+         leax  memmap,u
          lda   #$30
          sta   <u0005
          clr   ,-s
@@ -81,17 +82,17 @@
          bita  #$0F
          bne   L00DF
          pshs  x
-         lbsr  L0170
+         lbsr  WriteCR
          leax  u0006,u
          ldy   #$0004
          lda   <u0005
-         cmpa  #$3A
+         cmpa  #':
          bne   L00CD
-         lda   #$41
+         lda   #'A
          sta   <u0005
-L00CD    sta   <u0007
+L00CD    sta   <wrbuf
          inc   <u0005
-         ldd   #$2020
+         ldd   #C$SPAC*256+C$SPAC
          sta   <u0006
          std   <u0008
          lda   #$01
@@ -100,17 +101,17 @@
 L00DF    ldb   ,x+
          beq   L00ED
          bmi   L00E9
-         ldb   #$55
+         ldb   #'U
          bra   L00F1
-L00E9    ldb   #$2E
+L00E9    ldb   #'.
          bra   L00F1
-L00ED    ldb   #$5F
-         inc   <u0004
-L00F1    stb   <u0007
-         ldb   #$20
+L00ED    ldb   #'_
+         inc   <free			increment free page counter
+L00F1    stb   <wrbuf
+         ldb   #C$SPAC
          stb   <u0008
          pshs  x
-         leax  u0007,u
+         leax  wrbuf,u
          ldy   #$0002
          lda   #$01
          os9   I$Write  
@@ -118,26 +119,26 @@
          dec   ,s
          lbhi  L00B2
          puls  a
-         bsr   L0170
-         bsr   L0170
+         bsr   WriteCR
+         bsr   WriteCR
          leax  >FreePgs,pcr
          ldy   #FreePgsL
          lda   #$01
          os9   I$Write  
-         ldb   <u0004
+         ldb   <free
          clra  
          lbsr  L0194
-         bsr   L0170
+         bsr   WriteCR
          leax  >FreeRAM,pcr
          ldy   #FreeRAML
          lda   #$01
          os9   I$Write  
-         ldb   <u0004
+         ldb   <free
          clra  
          lsrb  
          lsrb  
          lbsr  L0194
-         bsr   L0170
+         bsr   WriteCR
          clrb  
 L013F    os9   F$Exit   
 
@@ -146,34 +147,36 @@
 FreeRAM  fcc   "   RAM Free in KBytes: "
 FreeRAML equ   *-FreeRAM
 
-L0170    pshs  x,a
-         lda   #C$CR
-         sta   <u0007
-         leax  u0007,u
+WriteCR  pshs  x,a
+*         lda   #C$CR
+*         sta   <wrbuf
+         leax  CrRt,pcr
          ldy   #$0001
          lda   #$01
          os9   I$WritLn 
          puls  pc,x,a
-L0183    sta   <u0007
+
+L0183    sta   <wrbuf
          pshs  x
-         leax  u0007,u
+         leax  wrbuf,u
          ldy   #$0001
          lda   #$01
          os9   I$Write  
-L0192    puls  pc,x
-L0194    leax  u0001,u
+         puls  pc,x
+
+L0194    leax  decbuff,u
          clr   <u0000
          clr   ,x
          clr   $01,x
          clr   $02,x
 L019E    inc   ,x
-         subd  #$0064
+         subd  #100
          bcc   L019E
-         addd  #$0064
+         addd  #100
 L01A8    inc   $01,x
-         subd  #$000A
+         subd  #10
          bcc   L01A8
-L01AF    addd  #$000A
+L01AF    addd  #10
          incb  
          stb   $02,x
          bsr   L01BF
@@ -194,5 +197,5 @@
 
          emod
 eom      equ   *
-	end
+	 end