home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / STOSSER / STOSSE04.MSA / TUTORIAL.DOC / TUTORIA2.DOC < prev   
Encoding:
Text File  |  1987-04-22  |  9.8 KB  |  411 lines

  1.            STOS BASIC 4
  2.  
  3. I assume little/no prior knowledge 
  4. of Stos.  Each lesson will also have 
  5. a Stos BASic or ASCii file to go 
  6. with it.
  7.  
  8. Listed here for your convenience.  
  9. I.E. to make it easier to write them 
  10. down or to look at the structure of 
  11. the command. Are the new commands to 
  12. be dealt with.
  13.  
  14. LOAD     SAVE     DIR$    RESERVE
  15. BAS      ASC      MBK     PI!
  16. CLS      NEW      CLEAR   WAIT     
  17. APPEAR   DELETE   MODE
  18.  
  19. Do not worry if you find things hard 
  20. at first, practice makes perfect. 
  21.  
  22. Actual progs are used to explain 
  23. things, called 'name.asc' and 
  24. included in this folder.  First how 
  25. to load and save files, then other 
  26. the commands. 
  27.  
  28. If you have any problems, then look 
  29. for the command on pages 271/73 of 
  30. the manual.  This is not intended to 
  31. replace the manual, but to add to it 
  32. where needed.
  33.  
  34.  
  35. LESSON ONE:
  36.  
  37. loading & Saving normal files.
  38.  
  39. Name = The name you give to the 
  40.         file.
  41.  
  42. Type = The type of file it is.
  43.  
  44. Load"name.type"
  45. Save"name.type"
  46.  
  47. Types of files:
  48.  
  49. ASC = a file saved (as text only).
  50. BAS = Stos Language file.
  51. MBK = single memory bank file.
  52. Pi1 = degas low res picture. 
  53.  
  54.  
  55. Files ending in '.ASC' are files 
  56. which just store the character 
  57. details.  Try to open one from 
  58. desktop.  You can read these files, 
  59. but you can also load them into 
  60. STOS.
  61.  
  62. Files ending in '.BAS' store details 
  63. of Stos which can only be loaded 
  64. into STOS.  Try to open one from the 
  65. desktop and you will only see a lot 
  66. of gibberish.  This is the format in 
  67. which Stos stores its files.  This 
  68. can be text as well as whatever is 
  69. in the memory banks. 
  70.  
  71. ASCII files only store the text.
  72.  
  73.  
  74. The BASic file, will store the 
  75. picture and the code together as one 
  76. file, but I am going to show you how 
  77. to store them on their own as well.
  78.  
  79. But first the code ( T4LES1.ASC)
  80.  
  81. 10 rem this loads a picture to 
  82.        screen
  83. 20 rem and to bank 6
  84. 30 rem it then tests for screen res
  85. 40 rem and loads the picture from 
  86.        bank 6 to screen
  87. 50 cls
  88. 60 dir$="\stos"
  89. 70 load "pic.pi1"
  90. 80 reserve as screen 6
  91. 90 load "pic.pi1",6
  92. 100 print "press any key"
  93. 110 wait key
  94. 120 if mode<>0 then mode 0
  95. 130 appear 6
  96. 140 dir$="A:\"
  97.  
  98. Ok.
  99. lines 10-40 are not read by the 
  100. computer, and are there just for 
  101. your use.  I.e. so that you know 
  102. what to expect.
  103.  
  104. line 50 CLS
  105.  
  106. this clears the screen removing 
  107. anything not wanted on screen.  Not 
  108. really that important here, but it 
  109. is good practice to use the CLS 
  110. command.
  111.  
  112. line 60 dir$="\stos"
  113.  
  114. This is important.  It tells STOS 
  115. where to look for the picture file 
  116. on disk.  Notice the BACKSLASH '\' 
  117. it wont work if you miss it from the 
  118. command.
  119.  
  120. line 70 load "pic.pi1"
  121.  
  122. This loads the file to the screen, 
  123. from within the STOS folder on your 
  124. language disk. It looks for a file 
  125. called 'PIC.PI1'.  If not found the 
  126. programme will stop dead. If you 
  127. were in medium res then the picture 
  128. is somewhat scrambled.  Do not 
  129. worry, it will sort itself out soon 
  130. enough.  Notice that the file name 
  131. and file type are separated by a 
  132. full stop and not a comma.
  133.  
  134. 80 reserve as screen 6
  135.  
  136. This reserves a memory bank as a 
  137. screen bank, and allows you to load 
  138. pictures into that bank.  It also 
  139. allows you to save them as well as 
  140. moving them about.
  141.  
  142. 90 load "pic.pi1",6
  143.  
  144. You should have an idea about this 
  145. line.  It loads the same picture 
  146. into bank 6.  Notice the comma 
  147. before the number.  It wont work if 
  148. you miss the comma off.
  149.  
  150. 100 print "press any key"
  151.  
  152. This just tells you that the 
  153. computer is waiting.  You could use 
  154. the LOCATE command discussed in the 
  155. previous three tutorials to place 
  156. this in a better spot, but I wanted 
  157. to keep this simple.
  158.  
  159. 110 wait key
  160.  
  161. This tells the computer to wait for 
  162. a keypress before continuing.  WAIT 
  163. 100 could have been used to pause 
  164. for a short time, where upon the 
  165. computer would have waited a short 
  166. while before moving on.  But I 
  167. wanted you to know what is happening 
  168. and why.
  169.  
  170. 120 if mode<>0 then mode 0
  171.  
  172. This line would normally appear near 
  173. the start of a programme.  It checks 
  174. to see if the screen is set to low 
  175. res or not.  If it is then nothing 
  176. happens, if not then it changes to 
  177. low res.  The mode being how many 
  178. dots appear on the screen.  More 
  179. dots means a better picture, but 
  180. less colours.
  181.  
  182. 130 appear 6
  183.  
  184. This command makes the contents of 
  185. bank 6 appear to the screen.  
  186. However, if you move the mouse 
  187. around, then you will see that the 
  188. picture starts to disappear.  Do you 
  189. know why?  Well it is because the 
  190. appear command only places the 
  191. picture to the physical screen. 
  192. There is a Logical and background 
  193. screen as well. But as this is only 
  194. about loading and saving, I am not 
  195. going to go into the different 
  196. screens.  That will come in a couple 
  197. of tutorials time.
  198.  
  199. 140 dir$="A:\"
  200.  
  201. This resets Stos to the root 
  202. directory of drive 'A:'. 
  203.  
  204.  
  205. [ ] is used to enclose direct 
  206. commands where you copy everything 
  207. except the [] and then press either 
  208. the RETURN or ENTER key.
  209.  
  210. It does not matter whether you use 
  211. capitals or not, but you must enter 
  212. everything enclosed within the [ ] 
  213. paying attention to full stops and 
  214. commas.
  215.  
  216. To load the file you type [LOAD 
  217. "T4LES1.ASC"]
  218.  
  219. Then enter [LIST] to have a look at 
  220. what has been entered.
  221.  
  222. Now we are going to save the file.
  223.  
  224. Type [SAVE"TRASH1.BAS"] or press 
  225. [F4] and type in the name and press 
  226. return.
  227.  
  228. Now enter [MODE1]
  229.  
  230. The screen should have changed, and 
  231. the writing on it should be smaller, 
  232. as we are now in medium resolution.
  233.  
  234. now enter [RUN]
  235.  
  236. It should have loaded a picture from 
  237. disk and displayed it to screen.  
  238. Because the picture is in the wrong 
  239. resolution it displayed a scrambled 
  240. picture to screen.
  241.  
  242. Then it waits for you to press a 
  243. key, before changing resolution and 
  244. moving the picture from bank 6 and 
  245. displaying it to screen.
  246.  
  247. So now you know what happens if you 
  248. use the wrong picture and screen 
  249. resolution.
  250.  
  251. enter [DIR]
  252.  
  253. Pay attention to the files on disk.
  254. DIR displays the DIRectory contents 
  255. of whichever folder you are in at 
  256. the time.  Now delete line 140 by 
  257. typing DELETE 140 and pressing 
  258. return.  You could also just type 
  259. the 140 and press return to delete a 
  260. single line, as line numbers without 
  261. any code are not entered but are 
  262. deleted instead.
  263.  
  264. Now save the file as "TRASH2.BAS". 
  265. and use the DIR command again.  This 
  266. time the contents are different, and 
  267. there is no TRASH1.BAS.  Do you know 
  268. why?  Well, it is because you are 
  269. still in the STOS folder, and that 
  270. is where you have saved to.  
  271. TRASH1.BAS is out side of the 
  272. folder.
  273.  
  274. We have done three very important 
  275. things now.  We have learnt how to 
  276. load, how to save and how to move 
  277. from one folder into another within 
  278. Stos.
  279.  
  280. But now for something a bit easier.
  281.  
  282. enter [Dir$ = "A:\"]
  283.  
  284. enter [LIST]
  285.  
  286. You should see the lines of code 
  287. from 10 to 130, or to 140 if you did 
  288. not delete the last line, plus 
  289. memory bank 6.  Which if you 
  290. remember holds the picture.
  291.  
  292. Now, how do you get rid of what's on 
  293. screen?  Well if you just want to 
  294. tidy up the screen then you would 
  295. use the CLS command. 
  296.  
  297. enter [CLS]  then [LIST]
  298.  
  299. You should see the same as before.
  300.  
  301. But what if you wanted to get rid of 
  302. the memorybank but keep the code or 
  303. perhaps the other way round.
  304.  
  305. enter [CLEAR} then [LIST]
  306.  
  307. To dispose of the memory banks you 
  308. use the CLEAR command.  This 
  309. disposes not only of all the banks 
  310. but also the value of all variables 
  311. as well - in this case we do not 
  312. have any variables so it does not 
  313. matter. 
  314.  
  315. There is a way to get rid of just 
  316. one bank at a time, but that will be 
  317. discussed next time.
  318.  
  319. However, what if you wanted to keep 
  320. the banks but get rid of the code?  
  321. Well in that case you would use the 
  322. DELETE command.
  323.  
  324. enter [LOAD"trash1.bas"]
  325.  
  326. Now enter [list] 
  327.  
  328.  
  329.  
  330. Now we start on something a bit 
  331. different. type [NEW].
  332.  
  333. Now type [DIR]  if you are not in 
  334. the root directory, then type [DIR$ 
  335. = "A:\"] to move there and load the 
  336. trash1.bas file again.
  337.  
  338. Now to add some more lines to it.
  339. 150 SAVE "TRASH3.BAS"
  340. 160 SAVE "TRASH1.mbk",6
  341. 170 ERASE 6: SAVE "TRASH1.BAS"
  342.  
  343. You have now saved the picture to 
  344. disk from bank six, or you will have 
  345. when you run the programme.  Once 
  346. you have [RUN] the programme then 
  347. [DIR] again.
  348.  
  349. You will see something interesting.
  350. Trash1.bas is not the same size as 
  351. trash3.bas.  And there is also a 
  352. trash1.bak file as well.
  353.  
  354. This is the important part of the 
  355. whole lesson.  Stos makes duplicates 
  356. of the BASic files when you save 
  357. them more than once, but it does not 
  358. do this to the other files.  So 
  359. what?  Well if you are pushed for 
  360. space on disk, you do not really 
  361. want the memory banks to be saved 
  362. twice, so it is better to split them 
  363. and save each separate.
  364.  
  365.  
  366. Now, type [NEW] then 
  367. [LOAD"TRASH1.MBK,6"] then [LIST].  
  368.  
  369. Notice the comma after MBK, and the 
  370. full stop before it, and that the 6 
  371. is included within the quotes.
  372.  
  373. You will see that there is no BASic 
  374. file, but there is a memory bank 
  375. file which is bank 6.  Stos tells 
  376. you it is a screen bank by its name, 
  377. but there are ways of saving screens 
  378. to banks other than as screen banks.
  379.  
  380. NOW type [APPEAR 6]
  381.  
  382. then move the mouse around the 
  383. screen.
  384.  
  385. Now type [CLS] then 
  386. [LOAD"trash1.bas"]
  387.  
  388. Then [LIST]  Then [APPEAR 6]
  389.  
  390. You will find that the memory bank 
  391. has been erased.  This is because 
  392. Stos deletes everything and erases 
  393. everything when it loads a BASic 
  394. file.
  395.  
  396. Now type [LOAD"trash1.mbk,6"] again.
  397. and then [LIST].
  398.  
  399. This time you will see that the 
  400. Basic code has not been deleted, and 
  401. that the memory bank 6 has been 
  402. loaded.
  403.  
  404. Type [APPEAR 6] to make sure that it 
  405. is there.  I assume that you know 
  406. how to change resolution if you are 
  407. in medium res.  [MODE0] if you have 
  408. forgotten.
  409.  
  410.  
  411.