home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol100 / echo.mac < prev    next >
Encoding:
Text File  |  1984-04-29  |  4.9 KB  |  235 lines

  1. ;
  2. ;  PROGRAM:  ECHO
  3. ;  AUTHOR:  RICHARD CONN
  4. ;  VERSION:  1.1
  5. ;  DATE:  6 JAN 83
  6. ;  PREVIOUS VERSIONS:  1.0 (10 DEC 82)
  7. ;
  8. VERS    EQU    11
  9.  
  10. ;
  11. ;    This program is Copyright (c) 1982, 1983 by Richard Conn
  12. ;    All Rights Reserved
  13. ;
  14. ;    ZCPR2 and its utilities, including this one, are released
  15. ; to the public domain.  Anyone who wishes to USE them may do so with
  16. ; no strings attached.  The author assumes no responsibility or
  17. ; liability for the use of ZCPR2 and its utilities.
  18. ;
  19. ;    The author, Richard Conn, has sole rights to this program.
  20. ; ZCPR2 and its utilities may not be sold without the express,
  21. ; written permission of the author.
  22. ;
  23.  
  24.  
  25. ;
  26. ;    ECHO is used to echo the command line to the screen.  It is invoked
  27. ; in two different ways:
  28. ;        ECHO            <-- print Help Message
  29. ;        ECHO //            <-- print Help Message
  30. ;        ECHO text        <-- print text
  31. ;
  32. ;    This seems like a trivial program, but it buys the user one key thing:
  33. ; for ZCPR2 use, a message may be stored in the multiple command line buffer
  34. ; by using ECHO, so that programs like STARTUP can print a welcome message
  35. ; after they have run.  For STARTUP in particular, a sample command line
  36. ; would be:
  37. ;        ioloader;ld ld;tinit;echo WELCOME TO ZCPR II
  38. ;    This line runs IOLOADER, which loads the redirectable I/O devices,
  39. ; followed by LD LD, which loads a named directory into memory, and TINIT,
  40. ; which initializes a TVI 950 terminal (function keys, user line, etc).
  41. ; When all is done, TINIT will have cleared the screen and ECHO will have
  42. ; printed its message.
  43. ;
  44.  
  45. ;
  46. ;  Externals
  47. ;
  48.     ext    pstr    ; print string pted to by HL
  49.     ext    crlf    ; new line
  50.     ext    print    ; print string pted to by ret adr
  51.  
  52. ;
  53. ;  CP/M Constants
  54. ;
  55. tbuff    equ    80h    ; console line buffer
  56. cr    equ    0dh
  57. lf    equ    0ah
  58.  
  59. ;
  60. ;  Branch to Start of Program
  61. ;
  62.     jmp    start
  63.  
  64. ;
  65. ;******************************************************************
  66. ;
  67. ;  SINSFORM -- ZCPR2 Utility Standard General Purpose Initialization Format
  68. ;
  69. ;    This data block precisely defines the data format for
  70. ; initial features of a ZCPR2 system which are required for proper
  71. ; initialization of the ZCPR2-Specific Routines in SYSLIB.
  72. ;
  73.  
  74. ;
  75. ;  EXTERNAL PATH DATA
  76. ;
  77. EPAVAIL:
  78.     DB    0FFH    ; IS EXTERNAL PATH AVAILABLE? (0=NO, 0FFH=YES)
  79. EPADR:
  80.     DW    40H    ; ADDRESS OF EXTERNAL PATH IF AVAILABLE
  81.  
  82. ;
  83. ;  INTERNAL PATH DATA
  84. ;
  85. INTPATH:
  86.     DB    0,0    ; DISK, USER FOR FIRST PATH ELEMENT
  87.             ; DISK = 1 FOR A, '$' FOR CURRENT
  88.             ; USER = NUMBER, '$' FOR CURRENT
  89.     DB    0,0
  90.     DB    0,0
  91.     DB    0,0
  92.     DB    0,0
  93.     DB    0,0
  94.     DB    0,0
  95.     DB    0,0    ; DISK, USER FOR 8TH PATH ELEMENT
  96.     DB    0    ; END OF PATH
  97.  
  98. ;
  99. ;  MULTIPLE COMMAND LINE BUFFER DATA
  100. ;
  101. MCAVAIL:
  102.     DB    0FFH    ; IS MULTIPLE COMMAND LINE BUFFER AVAILABLE?
  103. MCADR:
  104.     DW    0FF00H    ; ADDRESS OF MULTIPLE COMMAND LINE BUFFER IF AVAILABLE
  105.  
  106. ;
  107. ;  DISK/USER LIMITS
  108. ;
  109. MDISK:
  110.     DB    4    ; MAXIMUM NUMBER OF DISKS
  111. MUSER:
  112.     DB    31    ; MAXIMUM USER NUMBER
  113.  
  114. ;
  115. ;  FLAGS TO PERMIT LOG IN FOR DIFFERENT USER AREA OR DISK
  116. ;
  117. DOK:
  118.     DB    0FFH    ; ALLOW DISK CHANGE? (0=NO, 0FFH=YES)
  119. UOK:
  120.     DB    0FFH    ; ALLOW USER CHANGE? (0=NO, 0FFH=YES)
  121.  
  122. ;
  123. ;  PRIVILEGED USER DATA
  124. ;
  125. PUSER:
  126.     DB    10    ; BEGINNING OF PRIVILEGED USER AREAS
  127. PPASS:
  128.     DB    'chdir',0    ; PASSWORD FOR MOVING INTO PRIV USER AREAS
  129.     DS    41-($-PPASS)    ; 40 CHARS MAX IN BUFFER + 1 for ending NULL
  130.  
  131. ;
  132. ;  CURRENT USER/DISK INDICATOR
  133. ;
  134. CINDIC:
  135.     DB    '$'    ; USUAL VALUE (FOR PATH EXPRESSIONS)
  136.  
  137. ;
  138. ;  DMA ADDRESS FOR DISK TRANSFERS
  139. ;
  140. DMADR:
  141.     DW    80H    ; TBUFF AREA
  142.  
  143. ;
  144. ;  NAMED DIRECTORY INFORMATION
  145. ;
  146. NDRADR:
  147.     DW    00000H    ; ADDRESS OF MEMORY-RESIDENT NAMED DIRECTORY
  148. NDNAMES:
  149.     DB    64    ; MAX NUMBER OF DIRECTORY NAMES
  150. DNFILE:
  151.     DB    'NAMES   '    ; NAME OF DISK NAME FILE
  152.     DB    'DIR'        ; TYPE OF DISK NAME FILE
  153.  
  154. ;
  155. ;  REQUIREMENTS FLAGS
  156. ;
  157. EPREQD:
  158.     DB    000H    ; EXTERNAL PATH?
  159. MCREQD:
  160.     DB    000H    ; MULTIPLE COMMAND LINE?
  161. MXREQD:
  162.     DB    000H    ; MAX USER/DISK?
  163. UDREQD:
  164.     DB    000H    ; ALLOW USER/DISK CHANGE?
  165. PUREQD:
  166.     DB    000H    ; PRIVILEGED USER?
  167. CDREQD:
  168.     DB    000H    ; CURRENT INDIC AND DMA?
  169. NDREQD:
  170.     DB    000H    ; NAMED DIRECTORIES?
  171. Z2CLASS:
  172.     DB    0    ; CLASS 0
  173.     DB    'ZCPR2'
  174.     DS    10    ; RESERVED
  175.  
  176. ;
  177. ;  END OF SINSFORM -- STANDARD DEFAULT PARAMETER DATA
  178. ;
  179. ;******************************************************************
  180. ;
  181.  
  182. ;
  183. ;  Start of Program
  184. ;
  185. start:
  186.     lxi    h,tbuff    ; place zero at end of command line
  187.     mov    a,m    ; get char count
  188.     inx    h    ; pt to first char
  189.     push    h    ; save ptr
  190.     add    l    ; HL=HL+A
  191.     mov    l,a
  192.     mov    a,h
  193.     aci    0
  194.     mov    h,a
  195.     mvi    m,0    ; store ending zero
  196.     pop    h    ; pt to first char
  197.     call    sblank    ; skip to first non-blank
  198.     ora    a    ; EOL means print Help Message
  199.     jz    phelp
  200.     cpi    '/'    ; slash means print Help Message also
  201.     jnz    echo    ; if not slash, print buffer contents
  202. ;
  203. ;  Print Help Message
  204. ;
  205. phelp:
  206.     call    print
  207.     db    'ECHO  Version '
  208.     db    (vers/10)+'0','.',(vers mod 10)+'0'
  209.     db    cr,lf,'    ECHO prints the command line on the user''s console.'
  210.     db    cr,lf,'It is invoked by the following forms:'
  211.     db    cr,lf
  212.     db    cr,lf,'        ECHO or ECHO //        <-- Print this Help'
  213.     db    cr,lf,'        ECHO text        <-- Print text'
  214.     db    cr,lf,0
  215.     ret
  216. ;
  217. ;  Echo Command Line
  218. ;
  219. echo:
  220.     call    crlf    ; new line
  221.     call    pstr    ; simply print string starting at HL
  222.     ret
  223. ;
  224. ;  Skip to Non-Blank
  225. ;
  226. sblank:
  227.     mov    a,m    ; get char
  228.     inx    h    ; pt to next
  229.     cpi    ' '    ; skip if space
  230.     jz    sblank
  231.     dcx    h    ; back up to non-space
  232.     ret
  233.  
  234.     end
  235.