home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / program / d / demofx / !DemoFX / FXManual < prev    next >
Encoding:
Text File  |  1991-10-14  |  15.1 KB  |  366 lines

  1.                                 DemoFX
  2.                                 ~~~~~~
  3.  
  4. DemoFX is a module containing graphical effects similar to those used 
  5. in professional games and demos. The purpose of this module is to allow 
  6. enhancement of P.D. games or demos. The module can take over the 
  7. repetitive tasks of updating scrolltexts and starfields, allowing the 
  8. programmer to concentrate on the main program.
  9.  
  10. DemoFX allows control of the machine code effects from BASIC via 
  11. *commands and SYS calls. To get best use from DemoFX please read this 
  12. file.
  13.  
  14. ***********************************************************************
  15.                         Quick Copyright Notice
  16.                         ~~~~~~~~~~~~~~~~~~~~~~
  17. The contents of the !DemoFX directory are Public Domain and may be 
  18. distributed freely. There is no stipulation about breaking the files 
  19. from the directory up, provided that this Manual file is included with 
  20. any copies of the DemoFX module.
  21.  
  22. The DemoFX module is distributed on the understanding that it will not 
  23. be sold for profit (P.D. libraries may charge for disks, carriage etc). 
  24. The !Convert utility is also P.D. and is subject to similar conditions.
  25. ***********************************************************************
  26.  
  27. About the Demo
  28. ~~~~~~~~~~~~~~
  29. There is a short demo included with this version of DemoFX to show what 
  30. can be done. If it repeatedly crashes your computer, load the !RunImage 
  31. file into BASIC and delete the line that reads: SYS 
  32. "OS_UpdateMEMC",64,64 then re-save the program as !RunImage. This line 
  33. speeds up the ROM clock rate from 4 to 8 MHz so that DemoFX and 
  34. soundtracker can run at the same time. If you have an older computer, 
  35. then you will have 4MHz only ROMs. If you have to alter the program, 
  36. you may get some audio interference from soundtracker.
  37.  
  38. DemoFX is in 4 parts, the Scrolltext, the Parallax Starfield, the 
  39. Screen Fader and the Sprite folder. Each part functions independently 
  40. of the others.
  41.  
  42. The Scrolltext:
  43. ~~~~~~~~~~~~~~~
  44. This module section used the 50Hz VSYNC event to draw a scrolltext 
  45. along the bottom of the screen. The intended mode of use is 13. It 
  46. doesn’t work very well outside this mode.
  47. If you have used my ScrollText module, you will recognise many 
  48. similarities (yes, that's right, they're exactly the same!). The 
  49. scrolltext provides these *commands:
  50.  
  51. *ScrollFile <filename>
  52. *ScrollOn
  53. *ScrollOff
  54. *ScrollGo
  55. *ScrollCheck
  56. *ScrollFont <1 2 3 4 5 6 7 8 9> <filename>
  57. *ScrollWrap
  58. *ScrollLine "<text>"
  59.  
  60. *ScrollFile <filename> loads a textfile for scrolling (see below for 
  61. details)
  62. *ScrollOn starts scrolling in current mode.
  63. *ScrollOff indefinitely pauses the scrolltext (restart with *ScrollOn)
  64. *ScrollGo sets mode 13 then executes *ScrollOn
  65. *ScrollCheck checks the error request flag. If set, it returns an error 
  66. type &DE3 ("Scrolltext to user message") then clears the flag. 
  67. *ScrollFont <slot> <filename> loads a demofont file (type &601) into 
  68. the specified slot (where slot is between 1&9). See below about font 
  69. creation. *ScrollWrap causes instant wrap to start of scroll's text 
  70. file. *ScrollLine "<text>" temporarily overrides file based scrolling 
  71. with the specified text. The text can contain any scrolltext control 
  72. codes but must be 255 or less characters long.
  73.  
  74. Scrolltext files:
  75. These are simple ASCII text files which are loaded into the scrolltext 
  76. module for scrolling. You cannot start scrolling unless a file has been 
  77. loaded. If you try to do so without a file loaded, a "No scrolltext 
  78. data" error (type &DE0) will be produced. Files are retained over soft 
  79. resets. There is no theoretical limit on file size - only that of free 
  80. memory. Any memory taken up by the file is taken from the RMA.
  81.  
  82. The files MUST be entirely in upper case. Numbers and punctuation can 
  83. be used normally. You may find that a couple of punctuation symbols 
  84. have been replaced with other characters. 
  85. There are a few exceptions to this rule of being in upper case. Some 
  86. lower case characters are used to produce effects in the scrolltext. 
  87. Some of these characters take a one digit qualifying number after them.
  88. Failure to produce find this qualifier (with the exception of the x 
  89. command) will probably cause a crash.
  90. The commands are: 
  91.  
  92. f<n> Select font slot <n>. You must have previously loaded a font into 
  93. slot <n>, otherwise the font vector still points into the zero page and 
  94. random garbage will be displayed. The scrolltext's built-in font is in 
  95. slot 0 Example:  THIS IS FONT 0 f1AND THIS IS FONT 1
  96.  
  97. p pause scrolltext for 1 second.
  98. Example: SCROLLING NICELY. AND NOW A PAUSEp
  99.  
  100. s<n> select speed <n> where <n> is between 1 & 9. 1 is the slowest speed, 
  101. 9 is the fastest. Remember that the greater the speed, the more system 
  102. time it takes. The system time taken by speed 9 is about 10 times that 
  103. of speed 1. The default speed is 2. Bear in mind that the scrolltext is 
  104. almost unreadable at speeds above 3 or 4.
  105. Example: s1SLOWLY FIRST, s2THEN FASTER, s3THEN FASTER STILL. s1NORMAL.
  106.  
  107. w causes the scrolltext to wrap to the start of the file. ALL files for 
  108. scrolling must end with this character to avoid a lot of messy garbage.
  109. Example: TIME TO WRAP.....w
  110.  
  111. x<n> causes the error request flag to be set. If *ScrollCheck is used 
  112. after this point an error will be produced. The one-digit number <n> 
  113. can be read using SYS "DemoFX_ScrollCheck" TO number. This puts the 
  114. value of <n> into the BASIC variable number. In this case alone, the 
  115. qualifier can be omitted. In this case, the program will find a 
  116. character apart from a number. This causes the error number to be set 
  117. to &FF (255). When a numeric qualifier is provided, the number is not 
  118. scrolled. However, if another type of qualifier is given (to set the 
  119. error number to &FF) then the qualifier will be displayed - this gives 
  120. compatibility with scrollfiles from earlier scrolltexts. *ScrollCheck 
  121. cannot differentiate between error numbers. Also, if x0 is used, the 
  122. error number is set to &A (10).
  123. Example: PRODUCING ERROR NUMBER 10 x0 AND ERROR NUMBER 255 x AND 
  124. ERROR 
  125. NUMBER 5 x5
  126.  
  127. The control v is also used internally by the module by the ScrollLine 
  128. function. DO NOT include this code in ANY file for scrolling.
  129.  
  130. Creation of DemoFonts
  131. ~~~~~~~~~~~~~~~~~~~~~
  132. To create a new font for the scrolltext, you must design the letters as 
  133. sprites. All the sprites must by 32*32 pixels in mode 13 with no 
  134. palette and no mask. You need to design characters up from ASCII 32 
  135. (space). There is no point in designing characters beyond ASCII 96 (£) 
  136. as these cannot be displayed by the scrolltext. The characters you 
  137. design must then be placed in a single spritefile in ASCII order from 
  138. SPACE upwards 
  139. (ie  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_£). 
  140. This means that the sprites will appear in ASCII order in the !Paint 
  141. window. Each letter must also incorporate a gap to separate it from 
  142. other letters. If you omit this gap, it becomes possible to run the 
  143. letters together to create wide designs such as pictures or logos.
  144. Once this is done, you have to convert the spritefile to a demofont 
  145. file (type &601). Dragonrider (David Shepherdson) has furnished me with 
  146. a very nice multitasking program to do this. Once this is finished, you 
  147. can load the font with *ScrollFont and use it as normal. If the convert 
  148. program rejects your sprite file, check that all the sprites are of the 
  149. right size (32*32) and have no masks or palettes included. 
  150. If, when you use the font, the wrong characters are displayed, then the 
  151. spritefile was in the wrong order - start again!   
  152. DO NOT delete the spritefile of your font because it is impossible to 
  153. recover from the demofont file.
  154.  
  155.  
  156. Scrolltext SWI (SYS) calls: 
  157. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  158. SWI "DemoFX_ScrollFile" (&50004) Load file 
  159. for scrolling (as in *ScrollFile) 
  160. Entry: R0 points to control character terminated filename 
  161. Exit : All registers preserved
  162.  
  163. SWIs "DemoFX_ScrollOn, ScrollOff,ScrollGo" (&50005-&50007)
  164. Perform *command of the same name
  165. No parameters
  166.  
  167. SWI "DemoFX_ScrollCheck" (&50008)
  168. Check for error request and return error number
  169. Entry: No entry parameters
  170. Exit : R0 contains requested error number or 0 if no error request
  171. Note that once this command has been executed that the error request 
  172. flag is cleared. This ensures that each request only produces one 
  173. result.
  174.  
  175. SWI "DemoFX_ScrollFont" (&50009)
  176. Load Demofont into specified slot
  177. Entry: R0 contains slot number
  178.        R1 points to control character terminated filename
  179. Exit : All registers preserved
  180.  
  181. SWI "DemoFX_ScrollWrap" (&5000A)
  182. Immediate scrolltext wrap to start.
  183. No parameters
  184.  
  185. SWI "DemoFX_ScrollLine" (&5000B)
  186. Override file-based scrolling with message
  187. Entry: R0 points to control character terminated string.
  188. Exit : All registers preserved
  189. Note that the string must have one leading and one trailing space 
  190. (ASCII 32) character. E.g. string = " OVERRIDE MESSAGE "
  191.  
  192. These are all the SWIs provided by the scrolltext section.
  193.  
  194. Scrolltext credits:
  195. Coding by BATMAN
  196. Help in debugging for 4Mb computers by DRAGONRIDER
  197.  
  198. The Parallax Scrolling Starfield
  199. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  200. This module section uses the 50Hz VSYNC event to draw a field of 255 
  201. stars. The scrolling is on 4 levels, brightest stars moving the 
  202. fastest. The default starfield is one that scrolls from right to left. 
  203. If the scroll is a horizontal one, then the stars will move slowly up 
  204. (or down, depending on the direction) the screen. 
  205. The stars will automatically disappear behind objects drawn on the 
  206. screen provided that these objects are not the same colour as the 
  207. stars. When the routine is called, all the stars are unplotted. The 
  208. routine checks that the pixel is the colour of a star before it is 
  209. unplotted. The stars are then all replotted in a new position. Before 
  210. each star is plotted, the routine checks that the pixel is black before 
  211. the star is plotted. This is how the stars appear to disappear behind 
  212. white text or coloured logos.
  213. If you want to draw a sprite that will appear to float above the stars 
  214. then do not use colours 254,210,47 or 45 as numbered on the !Paint 256 
  215. colour palette.
  216.  
  217. Starfield *Commands:
  218. *StarsOn turns the starfield on
  219. *StarsOff turns the starfield off
  220.  
  221. Before you use *StarsOn ensure that there is at least 80k of screen 
  222. memory allocated by the task manager. The starfield is intended for use 
  223. in 80k modes, but can be used in modes that take up less room provided 
  224. that there is 80k of screen memory allocated. Mode 13 is the intended 
  225. mode for use.
  226.  
  227. Starfield SWIs
  228. ~~~~~~~~~~~~~~
  229. SWI "DemoFX_StarsOn" (&5000C)
  230. Execute *StarsOn
  231. No Parameters
  232.  
  233. SWI "DemoFX_StarsOff" (&5000D)
  234. Execute *StarsOff
  235. No Parameters
  236.  
  237. SWI "DemoFX_StarStep" (&5000E)
  238. Set step in bytes between successive plots of the slowest stars.
  239. Entry: R0 contains new step
  240. Exit : All registers preserved
  241. Note that this sets the speed of the slowest level of stars. The other 
  242. levels move at 2,3 or 4 times this speed depending on their colour.
  243. This SWI is also used to set the direction of the starfield. A step of 
  244. 1 is default, but a step of -1 reverses the starfield direction. A step 
  245. of 320 (the number of bytes per line in an 80k mode) causes vertical 
  246. scrolling. You can set the direction easily by assigning a variable X 
  247. with the horizontal component of movement (i.e. +ve or -ve number less 
  248. then 320) and variable Y with the vertical component of movement (i.e. 
  249. +ve or -ve number less than 255)  the star step will then be given as 
  250. X+(320*Y).  Note that +ve Y is upwards and +ve X is left.
  251.  
  252. Starfield credits:
  253. Coding by BATMAN
  254. Preliminary testing by DRAGONRIDER
  255.  
  256. Screen Fader
  257. ~~~~~~~~~~~~
  258. This is a simple machine code program that pokes 0 words into screen 
  259. memory with a step between each. The starting place is then moved on 
  260. and the process repeated. This causes the screen to be cleared in a 
  261. pattern.
  262.  
  263. Fader *Commands
  264. ~~~~~~~~~~~~~~~
  265. *Fade clears the screen to logical colour 0. This works in any mode 
  266. though the more memory it has to clear, the slower it is.
  267.  
  268. Fader SWIs
  269. ~~~~~~~~~~
  270. SWI "DemoFX_Fade" (&50003)
  271. Execute *Fade
  272. No parameters
  273.  
  274. SWI "DemoFX_FadeStyle" (&50000)
  275. Entry: R0 contains new fade style
  276. Exit : All registers preserved.
  277. Note that this call sets the gap in bytes between successive pokes of 0
  278. words into screen memory. The default gap is 11. DO NOT set the step to 
  279. 0. Steps of 5 or greater which are not divisible by 4 are advised. 
  280. There is no limit to the size of step, but one that is greater than the 
  281. amount of memory taken by the current mode just causes a plain bottom 
  282. to top clear.
  283.  
  284. Fader credits
  285. Coded by BATMAN
  286.  
  287.  
  288. Sprite Folder
  289. ~~~~~~~~~~~~~
  290. This is only provided as an SWI call. It takes a sprite and plots it 
  291. onto the screen. Due to the way it is plotted, the sprite seems to 
  292. swing down from the top. This is similar to the effect used on the Drop 
  293. Ship title screens.
  294.  
  295. Folder SWIs
  296. ~~~~~~~~~~~
  297. SWI "DemoFX_FoldSprite" (&5000F)
  298. Fold sprite onto screen
  299. Entry : R0 contains sprite type
  300. R0=0: Plot sprite
  301.       R1 points to a sprite file which has been *Loaded into memory.
  302.       R2 contains the plot offset (see below)
  303. R0=1: Plot raw
  304.       R1 contains the width of the sprite in bytes
  305.       R2 contains the height of the sprite in scanlines
  306.       R3 points to the beginning of raw screen data
  307.       R4 contains the mode for use
  308.       R5 contains the plot offset
  309. R0=2: Plot from user sprite area
  310.       R1 points to a user sprite area
  311.       R2 contains plot offset
  312.       R3 contains the sprite's number. (This is the number of the 
  313. sprite in the area. E.g. to plot the 5th sprite in the area R3=5. This 
  314. method is used because it is a lot easier than string searches.)
  315.  
  316. This SWI is either given the mode for use (R0=1) or loads it from the 
  317. spritefile (R0=0). If the current screen mode is not the one specified 
  318. then the correct one will be selected.
  319. The plot offset is used to set where the sprite will appear. An offset 
  320. of 0 is at the top left of the screen. Every time you add one to the 
  321. offset, the fold position will move right. You can move the fold 
  322. position downwards by adding the number of bytes across the screen to 
  323. the offset (this value is returned in R3 by SWI "DemoFX_ScreenMem").
  324. When R0=1, this is used to plot raw screen data (a sprite is raw screen 
  325. data with a header tagged on). This command allows more flexibility, 
  326. but requires more work to set up.
  327. When used with R0=0, only the first sprite in the file is folded. The 
  328. dimensions of the sprite are automatically read from it's header.
  329.  
  330.  
  331. Miscellaneous Functions 
  332. ~~~~~~~~~~~~~~~~~~~~~~~ 
  333. There are 2 functions which form no part of any of the 3 module 
  334. sections. These are the ShutDown and ScreenMem SWIs
  335.  
  336. SWI "DemoFX_ScreenMem" (&50001)
  337. Read screen memory allocation for current mode.
  338. Entry: No entry parameters
  339. Exit : R0 points to the bottom of screen RAM
  340.        R1 points to the top of screen RAM
  341.        R2 contains the number of bytes used by the current screen mode.
  342.        R3 contains bytes per line used by the current screen mode.
  343. Note: This SWI is used internally by DemoFX, but is made available to 
  344. the user because I am incredibly generous.
  345.  
  346. SWI "DemoFX_ShutDown" (&50002)
  347. Shuts down all DemoFX VSYNC based effects (i.e. scrolltext and 
  348. starfield)
  349. No Parameters
  350.  
  351.  
  352.  
  353. That's it for the DemoFX (1.05) manual.
  354.  
  355. If you have any suggestions for more effects, bug reports, or anything 
  356. (even praise - Hint Hint), contact me at:
  357.      Batman
  358.      The Postern
  359.      Chignal Smealey
  360.      Chelmsford
  361.      Essex
  362.      CM1 4SU
  363.  
  364. TTFN Batman (19/8/91)
  365.  
  366.