home *** CD-ROM | disk | FTP | other *** search
/ TCE Demo 2 / TCE_DEMO_CD2.iso / demo_cd_.2 / mags / stosser / stoser08.arj / stoser08.msa / ISSUE_8 / 4.PNE < prev    next >
Text File  |  1987-04-22  |  10KB  |  235 lines

  1.  
  2.                   ~~~~~~~ STOS EXTENSIONS ~~~~~~
  3.  
  4.                    ~~~~~ ARTICLE BY DEANO ~~~~~
  5.  
  6.        ~~~~~ FROM THE FORTHCOMING 'COMPLETE GUIDE TO STOS' ~~~~~
  7.  
  8. In this article,  I hope to shed some light on what a few people seem to 
  9. be  having  problems with....  STOS extensions.  Various  questions  are 
  10. raised on the subject,  what is an extension,  what does it do, how do I 
  11. install  it,  and  how is one written.  Well,  in this article  I  shall 
  12. attempt to answer these questions.
  13.                        
  14.  1> WHAT IS AN EXTENSION?
  15.  
  16. When Francios Lionet developed STOS,  he decided that there could always 
  17. be room for improvment.  In other words,  fix it so extra commands could 
  18. be added. So, instead of releasing a new version of it with new commands 
  19. he fixed it so that the new commands could be an added on.
  20.  
  21. When we enter a command into STOS, it is not understood by the ST in its 
  22. basic form.  It first has to be translated into a language which the  ST 
  23. can understand, which is machine code. Suppose we type.....
  24.  
  25.  plot 320,100,1
  26.  
  27. The assembly routine for this command would look like this.
  28.  
  29.  move.I #1,-(a6)
  30.  move.I #100,-(a6)
  31.  move.I #320,-(a6)
  32.  jsr plot
  33.  
  34. If we look in the STOS folder,  we will see a large selection of  files. 
  35. As  STOS loads,  each of these files are loaded into memory,  each  file 
  36. contains M/C routines for each basic command entered into STOS. 
  37. For example, if we entered the above 'plot' command, STOS would look 
  38. through the BASIC.BIN file for the M/C routine for it.
  39.  
  40. STOS was written in assembly language then assembled into machine  code, 
  41. which is a list of numbers called binary numbers. So the SPRITE.BIN file 
  42. contains the binary numbers for the SPRITE commands.  So as we can  see, 
  43. STOS  is  not just one large piece of code,  its  split  into  different 
  44. parts.  If we remove the FLOAT.BIN file then we would'nt be able to  use 
  45. floating point numbers as STOS does'nt know the machine code routine.
  46.  
  47. So,  a STOS extension is just an extra file containing the command names 
  48. and  machine  routines  like the .BIN files which is  first  written  in 
  49. assembly then translated to machine code.  STOS loads it into memory and 
  50. when we enter one of the new commands,  STOS looks in the extra file and 
  51. finds the machine code routine for it, then executes it.
  52.  
  53. Sounds confusing does'nt it.  Well, to use an extension this information 
  54. is not really important anyway so panic ye not.
  55.  
  56. Its likely that you've been using an extension which realising it,  STOS 
  57. already has one installed in the later versions.  The COMPACT  extension 
  58. which  gives  us two extra commands....PACK and UNPACK.  Load  STOS  and 
  59. enter the following routine....
  60.  
  61.  10 key off : mode 10 key off : mode 0
  62.  20 reserve as screen 5 : reserve as screen 6
  63.  30 load"pic.pi1",5
  64.  40 pack 5,6
  65.  50 unpack 6
  66.  
  67.  
  68. This  routine  will load a degas picture into bank five and  the  'pack' 
  69. command  will compress it to a smaller size then put it into  bank  six. 
  70. The  'unpack' command will expand the compressed picture from this  bank 
  71. and copy it to the background and physic screens. Now, save this routine 
  72. to disk and exit STOS by typing 'system' to go to the desktop.
  73.  
  74. Insert  the STOS disk and open the STOS folder,  look through the  files 
  75. for one called COMPACT.EXA. This is the file that holds the new commands 
  76. names  along  with the machine code routine for each one.  This  is  the 
  77. compact extension for STOS, the interpeter version.
  78.  
  79. If we look at the three letters following the dot,  we see it says  EXA, 
  80. this informs STOS that it is extension A.  As STOS loads,  it reserves a 
  81. slot  in  memory for this file and names it slot A,  so  when  it  comes 
  82. across  a command from this file,  it looks in slot A for the  command's 
  83. information and carries it out.
  84.    
  85. Lets try something,  rename EXA to XXX and re-load STOS.  Next, load the 
  86. compress routine we did earlier and list it. It looks like this...
  87.  
  88.  10 key off : mode 10 key off : mode 0
  89.  20 reserve as screen 5 : reserve as screen 6
  90.  30 load"pic.pi1",5
  91.  40 extension #A 5,6
  92.  50 extension #A 6
  93.  
  94. Whats happened??? Wheres the PACK and UNPACK commands? Whats happened is 
  95. since  we renamed the EXA part of the file STOS has'nt loaded  the  file 
  96. into memory..(slot A),  the routine has told STOS that the command names 
  97. and  routines  are in the COMPACT.EXA file but as its not  been  loaded, 
  98. slot A is empty so STOS lists the PACK and UNPACK commands as it has  in 
  99. lines  40 and 50 telling us that extension slot A is empty.  We can  see 
  100. this by running the program.
  101.  
  102. Type 'run' and the following will appear......
  103.  
  104.  Extension not present in line 40
  105.  
  106.  40 extension #A 5,6
  107.  
  108. So,  in  order to get the commands back we need to rename the  extension 
  109. filename back to COMPACT.EXA.  Reboot STOS and run the routine again and 
  110. hey presto, the commands appear back in the listing. This is because the 
  111. extension details are sat back in slot A waiting to be used.
  112.  
  113.  2> HOW DO WE INSTALL AN EXTENSION?
  114.  
  115. Before  we  can use the new commands in an extension we  first  need  to 
  116. install the extension.  This is very simple indeed, all we need to do is 
  117. put  the extension file in the STOS folder on the STOS disk.  When  STOS 
  118. loads up,  it looks inside the STOS folder and loads each file in it, so 
  119. inside the STOS folder is the COMPACT.EXA file which STOS will load into 
  120. memory...(SLOT A), when it comes across it. The extension file that goes 
  121. in the STOS folder is called the 'interpreter' version.
  122.  
  123. Some extensions,  such as MISTY,  have a program supplied to install  the 
  124. extension  for us.  We just load the program,  select the right  install 
  125. option and insert the right disk,  other extensions just have the  files 
  126. on disk leaving us to install them ourselves.
  127.  
  128. Extensions  such  as 'missing link' are actually cut into two  or  three 
  129. different extension files so that means each interpreter file has to  be 
  130. put  in the STOS folder in order for us to use all  the  commands.  Lets 
  131. look at the COMPACT extension and see what the extension name means..
  132.  
  133.  COMPACT.EXA
  134.  
  135.  E= The file is a STOS extension
  136.  X= And it's the interpreter version
  137.  A= It is loaded in slot A
  138.  
  139. If  you were installing the 'missing link' extension then you would  put 
  140. these files in the STOS folder......
  141.  
  142.  LINK1.EXQ
  143.  LINK2.EXR
  144.  LINK3.EXS
  145.  
  146. As you can see from this last example, each of these extension files has 
  147. a different SLOT letter...Q,  R, S. If you have two extensions installed 
  148. which have the same SLOT letter then only one will load. STOS loads each 
  149. letter in alphabetical order,  so it will load extension A,  ignore  the 
  150. next  extension  with  the same SLOT letter and proceed  onto  the  next 
  151. extension  file it finds.  As far as I know,  three extensions use  SLOT 
  152. letter S,  these are Stos Tracker,  Link3,  and STOS 3D. We can't change 
  153. the  SLOT  letter  as the file will only load  into  its  original  SLOT 
  154. number,  but we can stop it from loading by renaming the file extension, 
  155. IE: the three letter name of one file to XXX.
  156.  
  157. 2.1> THE STOS COMPILER
  158.  
  159. If you have a copy of the compiler then you need to know that before you 
  160. can  compile a routine using new commands then you need to  install  the 
  161. compiler extension into the COMPILER folder on the COMPILER disk.
  162.  
  163. When we compile a program,  the compiler looks for each basic command it 
  164. finds  in the routine and converts it to machine code by looking at  the 
  165. files  in the COMPILER folder and putting the commands information  into 
  166. the compiled program. So in order for our new commands to be compiled we 
  167. need  to  put  the COMPILER version of the  extension  in  the  compiler 
  168. folder. Have a look in this folder and you will see this file.
  169.  
  170.  COMPACT.ECA
  171.  
  172. This file tells the compiler that.......
  173.  
  174.  E= The file is a STOS extension
  175.  C= And it is the COMPILER version
  176.  A= It is compiled into SLOT A
  177.  
  178. Try  loading that routine we prepared eariler and compiling  it.  You'll 
  179. see that it works okay,  but try changing COMPACT.ECA to COMPACT.XXX and 
  180. try compiling the routine again. The compiler reports this message...
  181.  
  182.  Extension not found in line 40
  183.  
  184. Which  quite simply means that the compiler can't compile the  extension 
  185. because  it can't find it on the disk,  just rename COMPACT.XXX back  to 
  186. COMPACT.ECA and everything will work fine.
  187.  
  188. Compiler users will have the compiler's own extension installed and will 
  189. see it as COMPILER.EXC and COMPILER.ECC.
  190.  
  191.  3> HOW DO I WRITE AN EXTENSION
  192.  
  193. In  order  to  write  an extension we need to know  how  to  program  in 
  194. assembly language.  I can't really tell you were to start and what to do 
  195. as  it  would  be inflicting copyright as there is a  book  that  has  a 
  196. chapter  on writing extensions which is called The Game  Makers  Manual, 
  197. which is availible from MT Software and Sigma Press.
  198.  
  199.  4> WHAT EXTENSIONS ARE AVAILIBLE?
  200.  
  201. Various  STOS  listings found with STOSSER and PD  librarys  mainly  use 
  202. extensions  but  if  you have'nt got the right one  installed  then  the 
  203. listing  won't  work.  Some programmers mention in their  listing  which 
  204. extension is used but others don't bother. So for your information, here 
  205. is a list of the various extensions round at the moment....
  206.  
  207.  ======================================================================
  208.  
  209.  STOS 3D.............STOS (.EXS).........COMPLIER (.ECS)
  210.  STE.................STOS (.EXT).........COMPILER (.ECT)
  211.  STOS MAESTRO........STOS (.EXD).........COMPILER (.ECD)
  212.  MISTY...............STOS (.EXM).........COMPILER (.ECM)
  213.  MISSING LINK........STOS (.EXQ,R,S).....COMPILER (.ECQ,R,S)
  214.  EXTRA...............STOS (.EXZ).........COMPILER (.ECZ)
  215.  STOS TRACKER........STOS (.EXS).........COMPILER (.ECS)
  216.  STARS...............STOS (.EXH).........COMPILER (.ECH)
  217.  BLITTER.............STOS (.EXE).........COMPILER (.ECE)
  218.  
  219. There may be one or two others around but these are the main ones.  Each 
  220. extension  loads into the solt specified by the extension but none  ever 
  221. use slot B as it has a bug...
  222.  
  223. Well  thats the end of this little lot.  I hope it proves  helpful,  but 
  224. should you want to ask any questions then write to me at.....
  225.  
  226.  DEANO
  227.  27 TURBARY WALK
  228.  MILNROW ROCHDALE
  229.  OL16 4JN
  230.  
  231. If I can't help, then I'll find someone who can....
  232.  
  233. This is DEANO signing off..............
  234.  
  235.