changeset 219:f213b599d6e2

Moved ddir, dirm, dmem, idir, mmap, pmap, proc to 3rdparty/utils/kdutils
author boisy
date Tue, 16 Jul 2002 00:54:07 +0000
parents 586168970ced
children 7fed7dcadaee
files level2/cmds/ddir.asm level2/cmds/dirm.asm level2/cmds/dmem.asm level2/cmds/idir.asm level2/cmds/makefile level2/cmds/mmap.asm level2/cmds/pmap.asm level2/cmds/proc.asm
diffstat 8 files changed, 4 insertions(+), 2064 deletions(-) [+]
line wrap: on
line diff
--- a/level2/cmds/ddir.asm	Tue Jul 16 00:46:27 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,265 +0,0 @@
-********************************************************************
-* DDir - Show device table entries
-*
-* $Id$
-*
-* Ed.    Comments                                       Who YY/MM/DD
-* ------------------------------------------------------------------
-* 2      Reworked                                       AD
-
-         nam   DDir
-         ttl   program module       
-
-* Disassembled 94/11/05 14:18:05 by Alan DeKok
-*
-* Future revisions:
-* Check <D.Init and DevCnt for entries in device polling table
-* check 9/D for size of table - go to V$DESC and look for $87CD
-
-         ifp1
-         use   defsfile
-         endc
-
-tylg     set   Prgrm+Objct   
-atrv     set   ReEnt+rev
-rev      set   $01
-edition  set   2
-
-         mod   eom,name,tylg,atrv,start,size
-
-MemStrt  rmb   2
-DATImg   rmb   4
-u0006    rmb   2
-u0008    rmb   1
-u0009    rmb   8
-DevTbl   rmb   2
-u0013    rmb   1
-u0014    rmb   80
-u0064    rmb   512
-u0264    rmb   512
-u0464    rmb   712
-size     equ   .
-
-name     fcs   /DDir/
-         fcb   edition
-
-L0012    fcc   /Device Table at: /
-x12Len   equ   *-L0012
-Header   fcc   /Device Desc  Driver Static  File    Usr/
-         fcb   $0D 
-L004B    fcc   /Name   Port  Name      Mem  Manager Cnt/
-         fcb   $0D 
-L0073    fcc   /-----------  -------------  ------- ---/
-MyCR     fcb   $0D 
-
-start    ldd   ,x         get parameter bytes
-         cmpd  #$2D3F     -?
-         lbeq  Help
-
-         lda   #$01
-         stu   <MemStrt
-         leax  >MyCR,pcr
-         ldy   #$0001
-         os9   I$WritLn   output a CR
-         lbcs  Exit 
-         leax  >L0012,pcr dump out header
-         ldy   #x12Len
-         os9   I$Write  
-         lbcs  Exit 
-         lda   #$01
-         leax  >u0464,u
-         os9   F$GPrDsc   get system process descriptor
-         bcs   Exit 
-         leax  <P$DATImg,x
-         stx   <DATImg     save address of system's DAT image
-         bra   L00D3
-
-ClnExit  clrb  
-Exit     os9   F$Exit   
-
-L00D3    ldu   <MemStrt
-         leau  >u0064,u
-         ldd   <DATImg
-         ldx   #D.DevTbl  I/O device table
-         ldy   #$0002     size of the pointer
-         os9   F$CpyMem 
-         lbcs  Exit 
-
-         ldu   <MemStrt
-         leay  <u0014,u
-         sty   <u0006
-         ldd   <u0064,u   get the pointer
-         std   <DevTbl     save it
-         lbsr  L0222
-         lbsr  L01E6
-
-         lda   #$01
-         leax  >MyCR,pcr dump out another CR
-         ldy   #$0001
-         os9   I$WritLn 
-         lbcs  Exit 
-
-         leax  >Header,pcr
-         ldy   #$0028
-         os9   I$WritLn 
-         lbcs  Exit 
-
-         leax  >L004B,pcr
-         ldy   #$0028
-         os9   I$WritLn 
-         lbcs  Exit 
-         leax  >L0073,pcr
-         ldy   #$0028
-         os9   I$WritLn 
-         lbcs  Exit
-
-         ldu   <MemStrt
-         leau  >u0064,u
-         ldx   <DevTbl
-         ldy   #$0100
-         ldd   <DATImg
-         os9   F$CpyMem   copy the device table over
-         lbcs  Exit 
-         ldb   #256/DEVSIZ
-         stb   <u0008     total number of entries to get
-         stu   <u0009     save pointer to start of DevTbl
-
-L0155    bsr   L0165
-         dec   <u0008
-         lbeq  ClnExit    if done them all, exit
-
-         ldx   <u0009     get current pointer
-         leax  DEVSIZ,x   go to the next one
-         stx   <u0009     save the pointer again
-         bra   L0155      and loop back
-
-L0165    ldu   <MemStrt
-         leay  <u0014,u
-         sty   <u0006
-         lda   #C$SPAC    space
-         ldb   #$05
-L0171    sta   ,y+        save 5 spaces
-         decb  
-         bne   L0171
-
-         ldx   <u0009     get the current pointer
-         ldx   V$DESC,x   descriptor?
-         bne   L017D      if exists, go do it
-         rts              otherwise exit
-
-L017D    pshs  u
-         leau  >u0264,u   to another buffer
-         ldd   <DATImg    system DAT image
-         ldy   #200       get 200 bytes
-         os9   F$CpyMem 
-         puls  u
-         lbcs  Exit 
-
-         leax  >u0264,u   point to the start of the buffer
-         ldd   M$Name,x   pointer to the name
-         leax  d,x
-         lda   #$05
-         bsr   L01FF      dump out the first 5 bytes of the name?
-
-         leax  >u0264,u
-         lda   M$Port,x   port address of the device
-         lbsr  L0228
-         ldy   <u0006
-         leay  -$01,y
-         sty   <u0006
-         ldd   M$Port+1,x
-         lbsr  L0222
-         lbsr  L022A
-         leax  >u0264,u
-         ldd   M$PDev,x   device driver name offset
-         leax  d,x
-         lda   #$09
-         bsr   L01FF      dump out 9 bytes of the driver name
-         ldx   <u0009
-         ldd   V$STAT,x
-         lbsr  L0222
-         lbsr  L022A
-         leax  >u0264,u
-         ldd   M$FMGr,x   file manager name offset
-         leax  d,x        point to it
-         lda   #$09
-         bsr   L01FF      dump out 9 bytes of the file manager's name
-         ldx   <u0009
-         lda   V$USRS,x   use count
-         lbsr  L0228      print it
-         ldx   <u0006
-         leax  -$01,x
-         bra   L01E8
-
-L01E6    ldx   <u0006
-
-L01E8    lda   #C$CR      save a CR in memory
-         sta   ,x
-         ldu   <MemStrt
-         leax  <u0014,u   to the buffer
-         ldy   #$0050     80 characters max.
-         lda   #$01
-         os9   I$WritLn   dump the buffer out
-         lbcs  Exit 
-         rts
-
-L01FF    sta   <u0013     dump out A bytes at X
-         clrb  
-         bra   L0207
-
-L0204    lbsr  L0242
-L0207    incb  
-         cmpb  <u0013
-         bcc   L0219
-         lda   ,x+
-         bpl   L0204
-         anda  #$7F
-         lbsr  L0242      dump it out
-         cmpb  <u0013
-         bcc   L0221
-
-L0219    lbsr  L022A
-         incb  
-         cmpb  <u0013
-         bcs   L0219
-L0221    rts   
-
-L0222    pshs  b
-         bsr   L022E
-         puls  a
-L0228    bsr   L022E
-L022A    lda   #C$SPAC   output a space
-         bra   L0242
-
-L022E    tfr   a,b
-         lsra  
-         lsra  
-         lsra  
-         lsra  
-         bsr   L0238
-         tfr   b,a
-L0238    anda  #$0F       get the number
-         cmpa  #$0A       >10?
-         bcs   L0240      no, make it a number
-         adda  #$07       if so, make it A-F
-L0240    adda  #$30
-L0242    pshs  x
-         ldx   <u0006     get buffer pointer
-         sta   ,x+
-         stx   <u0006
-         puls  pc,x
-
-Help     lda   #1         to STDOUT
-         leax  HMsg,pcr
-         ldy   #HLen
-         OS9   I$Write
-         clrb
-         OS9   F$Exit
-
-HMsg     fcc   /ddir: NitrOS-9 v1.21 or greater only./
-         fdb   C$CR,C$LF
-HLen     equ   *-HMsg
-
-         emod
-eom      equ   *
-         end
--- a/level2/cmds/dirm.asm	Tue Jul 16 00:46:27 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,256 +0,0 @@
-********************************************************************
-* DirM - Show module directory
-*
-* $Id$
-*
-* Changes:
-*
-* Added internal print buffer, so an I$Write call is not performed for every
-* byte printed out.  Halves printout time.
-*
-* Added SS.ScSiz check, and goes to 32-column output if display is 40 columns
-* or less.
-*
-* Ed.    Comments                                       Who YY/MM/DD
-* ------------------------------------------------------------------
-* ?      Disassembled at 8:18:38                        AD  94/11/10
-* 5      Added internal print buffer, so an I$Write     AD  ??/??/??
-*        call is not performed for every byte printed
-*        out.  Halves printout time.  Added SS.ScSiz
-*        check, and goes to 32-column output if display
-*        is 40 columns or less.
-
-         nam   DirM
-         ttl   Show module directory
-
-         ifp1
-         use   defsfile
-         endc
-
-tylg     set   Prgrm+Objct   
-atrv     set   ReEnt+rev
-rev      set   $01
-edition  set   5
-
-Bound    equ   40         width at which change is made to 32-col printing
-
-
-         mod   eom,name,tylg,atrv,start,size
-
-MD.DAT   rmb   2
-MD.Crnt  rmb   2
-MD.Strt  rmb   2
-MD.End   rmb   2
-MD.MPDAT rmb   5
-PntCnt   rmb   1
-
-*Single   rmb   1          single entry/line?
-Width    rmb   1          width of the output device
-
-PBuffer  rmb   31         internal print buffer
-Buffer   rmb   40         room for a name buffer
-MD.Data  rmb   2048       size of the module directory
-         rmb   200        for the stack
-size     equ   .
-name     equ   *
-         fcs   /DirM/
-         fcb   edition
-
-H2       fcc   / Bk Ofst Size Ty At Link Name/
-         fcb   $0d 
-H3       fcc   / -- ---- ---- -- -- ---- -----/
-H1       fcb   $0d
-
-* Believe it or not, all this internal crap is still smaller than having
-* a different version of the header for 32/80 columns.
-Dump     ldu   #PBuffer   output print buffer
-         lda   ,x+        get first character
-         sta   ,u+        move it over
-         ldb   <Width     get the width
-
-D.01     cmpa  #C$CR      CR?
-         beq   D.Print    yup, dump it out
-
-         lda   ,x+        grab a character
-         sta   ,u+        save it
-         cmpa  #C$SPAC    was it a space?
-         bne   D.01       no, just save it
-
-         cmpb  #Bound     40-column screen?
-         bls   D.01       yes, don't add the space
-         sta   ,u+        if a space, save another copy of it
-         bra   D.01
-
-D.Print  lda   #$01       to STDOUT
-         ldx   #PBuffer
-         ldy   #50        max. size of data to print
-         OS9   I$WritLn   dump it out
-         bcs   Exit
-         rts
-
-start    equ   *
-         stu   <MD.DAT    u=$0000 always on startup in OS-9 LII
-         ldd   #$0100+SS.ScSiz stdout, get screen size
-         OS9   I$GetStt
-         bcs   s.01
-         tfr   x,d
-         bra   s.02       save actual screen size
-
-s.01     cmpb  #E$UnkSvc
-         bne   Exit
-         ldb   #80        default to 80 columns if error
-s.02     stb   <Width
-
-         leax  <H1,pcr   print out initial CR
-         bsr   Dump
-         leax  >H2,pcr   header of names
-         bsr   Dump
-         leax  <H3,pcr   and hyphens
-         bsr   Dump
-
-         ldx   #MD.Data
-         os9   F$GModDr 
-         bcs   Exit
-         stu   <MD.Strt     save start address of system module dir
-
-         sty   <MD.End     save end of the module directory
-         bra   L00B5
-
-ClnExit  clrb  
-Exit     os9   F$Exit   
-
-L00AD    ldx   <MD.Crnt
-         leax  MD$ESIZE,x go to the next entry
-         cmpx  <MD.End
-         bcc   ClnExit
-
-L00B5    stx   <MD.Crnt
-         ldu   #PBuffer      temporary print buffer
-         ldd   MD$MPDAT,x get module DAT image
-         beq   L00AD      if zero, skip this entry
-         pshs  d
-         cmpd  <MD.DAT
-         beq   L00CD
-         std   <MD.DAT    save the current DAT image
-         lda   #'-        start of this block
-         fcb   $8C        skip 2 bytes
-
-L00CD    lda   #C$SPAC    space
-         sta   ,u+        store it in the data buffer
-L00D0    puls  d          restore current DAT image
-         subd  <MD.Strt   take out start of the block
-         ldy   #MD.Data   point to module directory data
-         leay  d,y        to the DAT image within it
-         tfr   y,d
-         std   <MD.MPDAT     save pointer to DAT
-         lda   MD$MPtr,x  module pointer
-         lsra  
-         lsra  
-         lsra  
-         lsra             turn address into block offset
-         anda  #$0E       keep low bits only
-         inca             DAT image is (junk),(block)
-         lda   a,y        get the starting block number
-         bsr   L0165      dump it out
-         ldd   MD$MPtr,x  get real pointer
-         anda  #$1F       get offset inside block
-         bsr   L0159      print it out
-         ldx   MD$MPtr,x  and get pointer again
-
-         pshs  u          save print buffer pointer
-         ldu   #Buffer     to a name buffer
-         ldy   #$000A     move first 10 bytes of the module?
-         ldd   <MD.MPDAT
-         os9   F$CpyMem   copy it over
-         puls  u          restore print buffer ptr
-         bcs   Exit
-
-         ldd   <Buffer+M$Size
-         bsr   L0159      print out the size of the module
-         lda   <Buffer+M$Type
-         bsr   L0165      print out the Ty/Lg
-         lda   <Buffer+M$Revs
-         bsr   L0165      print out At/Rv
-         ldx   <MD.Crnt   get current module pointer
-         ldd   MD$Link,x  link count
-         bsr   L0159
-         ldd   <Buffer+M$Name
-         ldx   <MD.Crnt
-         ldx   MD$MPtr,x  start address of the module
-         leax  d,x        point to the name
-
-         pshs  u          save print buffer ptr
-         ldu   #Buffer    to the buffer again
-         lda   <Width
-         cmpa  #Bound
-         bhi   n.01
-         leau  -6,u       discount 6 spaces
-
-n.01     ldd   <MD.MPDAT
-         ldy   #$0028     copy over 40 bytes of the name
-         os9   F$CpyMem 
-         tfr   u,x        save copy of the start of the buffer
-         puls  u          restore print buffer ptr
-         lbcs  Exit
-
-         ldb   #39        maximum number of characters to check
-L013F    lda   ,x+        get a character
-         bpl   L013F      if it's OK
-         anda  #$7F       force it to be printable
-         sta   -$01,x     save it again
-         lda   #C$CR      drop a CR after the last character of the name
-
-         sta   ,x         save it
-         ldx   #PBuffer   point to the start of the buffer
-         ldy   #$0040     64 characters
-         lda   #$01
-         os9   I$WritLn   print out the name
-         lbra  L00AD      start all over again
-
-* Print out a 2-byte hex number in D
-L0159    pshs  b          save low order character
-         ldb   #$03       3 digits to print out
-         bsr   L0171      print out A
-         puls  a          restore low byte
-         bsr   L0173      print it, too
-         bra   L0167      and dump out 2 spaces
-
-* print out a 1-digit hex number in A
-L0165    bsr   L016F
-L0167    lda   <Width     check the width
-         cmpa  #Bound
-         bls   L016B      if 40 columns or smaller, don't print extra space
-         lda   #C$SPAC    space
-         sta   ,u+
-L016B    lda   #C$SPAC    and another space
-         sta   ,u+
-         rts
-
-L016F    ldb   #$01
-L0171    stb   <PntCnt
-L0173    tfr   a,b        save a copy of the number in B
-         lsra  
-         lsra  
-         lsra  
-         lsra             move high nibble into the lower nibble
-         bsr   L017D      print out lower nibble of A as hex number
-         tfr   b,a        restore lower nibble
-
-L017D    anda  #$0F       make 0-15
-         beq   L019C      if zero, skip printing it out
-         clr   <PntCnt
-         cmpa  #$0A       higher than A?
-         bcs   L0189      no, add in ascii zero
-         adda  #$07       yes, add difference between 9 and A
-L0189    adda  #'0        turn it into an ascii number
-
-Print    sta   ,u+        save the character in the buffer
-         rts
-
-L019C    dec   <PntCnt    count down of number of characters to print
-         bmi   L0189      if last one, print out a zero
-         bra   L016B      otherwise print out a space
-
-         emod
-eom      equ   *
-         end
--- a/level2/cmds/dmem.asm	Tue Jul 16 00:46:27 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,141 +0,0 @@
-********************************************************************
-* DMem - Dump memory from system
-*
-* $Id$
-*
-* Ed.    Comments                                       Who YY/MM/DD
-* ------------------------------------------------------------------
-* 2      Written by Kevin Darling
-
-         nam   DMem
-         ttl   Dump memory from system
-
-* Disassembled 98/09/14 19:24:59 by Disasm v1.6 (C) 1988 by RML
-
-         ifp1
-         use   defsfile
-         endc
-
-tylg     set   Prgrm+Objct   
-atrv     set   ReEnt+rev
-rev      set   $01
-edition  set   2
-
-         mod   eom,name,tylg,atrv,start,size
-
-u0000    rmb   1
-u0001    rmb   1
-u0002    rmb   1
-u0003    rmb   2
-u0005    rmb   3
-u0008    rmb   64
-u0048    rmb   1
-u0049    rmb   447
-u0208    rmb   4296
-size     equ   .
-
-name     fcs   /DMem/
-         fcb   edition
-
-L0012    clr   <u0000
-         clr   <u0001
-L0016    lda   ,x+
-         cmpa  #C$SPAC
-         beq   L0046
-         cmpa  #C$CR
-         beq   L0046
-         suba  #$30
-         cmpa  #$0A
-         bcs   L002A
-         anda  #$07
-         adda  #$09
-L002A    lsla
-         lsla
-         lsla
-         lsla
-         sta   <u0002
-         ldd   <u0000
-         rol   <u0002
-         rolb
-         rola
-         rol   <u0002
-         rolb
-         rola
-         rol   <u0002
-         rolb
-         rola
-         rol   <u0002
-         rolb
-         rola
-         std   <u0000
-         bra   L0016
-L0046    leax  -1,x
-         ldd   <u0000
-         rts
-
-start    lbsr  L0128
-         lbeq  L0119
-         cmpa  #'-
-         bne   L006D
-         leax  1,x
-         bsr   L0012
-         tfr   b,a
-         pshs  x
-         leax  >u0008,u
-         os9   F$GPrDsc 
-         lbcs  L00BC
-         puls  x
-         bra   L0073
-L006D    bsr   L0012
-         clr   <u0048
-         stb   <u0049
-L0073    lbsr  L0128
-         lbeq  L0119
-         lbsr  L0012
-         std   <u0003
-         lbsr  L0128
-         beq   L0092
-         lbsr  L0012
-         cmpd  #$1000
-         bls   L0095
-         ldd   #$1000
-         bra   L0095
-L0092    ldd   #$0100
-L0095    std   <u0005
-         leax  >u0048,u
-         tfr   x,d
-         ldy   <u0005
-         ldx   <u0003
-         pshs  u
-         leau  >u0208,u
-         os9   F$CpyMem 
-         puls  u
-         bcs   L00BC
-         ldy   <u0005
-         leax  >u0208,u
-         lda   #$01
-         os9   I$Write  
-L00BB    clrb  
-L00BC    os9   F$Exit   
-
-HelpTxt  fcc   "Use: DMem <block> <offset> [<length>] ! dump"
-         fcb   C$LF
-         fcc   " or: DMem -<id>   <offset> [<length>] ! dump"
-         fcb   C$CR
-HelpTxtL equ   *-HelpTxt
-
-L0119    leax  >HelpTxt,pcr
-L011D    ldy   #HelpTxtL
-         lda   #$02
-         os9   I$WritLn 
-         bra   L00BB
-L0128    lda   ,x+
-         cmpa  #C$SPAC
-         beq   L0128
-         leax  -1,x
-         cmpa  #C$CR
-         rts   
-
-         emod
-eom      equ   *
-         end
--- a/level2/cmds/idir.asm	Tue Jul 16 00:46:27 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,293 +0,0 @@
-********************************************************************
-* IDir - Show interrupt polling table
-*
-* $Id$
-*
-* Ed.    Comments                                       Who YY/MM/DD
-* ------------------------------------------------------------------
-* 1      Created                                        KKD
-* 2      Modified                                       GH
-
-         nam   IDir
-         ttl   Show interrupt polling table
-
-         ifp1  
-         use   defsfile
-         endc  
-
-rev      set   $01
-edition  set   2
-
-         mod   lenmod,namemd,prgrm+objct,reent+rev,start,endmem
-
-         org   $0000
-usaver   rmb   $0002      = $0000
-datptr   rmb   $0002      = $0002
-notuse   rmb   $0002      = $0004
-outptr   rmb   $0002      = $0008
-cntr1    rmb   $0001      = $0009
-devptr   rmb   $0002      = $000B
-tblptr   rmb   $0002      = $000D
-dpvars   rmb   $0009
-rptbuf   rmb   $0050
-Devbuf   rmb   $0104
-u016A    rmb   $0002
-u016C    rmb   $0102
-u026E    rmb   $0104
-buffer2  rmb   $02C8
-endmem   equ   .
-x0004    equ   $0004
-Poltbl   equ   $0011
-x0012    equ   $0012
-DevTbl   equ   $0013
-x0015    equ   $0015
-x0023    equ   $0023
-x0050    equ   $0050
-x0080    equ   $0080
-x00C8    equ   $00C8
-x0100    equ   $0100
-z0000    equ   $0000
-
-namemd   fcs   "IDir"
-         fcb   edition
-
-z0012    fcc   "Polling Table at: "
-z0012L   equ   *-z0012
-Device   fcc   " Device Table at: "
-DeviceL  equ   *-Device
-Topline  fcc   " Device    Driver  IRQ   Flip     "
-         fcb   C$CR
-ToplineL equ   *-Topline
-Line2    fcc   "Port Mem   Name  Vector  &Mask Pty"
-         fcb   C$CR
-Line2L   equ   *-Line2
-Line3    fcc   "---- ----  ------------  ----- ---"
-crtn     fcb   C$CR
-Line3L   equ   *-Line3
-
-start    lda   #$01
-         stu   <usaver    at 0000 in direct page
-         leax  >crtn,pcr  start with \n
-         ldy   #$0001
-         os9   I$WritLn
-         bcs   errexit
-         leax  >z0012,pcr "Polling Table at: " etc
-         ldy   #z0012L     num chars to write
-         os9   I$Write
-         bcs   errexit
-         lda   #$01
-         leax  buffer2,u  $0372,u
-         os9   F$GPrDsc   get $200 byte copy of process 1
-         bcs   errexit
-* F$GPrDsc returns $200 bytes, why inc only $40?
-         leax  P$DatImg,x 40,x to next ptr area=$03B2,u
-         stx   <datptr    at +2 in direct page
-         bra   z00C5
-okexit   clrb  
-errexit  os9   F$Exit
-z00C5    leay  rptbuf,u   = $0016,u
-         sty   <outptr    at 0006 in direct page
-         ldu   <usaver    get u back? was it diddled?
-         leau  u016A,u    is now! destination buffer
-         ldd   <datptr    get ptr P$datimg
-         ldx   #$0080     offset to begin=D.Devtbl
-         ldy   #$0004     include D.Poltbl 4 bytes to copy
-         os9   F$CpyMem   get it
-         bcs   errexit
-         ldu   <usaver    restore u
-         ldd   u016A,u    get D.Devtbl addr
-         std   <DevTbl    put in dp
-         ldd   u016C,u    get D.Poltbl addr
-         std   <Poltbl    put in dp u016A is re-used below
-         lbsr  z023B      cnvrt 4 dgts of poll tbl addr
-         lbsr  z01B1      output poll tbl address in ascii
-* troubleshooting printout
-         pshs  u,x,y,d
-         leax  >Device,pcr
-         ldy   #DeviceL
-         lda   #1
-         os9   I$Write
-         ldu   <usaver
-         leax  rptbuf,u
-         stx   <outptr
-         ldd   <devtbl
-         lbsr  z023B
-         lbsr  z01B1
-         puls  u,x,y,d
-* to here
-         lda   #1
-         leax  >crtn,pcr  stick another \n on it
-         ldy   #$0001
-         os9   I$WritLn
-         bcs   errexit
-         leax  >Topline,pcr " Device    Driver  IRQ   Flip     "
-         ldy   #ToplineL
-         os9   I$WritLn
-         bcs   errexit
-         leax  >Line2,pcr "Port Mem   Name  Vector  &Mask Pty"
-         ldy   #Line2L
-         os9   I$WritLn
-         bcs   errexit
-         leax  >Line3,pcr "---- ----  ------------  ----- ---"
-         ldy   #Line3L
-         os9   I$WritLn
-         lbcs  errexit
-         ldu   <usaver    now get orig u back
-         leau  u016A,u
-         stu   <devptr
-         ldx   <Poltbl    D.Poltbl addr
-         ldy   #$006C     256 bytes to get is too many
-         ldd   <datptr    s/b only 9*12 entries, $6C
-         os9   F$CpyMem
-         lbcs  errexit
-         ldu   <usaver
-         leau  Devbuf,u
-         ldd   <datptr
-         ldx   <DevTbl    D.Devtbl
-         ldy   #x0100     is not all of devtbl, s/b $015F!
-         os9   F$CpyMem
-         lbcs  errexit
-         ldb   #$0C
-         stb   <cntr1
-         ldx   <devptr
-z0165    ldd   Q$STAT,x   06,x checking memory required
-* another troubleshooting printout
-* pshs u,x,y,d,cc
-* ldu <usaver
-* leax rptbuf,u
-* stx <outptr
-* lbsr z023B converet d to ascii
-* lbsr z01B1
-* puls u,x,y,d,cc
-* to here
-         beq   z016B
-         bsr   z0179
-z016B    dec   <cntr1
-         lbeq  okexit
-         ldx   <devptr
-         leax  $09,x
-         stx   <devptr    to next irqtbl entry
-         bra   z0165
-z0179    ldu   <usaver    restore u to dp
-         leay  rptbuf,u
-         sty   <outptr
-         ldx   <devptr
-         ldd   ,x
-         lbsr  z023B      convert 2 bytes port addr->ascii
-         ldd   $06,x
-         lbsr  z023B      convert 2 bytes memsiz->ascii
-         lbsr  z0243      extra space in line
-         bsr   z01CA      now do name
-         ldu   <usaver
-         ldx   <devptr
-         ldd   $04,x      get irq vector
-         lbsr  z023B      convert it to ascii
-         lbsr  z0243      extra space
-         lda   $02,x      get flip
-         lbsr  z0241      convert 1 byte + space
-         lda   $03,x      get mask
-         lbsr  z0241      convert 1 byte + space
-         lbsr  z0243      extra space
-         lda   $08,x      get priority byte
-         lbsr  z0241      convert 1 byte
-z01B1    ldx   <outptr
-         lda   #C$CR      terminate this line
-         sta   ,x
-         ldu   <usaver    restore u again
-         leax  rptbuf,u   ptr to outbuff
-         ldy   #80        max 80 chars
-         lda   #$01       stdout
-         os9   I$WritLn
-         lbcs  errexit
-         rts   
-z01CA    ldx   <devptr    fnd nam in devtbl if memaddr=
-         ldb   #$1C       27 entries max in devtbl
-         pshs  b
-* now we make an assumption that data
-* areas for the same driver will be
-* in the same page of memory, so compare
-* only the high bytes of the address
-         ldb   $06,x      get irq dat addr
-         leax  Devbuf,u   devtbl buffer
-z01D6    cmpb  $02,x
-         beq   z01F3      if match, found device
-         leax  $09,x      else inc to next tbl entry
-         dec   ,s         that pshs'd b above
-         bne   z01D6
-         leas  $01,s      get rid of stack data
-         ldy   <outptr
-* lda #$20
-* ldb #$08 trial to space empty over
-* z01EA sta ,y+
-* decb 
-* bne z01EA
-         leay  8,y        this leaves name visible
-         sty   <outptr    until new one found
-         rts   
-z01E9    ldy   <outptr
-         ldb   #08
-         lda   #$20       a space 
-z01EA    sta   ,y+
-         decb  
-         bne   z01EA
-         sty   <outptr
-         rts   
-z01F3    leas  $01,s      get rid of stack dat
-         ldx   V$DESC,x   $04,x pointer to dev desc
-         beq   z01E9      what, no module name ptr?
-         pshs  u
-         leau  u026E,u
-         ldd   <datptr
-         ldy   #x00C8
-         os9   F$CpyMem
-         puls  u
-         lbcs  errexit
-         leax  u026E,u
-         ldd   $0B,x
-         leax  d,x
-         lda   #$08
-         sta   <x0015
-         clrb  
-         bra   z0220
-z021D    bsr   z025B
-z0220    incb  
-         cmpb  <x0015
-         bcc   z0232
-         lda   ,x+
-         bpl   z021D
-         anda  #$7F
-         bsr   z025B
-         cmpb  <x0015
-         bcc   z023A
-z0232    bsr   z0243
-         incb  
-         cmpb  <x0015
-         bcs   z0232
-z023A    rts   
-z023B    pshs  b          convert to ascii
-         bsr   z0247      make 2 digits
-         puls  a
-z0241    bsr   z0247      make 2 more
-z0243    lda   #$20
-         bra   z025B
-z0247    tfr   a,b
-         lsra  
-         lsra  
-         lsra  
-         lsra  
-         bsr   z0251
-         tfr   b,a
-z0251    anda  #$0F
-         cmpa  #$0A
-         bcs   z0259
-         adda  #$07
-z0259    adda  #$30
-z025B    pshs  x
-         ldx   <outptr    get outbuf ptr
-         sta   ,x+
-         stx   <outptr
-         puls  pc,x
-
-         emod  
-lenmod   equ   *
-         end   
--- a/level2/cmds/makefile	Tue Jul 16 00:46:27 2002 +0000
+++ b/level2/cmds/makefile	Tue Jul 16 00:54:07 2002 +0000
@@ -3,9 +3,9 @@
 DEPENDS		= ./Makefile
 
 CMDS		= attr binex build cobbler copy date \
