home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol089 / syslib.hlp < prev    next >
Text File  |  1985-02-09  |  14KB  |  371 lines

  1. Directory Manipulation Routines
  2. Numeric String Evaluation Routines
  3. Byte-Oriented File Input/Output Routines
  4. CP/M File Input/Output Routines
  5. User/Disk Manipulation Routines
  6. File Name String Parser (FNAME) and FCB Init (INITFCB)
  7. ZCPR2-Specific File Name String Parser (ZFNAME) and Support
  8. ZCPR2 Feature-Specific Routines
  9. Input Line Editors
  10. String Output Routines
  11. NumeriπáOutpu⌠ Routine≤
  12. String and Value Comparison Routines
  13. Character-Oriented Input/Output Routines
  14. Math Routines
  15. CRC Routines
  16. Random Number Generator Routines
  17. Sort Routines
  18. Misπellaneous Routines
  19. ::SYSLIB1.HLP
  20. ::SYSLIB2.HLP
  21. ::SYSLIB3.HLP
  22. ::SYSLIB4.HLP
  23. :User/Disk Manipulation Routines
  24.  
  25.      Thi≤á i≤á ßá se⌠ oµ fou≥ routine≤ whicΦ allo≈á thσá use≥á t∩ ì
  26. readil∙ movσ arounΣ betweeε disk≤ anΣ use≥ areas«  Thesσ routine≤ ì
  27. are:
  28.           PUTUD -- to save away the current disk/user
  29.           GETUD -- to restore the disk/user saved by PUTUD
  30.           RETUD -- to return the current disk/user
  31.           LOGUD -- to log the user into a specified disk/user
  32.  
  33.      PUTU─á anΣ GETU─ arσ designeΣ t∩ bσ useΣ a≤ ßá placσá marke≥ ì
  34. anΣá returεá combination«á  The∙ arσ intendeΣ t∩ bσ useΣ iεá codσ ì
  35. sequences like the following:
  36.  
  37.           CALL PUTUD     ; Mark current location
  38.           < move around on disks/users >
  39.           CALL GETUD     ; Return to marked location
  40.  
  41.      RETU─ anΣ LOGU─ arσ t∩ bσ useΣ t∩ finΣ ou⌠ wherσ thσ prograφ ì
  42. is (RETUD) and to enter a specific disk/user area (LOGUD).
  43.  
  44.      Routine Name:  PUTUD
  45.      Function║
  46.           PUTU─á save≤ thσ curren⌠ use≥ anΣ disδ number≤ awa∙ fo≥ ì
  47. late≥á retrieva∞ b∙ GETUD«á  PUTU─ anΣ GETU─ arσ intendeΣá t∩á bσ ì
  48. useΣá t∩á savσ anΣ restorσ thσ curren⌠ disδ anΣ use≥ arounΣá somσ ì
  49. set of operations in another user/disk area.
  50.      Inputs:  None
  51.      Outputs:  None
  52.      Registers Affected:  None
  53.      SYSLIB Routines Called:  RETUD
  54.      Specia∞á Erro≥ Conditions║  None
  55.  
  56.  
  57.      Routine Name:  GETUD
  58.      Function║
  59.           GETU─á restore≤á thσ curren⌠ use≥ anΣá disδá whicΦá wa≤ ì
  60. saved by PUTUD.
  61.      Inputs:  None
  62.      Outputs:  None
  63.      Registers Affected:  None
  64.      SYSLIB Routines Called:  BDOS
  65.      Specia∞á Erro≥ Conditions║  None
  66.  
  67.  
  68.      Routine Name:  LOGUD
  69.      Function║
  70.           LOGU─ log≤ iε thσ disδ specifieΣ b∙ thσ ┬ registe≥ (B=░ ì
  71. fo≥ Disδ A) and the user specified by the C register.
  72.      Inputs:  B=Disk (B=0 for Disk A), C=User
  73.      Outputs:  None
  74.      Registers Affected:  None
  75.      SYSLIB Routines Called:  BDOS
  76.      Specia∞á Erro≥ Conditions║  None
  77.  
  78.  
  79.      Routine Name:  RETUD
  80.      Function║
  81.           RETU─á return≤ thσ number≤ oµ thσ curren⌠ use≥ iε ├ anΣ ì
  82. current disk in B (B=0 for disk A).
  83.      Inputs:  None
  84.      Outputs:  B=Disk (B=0 for disk A), C=User
  85.      Registers Affected:  BC
  86.      SYSLIB Routines Called:  BDOS
  87.      Specia∞á Erro≥ Conditions║  None
  88.  
  89.  
  90. :File Name String Parser (FNAME) and FCB Init (INITFCB)
  91.      Routine Name: FNAME
  92.      Function:
  93.           FNAM┼á i≤ ß filσ namσ scanner«á  Pointinτ t∩ thσá firs⌠ ì
  94. characte≥ oµ ß filσ namσ specificatioε oµ thσ form:
  95.  
  96. ááááá          du:filename.typ
  97.  
  98. wherσá an∙á par⌠ oµ thσ specificatioε i≤ optional¼á thi≤á routinσ ì
  99. fill≤ iε aε FC┬ witΦ zeroe≤ (3╢ bytes)¼á properl∙ initialize≤ thσ ì
  100. F╬ (Filσ Name⌐ fielΣ iµ 'filenameº i≤ presen⌠ anΣ F╘ (Filσá Type⌐ ì
  101. fielΣ iµ 'typº i≤ present¼ anΣ return≤ thσ numbe≥ oµ thσ selecteΣ ì
  102. disδá (iεá thσ rangσ froφ ▒ fo≥ ┴ t∩ 1╢ fo≥ P⌐ iµ 'dº i≤á presen⌠ ì
  103. anΣá thσ numbe≥ oµ thσ selecteΣ use≥ (iε thσ rangσ froφ ░á t∩á 3▒ ì
  104. anΣá thσ questioε marδ '?º character⌐ iµ 'uº i≤ present«á  Iµ 'dº ì
  105. i≤ no⌠ present¼ 0FF╚ i≤ returneΣ fo≥ i⌠ t∩ indicatσ curren⌠ disk¼ ì
  106. anΣá iµ 'uº i≤ no⌠ present¼á 0FF╚ i≤ returneΣ fo≥ i⌠ t∩á indicatσ ì
  107. curren⌠ user.
  108.  
  109.  
  110.      Thσ strinτ pointeΣ t∩ b∙ H╠ i≤ no⌠ ß conventiona∞ strinτá iε ì
  111. thσá sensσá oµ thσ res⌠ oµ thσ SYSLI┬ routines«á  Thi≤ strinτá i≤ ì
  112. terminateΣ b∙ an∙ oµ thσ followinτ delims¼á a≤ opposeΣ b∙á simpl∙ ì
  113. alway≤ beinτ terminateΣ b∙ ß binar∙ zero«  Thσ delimite≥ lis⌠ is:
  114.  
  115. ááááá          <NULL or Binary 0>       <SP or Space>
  116. ááááá          =    _    ;    ,    <    >
  117.  
  118.      Thσ followinτ arσ valiΣ examples:
  119. ááááá          test.txt   <-- FN=TEXT  FT=TXT, B reg = 0FFH,
  120. ááááá                         C reg = 0FFH
  121. ááááá          a:t        <-- FN=T  FT=<SP>, B reg = 1,
  122. ááááá                         C reg = 0FFH
  123. ááááá          5:t        <-- FN=T  FT=<SP>, B reg = 0FFH,
  124. ááááá                         C reg = 5
  125. ááááá          c10:x.y    <-- FN=X  FT=Y, B reg = 3,
  126. ááááá                         C reg = 10
  127.  
  128.  
  129.      Inputs:  HL points to the first byte of the target string
  130. ááááá               (which ends in a delimiter)
  131. ááááá         DE pts to the first byte of a 36-byte long FCB
  132.      Outputs:  B=Disk Number (1 for A to 16 for P, or 0FFH if
  133. ááááá               no disk specified)
  134. ááááá          C=User Number (0 to 31 or '?' for all users, or
  135. ááááá               0FFH if no user specified)
  136. ááááá          HL points to the character which ended the scan
  137. ááááá          A = 0 and Zero Flag Set (Z) if invalid Disk or User
  138. ááááá               Specified; A = 0FFH and NZ if no error
  139.      Registers Affected: PSW, BC, HL
  140.      SYSLIB Routines Called:  CAPS
  141.      Special Error Conditions:  None
  142.  
  143.  
  144.      Routine Name:  INITFCB
  145.      Function║
  146. ááááá     INITFC┬á simpl∙á clear≤ al∞ oµ thσ field≤ oµ ßá 36-bytσ ì
  147. áááááFC┬á t∩á zer∩ excep⌠ fo≥ thσ F╬ anΣ F╘ (Filσ Namσá anΣá Filσ ì
  148. áááááType⌐ fields¼ whicΦ i⌠ leave≤ untouched.
  149.  
  150.      Inputs:  DE = pointer to FCB buffer
  151.      Outputs:  None
  152.      Registers Affected:  None
  153.      SYSLIB Routines Called:  FILLB
  154.      Special Error Conditions:  None
  155. ::SYSLIB8.HLP
  156. ::SYSLIB9.HLP
  157. ::SYSLIBA.HLP
  158. :String Output Routines -- PRINT, LPRINT, PSTR, LPSTR
  159.      Routine Names:  PRINT, LPRINT
  160.      Function║
  161.           Prin⌠á strinτ pointeΣ t∩ b∙ thσ returε addres≤ oεá CON║ ì
  162. (PRINT⌐á o≥ LST║á (LPRINT)«á  Strinτ i≤ terminateΣ b∙ ß binar∙ 0«  ì
  163. Contro∞ i≤ returneΣ t∩ bytσ followinτ string.
  164.      Inputs:  Return Address = pointer to string to be printed
  165.      Outputs:  HL points to byte after string
  166.                (string is printed on CON: or LST:)
  167.      Registers Affected:  HL
  168.      SYSLIB Routines Called:  PSTR (for PRINT); LSTR (for LPRINT)
  169.      Specia∞ Erro≥ Conditions:
  170.           Thσ strinτ MUS╘ bσ terminateΣ b∙ ß binar∙ 0!!!
  171.  
  172.      Routine Names:  PSTR, LPSTR
  173.      Function║
  174.           Prin⌠á strinτ pointeΣ t∩ b∙ H╠ oε CON║á (PSTR⌐ o≥á LST║ ì
  175. (LPSTR)«  Strinτ i≤ terminateΣ b∙ ß binar∙ 0.
  176.      Inputs:  HL = pointer to string to be printed
  177.      Outputs:  HL pts to the byte following the terminating 0
  178.                 (string is printed on CON: or LST:)
  179.      Registers Affected:  HL
  180.      SYSLI┬á Routine≤ Called║  CCOUT¼á COU╘ (fo≥ PSTR)╗
  181.                                LCOUT¼ LOU╘ (fo≥ LPSTR)
  182.      Specia∞ Erro≥ Conditions:
  183.           Thσ strinτ MUS╘ bσ terminateΣ b∙ ß binar∙ 0!!!
  184. ::SYSLIB5.HLP
  185. :String and Value Comparision Routines
  186.      Routine Name:  COMPHD
  187.      Function║
  188.           Comparσ H╠ t∩ DE«á  Oε return¼á Zer∩ Flaτ Se⌠ =╛ HL=DE¼ ì
  189. Carr∙ Flaτ Se⌠ =╛ HL<DE.
  190.      Inputs:  HL, DE -- Values to compare
  191.      Outputs:  Zero and Carry Flags
  192.      Registers Affected:  PSW
  193.      SYSLIB Routines Called:  -None-
  194.      Special Error Conditions:  -None-
  195.  
  196.      Routine Names:  COMPB, COMPBC
  197.      Function║
  198.           Vecto≥ Comparσ Routines«  Comparσ thσ vecto≥ pointeΣ t∩ ì
  199. b∙á H╠ witΦ tha⌠ pointeΣ t∩ b∙ D┼ (Vector≤ arσ oµ equa∞á length)«  ì
  200. Vector≤á arσ ┬ byte≤ lonτ fo≥ COMP┬ anΣ B├ byte≤ lonτ fo≥ COMPBC«  ì
  201. Oεá exit¼á Zer∩á Flaτ Se⌠ indicate≤ tha⌠ vector≤á arσá identical╗ ì
  202. Carr∙ Flaτ Se⌠ indicate≤ tha⌠ thσ vecto≥ pointeΣ t∩ b∙ H╠ i≤ les≤ ì
  203. thaε thσ vecto≥ pointeΣ t∩ b∙ DE.
  204.      Inputs:  HL, DE -- Pointers to vectors to compare
  205.               B (for COMPB), BC (for COMPBC) -- number of bytes in vectors
  206.      Outputs:  Zero and Carry Flags
  207.      Registers Affected:  PSW
  208.      SYSLIB Routines Called:  -None-
  209.      Special Error Conditions:  -None-
  210.  
  211.      Routine Name:  SCANNER
  212.      Function║
  213.           SCANNE╥ scan≤ thσ vecto≥ oµ byte≤ pointeΣ t∩ b∙ H╠á fo≥ ì
  214. thσá vecto≥ oµ byte≤ pointeΣ t∩ b∙ DE«á  Thσ HL-bytσ vecto≥ i≤á ┬ ì
  215. byte≤ lonτ anΣ thσ DE-bytσ vecto≥ i≤ ├ byte≤ long«  Oε return¼ iµ ì
  216. found¼ H╠ point≤ t∩ thσ beginninτ locatioε withiε thσ origina∞ H╠ ì
  217. vecto≥á oµá thσ locateΣ vecto≥ anΣ thσ Zer∩ Flaτ i≤ Set╗á iµá no⌠ ì
  218. found¼ Zer∩ Flaτ i≤ no⌠ se⌠ anΣ H╠ i≤ no⌠ affecteΣ (point≤ t∩ thσ ì
  219. beginninτ oµ thσ origina∞ HL-bytσ vector).
  220.      Inputs:  HL = Pointer to vector to be scanned
  221.               DE = Pointer to vector to scan for
  222.               B = Number of bytes in HL-vector
  223.               C = Number of bytes in DE-vector
  224.      Outputs:  If found, Zero Set and HL pts to located vector
  225.                If not found, Zero Reset and HL unaffected
  226.      Registers Affected:  PSW, HL
  227.      SYSLIB Routines Called:  -None-
  228.      Specia∞á Erro≥á Conditions║á  Automatiπá succes≤á iµá vecto≥ ì
  229. searcheΣ fo≥ i≤ null.
  230.  
  231.      Routine Name:  INSTR
  232.      Function║
  233.           INSTRIN╟á Function«á  Scaε thσ strinτ pointeΣ t∩ b∙á H╠ ì
  234. fo≥ thσ strinτ pointeΣ t∩ b∙ DE«á  ┴ strinτ i≤ ß vecto≥ oµá byte≤ ì
  235. terminateΣ b∙ ß binar∙ 0.
  236.           Oε return¼á iµ found¼ Zer∩ Flaτ i≤ Se⌠ anΣ H╠ point≤ t∩ ì
  237. 1s⌠ bytσ oµ substrinτ withiε scanneΣ string╗á iµ no⌠ found¼á Zer∩ ì
  238. Flaτ i≤ no⌠ se⌠ anΣ H╠ i≤ no⌠ affected.
  239.      Inputs:  HL = Pointer to string to be scanned
  240.               DE = Pointer to string to scan for
  241.      Outputs:  If found, Zero Set and HL pts to located substring
  242.                If not found, Zero Reset and HL unaffected
  243.      Registers Affected:  PSW, HL
  244.      SYSLIB Routines Called:  -None-
  245.      Specia∞ Erro≥ Conditions:
  246.           Automatiπ succes≤ iµ strinτ searcheΣ fo≥ i≤ null.
  247. ::SYSLIB6.HLP
  248. ::SYSLIB7.HLP
  249. :CRC Routines -- CRCCLR, CRCUPD, CRCDONE, CRCK, CRC1's
  250.      Thσá CR├á Routine≤ ma∙ bσ useΣ t∩ checδ thσ validit∙á oµá aε ì
  251. incominτ seria∞ bytσ streaφ oµ arbitrar∙ length«á  Thesσ routine≤ ì
  252. computσ anΣ checδ ß truσ 16-bi⌠ Cycliπ Redundanc∙ Codσ (CRC).
  253.      The use of these routines will guarantee detection of:
  254.           1) all single- and double-bit errors
  255.           2) all errors with an odd number of error bits
  256.           3) all burst errors of length 16 or less
  257.      Additionally, the following statistics:
  258.           1) 99.9969% of all 17-bit error bursts
  259.           2) 99.9984% of all possible longer error bursts
  260.  
  261.      Thσá followinτá screeε displa∙ illustrate≤ ß typica∞ wa∙á t∩ ì
  262. usσ thesσ routines:
  263.  
  264.      CRC$MAKE:                ; ROUTINE TO ESTABLISH OUTGOING CRC VALUE
  265.           CALL CRCCLR    ; CLEAR CRC
  266.           <loop CALLing CRCUPD>    ; ACQUIRE VALUES
  267.           CALL CRCDONE   ; GET VALUE
  268.           SHLD CRCVAL    ; SAVE VALUE
  269.      CRC$CHECK:          ; ROUTINE TO CHECK INCOMING CRC VALUE
  270.           CALL CRCCLR    ; CLEAR CRC
  271.           <loop CALLing CRCUPD>    ; ACQUIRE VALUES
  272.           LHLD CRCVAL    ; FROM CRC$MAKE ABOVE
  273.           MOV  A,H       ; SEND HIGH FIRST
  274.           CALL CRCUPD    ; UPDATE
  275.           MOV  A,L       ; SEND LOW NEXT
  276.           CALL CRCUPD    ; UPDATE
  277.           CALL CRCDONE   ; NOW DONE
  278.           CALL CRCK      ; RETURN Z IF OK, NZ IF NOT OK
  279.  
  280.      Thσá followinτá screeε display≤ describσ thσá CR├á routines«  ì
  281. Thσ CRC- routine≤ usσ thσ X^16+X^12+X^5+▒ polynomial¼á whilσá thσ ì
  282. CRC1- routine≤ usσ thσ X^16+X^15+X^2+▒ polynomial.
  283.      Routine Name:  CRCCLR, CRC1CLR
  284.      Function║
  285.           Clea≥á thσá interna∞ CR├ Accumulato≥ iε preparatioεá t∩ ì
  286. CR├ computation.
  287.      Inputs:  None
  288.      Outputs:  None
  289.      Registers Affected:  None
  290.      SYSLIB Routines Called:  None
  291.      Special Error Conditions:  None
  292.  
  293.      Routine Name:  CRCUPD, CRC1UPD
  294.      Function:
  295.           Updatσ thσ CR├ Accumulato≥ valuσ witΦ thσ nex⌠ byte.
  296.      Input:  A=byte to be included in CRC
  297.      Outputs:  None
  298.      Registers Affected:  None
  299.      SYSLIB Routines Called:  None
  300.      Special Error Conditions:  None
  301.      Routine Name:  CRCDONE, CRC1DONE
  302.      Function║
  303.           Terminatσáá CR├á valuσá accumulatioεá anΣá returεáá thσ ì
  304. calculateΣ 16-bi⌠ CR├ value.
  305.      Inputs:  None
  306.      Output:  HL = calculated CRC value
  307.      Registers Affected:  HL
  308.      SYSLIB Routines Called:  None
  309.      Special Error Conditions:  None
  310.  
  311.  
  312.      Routine Name:  CRCK, CRC1K
  313.      Function║
  314.           Checδá thσá CR├á accumulato≥á valuσá fo≥á zero¼áá whicΦ ì
  315. indicate≤ tha⌠ thσ receiveΣ bytσ streaφ i≤ correct«  Thi≤ routinσ ì
  316. shoulΣá bσ calleΣ afte≥ thσ incominτ bytσ streaφ anΣ thσ tw∩á CR├ ì
  317. byte≤á (high-orde≥ first⌐ havσ beeε receiveΣ anΣá passeΣá througΦ ì
  318. CRCUPD.
  319.      Inputs:  None
  320.      Outputs:  A=0 and Z Set if OK, A=0FFH and NZ Set if Not OK
  321.      Registers Affected:  PSW
  322.      SYSLIB Routines Called:  None
  323.      Special Error Conditions:  None
  324. :Random Number Generator Routines
  325.  
  326.      The Random Number Generator Routines are:
  327.  
  328.           RNDINIT - Initializes the Generator Seed on user
  329.                          keypress
  330.           RNDSEED - Allows user to provide a seed
  331.           RND - Returns a Pseudo-Random Number
  332.  
  333.  
  334.      Routine Name:  RNDINIT
  335.      Function║
  336.           RNDINI╘ enter≤ ß countinτ loop¼ waitinτ fo≥ thσ use≥ t∩ ì
  337. strikσ ß ke∙ a⌠ hi≤ console«  I⌠ theε set≤ thσ seeΣ valuσ fo≥ thσ ì
  338. randoφ numbe≥ generato≥ baseΣ upoε it≤ coun⌠ valuσ a⌠ thσ instan⌠ ì
  339. of keypress.  The seed value is an 8-bit quantity.
  340.      Inputs:  None (User Keypress)
  341.      Outputs:  None  (Seed is set)
  342.      Registers Affected:  None
  343.      SYSLIB Routines Called:  CONDIN, RND
  344.      Specia∞á Erro≥ Conditions║  None
  345.  
  346.      Routine Name:  RNDSEED
  347.      Function║
  348.           Thi≤á routinσá allow≤ thσ use≥ t∩ providσ ß seeΣá valuσ ì
  349. fo≥á thσ randoφ numbe≥ generator«á  Thσ seeΣ i≤ passeΣ iεá thσá ┴ ì
  350. register.
  351.      Inputs:  A = Seed
  352.      Outputs:  None  (Seed is set)
  353.      Registers Affected:  None
  354.      SYSLIB Routines Called:  RND
  355.      Specia∞á Erro≥ Conditions║  None
  356.  
  357.  
  358.      Routine Name:  RND
  359.      Function║
  360.           Thi≤ i≤ thσ user-callablσ randoφ numbe≥ generator«á  I⌠ ì
  361. return≤á ßá pseudo-randoφ numbe≥ (8-bit⌐ iε thσ ┴á registe≥á wheε ì
  362. called.
  363.      Inputs:  None
  364.      Outputs:  A = Random Number
  365.      Registers Affected:  PSW
  366.      SYSLIB Routines Called:  None
  367.      Specia∞á Erro≥ Conditions║  None
  368.  
  369. ::SYSLIBB.HLP
  370. ::SYSLIBC.HLP
  371.