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 / BEEHIVE / ZSUS / Z3HELP-6.LBR / ZA.LBR / Z3LIB4.HZP / Z3LIB4.HLP
Text File  |  2000-06-30  |  17KB  |  472 lines

  1.  Introduction - ZCPR3 Messages
  2.  Command Status Message      - GETCST, PUTCST, QERROR, QSHELL
  3.  Error Flag & Error Command  - ERRADR, GETER1, PUTER1, GETERC, PUTERC
  4.  Inter-Transient Error Code  - GETER2, PUTER2
  5.  Command Error Flag & Hndlr  - GETER3, PUTER3, INVERROR
  6.  Command Status Flag         - SETEPB, RESEPB, RETCST
  7.  Register Access             - GETREG, PUTREG
  8.  ZCPR 3.3 Default DU Buffer  - GDEFDU, PDEFDU
  9. :           Introduction to ZCPR3 Messages 
  10.  
  11. ZCPR3 offers many features not found in CP/M, ZCPR1, or ZCPR2.
  12. One very special feature is that of Command Processor Messages.
  13.  
  14. ZCPR3 supports a Message Buffer which contains a number of
  15. messages which can be passed from one transient program to
  16. another or between ZCPR3 itself and all transient programs
  17. which run under it.  Commands can be given directly to ZCPR3,
  18. status information can be passed from ZCPR3 to the transients,
  19. and both status and commands can be passed from one transient
  20. to another through these messages.
  21.  
  22.  These message can be divided into six basic classes:
  23.  
  24.     o  Messages which command ZCPR3
  25.     o  Status messages sent by ZCPR3
  26.     o  ZEX command messages
  27.     o  Status and command messages sent by one program
  28.         to another which are ignored by ZCPR3
  29.     o  User-defined messages
  30.     o  Reserved messages
  31.  
  32. Before using any Z3LIB routines to access these messages, your
  33. program should ensure that the Message Buffer is available to
  34. it.  This can easily be done by calling the GETMSG routine (see
  35. the screen on the  ZCPR3 environment).  GETMSG returns with the
  36. Zero Flag Set (Z) if no ZCPR3 Message Buffer exists.  Hence:
  37.  
  38.     EXT    GETMSG        ; Declare the routine
  39.     ...
  40.     CALL    GETMSG        ; Get message buffer status
  41.     JR    Z,NOZ3MSGS    ; ..jump if No Msgs to read
  42.     ...
  43.  
  44. The following screens summarize facilities available through
  45. the ZCPR3 Message Buffer.
  46.  
  47.               Messages which Command ZCPR3 
  48.  
  49. Some of the messages in the ZCPR3 Message Buffer are set by
  50. external programs (transients or command packages) and are
  51. read and interpreted by ZCPR3.  These messages are:
  52.  
  53.     o  Current IF level and active (T/F) status of
  54.         all IF levels
  55.     o  Whether an error handler is available and what
  56.         the command line to invoke it is
  57.  
  58.               Status Messages Sent by ZCPR3 
  59.  
  60. Some of the messages in the ZCPR3 Message Buffer are set only
  61. by ZCPR3 or a ZCPR3 Shell and are intended to be used as R/O
  62. messages by transients.  These messages are:
  63.  
  64.     o  ZCPR3 Command Status
  65.         - the transient loaded is/is not a shell
  66.         - the transient loaded is/is not an error handler
  67.     o  Error Address
  68.         - if the transient loaded is an error handler,
  69.         this is the address of the first character of
  70.         the command line which was in error
  71.  
  72.                    ZEX Command Messages 
  73.  
  74. One message in the ZCPR3 Message Buffers is intended to
  75. directly send commands to the ZEX memory-based command file
  76. processor.  This message byte tells ZEX three different things:
  77.  
  78.     o  Run normally - ZEX is to intercept Input calls and
  79.         provide characters in place of console input
  80.     o  ZCPR3 is prompting - ZEX is providing input directly
  81.         to the Command Processor ZCPR3
  82.     o  Suspend intercept - ZEX is to stop intercepting
  83.         console input and allow input from the console
  84.         until normal execution or the ZCPR3 prompt
  85.         appears
  86.  
  87.                 Messages Ignored by ZCPR3 
  88.  
  89. Two pre-defined messages are ignored by ZCPR3.  The first is
  90. the Program Error Code.  This byte can be set by any program
  91. under ZCPR3 to indicate a return status to the next program.
  92. The convention has been adopted that if this byte is 0, then
  93. the program completed successfully.  If it is non-zero, the
  94. program failed for some reason and the value of this code
  95. indicates that reason to a following program.
  96.  
  97. The second message is the register buffer.  Ten 1-byte
  98. registers are available and can be tested by the Flow Command
  99. Package.  Conditions like "IF 0 5" (IF Register 0 = 5) can be
  100. tested and processed by the Flow Command Package, and other
  101. Transient programs or Resident Command Packages can manipulate
  102. these register values.
  103.  
  104.                  User-Defined Messages 
  105.  
  106. A set of 16 messages are available for user definition.  Each
  107. message is one byte long, and Z3LIB routines are provided to
  108. place values into these messages and query them.
  109.  
  110.  
  111.                     Reserved Messages 
  112.  
  113. A set of 16 one-byte messages is reserved for future use in the
  114. ZCPR3 system and should not be used by applications programmers.
  115. Z3LIB does not provide access to these messages.
  116.  
  117. :Command Status Message    GETCST, PUTCST, QERROR, QSHELL 
  118.  
  119. These messages return the status of the current transient
  120. as set by ZCPR3.  Any transient has been invoked in one of
  121. three possible states:
  122.  
  123.    - As a "normal" transient, executed at the request of the
  124.        user or another program
  125.    - As a "shell", invoked by ZCPR3 itself
  126.    - As an "error handler", invoked by ZCPR3 itself when it
  127.        cannot process the current command line (cannot find a
  128.        matching COM file or CMDRUN facility)
  129.  
  130. GETCST - Return the ZCPR3 Command Status Message
  131.  
  132.   ENTER: None
  133.   EXIT : A = Message Code (Zero Flag set accordingly)
  134.   USES : AF
  135.  
  136.  Usage:  This routine returns the ZCPR3 Command Status Message
  137.   which is always set by ZCPR3 and not intended to be set by
  138.   any program.  It can have one of three values:
  139.  
  140.           0 - this is a "Normal" transient
  141.           1 - this is a "Shell"
  142.           2 - this is an "Error Handler"
  143.  
  144. PUTCST - Set the ZCPR3 Command Status Message
  145.  
  146.   ENTER: A = ZCPR3 Command Status Message value (0, 1, or 2)
  147.   EXIT : None
  148.   USES : None
  149.  
  150.  Usage:  This routine is provided to allow a ZCPR3 Shell
  151.   program to Set the ZCPR3 Command Status Message Byte.  It
  152.   is NOT intended for general use by application programs.
  153.   Allowable values for the Command Status Message are:
  154.  
  155.           0 - this is a "Normal" transient
  156.           1 - this is a "Shell"
  157.           2 - this is an "Error Handler"
  158.  
  159. QERROR - Test Command Status Message for Error Handler
  160.  
  161.   ENTER: None
  162.   EXIT : A = Message Code. Zero Set (Z) if transient is an
  163.              Error Handler, else Clear (NZ)
  164.   USES : AF
  165.  
  166.  Usage:  This routine is used as a quick test to see if the
  167.   ZCPR3 Command Status Message indicates that the current
  168.   transient is an error handler.  The ZCPR3 Command Status
  169.   Message is read and tested against the Error Handler code
  170.   value.   Zero Flag is Set if the current transient is an
  171.   Error Handler.
  172.  
  173. QSHELL - Test Command Status Message for Shell Transient
  174.  
  175.   ENTER: None
  176.   EXIT : A = Message Code. Zero Set (Z) if transient is Shell
  177.   USES : AF
  178.  
  179.  Usage:  This routine is used as a quick test to see if the
  180.   ZCPR3 Command Status Message indicates that the current
  181.   transient is a Shell.  The ZCPR3 Command Status Message is
  182.   read and tested against the Shell code value.   Zero Flag
  183.   is Set if the current transient is a Shell.
  184.  
  185. :Error Flag & Error Comnd  ERRADR, GETER1, PUTER1, GETERC, PUTERC 
  186.  
  187. This set of routines performs the following functions:
  188.  
  189.     ERRADR - returns the address of the first character of the
  190.               Command Line in error
  191.     GETER1 - returns the Error Flag
  192.     PUTER1 - sets the error flag
  193.     GETERC - returns the address of the first character of the
  194.               Error Handler Command Line
  195.     PUTERC - set the Error Handler Command Line
  196.  
  197. ERRADR - On Error, return First Char of Erred Command Line
  198.  
  199.   ENTER: None
  200.   EXIT : HL = Address of first character of error line
  201.   USES : HL
  202.  
  203.  Usage:  Assuming that the current transient is an Error
  204.   Handler, (call to QERROR returning with Zero Flag Set), this
  205.   routine returns the address of the first character of the
  206.   Command Line which was in error. For example, if the Command:
  207.  
  208.     XXX params;DIR
  209.  
  210.   was issued and XXX.COM could not be found, ERRADR returns the
  211.   address of the first character of the string:
  212.  
  213.     DEFB    'XXX params;DIR',0
  214.  
  215. GETER1 - Return Error Flag
  216.  
  217.   ENTER: None
  218.   EXIT : A <> 0, Zero Flag Clear (NZ) if Error present
  219.              A = 0, Zero Set (Z) if NO Error
  220.   USES : AF
  221.  
  222.  Usage:  Return the error flag in A.  GETER1 has been
  223.   redefined from the original purpose of determining Error
  224.   Handler presence, and now only returns the value of the
  225.   Error Flag.
  226.  
  227. PUTER1 - Engage/Disengage Error Handler Flag  (* removed *)
  228.  
  229.   ENTER: None
  230.   EXIT : None
  231.   USES : None
  232.  
  233.  Usage:  This routine no longer performs a function and
  234.   simply returns to the calling program.
  235.  
  236. GETERC - Return Address of String invoking Error Handler
  237.  
  238.   ENTER: None
  239.   EXIT : HL = Addr of first char of string invoking Handler
  240.           A <> 0, Zero Flag Clear (NZ) if Valid char
  241.               A = 0 and Zero Flag Set if string is empty
  242.   USES : AF,HL
  243.  
  244.  Usage:  This routine may be used to facilitate Error Handler
  245.   construction by returning the string address and first char.
  246.   If the Error Handler is to be invoked by the command:
  247.  
  248.     ERROR params
  249.  
  250.   then GETERC returns the address of the first character of:
  251.  
  252.     DEFB    'ERROR params',0
  253.  
  254. PUTERC - Set the Error Handler Command Line
  255.  
  256.   ENTER: HL = Addr of first char of Error Handler Comnd Line
  257.   EXIT :  A <> 0, Zero Flag Clear (NZ) if Ok
  258.               A = 0, Zero Flag Set (Z) if Comnd line too long
  259.                      (more than 32 bytes)
  260.   USES : AF
  261.  
  262.  Usage:  This routine established a string which is to be the
  263.   Command Line executed to invoke an error handler.  The Error
  264.   string, including the ending 0, must be 32 bytes long or
  265.   less.
  266.  
  267. Example:
  268.     EXT    PUTERC        ; Declare the routine
  269.     ...            ; ..preceeding code
  270.     LD    HL,ERSTR    ; Address this string
  271.     CALL    PUTERC        ; Set it as Handler Comnd Line
  272.     JR    NZ,OK        ; ..jump if string accepted
  273.     ...            ; Else take other action
  274.  ERSTR:    DEFB    'ERROR NOOPT',0
  275. :Inter-Transient Error Code    GETER2, PUTER2 
  276.  
  277. The inter-transient error code is a one-byte message which any
  278. program can set to indicate its completion success.  The
  279. convention is that if this message byte is set to 0, then the
  280. program completed successfully.  If this message byte is not 0,
  281. then the program had an error and the value of this message
  282. byte indicates the error.
  283.  
  284. GETER2 allows a program to determine the value of this inter-
  285. transient error code and PUTER2 allows a program to set the
  286. value of the inter-transient error code.
  287.  
  288. GETER2 - Return the Value of Inter-Transient Error Code
  289.  
  290.   ENTER: None
  291.   EXIT :  A = Error Code, Zero Clear (NZ) if Error
  292.               A = 0, Zero Flag Set (Z) if NO Error
  293.   USES : AF
  294.  
  295.  Usage:  This routine is used to determine if a preceeding
  296.   program passed an error to this one in the Inter-Transient
  297.   Error Code.
  298.  
  299. PUTER2 - Set Inter-Transient Error Code
  300.  
  301.   ENTER:  A = Error Code (0 for No Error)
  302.   EXIT : None
  303.   USES : None
  304.  
  305.  Usage:  This routine is used to signal following programs that
  306.   No error status resulted from the presently-executing
  307.   transient.
  308.  
  309. :GETER3 - Return the value of the Command Error Flag           (*)
  310.  
  311.   ENTER: None
  312.   EXIT :  A <> 0, Zero Clear (NZ) if Message Exists
  313.               A = 0, Zero Set (Z) if NO Message
  314.   USES : AF
  315.  
  316.  Usage:  This routine is most often used by Error Handlers to
  317.   identify whether or not an error occurred.  If an error is
  318.   detected from the Command Error Flag, the Message Buffers may
  319.   be used to pass additional information on the cause and
  320.   action.
  321.  
  322. PUTER3 - Set the Command Error Flag                           (*)
  323.  
  324.   ENTER: A = Value to set Command Error Flag
  325.   EXIT : None.  Value is stored in Command Error Flag
  326.   USES : None
  327.  
  328.  Usage:  This routine is used to set the Command Error Flag
  329.   for possible invocation of an error handler.  Additional
  330.   information may be passed in other Message Buffers.
  331.  
  332. Example:
  333.     EXT    PUTER3        ; Declare the routine
  334.     ...
  335.  ISERR:    LD    A,0FFH        ; Signal Error Occurrance
  336.     JR    ERRV        ; ..with Command Error Flag
  337.  
  338.  NOERR:    XOR    A        ; Enter here to set No Errs
  339.  ERRV:    CALL    PUTER3        ; ..set/clear Comnd Err Flag
  340.     ...            ; Continue
  341.  
  342. INVERROR - Invoke Error Handler                               (*)
  343.  
  344.   ENTER:  A = 0 for Internal errs, A <> 0 for External errs
  345.       B = Error code for External errors,
  346.         undefined for Internal errors
  347.   EXIT :  A = 0 if the Error is internal to ZCPR 3.3
  348.           A <> 0 if the Error is external to ZCPR 3.3
  349.   USES : AF,DE,HL
  350.  
  351.  Usage:  This routine set all parameters for an Error Handler
  352.   invocation.  It is normally used just prior to a program
  353.   abort to either the Command Processor or to a Warm Boot.
  354.  
  355.  
  356. Example:
  357.     EXT    INVERROR    ; Declare the routine
  358.     ...            ; ..pgm flow w/detected error
  359.     LD    A,(ERRCODE)    ; Get error code (if external)
  360.     LD    B,A        ; ..and put in correct register
  361.     LD    A,(ERRTYPE)    ; Load the error type
  362.     CALL    INVERROR    ; Call the routine
  363.     JP    NZ,0        ; ..jump Warm Boot if No ZCPR33
  364.     ...            ; Else return to Command Proc
  365.  
  366. :SETEPB - Set External Program Bit in Command Status Flag      (*)
  367.  
  368.   ENTER: None
  369.   EXIT : None
  370.   USES : None
  371.  
  372.  Usage:  This routine Sets the External Program Bit in the
  373.   Command Status Flag to signify to the ZCPR 3.3 or later
  374.   Command Processor that current actions (such as parsing) is
  375.   being requested by an External Program.
  376.  
  377. RESEPB - Reset External Program bit in Command Status Flag.   (*)
  378.  
  379.   ENTER: None
  380.   EXIT : None
  381.   USES : None
  382.  
  383.  Usage:  This routine resets the External Program bit in the
  384.   Command Status Flag indicating that the ZCPR 3.3 or later to
  385.   signify to the Command Processor that any actions there are
  386.   internal and not related to an External Program.
  387.  
  388. RETCST - Return the address of the Command Status Flag.       (*)
  389.  
  390.   ENTER: None
  391.   EXIT : HL = Address of the Command Status Flag
  392.   USES : HL
  393.  
  394.  Usage:  This routine returns the address of the Command Status
  395.   Flag.  It is used by SETEPB, RESEPB and other internal modules.
  396.  
  397. :Register Access         GETREG, PUTREG 
  398.  
  399. The ZCPR3 Message Buffer provides ten one-byte messages which
  400. are used as one-byte registers.  The GETREG and PUTREG routines
  401. allow a program to obtain and set a value in any one of the ten
  402. registers.
  403.  
  404. GETREG - Return contents of specified Message Buffer
  405.  
  406.   ENTER:  B = Number of register to access (0..9)
  407.   EXIT :  A = value of register, Zero Flag is set accordingly
  408.   USES : AF
  409.  
  410.  Usage:  This routine is used to obtain the contents of an
  411.   arbitrary Message Buffer.  These buffers are byte values.
  412.  
  413.   NOTE:  GETREG performs no validity check on the specified
  414.   register number, merely using it as an index into the
  415.   Message Buffer array.  You must insure that only values in
  416.   the range of 0..9 are passed.
  417.  
  418. Example:
  419.     EXT    GETREG        ; Declare the routine
  420.     ...            ; ..preceeding code
  421.     LD    B,5        ; Get the value of Reg 5
  422.     CALL    GETREG        ; Return Reg 5 value byte
  423.     JR    Z,R5EQ0        ; ..jump to process if 0
  424.     ...            ; Else check more, etc
  425.  
  426. PUTREG - Set a specified Message Buffer Reg to given value
  427.  
  428.   ENTER: B = Register number to set (0 to 9)
  429.          A = Value to Set in Register (0 to 255)
  430.   EXIT : None
  431.   USES : None
  432.  
  433.  Usage:  This routine sets a specified Message Buffer Register
  434.   to a given value which may be tested by other programs.
  435.  
  436.   NOTE:  No check is made to ensure that B contains a valid
  437.   register number.  You must insure that in contains only
  438.   values from 0 to 9.
  439.  
  440. Example:
  441.     EXT    PUTREG        ; Declare the routine
  442.     ...            ; ..preceeding code
  443.     LD    B,9        ; Set Message Register 9
  444.     LD    A,20        ; ..to 20
  445.     CALL    PUTREG        ; Do it
  446.     ...            ; ..and continue
  447.  
  448. :GDEFDU - Return Current Drive and User                        (*)
  449.  
  450.   ENTER: None
  451.   EXIT : BC = DU.  B=Drive (A=0,..P=15), C = User Number
  452.   USES : BC
  453.  
  454.  Usage:  This routine returns the Current Drive and User
  455.   settings from the ZCPR 3.3 Message Buffer for use by the CD
  456.   Change Directory routine, Shells, or when a User Number
  457.   greater than 15 is logged.  This is the preferred method of
  458.   logging into High User Areas since the CURDRV byte at
  459.   location 4 only accomodates Users from 0 through 15.
  460.  
  461. PDEFDU - Make specified Drive and User Current                (*)
  462.  
  463.   ENTER: BC = DU.  B=Drive (A=0,..P=15), C=User (0..31) to set
  464.   EXIT : None.  CURDR and CURUSR are set to specified values
  465.   USES : None
  466.  
  467.  Usage:  This routine is used to store specified Drive and User
  468.   values into CURDR and CURUSR locations in the ZCPR 3 Message
  469.   Buffer thereby making them current.  It is normally used when
  470.   Drive and User are obtained from Path specifications to
  471.   signal Shells or Error Handlers where activities occurred.
  472.