home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / PASCAL / ANSIPAS.ZIP / ANSIIO.DOC next >
Text File  |  1990-08-14  |  12KB  |  171 lines

  1. +---------------------------------------------------------------------------+
  2. |                                                                           |
  3. |                               ANSIIO.PAS                   Now supports   |
  4. |                              Version 2.00                   ANSI Music!   |
  5. |                                                                           |
  6. |                  ANSI code Generation and Processing                      |
  7. |                 Compatable with most PASCAL Compilers                     |
  8. |                                                                           |
  9. |   Written by:                              ANSIWrite adapted from         |
  10. |                                               ANSISIM.PAS by              |
  11. |                                                                           |
  12. | Michael Booth                            William A. Blaylock              |
  13. | 797 East 5050 South                      437 East 3250 North              |
  14. | South Ogden, UT 84403                    North Ogden, UT 84414-1617       |
  15. | (801)479-3553                            (801)479-7618                    |
  16. |                                                                           |
  17. |                                                                           |
  18. |      IF YOU MAKE CHANGES, IMPROVEMENTS, ENHANCEMENTS, ETC., PLEASE        |
  19. |      MAKE THEM AVAILABLE TO ALL OF US.                                    |
  20. |                                                                           |
  21. |      THIS PROGRAM IS IN THE PUBLIC DOMAIN.  THE AUTHORS WILL NOT BE       |
  22. |      HELD RESPONSIBLE FOR ANY DAMAGES WHICH MAY BE CAUSED BUY THIS        |
  23. |      PROGRAM OR IT'S NOT FUNCTIONING AS YOU EXPECT IT TO.                 |
  24. |                                                                           |
  25. |   WARNING! - Because PASCAL's strings have a limit of 255 characters,     |
  26. |              ANSI lines that exceed this limit will be truncated!         |
  27. |              To fix this, the user must make use of CHARACTER BUFFERS     |
  28. |              instead.  This can be done with little difficulty.           |
  29. |              However, for the sake of simplicity and versatility, I       |
  30. |              have not made this modification.                             |
  31. |                                                                           |
  32. +---------------------------------------------------------------------------+
  33.  
  34. {****************************************************************************}
  35. {***                                                                      ***}
  36. {***       Function that returns the ANSI code for a Clear Screen.        ***}
  37. {***                                                                      ***}
  38. {****************************************************************************}
  39.    FUNCTION ANSIClrScr : string;
  40.  
  41. {****************************************************************************}
  42. {***                                                                      ***}
  43. {***    Function that returns the ANSI code for a Clear to End of Line.   ***}
  44. {***                                                                      ***}
  45. {****************************************************************************}
  46.    FUNCTION ANSIClrEol : string;
  47.  
  48. {****************************************************************************}
  49. {***                                                                      ***}
  50. {***   Function that returns the ANSI code to move the cursor to (X,Y).   ***}
  51. {***                                                                      ***}
  52. {****************************************************************************}
  53.    FUNCTION ANSIGotoXY(X, Y : word) : string;
  54.  
  55. {****************************************************************************}
  56. {***                                                                      ***}
  57. {***  Function that returns the ANSI code to move the cursor up "Lines"   ***}
  58. {***                         number of lines.                             ***}
  59. {***                                                                      ***}
  60. {****************************************************************************}
  61.    FUNCTION ANSIUp(Lines : word) : string;
  62.  
  63. {****************************************************************************}
  64. {***                                                                      ***}
  65. {***  Function that returns the ANSI code to move the cursor down "Lines" ***}
  66. {***                        number of lines.                              ***}
  67. {***                                                                      ***}
  68. {****************************************************************************}
  69.    FUNCTION ANSIDown(Lines : word) : string;
  70.  
  71. {****************************************************************************}
  72. {***                                                                      ***}
  73. {***     Function that returns the ANSI code to move the cursor "Cols"    ***}
  74. {***                         positions forward.                           ***}
  75. {***                                                                      ***}
  76. {****************************************************************************}
  77.    FUNCTION ANSIRight(Cols : word) : string;
  78.  
  79. {****************************************************************************}
  80. {***                                                                      ***}
  81. {***     Function that returns the ANSI code to move the cursor "Cols"    ***}
  82. {***                        positions backward.                           ***}
  83. {***                                                                      ***}
  84. {****************************************************************************}
  85.    FUNCTION ANSILeft(Cols : word) : string;
  86.  
  87. {****************************************************************************}
  88. {***                                                                      ***}
  89. {***    Function that returns the ANSI code to change the screen color    ***}
  90. {***             to an "Fg" foreground and a "Bg" background.             ***}
  91. {***                                                                      ***}
  92. {****************************************************************************}
  93.    FUNCTION ANSIColor(Fg, Bg : integer) : string;
  94.  
  95. {****************************************************************************}
  96. {***                                                                      ***}
  97. {*** Function that returns an ANSI code representing a music string ("s") ***}
  98. {***                                                                      ***}
  99. {***   Usage is the same as BASIC's "PLAY" command.  (Except you don't    ***}
  100. {***        need to begin the music string with an "MF" or an "MB"        ***}
  101. {***                                                                      ***}
  102. {***                                                                      ***}
  103. {***   A-G [#,+,-]   A-G are notes.  # or + following a note produces a   ***}
  104. {***                 sharp; - produces a flat.                            ***}
  105. {***                                                                      ***}
  106. {***                 Any note followed by a #, +, or - must refer to a    ***}
  107. {***                 black key on a piano.                                ***}
  108. {***                                                                      ***}
  109. {***   L(n)          Sets the length of each note.  L4 is a quarter       ***}
  110. {***                 note, L1 is a whole note, and so on.  n may be       ***}
  111. {***                 from 1 to 64.                                        ***}
  112. {***                                                                      ***}
  113. {***                 Length may also follow the note to change the        ***}
  114. {***                 length for that note only.  A16 is equivalent to     ***}
  115. {***                 L16A.                                                ***}
  116. {***                                                                      ***}
  117. {***   MN            Music normal.  Each note plays seven-eighths of      ***}
  118. {***                 the time determined by L (length).                   ***}
  119. {***                                                                      ***}
  120. {***   ML            Music legato.  Each note plays the full period       ***}
  121. {***                 set by L.                                            ***}
  122. {***                                                                      ***}
  123. {***   MS            Music staccato.  Each note plays three-quarters      ***}
  124. {***                 of the time determined by L.                         ***}
  125. {***                                                                      ***}
  126. {***   N(n)          Play note n.  n may range from 0 to 84.  In the 7    ***}
  127. {***                 possible octaves, there are 84 notes.  n set to 0    ***}
  128. {***                 indicates a rest.                                    ***}
  129. {***                                                                      ***}
  130. {***   O(n)          Octave 0 sets the current octave.  There are 7       ***}
  131. {***                 octaves (0 through 6).  Default is 4.  Middle C      ***}
  132. {***                 is at the beginning of octave 3.                     ***}
  133. {***                                                                      ***}
  134. {***   P(n)          Pause.  P may range from 1-64                        ***}
  135. {***   T(n)          Tempo.  T sets the number of L4s in a minute.  n     ***}
  136. {***                 may range from 32-255.  Default is 120.              ***}
  137. {***                                                                      ***}
  138. {***   .(period)     A period after a note increases the playing time     ***}
  139. {***                 of the note by 3/2 times the period determined by    ***}
  140. {***                 L (length of the note) times T (tempo).  Multiple    ***}
  141. {***                 periods can appear after a note, and the playing     ***}
  142. {***                 time is scaled accordingly.  For example, A. will    ***}
  143. {***                 cause the note A to play 1 1/2 times the playing     ***}
  144. {***                 time determined by L times T; two periods after A    ***}
  145. {***                 will cause the note to be played at 9/4 times its    ***}
  146. {***                 ascribed value; an A with three periods at 27/8.     ***}
  147. {***                                                                      ***}
  148. {***   >n            A greater-than symbol preceding the note n plays     ***}
  149. {***                 the note in the next higher octave.                  ***}
  150. {***                                                                      ***}
  151. {***   <n            A less-than symbol preceding the note n plays the    ***}
  152. {***                 note in the next lower octave.                       ***}
  153. {***                                                                      ***}
  154. {****************************************************************************}
  155.    FUNCTION ANSIMusic(s : string) : string;
  156.  
  157. {****************************************************************************}
  158. {***                                                                      ***}
  159. {***    Procedure to process string "s" and write its contents to the     ***}
  160. {***          screen, interpreting ANSI codes as it goes along.           ***}
  161. {***                                                                      ***}
  162. {****************************************************************************}
  163.    PROCEDURE ANSIWrite(s : string);
  164.  
  165. {****************************************************************************}
  166. {***                                                                      ***}
  167. {***         Procedure that calls ANSIWrite, then line feeds.             ***}
  168. {***                                                                      ***}
  169. {****************************************************************************}
  170.    PROCEDURE ANSIWriteLn(s : string);
  171.