home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol124 / syslib.hlp < prev    next >
Encoding:
Text File  |  1985-02-10  |  14.3 KB  |  367 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, EPRINT, LPRINT, PSTR, EPSTR, LPSTR
  159.      Routine Names:  PRINT, LPRINT, EPRINT
  160.      Function║
  161.           Prin⌠á strinτ pointeΣ t∩ b∙ thσ returε addres≤ oεá CON║ ì
  162. (PRIN╘ anΣ EPRINT⌐ o≥ LST║á (LPRINT)«á  Strinτ i≤ terminateΣ b∙ ß ì
  163. binar∙ 0«á  Contro∞ i≤ returneΣ t∩ bytσ followinτ string«á  PRIN╘ ì
  164. anΣá LPRIN╘á interpre⌠ contro∞ characters¼á sendinτ theφá t∩á thσ ì
  165. CON:/LST║á device≤ a≤ "^có sequences«á  EPRIN╘ (fo≥ Exac⌠á Print⌐ ì
  166. onl∙ expand≤ tabs¼ sendinτ al∞ othe≥ character≤ as-is.
  167.      Inputs:  Return Address = pointer to string to be printed
  168.      Outputs:  HL points to byte after string
  169.                (string is printed on CON: or LST:)
  170.      Registers Affected:  HL
  171.      SYSLIB Routines Called:  PSTR (for PRINT);
  172.                               EPSTR (for EPRINT);
  173.                               LPSTR (for LPRINT)
  174.      Specia∞ Erro≥ Conditions:
  175.           Thσ strinτ MUS╘ bσ terminateΣ b∙ ß binar∙ 0!!!
  176.  
  177.      Routine Names:  PSTR, EPSTR, LPSTR
  178.      Function║
  179.           Prin⌠ strinτ pointeΣ t∩ b∙ H╠ oε CON║á (PST╥ anΣ EPSTR⌐ ì
  180. o≥ LST║á (LPSTR)«  Strinτ i≤ terminateΣ b∙ ß binar∙ 0«  H╠ point≤ ì
  181. t∩á bytσá followinτá strinτ oε exit«á  PST╥ anΣá LPST╥á interpre⌠ ì
  182. contro∞ characters¼ sendinτ theφ t∩ thσ CON:/LST║ device≤ a≤ "^có ì
  183. sequences«á  EPST╥ (fo≥ Exac⌠ Print⌐ onl∙ expand≤á tabs¼á sendinτ ì
  184. al∞ othe≥ character≤ as-is.
  185.      Inputs:  HL = pointer to string to be printed
  186.      Outputs:  HL pts to the byte following the terminating 0
  187.                 (string is printed on CON: or LST:)
  188.      Registers Affected:  HL
  189.      SYSLI┬á Routine≤ Called║  CCOUT¼ COU╘ (fo≥ PSTR)╗
  190.                                COUT (for EPSTR);
  191.                                LCOUT¼ LOU╘ (fo≥ LPSTR)
  192.      Specia∞ Erro≥ Conditions:
  193.           Thσ strinτ MUS╘ bσ terminateΣ b∙ ß binar∙ 0!!!
  194. ::SYSLIB5.HLP
  195. :String and Value Comparision Routines
  196.      Routine Name:  COMPHD
  197.      Function║
  198.           Comparσ H╠ t∩ DE«á  Oε return¼á Zer∩ Flaτ Se⌠ =╛ HL=DE¼ ì
  199. Carr∙ Flaτ Se⌠ =╛ HL<DE.
  200.      Inputs:  HL, DE -- Values to compare
  201.      Outputs:  Zero and Carry Flags
  202.      Registers Affected:  PSW
  203.      SYSLIB Routines Called:  -None-
  204.      Special Error Conditions:  -None-
  205.  
  206.      Routine Names:  COMPB, COMPBC
  207.      Function║
  208.           Vecto≥ Comparσ Routines«  Comparσ thσ vecto≥ pointeΣ t∩ ì
  209. b∙á H╠ witΦ tha⌠ pointeΣ t∩ b∙ D┼ (Vector≤ arσ oµ equa∞á length)«  ì
  210. Vector≤á arσ ┬ byte≤ lonτ fo≥ COMP┬ anΣ B├ byte≤ lonτ fo≥ COMPBC«  ì
  211. Oεá exit¼á Zer∩á Flaτ Se⌠ indicate≤ tha⌠ vector≤á arσá identical╗ ì
  212. Carr∙ Flaτ Se⌠ indicate≤ tha⌠ thσ vecto≥ pointeΣ t∩ b∙ H╠ i≤ les≤ ì
  213. thaε thσ vecto≥ pointeΣ t∩ b∙ DE.
  214.      Inputs:  HL, DE -- Pointers to vectors to compare
  215.               B (for COMPB), BC (for COMPBC) -- number of bytes in vectors
  216.      Outputs:  Zero and Carry Flags
  217.      Registers Affected:  PSW
  218.      SYSLIB Routines Called:  -None-
  219.      Special Error Conditions:  -None-
  220.  
  221.      Routine Name:  SCANNER
  222.      Function║
  223.           SCANNE╥ scan≤ thσ vecto≥ oµ byte≤ pointeΣ t∩ b∙ H╠á fo≥ ì
  224. thσá vecto≥ oµ byte≤ pointeΣ t∩ b∙ DE«á  Thσ HL-bytσ vecto≥ i≤á ┬ ì
  225. byte≤ lonτ anΣ thσ DE-bytσ vecto≥ i≤ ├ byte≤ long«  Oε return¼ iµ ì
  226. found¼ H╠ point≤ t∩ thσ beginninτ locatioε withiε thσ origina∞ H╠ ì
  227. vecto≥á oµá thσ locateΣ vecto≥ anΣ thσ Zer∩ Flaτ i≤ Set╗á iµá no⌠ ì
  228. found¼ Zer∩ Flaτ i≤ no⌠ se⌠ anΣ H╠ i≤ no⌠ affecteΣ (point≤ t∩ thσ ì
  229. beginninτ oµ thσ origina∞ HL-bytσ vector).
  230.      Inputs:  HL = Pointer to vector to be scanned
  231.               DE = Pointer to vector to scan for
  232.               B = Number of bytes in HL-vector
  233.               C = Number of bytes in DE-vector
  234.      Outputs:  If found, Zero Set and HL pts to located vector
  235.                If not found, Zero Reset and HL unaffected
  236.      Registers Affected:  PSW, HL
  237.      SYSLIB Routines Called:  -None-
  238.      Specia∞á Erro≥á Conditions║á  Automatiπá succes≤á iµá vecto≥ ì
  239. searcheΣ fo≥ i≤ null.
  240.  
  241.      Routine Name:  INSTR
  242.      Function║
  243.           INSTRIN╟á Function«á  Scaε thσ strinτ pointeΣ t∩ b∙á H╠ ì
  244. fo≥ thσ strinτ pointeΣ t∩ b∙ DE«á  ┴ strinτ i≤ ß vecto≥ oµá byte≤ ì
  245. terminateΣ b∙ ß binar∙ 0.
  246.           Oε return¼á iµ found¼ Zer∩ Flaτ i≤ Se⌠ anΣ H╠ point≤ t∩ ì
  247. 1s⌠ bytσ oµ substrinτ withiε scanneΣ string╗á iµ no⌠ found¼á Zer∩ ì
  248. Flaτ i≤ no⌠ se⌠ anΣ H╠ i≤ no⌠ affected.
  249.      Inputs:  HL = Pointer to string to be scanned
  250.               DE = Pointer to string to scan for
  251.      Outputs:  If found, Zero Set and HL pts to located substring
  252.                If not found, Zero Reset and HL unaffected
  253.      Registers Affected:  PSW, HL
  254.      SYSLIB Routines Called:  -None-
  255.      Specia∞ Erro≥ Conditions:
  256.           Automatiπ succes≤ iµ strinτ searcheΣ fo≥ i≤ null.
  257. ::SYSLIB6.HLP
  258. ::SYSLIB7.HLP
  259. :CRC Routines -- CRCCLR, CRCUPD, CRCDONE, CRC1's, CRC2's
  260.      Thσá CR├á Routine≤ ma∙ bσ useΣ t∩ checδ thσ validit∙á oµá aε ì
  261. incominτ seria∞ bytσ streaφ oµ arbitrar∙ length«á  Thesσ routine≤ ì
  262. computσ anΣ checδ ß truσ 16-bi⌠ Cycliπ Redundanc∙ Codσ (CRC).
  263.      The use of these routines will guarantee detection of:
  264.           1) all single- and double-bit errors
  265.           2) all errors with an odd number of error bits
  266.           3) all burst errors of length 16 or less
  267.      Additionally, the following statistics:
  268.           1) 99.9969% of all 17-bit error bursts
  269.           2) 99.9984% of all possible longer error bursts
  270.  
  271.      Thσá followinτá screeε displa∙ illustrate≤ ß typica∞ wa∙á t∩ ì
  272. usσ thesσ routines:
  273.  
  274.      CRC$MAKE:                ; ROUTINE TO ESTABLISH OUTGOING CRC VALUE
  275.           CALL CRCCLR    ; CLEAR CRC
  276.           <loop CALLing CRCUPD>    ; ACQUIRE VALUES
  277.           CALL CRCDONE   ; GET VALUE
  278.           SHLD CRCVAL    ; SAVE VALUE
  279.      CRC$CHECK:          ; ROUTINE TO CHECK INCOMING CRC VALUE
  280.           CALL CRCCLR    ; CLEAR CRC
  281.           <loop CALLing CRCUPD>    ; ACQUIRE VALUES
  282.           CALL CRCDONE   ; GET VALUE
  283.           XCHG           ; VALUE IN DE
  284.           LHLD CRCVAL    ; GET FIRST VALUE IN HL
  285.           CALL COMPHD    ; COMPARE HL TO DE
  286.           JNZ  ERROR     ; CRC'S DON'T MATCH IF NOT EQUAL
  287.  
  288.      Thσá followinτá screeε display≤ describσ thσá CR├á routines«  ì
  289. Thσá CRC- routine≤ usσ thσ X^16+X^12+X^5+▒ polynomial¼á thσ CRC1- ì
  290. routine≤á usσá thσá X^16+X^15+X^2+▒á polynomial¼á anΣá thσá CRC2-ì
  291. routines use the X^16+X^15+X^13+X^7+X^4+X^2+X+1 polynomial.
  292.      Routine Name:  CRCCLR, CRC1CLR, CRC2CLR
  293.      Function║
  294.           Clea≥á thσá interna∞ CR├ Accumulato≥ iε preparatioεá t∩ ì
  295. CR├ computation.
  296.      Inputs:  None
  297.      Outputs:  None
  298.      Registers Affected:  None
  299.      SYSLIB Routines Called:  None
  300.      Special Error Conditions:  None
  301.  
  302.      Routine Name:  CRCUPD, CRC1UPD, CRC2UPD
  303.      Function:
  304.           Updatσ thσ CR├ Accumulato≥ valuσ witΦ thσ nex⌠ byte.
  305.      Input:  A=byte to be included in CRC
  306.      Outputs:  None
  307.      Registers Affected:  None
  308.      SYSLIB Routines Called:  None
  309.      Special Error Conditions:  None
  310.      Routine Name:  CRCDONE, CRC1DONE, CRC2DONE
  311.      Function║
  312.           Terminatσáá CR├á valuσá accumulatioεá anΣá returεáá thσ ì
  313. calculateΣ 16-bi⌠ CR├ value.
  314.      Inputs:  None
  315.      Output:  HL = calculated CRC value
  316.      Registers Affected:  HL
  317.      SYSLIB Routines Called:  None
  318.      Special Error Conditions:  None
  319.  
  320. :Random Number Generator Routines
  321.  
  322.      The Random Number Generator Routines are:
  323.  
  324.           RNDINIT - Initializes the Generator Seed on user
  325.                          keypress
  326.           RNDSEED - Allows user to provide a seed
  327.           RND - Returns a Pseudo-Random Number
  328.  
  329.  
  330.      Routine Name:  RNDINIT
  331.      Function║
  332.           RNDINI╘ enter≤ ß countinτ loop¼ waitinτ fo≥ thσ use≥ t∩ ì
  333. strikσ ß ke∙ a⌠ hi≤ console«  I⌠ theε set≤ thσ seeΣ valuσ fo≥ thσ ì
  334. randoφ numbe≥ generato≥ baseΣ upoε it≤ coun⌠ valuσ a⌠ thσ instan⌠ ì
  335. of keypress.  The seed value is an 8-bit quantity.
  336.      Inputs:  None (User Keypress)
  337.      Outputs:  None  (Seed is set)
  338.      Registers Affected:  None
  339.      SYSLIB Routines Called:  CONDIN, RND
  340.      Specia∞á Erro≥ Conditions║  None
  341.  
  342.      Routine Name:  RNDSEED
  343.      Function║
  344.           Thi≤á routinσá allow≤ thσ use≥ t∩ providσ ß seeΣá valuσ ì
  345. fo≥á thσ randoφ numbe≥ generator«á  Thσ seeΣ i≤ passeΣ iεá thσá ┴ ì
  346. register.
  347.      Inputs:  A = Seed
  348.      Outputs:  None  (Seed is set)
  349.      Registers Affected:  None
  350.      SYSLIB Routines Called:  RND
  351.      Specia∞á Erro≥ Conditions║  None
  352.  
  353.  
  354.      Routine Name:  RND
  355.      Function║
  356.           Thi≤ i≤ thσ user-callablσ randoφ numbe≥ generator«á  I⌠ ì
  357. return≤á ßá pseudo-randoφ numbe≥ (8-bit⌐ iε thσ ┴á registe≥á wheε ì
  358. called.
  359.      Inputs:  None
  360.      Outputs:  A = Random Number
  361.      Registers Affected:  PSW
  362.      SYSLIB Routines Called:  None
  363.      Specia∞á Erro≥ Conditions║  None
  364.  
  365. ::SYSLIBB.HLP
  366. ::SYSLIBC.HLP
  367.