home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / zsus / z3help / c.lbr / CFGLIB.HZP / CFGLIB.HLP
Encoding:
Text File  |  1991-11-18  |  9.0 KB  |  313 lines

  1. CFGLIB INTRODUCTION
  2. PUTZFS  (PUTZFS, PUTZDU, PUTZFN) Deparse FCB to DU:FN.FT
  3. GETZFS  (FNAME) Parse a Z3 filespec into a FCB
  4. INIFCB  Initialize a File Control Block
  5. MPY16   16 bit multiply with 32 bit result
  6. PKGOFF  convert offset in Z3ENV to absolute address
  7. RADBIN  (RADBIN, RTEN1) convert ASCII in any radix to binary
  8. SDELM   see if current character is a delimiter
  9. SKSP    increment a pointer past spaces
  10. UCASE   converts char to upper case
  11. FILL    Fill n bytes of memory with a constant
  12. RJUSTIP (RJIP, NTSPCS) - Right JUStify Text In Place
  13. :INTRODUCTION TO CFGLIB
  14.  
  15. CFGLIB is an M-REL library required during linking of ZCNFG.
  16. It was built using RLIB.
  17.  
  18. A library contains two or more concatenated REL modules each
  19. of which was (in principle, at least) separately assembled.
  20. Each module has a name which is either the name of the original
  21. source file (by default) or a name assigned with the NAME assembler
  22. instruction. Such names are used only by the library manager to
  23. distinguish one complete module from the next. 
  24.  
  25. Each (named) module contains one or more Entry Points: symbols which
  26. are usually the start of a subroutine. Such symbols were declared
  27. PUBLIC in the original source. For convenience, one of the entry points
  28. may have the same name as the module. Module names are meaningless to
  29. the linker; only entry points are recognized. See the GETZFS module,
  30. whose entry point is FNAME, for a case where the two are not the same.
  31.  
  32. CFGLIB is organized by Module Name. Examples show proper calls.
  33. The command 'RLIB CFGLIB' will display Module Names and Entry points.
  34. :PUTZFS - Deparse FCB to DU:FN.FT
  35.  
  36. Translates FCB preceded by a byte containing the user number into the
  37. standard FileSpec format, DU:FN.FT, with spaces removed from FN and
  38. appended at the end of the FT field.
  39.  
  40. PUTZFS sends DU:FN.FT to a 15 byte buffer
  41. PUTZDU sends DU: to a 3-byte destination
  42. PUTZFN sends FN.FT to a 12 byte buffer
  43.  
  44. CALL WITH:
  45.     HL -> FCB+1 (FILENAME field)
  46.     DE -> destination buffer
  47. RETURN WITH:
  48.     A destroyed, B = 0
  49.     C = number of fill spaces at buffer end
  50.     DE -> next unused buffer location
  51.     HL -> FCB+12
  52.  
  53.     ext    ma2hc        ;from SYSLIB
  54.     public    putzfs,putzdu,putzfn
  55.  
  56. :GETZFS  Parse a Z3 filespec into a FCB
  57. Routine to perform parse of [DU/DIR:]FN[.FT]
  58.  
  59. The Entry for this subroutine is FNAME. It is almost the same as
  60. the FNAME routine in Z3LIB.REL. The difference: this routine
  61. deposits the user number for the filespec in the address FCB-1.
  62. In addition, the list of delimiters recognized is different than
  63. those used by the Z3LIB fname routine. See routine SDELM for the
  64. delimiter list.
  65.  
  66. FNAME uses the following routines in CFGLIB:
  67.     fill,ifcb,inifcb,mpy16,pkgoff,radbin
  68.     rten1,sdelm,sksp,ucase
  69.  
  70. usage:    ext    fname
  71.     ...
  72.     ld    hl,(bufptr)        ;ascii string to parse
  73.     ld    de,fcb            ;place to parse to
  74.     ld    bc,(defdu)        ;currently logged DU
  75.     call    fname
  76.  
  77. CALL FNAME WITH:
  78.     HL -> Token to be parsed as Z3 filespec
  79.     DE -> FCB drive byte
  80.     B  =  Default Drive, (A...P = 1...16)
  81.     C  =  Default User, 0...31
  82.  
  83. RETURN WITH:
  84.     HL -> Delimiter which terminated the parse
  85.     DE    is preserved
  86.     BC =  D/U, with defaults replaced by explicit D or U
  87.     FCB drive byte, FN, FT, data fields initialized
  88.     FCB+13 =Default or declared User area (the S1 byte)
  89.     FCB-1 = Default or declared User area
  90.     NZ = Error, FCB+15 contains error flag
  91.     Z  = no error
  92.     A  = number of '?' in fn/ft. (wildcard count)
  93.  
  94. :INIFCB  Initialize a File Control Block
  95.  
  96. Two entry points are available in the INIFCB module, INIFCB and IFCB.
  97.  
  98. INIFCB initializes the FCB pointed to by DE. It initializes 32 bytes
  99. as fcb1 and fcb2. The Drive byte is not affected. This routine simply
  100. increments DE and then calls IFCB twice. See IFCB for details.
  101.  
  102. usage:    ext    inifcb
  103.     ...
  104.     call    inifcb
  105.  
  106. CALL WITH:
  107.     DE = address of the drive byte (byte 0) of an FCB
  108.  
  109. RETURN WITH:
  110.     DE = FCB+34
  111.  
  112. Other CFGLIB routines used:    fill
  113.  
  114. IFCB
  115. Initializes part of FCB whose file name field is pointed to by DE on entry.
  116. The file name and type are set to space characters; the EX, S2, RC, and the
  117. following CR (current record ) or DN (disk number) fields are set to zero.
  118. The S1 byte is set to the current user number.  On exit, DE points to the
  119. byte at offset 17 in the FCB (two bytes past the record count byte).
  120.  
  121. usage:    ext    ifcb
  122.     ...
  123.     ld    de,fcb+17    ;for fcb2 (for a Rename, for example)
  124.     call    ifcb
  125.  
  126. CALL WITH:
  127.     DE = address of the NAME field of the FCB to be initialized
  128.  
  129. RETURN WITH:
  130.     DE = <Name field address> + 16.
  131.  
  132. :MPY16   16 bit multiply with 32 bit result
  133.  
  134. This routine multiplies the 16-bit values in DE and HL and returns the
  135. 32-bit result in HLBC (HL has high 16 bits; BC has low 16 bits).
  136. Register pair AF is preserved.
  137.  
  138. usage:    ext    mpy16
  139.     ...
  140.     ld    hl,val1
  141.     ld    de,val2
  142.     call    mpy16
  143.  
  144. :PKGOFF  convert offset in Z3ENV to system module address
  145.  
  146. Calculate address of a package from Z3ENV.  On entry, E contains the
  147. offset to the address of the package in the environment.  On exit,
  148. DE points to the beginning of the package and HL points to the fifth
  149. byte (where the command table starts in the RCP and FCP modules).
  150. The zero flag is set on return if the package is not supported.
  151.  
  152. usage:    ext    pkgoff
  153.     public    z3env
  154.     ...
  155.     ld    e,offset
  156.     call    pkgoff
  157.  
  158. CALL WITH:
  159.     E = offset in the Z3 environment
  160.     Z3ENV is a label for the address of the 
  161.        ZCPR3x Environment Descriptor
  162.  
  163. RETURN WITH:
  164.     DE = Address of the environment package.
  165.  
  166. :RADBIN  convert ASCII in any radix to binary
  167.  
  168. The RADBIN module contains two entry points, RADBIN and RTEN1.
  169.  
  170. RTEN1 performs decimal conversion of the string at HL.
  171.  
  172. usage:    ext rten1
  173.     ...
  174.     call rten1    ;converts (HL) asumming a decimal number
  175.  
  176. RADBIN converts the string pointed to by HL using the radix passed in DE.
  177. If the conversion is successful, the value is returned in BC. HL points
  178. to the character that terminated the number, and A contains that
  179. character.  If an invalid character is encountered, the routine returns
  180. with the carry flag set, and HL points to the offending character.
  181.  
  182. usage:    ext radbin
  183.     ...
  184.     ld    de,13        ;for base 13
  185.     ld    hl,(bufptr)
  186.     call radbin
  187.  
  188. CALL WITH:
  189.     HL = address of an ascii string in any radix
  190.     DE = Number Base used to interpret the string
  191.          (2 for binary, 8 for Octal, etc.)
  192.  
  193. RETURN WITH:
  194.     BC = Binary value of the ASCII number represented
  195.     Carry flag set if the string contains an invalid character
  196.     
  197. Other CFGLIB routines used:    mpy16,sdelm
  198.  
  199. :SDELM   see if current character is a delimiter
  200.  
  201. This routine checks for a delimiter character pointed to by HL.
  202. It returns with the character in A and the zero flag set if it
  203. is a delimiter.  The delimiters tested for include all control
  204. characters, space, and the following characters.
  205.  
  206.     ','        ; comma
  207.     '/'        ; forward slash precedes options
  208.     ':'        ; colon
  209.     '.'        ; period
  210.     '='        ; equality sign
  211.     ';'        ; semicolon
  212.     '<'        ; left angle bracket
  213.     '>'        ; right angle bracket
  214.     '_'        ; underline
  215.  
  216. usage:    ext sdelm
  217.     ...
  218.     call sdelm
  219.     ...
  220.  
  221. CALL WITH:
  222.     HL = address of character to test
  223.  
  224. RETURN WITH:
  225.     A = the byte at HL
  226.     Z flag set means this is one of the delimiters
  227.     NZ means the character is NOT a delimiter
  228.     Other registers are preserved
  229.  
  230. :SKSP    increment a pointer past spaces
  231.     public    sksp
  232.  
  233. Subroutine to skip over spaces in the buffer pointed to by HL.  On return,
  234. the zero flag is set if we encountered the end of the line or a command
  235. separator character.
  236.  
  237. usage:    ext sksp
  238.     ...
  239.     ld hl,(bufptr)
  240.     call sksp
  241.  
  242. CALL WITH:
  243.     HL = address of a character in memory
  244.  
  245. RETURN WITH:
  246.     HL = address of next non-space character
  247.  
  248. :UCASE   converts char to upper case
  249.  
  250. Converts the  character in A to upper case.
  251.  
  252. usage:    ext ucase
  253.     ...
  254.     call ucase
  255.  
  256. CALL WITH:
  257.     A  = contains a lower case ASCII character
  258.  
  259. RETURN WITH:
  260.     A  = same character converted to upper case
  261.     All other registers are preserved
  262. :FILL    Fill n bytes of memory with a constant
  263.  
  264. Fill memory pointed to by DE with character in A for B bytes
  265.  
  266. usage:    ext    fill
  267.     ...
  268.     ld    b,10
  269.     ld    a,' '        ;fill with 10 spaces
  270.     call    fill
  271.  
  272. CALL FILL WITH
  273.     B  = number of bytes to fill
  274.     A  = value to fill with
  275.     DE = address to start filling
  276.  
  277. RETURN WITH
  278.     DE = address of next unfilled byte
  279.     The block specified has been filled with (A)
  280. :RJUSTIP - Right JUStify Text In Place
  281.  
  282. Moves left justified text to the right end of
  283. the buffer at HL and moves terminal spaces to
  284. the beginning of the buffer
  285.  
  286.     public    RJIP, NTSPCS
  287.  
  288. CALL WITH:
  289.     HL -> fixed length buffer, left justified
  290.     BC: B = field width, C = Number of spaces at end
  291. RETURN WITH:
  292.     HL preserved
  293.     BC, DE destroyed
  294.  
  295. NTSPCS (next screen) may be used to provide the calling
  296. data for this routine.
  297.  
  298.  
  299. NTSPCS - count trailing spaces in LJ field of text
  300.  
  301. Scan the field at (HL) whose length is given in BC
  302. or just C, counting trailing spaces.
  303. This routine may be used to provide input for RJIP
  304.  
  305. CALL WITH:
  306.     HL -> start of field containing text
  307.     C  =  length of the field (1...255)
  308.  
  309. RETURN WITH:
  310.     DE, HL are preserved
  311.     BC = field length in B, number of trailing spaces in C
  312.  
  313.