home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ZSYS / SIMTEL20 / ZCPR3 / Z3LOC.MQC / Z3LOC.MAC
Text File  |  2000-06-30  |  4KB  |  212 lines

  1. ;
  2. ;  PROGRAM:  Z3LOC
  3. ;  AUTHOR:  RICHARD CONN
  4. ;  VERSION:  1.0
  5. ;  DATE:  18 MAY 84
  6. ;  PREVIOUS VERSIONS:  None
  7. ;  DERIVATION:  CCPLOC 1.1 (6 Jan 83)
  8. ;
  9. VERS    EQU    10
  10. z3env    SET    0f400h
  11.  
  12. ;
  13. ;    Z3LOC -- ZCPR3 Environment Element Locator
  14. ;
  15. ;    The purpose of Z3LOC is to locate the addresses of the running
  16. ; ZCPR3 CCP, BDOS, and BIOS, and to display these values to the user.
  17. ; If the Z option is given, the addresses of the following system elements
  18. ; are also presented:
  19. ;
  20. ;        External Path
  21. ;        RCP
  22. ;        IOP
  23. ;        FCP
  24. ;        Named Directory
  25. ;        Command Line Buffer
  26. ;        Shell Stack
  27. ;        Environment Descriptor
  28. ;        External FCB
  29. ;        ZCPR3 Message Buffer
  30. ;        External Stack
  31. ;        Wheel Byte
  32. ;
  33.  
  34. ;
  35. ;  CP/M Constants
  36. ;
  37. bdos    equ    5    ; BDOS Entry
  38. fcb    equ    5dh    ; 1st char in FCB
  39. cr    equ    0dh
  40. lf    equ    0ah
  41.  
  42. ;
  43. ;  Externals
  44. ;
  45.     ext    z3init,envptr
  46.     ext    print,phl4hc,cout,crlf
  47.  
  48. ;
  49. ; Environment Definition
  50. ;
  51.     if    z3env ne 0
  52. ;
  53. ; External ZCPR3 Environment Descriptor
  54. ;
  55.     jmp    start
  56.     db    'Z3ENV'    ;This is a ZCPR3 Utility
  57.     db    1    ;External Environment Descriptor
  58. z3eadr:
  59.     dw    z3env
  60. start:
  61.     lhld    z3eadr    ;pt to ZCPR3 environment
  62. ;
  63.     else
  64. ;
  65. ; Internal ZCPR3 Environment Descriptor
  66. ;
  67.     MACLIB    Z3BASE.LIB
  68.     MACLIB    SYSENV.LIB
  69. z3eadr:
  70.     jmp    start
  71.     SYSENV
  72. start:
  73.     lxi    h,z3eadr    ;pt to ZCPR3 environment
  74.     endif
  75.  
  76. ;
  77. ; Start of Program -- Initialize ZCPR3 Environment
  78. ;
  79.     call    z3init    ;initialize the ZCPR3 Env and the VLIB Env
  80.     call    print
  81.     db    'Z3LOC  Version '
  82.     db    (vers/10)+'0','.',(vers mod 10)+'0',0
  83.     lda    fcb    ;check for help
  84.     cpi    'Z'    ;Z is only option
  85.     jz    start1
  86.     cpi    ' '    ;no option?
  87.     jz    start1
  88.     call    print
  89.     db    cr,lf,'    Z3LOC or Z3LOC Z'
  90.     db    cr,lf,'Z3LOC gives the addresses of the CCP, BDOS, and BIOS.'
  91.     db    cr,lf,'Z3LOC Z gives all key ZCPR3 addresses.',0
  92.     ret
  93. start1:
  94.     call    print
  95.     db    cr,lf,'ZCPR3 Element    Base Address'
  96.     db    cr,lf,'-------------    ------------',0
  97.  
  98.     lhld    bdos+1    ;get base address of BDOS
  99.     mvi    l,0    ;set to even boundary
  100.     lxi    d,-800H    ;back up to start of CCP (size of CCP)
  101.     dad    d    ;HL pts to CCP
  102.     call    print
  103.     db    cr,lf,'    CCP        ',0
  104.     call    prdata
  105.  
  106.     lhld    bdos+1    ;just get base address of BDOS again
  107.     call    print
  108.     db    cr,lf,'    BDOS    ',0
  109.     call    prdata
  110.  
  111.     mvi    l,0    ;set even page
  112.     lxi    d,0e00h    ;size of BDOS
  113.     dad    d    ;HL pts to BIOS
  114.     call    print
  115.     db    cr,lf,'    BIOS    ',0
  116.     call    prdata
  117.  
  118.     call    crlf    ;new line
  119.     lda    fcb    ;check for Z option
  120.     cpi    'Z'
  121.     rnz        ;done if not Z
  122.  
  123.     call    print
  124.     db    cr,lf,'Env Descriptor    ',0
  125.     lxi    d,18    ;offset to env descriptor element
  126.     call    z3data
  127.     call    crlf
  128.  
  129.     call    print
  130.     db    cr,lf,'Pack: FCP    ',0
  131.     lxi    d,9
  132.     call    z3data
  133.  
  134.     call    print
  135.     db    cr,lf,'      IOP    ',0
  136.     lxi    d,6
  137.     call    z3data
  138.  
  139.     call    print
  140.     db    cr,lf,'      RCP    ',0
  141.     lxi    d,3
  142.     call    z3data
  143.     call    crlf
  144.  
  145.     call    print
  146.     db    cr,lf,'Buf: Cmd Line    ',0
  147.     lxi    d,15
  148.     call    z3data
  149.  
  150.     call    print
  151.     db    cr,lf,'     Ext FCB    ',0
  152.     lxi    d,27
  153.     call    z3data
  154.  
  155.     call    print
  156.     db    cr,lf,'     Ext Path    ',0
  157.     lxi    d,0
  158.     call    z3data
  159.  
  160.     call    print
  161.     db    cr,lf,'     Ext Stk    ',0
  162.     lxi    d,29
  163.     call    z3data
  164.  
  165.     call    print
  166.     db    cr,lf,'     Messages    ',0
  167.     lxi    d,25
  168.     call    z3data
  169.  
  170.     call    print
  171.     db    cr,lf,'     Named Dir    ',0
  172.     lxi    d,12
  173.     call    z3data
  174.  
  175.     call    print
  176.     db    cr,lf,'     Shell Stk    ',0
  177.     lxi    d,21
  178.     call    z3data
  179.  
  180.     call    print
  181.     db    cr,lf,'     Wheel Byte    ',0
  182.     lxi    d,32
  183.     call    z3data
  184.  
  185.     jmp    crlf    ;new line and exit
  186.  
  187. ;
  188. ;  Z3DATA -- Print Data Fields for a ZCPR3 Element
  189. ;
  190. z3data:
  191.     lhld    envptr    ;pt to environment
  192.     dad    d    ;HL pts to element
  193.     lxi    d,9    ;add 9 for initial offset
  194.     dad    d    ;fall thru to PRDATA
  195.     mov    e,m    ;get address
  196.     inx    h
  197.     mov    d,m
  198.     xchg
  199.  
  200. ;
  201. ;  PRDATA -- Print Data Field (Base Address)
  202. ;
  203. prdata:
  204.     call    print
  205.     db    '   ',0
  206.     call    phl4hc    ;print full address
  207.     call    print
  208.     db    ' H',0
  209.     ret
  210.  
  211.     end
  212.