-		deiniz del deldir ddir dir dirm display dmem dump echo exbin \
-		free ident idir iniz link list load login makdir mdir \
-		merge mfree mmap montype pmap proc procs pwd pxd rename save \
+		deiniz del deldir dir display dump echo exbin \
+		free ident iniz link list load login makdir mdir \
+		merge mfree montype procs pwd pxd rename save \
 		setime shell_21 sleep swread swset tee tmode tsmon unlink \
 		verify wcreate xmode
 SUBS            = gfx inkey
@@ -13,8 +13,7 @@
 
 SHELLMODS	= shell_21 build copy date deiniz del dir display echo iniz \
 		link list load mdir merge mfree procs tmode unlink
-UTILPAK1        = attr deldir dirm dmem free ident mmap proc rename setime tmode
-UTILPAK2        = ddir idir pmap xmode
+UTILPAK1        = attr deldir free ident rename setime tmode xmode
 
 LEVEL1FILES	= binex.asm attr.asm build.asm date.asm deiniz.asm del.asm deldir.asm \
 		dump.asm echo.asm exbin.asm free.asm ident.asm iniz.asm inkey.asm link.asm \
--- a/level2/cmds/mmap.asm	Tue Jul 16 00:46:27 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,287 +0,0 @@
-********************************************************************
-* MMap - Show memory block map
-*
-* $Id$
-*
-* From Kevin Darling, "Inside OS9 Level II"
-*
-* Ed.    Comments                                       Who YY/MM/DD
-* ------------------------------------------------------------------
-* ?      Original verison                               KKD 88/??/??
-* 4      Modified by Ken Drexler fr various block sizes KD  89/07/30
-
-         nam   MMap
-         ttl   Memory Block Utility
-
-         ifp1  
-         use   defsfile
-         endc  
-
-Revs     set   ReEnt+1
-Type     set   Prgrm+Objct
-edition  set   4
-
-         mod   prglen,name,type,revs,MMap,datsiz
-
-Name     fcs   /MMap/
-         fcb   edition
-
-***************************************************
-*
-* Data
-*
-buffsiz  set   512
-
-numflag  rmb   1          flag for leading zeros
-rowcnt   rmb   1          no rows to print
-free     rmb   1          no free blocks
-rowno    rmb   1          row number
-lcnt     rmb   1          line length counter
-outptr   rmb   2          output pointer
-out      rmb   80         output buffer
-mapsiz   rmb   2          size of map block
-blksiz   rmb   2          block size
-buffer   rmb   buffsiz    map itself
-stack    rmb   200
-datsiz   equ   .
-
-         pag   
-***************************************************
-*
-*  Messages
-*
-header   fcc   /     0 1 2 3 4 5 6 7 8 9 A B C D E F/
-         fcb   C$CR
-hdrlen   equ   *-header
-
-hdr2     fcc   /  #  = = = = = = = = = = = = = = = =/
-         fcb   C$CR
-hdrlen2  equ   *-hdr2
-
-BlockMsg fcc   /  Block Size: /
-blklen   equ   *-Blockmsg
-
-Freemsg  fcc   / Free Blocks: /
-freelen  equ   *-Freemsg
-
-Rammsg   fcc   / KBytes Free: /
-ramlen   equ   *-Rammsg
-
-**********************************************
-*
-MMap     lbsr  pcrtn      print line
-         leax  header,pcr print headers
-         lda   #1
-         ldy   #hdrlen
-         os9   I$WritLn
-         leax  hdr2,pcr
-         ldy   #hdrlen2
-         os9   I$WritLn
-         leax  buffer,u   get block map to read
-         os9   F$GBlkMp
-         lbcs  error
-         std   blksiz     save block size
-         sty   mapsiz     save map size
-         clr   free
-         clr   rowno
-         ldd   mapsiz     compute number of rows
-         lsra             at 16 per row
-         rorb  
-         lsra  
-         rorb  
-         lsra  
-         rorb  
-         lsra  
-         rorb  
-         stb   rowcnt     save count
-         leax  out,u
-         stx   outptr
-         leax  buffer,u   point at map
-         pshs  x
-         bra   loop2
-
-loop     dec   lcnt       count -= 1
-         bne   loop3      if more, skip line print
-
-* print line, start next line
-loop1    pshs  x          save map pointer
-         lbsr  prline     print line
-         dec   rowcnt     done?
-         beq   exit       yes
-loop2    lda   #16        set line length count
-         sta   lcnt
-         lbsr  Space      1 space
-         lda   rowno      print row number
-         lbsr  Hex1
-         inc   rowno      row number += 1
-         lbsr  space2     2 spaces
-         puls  x
-
-* Print one block status
-loop3    ldb   ,x+        get next block
-         beq   freeram
-         bmi   noram
-         bitb  #2         module?
-         bne   module
-         lda   #'U        must be ram in use
-         bra   put
-
-freeram  lda   #'_        not used
-         inc   free       count it
-         bra   put
-
-module   lda   #'M        module
-         bra   put
-
-noram    lda   #'.        not ram
-
-* Print character in A and space
-put      equ   *
-         lbsr  print      put character in output buffer
-         lda   #C$SPAC    add space
-         lbsr  print
-
-         bra   loop
-
-* Add summary messages
-Exit     equ   *
-         leax  BlockMsg,pcr print "Block Size"
-         ldy   #blklen
-         lbsr  Prstr
-         ldd   blksiz
-         clr   numflag    suppress zeros
-         bsr   outdec
-         lbsr  prline     print line
-         leax  freemsg,pcr print "Free Blocks"
-         ldy   #freelen
-         lbsr  Prstr
-         ldb   free       get number of blocks
-         clra  
-         clr   numflag    suppress zeros
-         bsr   outdec     print in decimal
-         bsr   prline
-         leax  rammsg,pcr print "Ram Free"
-         ldy   #ramlen
-         lbsr  Prstr
-         ldb   free       get number of blocks
-         lda   blksiz     get #k/block
-         lsra             by dividing msb by 4
-         lsra  
-         mul   
-         clr   numflag    suppress zeros
-         bsr   outdec     print in decimal
-         bsr   prline
-
-bye      clrb             no errors
-
-error    os9   F$Exit
-
-
-**********************************************
-*
-* Subroutines
-*
-Pcrtn    pshs  a,x        Output carriage return
-         lda   #C$CR
-         sta   out
-         leax  out,u      point at buffer
-         ldy   #1         one char.
-         lda   #1
-         os9   I$WritLn
-         puls  a,x,pc
-
-
-** Decimal output routine
-*  IN:  D - number to output
-*       X - destination buffer
-* OUT:  X,Y,U preserved
-*
-Outdec   pshs  b,x,y,u
-         ldx   outptr     get pointer
-         leau  <dectbl,pcr
-         ldy   #5         set counter
-
-Outdec1  clr   ,s         clear workspace
-
-Outdec2  subd  ,u         subtract power of ten
-         bcs   outdec3
-         inc   ,s
-         bra   outdec2
-
-outdec3  addd  ,u++       add back one power
-         pshs  b          save b
-         ldb   1,s
-         addb  #'0        convert to ascii
-         cmpb  #'0        zero?
-         bne   outdec4    no, print it
-         tst   numflag    suppress zero?
-         beq   outdec5    yes
-outdec4  inc   numflag
-         stb   ,x+        put in buffer
-outdec5  puls  b          restore b
-         leay  -1,y       counter -= 1
-         bne   outdec1
-         stx   outptr     update pointer
-         puls  b,x,y,u,pc
-
-Dectbl   fdb   10000
-         fdb   1000
-         fdb   100
-         fdb   10
-         fdb   1
-
-
-* Print Line
-Prline   ldx   outptr     now print line
-         lda   #C$CR
-         sta   ,x         terminate line
-         leax  out,u
-         ldy   #80
-         lda   #1
-         os9   I$Writln
-         bcs   error
-         leax  out,u      set pointer
-         stx   outptr
-         rts   
-
-
-* Print Spaces
-Space2   bsr   Space
-
-Space    lda   #C$SPAC
-         bra   Print
-
-* Print Hexidecimal Digit in A
-Hex1     tfr   a,b
-         lsra  
-         lsra  
-         lsra  
-         lsra  
-         bsr   outhex
-         tfr   b,a
-Outhex   anda  #$0f
-         cmpa  #$0a       0 - 9
-         bcs   outdig
-         adda  #$07       A - F
-outdig   adda  #'0        make ASCII
-print    pshs  X
-         ldx   outptr
-         sta   ,X+
-         stx   outptr
-         puls  x,pc
-
-
-* Print string to output buffer
-*  IN:  X - string pointer
-*       Y - string length
-*
-Prstr    equ   *
-         lda   ,x+        get character
-         bsr   print      put in buffer
-         leay  -1,y
-         bne   Prstr
-         rts   
-
-         emod  
-Prglen   equ   *
-         end   
--- a/level2/cmds/pmap.asm	Tue Jul 16 00:46:27 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-********************************************************************
-* PMap - Show process map information
-*
-* $Id$
-*
-* From "Inside Level II" by Kevin Darling
-*
-* Ed.    Comments                                       Who YY/MM/DD
-* ------------------------------------------------------------------
-* ?      Original version                               KKD 87/02/08
-* 2      Revised to handle 4K or 8K blocks              KD  89/09/12
-
-         nam   PMap
-         ttl   Show process map information
-
-         ifp1  
-         use   defsfile
-         endc  
-
-Type     set   Prgrm+Objct
-Revs     set   ReEnt+1
-Bufsiz   set   512
-edition  set   2
-
-stdout   set   1
-maxnam   set   30
-
-         pag   
-***************************************************
-*
-         mod   PrgSiz,Name,Type,Revs,Entry,DatSiz
-
-Name     fcs   /PMap/
-         fcb   edition
-
-* Data Equates
-umem     rmb   2
-sysImg   rmb   2          pointer to sysprc datimg
-datimg   rmb   2          datimg for copymem
-lineptr  rmb   2
-number   rmb   3
-leadflag rmb   1
-pid      rmb   1
-hdr      rmb   12
-blkcnt   rmb   1          no. blocks/64k
-outbuf   rmb   80
-buffer   rmb   bufsiz*2   working proc. desc.
-stack    rmb   200
-datsiz   equ   .
-
-*************************************************
-*
-* Messages
-*
-Head1A   fcc   / ID   01 23 45 67 89 AB CD EF  Program    /
-         fcb   C$CR
-
-Head2A   fcc   /____  __ __ __ __ __ __ __ __  ___________/
-Hdrcr    fcb   C$CR
-
-Head1B   fcc   / ID   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F   Program/
-         fcb   C$CR
-
-Head2B   fcc   /____  __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  _______/
-         fcb   C$CR
-
-SysNam   fcs   "SYSTEM"
-syslen   equ   *-Sysnam
-
-         spc   3
-***************************************************
-*
-Entry    stu   Umem
-         lda   #1         start with process 1
-         clr   Pid
-
-* Print header
-         leax  buffer,u   point at storage
-         os9   F$GBlkMp   get block info
-         bcs   Error
-         cmpd  #8192      8k?
-         beq   Set8k
-         cmpd  #4096      4k?
-         beq   Set4k
-         bra   Error      we only do 4k/8k
-
-Set8k    lda   #64/8
-         bra   Entry1
-
-Set4k    lda   #64/4
-Entry1   sta   blkcnt     save size
-         leax  Hdrcr,pcr  print line
-         lbsr  PrintL1    print it
-         lda   blkcnt
-         cmpa  #64/4      4k?
-         beq   Headr4
-Headr8   leax  Head1A,pcr
-         lbsr  PrintL1    print it
-         leax  Head2A,pcr
-         bra   Head41
-
-Headr4   leax  Head1B,pcr
-         lbsr  PrintL1
-         leax  Head2B,pcr
-Head41   lbsr  PrintL1
-
-* Main Program Loop
-Main     ldu   umem
-         leax  OutBuf,U   set line pointer
-         stx   Lineptr
-         inc   Pid        next process
-         beq   Bye        >= 255 --> exit
-         lda   Pid        get proc id
-         leax  Buffer,U   set destination
-         os9   F$GPrDsc
-         bcs   Main       loop if no descriptor
-         bsr   Output     print data for descriptor
-         bra   Main
-
-Bye      clrb  
-Error    os9   F$Exit
-
-* Subroutines
-
-Output   lda   P$ID,X     process id
-         lbsr  Outdecl
-         lbsr  Space
-         lbsr  Space
-
-* Print Process DAT Image
-*  IN:  x = process descriptor
-*
-         pshs  X
-         leax  P$DATImg,x point to DAT image
-         ldb   blkcnt     set count
-         pshs  b
-
-PrntImg  ldd   ,x++       get DAT block
-         cmpd  #$00FC     empty?
-         bne   prntimg2
-         ldy   lineptr
-         ldd   #"..
-         std   ,y++
-         sty   lineptr
-         lbsr  space
-         bra   prntimg3
-
-PrntImg2 tfr   b,a        print block no.
-         lbsr  Out2HS
-
-PrntImg3 dec   ,s         count -= 1
-         bne   Prntimg
-         puls  b,x
-
-* Print primary module name
-* IN: X - process descriptor
-*
-         lbsr  Space
-         leay  P$DATImg,X
-         tfr   Y,D        d=dat image
-         std   datimg     save pointer
-         ldx   P$PModul,X x=offset in map
-         bne   doname
-         leax  >sysnam,pcr point at name
-         ldy   lineptr
-         ldb   #syslen
-
-Copy     lda   ,x+
-         sta   ,y+
-         decb  
-         bne   copy
-         bsr   Name2
-         bra   Printlin
-
-Doname   bsr   Printnam
-
-* Print Line
-Printlin ldx   lineptr    terminate line
-         lda   #C$CR
-         sta   ,X
-         ldu   umem
-         leax  outbuf,U
-
-* Print line
-PrintL1  ldy   #80
-         lda   #stdout
-         os9   I$Writln
-         bcs   Error
-         rts   
-
-** Find and print a module name
-* IN:  X - module offset
-*      U - data area
-*      datimg = pointer
-*
-Printnam equ   *
-
-* Read module header
-         pshs  U          save u
-         leau  hdr,U      destination
-         ldd   datimg     proc datimg pointer
-         ldy   #10        set length
-         os9   F$CpyMem
-         lbcs  Error
-
-* Read name from Module to buffer
-         ldd   M$Name,U   get name offset from header
-         ldu   lineptr    move name to outbuf
-         leax  D,X        X - offset to name
-         ldd   datimg
-         ldy   #maxnam    set maximum length
-         os9   F$CpyMem
-         puls  U
-         lbcs  Error
-
-Name2    pshs  X
-         ldx   lineptr
-         clrb             set length = 0
-Name3    incb  
-         lda   ,X+
-         bpl   Name3
-         cmpb  #40
-         bcc   Name5
-         anda  #$7F       clear d7
-         sta   -1,X
-         cmpb  #9
-         bcc   Name5
-         lda   #C$SPAC
-Name4    sta   ,X+
-         incb  
-         cmpb  #9
-         bcs   Name4
-Name5    stx   lineptr
-         puls  X,PC
-
-* Print hex digit in A
-Out2HS   bsr   Hexl
-
-Space    lda   #C$SPAC
-         bra   Print
-
-
-* Print Hexidecimal Digit in A
-Hexl     tfr   A,B
-         lsra  
-         lsra  
-         lsra  
-         lsra  
-         bsr   Outhex
-         tfr   B,A
-Outhex   anda  #$0F
-         cmpa  #$0A       0 - 9
-         bcs   Outdig
-         adda  #$07       A - F
-Outdig   adda  #'0        make ASCII
-
-* Put character in A in buf
-Print    pshs  X
-         ldx   lineptr
-         sta   ,X+
-         stx   lineptr
-         puls  X,PC
-
-* Print 1 Decimal Digit in A
-*
-Outdecl  tfr   A,B        number to B
-         clra  
-
-* Print 2 Decimal Digits in D
-Outdec   clr   leadflag
-         pshs  X
-         ldx   umem
-         leax  number,X
-         clr   ,X
-         clr   1,X
-         clr   2,X
-Hundred  inc   ,X
-         subd  #100
-         bcc   Hundred
-         addd  #100
-Ten      inc   1,X
-         subd  #10
-         bcc   Ten
-         addd  #10
-         incb  
-         stb   2,X
-         bsr   Printled
-         bsr   Printled
-         bsr   Printnum
-         bsr   Space
-         puls  X,PC
-
-Printnum lda   ,X+        get char
-         adda  #'0-1      make ASCII
-         bra   Print
-
-Printled tst   leadflag   print leading zero?
-         bne   Printnum   yes
-         ldb   ,X         is it zero?
-         inc   leadflag
-         decb  
-         bne   Printnum   no, print zeros
-         clr   leadflag
-         lda   #C$SPAC
-         leax  1,X
-         bra   Print
-
-         emod  
-Prgsiz   equ   *
-         end
--- a/level2/cmds/proc.asm	Tue Jul 16 00:46:27 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,507 +0,0 @@
-********************************************************************
-* Proc - Show process information
-*
-* $Id$
-*
-* NOTE: SHOULD ADD IN TO HANDLE PRINTING NAME OF CURRENT MODULE
-*       RUNNING IN A RUNB or BASIC09 PROCESS
-*
-* From "Inside Level II" by Kevin Darling
-*
-* Ed.    Comments                                       Who YY/MM/DD
-* ------------------------------------------------------------------
-* 1      Original version                               KKD 88/10/28
-* ?      Modified to show status in English, stderr     ??? 89/07/30
-*        and the system process
-* 11     Modified to add current executing/editing      LCB 94/11/08
-*        module name for Basic09 and/or RunB programs
-
-         nam   Proc
-         ttl   Show process information
-
-         ifp1  
-         use   defsfile
-         endc  
-
-Type     set   Prgrm+Objct
-Revs     set   ReEnt+1
-edition  set   11
-
-bufsiz   set   512
-CR       set   $0D
-Spc      set   $20
-stdout   set   1
-
-         pag   
-***************************************************
-         mod   PrgSiz,Name,Type,Revs,Entry,DatSiz
-
-Name     fcs   /Proc/
-         fcb   edition
-
-* Data Equates
-umem     rmb   2          Data mem ptr
-sysimg   rmb   2          pointer to sysprc datimg
-datimg   rmb   2          datimg for copymem
-datimg2  rmb   2          2nd copy for non-descriptor use
-basicflg rmb   1          Flag that primary module is BASIC09 or RUNB
-outptr   rmb   2          pointer in outbuf
-number   rmb   3
-leadflag rmb   1
-path     rmb   3          stdin, stdout and stderr
-pid      rmb   1
-namlen   rmb   1
-hdr      rmb   64
-outbuf   rmb   80         Buffer for output string
-buffer   rmb   bufsiz     working proc. desc.
-sysprc   rmb   bufsiz     system proc. desc.
-stack    rmb   200
-datsiz   equ   .
-
-**************************************************
-* Messages
-* Headers
-Header   fcc   " ID Prnt User Pty  Age  Tsk  Status  Signal   Module    I/O Paths "
-         fcb   CR
-Hdrlen   equ   *-Header
-
-Header2  fcc   /___ ____ ____ ___  ___  ___  _______ __  __  _________ __________________/
-Hdrcr    fcb   CR
-Hdrlen2  equ   *-Header2
-
-* State Strings (6 characters each)
-Quesstr  fcc   /??????/
-TimSlpSt fcc   /TSleep/
-TimOStr  fcc   /TimOut/
-ImgChStr fcc   /ImgChg/
-SuspStr  fcc   /Suspnd/
-CondmStr fcc   /Condem/
-DeadStr  fcc   /Dead          /
-Spaces   fcc   /              /
-SystmSt  fcc   /System        /
-
-* Special case module names
-basic09  fcc   'BASIC'
-b09sz    equ   *-basic09
-runb     fcc   'RUNB'
-runbsz   equ   *-runb
-basicms2 fcc   ')'
-         fcb   CR
-Nomodule fcc   'Not Defined'
-Nomodsz  equ   *-Nomodule
-
-************************************************
-Entry    stu   <Umem      save data mem ptr
-         lda   #stdout    Std out path=1
-         leax  Hdrcr,PC   print blank line
-         ldy   #1
-         os9   I$WritLn
-         bcs   Error
-         leax  Header,pcr  Print header line 1
-         ldy   #Hdrlen
-         os9   I$WritLn
-         bcs   Error
-         leax  Header2,pcr Print header line 2
-         ldy   #Hdrlen2
-         os9   I$WritLn
-         bcs   Error
-         lda   #1
-         leax  >sysprc,U  get system proc. desc.
-         os9   F$GPrDsc
-         bcs   Error
-         leax  P$DatImg,X just for its dat image
-         stx   <sysimg
-         clra             set <pid = start -1
-         sta   <basicflg  Default: not a RUNB or BASIC09
-         sta   <pid
-
-* Main Program Loop
-Main     ldu   <umem      Get data mem ptr
-         leax  OutBuf,U   Point to line buffer to print to screen
-         stx   <outptr
-         inc   <pid       next process
-         beq   Exit       If wrapped, we are done
-         lda   <pid       get proc ID to check 
-         leax  Buffer,U   Point to place to hold process dsc.
-         os9   F$GPrDsc   Get it
-         bcs   Main       loop if no descriptor
-         bsr   Output     print data for descriptor
-         bra   Main       Do rest of descriptors
-
-Exit     clrb  
-Error    os9   F$Exit
-
-***********************************************
-*  Subroutines
-* Print Data re Process
-* Entry: X=Ptr to buffer copy of process descriptor (Buffer,u)
-Output   lda   P$ID,X     process id
-         lbsr  Outdecl    print pid
-         lda   P$PID,X    parent's id
-         lbsr  Outdecl
-         lbsr  Spce
-         ldd   P$User,X   user id
-         lbsr  Outdec
-         lbsr  Spce
-         lda   P$Prior,X  priority
-         lbsr  Outdecl
-         lbsr  Spce
-         lda   P$Age,X    age
-         lbsr  Outdecl
-         lbsr  Spce
-         lbsr  Spce
-         lda   P$Task,X   task no.
-         lbsr  Out2HS
-         lbsr  Spce
-         lda   P$State,X  state
-         pshs  X          save X
-         lbsr  OutState
-         puls  X          restore x
-         lda   P$Signal,X signal
-         lbsr  Outdecl    - in decimal
-         lbsr  Spce
-         lda   P$Signal,X signal
-         lbsr  Out2HS     - in hex
-         lbsr  Spce
-         ldd   P$Path,X   get stdin and stdout
-         std   <path
-         lda   P$Path+2,X and stderr
-         sta   <path+2
-* Print primary module name
-* IN: X - ptr to process descriptor copy (buffer,u)
-         leay  P$DATImg,X
-         tfr   Y,D        d=dat image
-         std   <datimg
-         std   <datimg2   2nd copy for 2ndary name
-         lda   <pid       working on system process?
-         cmpa  #1
-         beq   Outp2      yes, print name
-         ldx   P$PModul,X x=offset in map
-         ldb   #9         set minimum space padded size of name
-         stb   <namlen
-         lbsr  Printnam   Go append name to buffer
-         bra   Outp3
-
-Outp2    leax  SystmSt,pcr print "System"
-         ldb   #9         name length
-         lbsr  PutSt1
-* Print Standard input Device
-Outp3    lbsr  Spce
-         lda   #'<
-         lbsr  Print
-         lbsr  Device
-         lda   <path+1    get stdout
-         sta   <path
-         lda   #'>
-         lbsr  Print
-         lbsr  Device
-Stderr   lda   <path+2    get stderr
-         sta   <path
-         lda   #'>
-         lbsr  Print      print first >
-         lda   #'>
-         lbsr  Print
-         bsr   Device
-* Print Line
-         ldx   <outptr    now print line
-         lda   #CR
-         sta   ,X         terminate line with CR
-         ldu   <umem
-         leax  outbuf,U   Print it (up to 80 chars)
-         ldy   #80
-         lda   #stdout
-         os9   I$Writln
-         lbcs  Error
-         lda   <basicflg  Was module RUNB or BASIC09?
-         beq   notbasic   No, finished this entry
-         clr   <basicflg  Yes, clear out flag for 2nd call to Printnam
-         leax  outbuf,u   Point to output buffer start
-         ldd   #$20*256+45 45 spaces
-copylp   sta   ,x+        Put spaces into output buffer
-         decb             Drop size counter
-         bne   copylp     Copy entire message
-         lda   #'(        Add opening parenthesis
-         sta   ,x+
-         stx   <outptr    Save new output buffer ptr
-         ldd   <datimg2   Get programs DAT img
-         std   <datimg    Save over descriptor one
-         ldx   #$002f     $002f in basic09 is ptr to current module
-         ldy   #2         Just need ptr for now
-         ldu   <umem
-         leau  hdr,u      Point to place to hold it
-         os9   F$CpyMem   Get current module ptr
-         ldu   <umem      Get data mem ptr
-         ldx   hdr,u      Get ptr to module start in BASIC09 workspace
-         beq   NotDef     If 0, no 'current module' defined
-         lbsr  Printnam   Go append sub-module name to output buffer
-         bra   printit    Add closing chars & print it
-
-NotDef   ldx   <outptr    Get current output buffer ptr
-         leay  Nomodule,pcr Point to 'Not Defined'
-         ldb   #Nomodsz   Size of message
-Notlp    lda   ,y+        Copy it
-         sta   ,x+
-         decb             Until done
-         bne   Notlp
-         stx   <outptr    Save output buffer ptr for below
-printit  ldd   basicms2,pcr Get closing ')' + CR
-         ldx   <outptr    Get current output buffer ptr
-         std   ,x         Append to output buffer
-         ldu   <umem
-         leax  outbuf,U   Print it (up to 80 chars)
-         ldy   #80
-         lda   #stdout
-         os9   I$Writln
-         lbcs  Error
-notbasic rts   
-
-* Print Character in A and Device Name
-Device   ldu   <umem      restore U
-         lda   <path
-         bne   Device2    if <path = 0, print spaces
-         leax  Spaces,pcr
-         lbra  PutStr
-
-* Get device name
-Device2  leau  hdr,U      get table offset in sys map
-         ldd   <sysimg
-         ldx   #D.PthDBT  from direct page
-         ldy   #2
-         os9   F$CpyMem
-         lbcs  Error
-         ldx   hdr        get <path descriptor table
-         ldy   #64
-         ldd   <sysimg
-         os9   F$CpyMem
-         lbcs  Error
-         ldb   <path      point to <path block
-         lsrb             four           <paths/ block
-         lsrb  
-         lda   B,U        a=msb block addr.
-         pshs  A
-         ldb   <path      point to <path
-         andb  #3
-         lda   #$40
-         mul   
-         puls  A          d= <path descriptor address
-         addb  #PD.Dev    get device table pointer
-         tfr   D,X
-         ldd   <sysimg
-         ldy   #2
-         os9   F$CpyMem
-         lbcs  Error
-         ldx   hdr        x= dev. table entry sys.
-         ldb   #V$Desc    we want descr. pointer
-         abx   
-         ldd   <sysimg
-         ldy   #2
-         os9   F$CpyMem
-         lbcs  Error
-         ldx   hdr        get descriptor addr.
-         ldu   <umem
-         ldd   <sysimg
-         std   <datimg
-         ldb   #5
-         stb   <namlen
-** Find and print a module name
-* IN:  X - module offset
-*      U - data area
-*      <datimg = pointer
-* Read module header
-Printnam pshs  U          save u
-         leau  hdr,U      destination
-         ldd   <datimg    proc <datimg pointer
-         ldy   #10        set length (M$Name ptr is @ 4)
-         os9   F$CpyMem   Get 1st 10 bytes of module header
-         lbcs  Error
-* Read name from Module to buffer
-         ldd   M$Name,U   get name offset from header
-         ldu   <outptr    move name to outbuf
-         leax  D,X        X - offset to name
-         ldd   <datimg
-         ldy   #40        max length of name we will accept
-         os9   F$CpyMem   Get copy of module name
-         puls  U
-         lbcs  Error
-
-         pshs  X
-         ldx   <outptr
-         pshs  X          Save start of module name ptr
-         clrb             set            length = 0
-Name3    incb             Bump up # chars long name is
-         lda   ,X+        Get char from module name
-         bpl   Name3      No hi-bit terminator yet, keep checking
-         cmpb  #40        Done, is it >39 chars?
-         bhs   Name5      Yes, skip ahead
-         anda  #$7F       Take out hi-bit
-         sta   -1,X       Save char back without hi-bit
-         cmpb  <namlen    Bigger than max name size we allow?
-         bhs   Name5      No, skip ahead
-         lda   #Spc       If smaller, pad with spaces
-Name4    sta   ,X+
-         incb  
-         cmpb  <namlen
-         blo   Name4
-Name5    stx   <outptr    Save new output buffer ptr
-         lda   <basicflg  Are we here doing a basic09 sub-module?
-         bne   notbas     Yes, don't get stuck in recursive loop
-         ldx   ,s         Get ptr to start of module name again
-         leay  basic09,pcr Check for BASIC09 1st
-         ldb   #b09sz     Size of module to check           
-chkb09lp lda   ,x+        Get char from module name
-         anda  #$df       Force to uppercase
-         cmpa  ,y+        Same as one for BASIC09?
-         bne   chkrunb    No, check runb
-         decb             Done 'BASIC' yet?
-         bne   chkb09lp   No, keep checking
-         ldd   ,x++       Get last 2 chars from name
-         cmpd  #$3039     '09'?
-         bne   chkrunb    No, try runb
-         lda   ,x         Next char space (end of name)?
-         cmpa  #$20
-         beq   setflag    Yes, set basic09 flag
-chkrunb  leay  runb,pcr    Point to 'runb'
-         ldb   #runbsz
-         ldx   ,s         Get ptr to name in buffer
-chkrunlp lda   ,x+        Get char
-         anda  #$df       Force to uppercase
-         cmpa  ,y+        Match?
-         bne   notbas     No, not either basic
-         decb             Done whole check?
-         bne   chkrunlp   No, keep checking
-setflag  sta   <basicflg  Set basic09 flag
-notbas   leas  2,s        Eat start of module name ptr
-         puls  X,PC       Restore X & return
-
-* Print Hexidecimal Digit in D
-Out4HS   pshs  B
-         bsr   Hexl
-         puls  A
-Out2HS   bsr   Hexl
-
-Spce     lda   #Spc
-         bra   Print
-
-* Print Hexidecimal Digit in A
-Hexl     tfr   A,B
-         lsra  
-         lsra  
-         lsra  
-         lsra  
-         bsr   Outhex
-         tfr   B,A
-Outhex   anda  #$0F
-         cmpa  #$0A       0 - 9
-         bcs   Outdig
-         adda  #$07       A - F
-Outdig   adda  #'0        make ASCII
-
-Print    pshs  X
-         ldx   <outptr
-         sta   ,X+
-         stx   <outptr
-         puls  X,PC
-
-* Print 1 Decimal Digit in B
-*
-Outdecl  tfr   A,B        <number to B
-         clra  
-
-* Print 2 Decimal Digits in D
-Outdec   clr   <leadflag
-         pshs  X
-         ldx   <umem
-         leax  <number,X
-         clr   ,X
-         clr   1,X
-         clr   2,X
-Hundred  inc   ,X
-         subd  #100
-         bcc   Hundred
-         addd  #100
-Ten      inc   1,X
-         subd  #10
-         bcc   Ten
-         addd  #10
-         incb  
-         stb   2,X
-         bsr   Printled
-         bsr   Printled
-         bsr   Printnum
-         bsr   Spce
-         puls  X,PC
-
-Printnum lda   ,X+        get char
-         adda  #$30-1     make ASCII
-         bra   Print
-
-Printled tst   <leadflag  print leading zero?
-         bne   Printnum   yes
-         ldb   ,X         is it zero?
-         inc   <leadflag
-         decb  
-         bne   Printnum   no, print zeros
-         clr   <leadflag
-         lda   #Spc
-         leax  1,X
-         bra   Print
-
-* Print process state in English
-*  IN:  A = P$State
-OutState tfr   A,B
-         bitb  #SysState  system?
-         beq   OutSt1     no
-         lda   #'s        s = System state
-         bra   OutSt2
-
-OutSt1   lda   #Spc
-
-OutSt2   bsr   Print
-         bitb  #TimSleep
-         bne   PTimSlp
-         bitb  #TimOut
-         bne   PTimOut
-         bitb  #ImgChg
-         bne   PImgCh
-         bitb  #Suspend
-         bne   PSuspnd
-         bitb  #Condem
-         bne   PCondem
-         bitb  #Dead
-         bne   PDead
-         bitb  #$04
-         bne   PQues
-         leax  Spaces,pcr  nothing to report
-         bra   PutStr
-
-PQues    leax  QuesStr,pcr
-         bra   PutStr
-
-PTimSlp  leax  TimSlpSt,pcr
-         bra   PutStr
-
-PTimOut  leax  TimOStr,pcr
-         bra   PutStr
-
-PImgCh   leax  ImgChStr,pcr
-         bra   PutStr
-
-PSuspnd  leax  SuspStr,pcr
-         bra   PutStr
-
-PCondem  leax  Condmstr,pcr
-         bra   PutStr
-
-PDead    leax  Deadstr,pcr
-
-Putstr   ldb   #6         six characters
-
-Putst1   lda   ,X+
-         lbsr  Print
-         decb  
-         bne   PutSt1
-         rts   
-
-         emod  
-Prgsiz   equ   *
-         end