home *** CD-ROM | disk | FTP | other *** search
- STOS BASIC 4
-
- I assume little/no prior knowledge
- of Stos. Each lesson will also have
- a Stos BASic or ASCii file to go
- with it.
-
- Listed here for your convenience.
- I.E. to make it easier to write them
- down or to look at the structure of
- the command. Are the new commands to
- be dealt with.
-
- LOAD SAVE DIR$ RESERVE
- BAS ASC MBK PI!
- CLS NEW CLEAR WAIT
- APPEAR DELETE MODE
-
- Do not worry if you find things hard
- at first, practice makes perfect.
-
- Actual progs are used to explain
- things, called 'name.asc' and
- included in this folder. First how
- to load and save files, then other
- the commands.
-
- If you have any problems, then look
- for the command on pages 271/73 of
- the manual. This is not intended to
- replace the manual, but to add to it
- where needed.
-
-
- LESSON ONE:
-
- loading & Saving normal files.
-
- Name = The name you give to the
- file.
-
- Type = The type of file it is.
-
- Load"name.type"
- Save"name.type"
-
- Types of files:
-
- ASC = a file saved (as text only).
- BAS = Stos Language file.
- MBK = single memory bank file.
- Pi1 = degas low res picture.
-
-
- Files ending in '.ASC' are files
- which just store the character
- details. Try to open one from
- desktop. You can read these files,
- but you can also load them into
- STOS.
-
- Files ending in '.BAS' store details
- of Stos which can only be loaded
- into STOS. Try to open one from the
- desktop and you will only see a lot
- of gibberish. This is the format in
- which Stos stores its files. This
- can be text as well as whatever is
- in the memory banks.
-
- ASCII files only store the text.
-
-
- The BASic file, will store the
- picture and the code together as one
- file, but I am going to show you how
- to store them on their own as well.
-
- But first the code ( T4LES1.ASC)
-
- 10 rem this loads a picture to
- screen
- 20 rem and to bank 6
- 30 rem it then tests for screen res
- 40 rem and loads the picture from
- bank 6 to screen
- 50 cls
- 60 dir$="\stos"
- 70 load "pic.pi1"
- 80 reserve as screen 6
- 90 load "pic.pi1",6
- 100 print "press any key"
- 110 wait key
- 120 if mode<>0 then mode 0
- 130 appear 6
- 140 dir$="A:\"
-
- Ok.
- lines 10-40 are not read by the
- computer, and are there just for
- your use. I.e. so that you know
- what to expect.
-
- line 50 CLS
-
- this clears the screen removing
- anything not wanted on screen. Not
- really that important here, but it
- is good practice to use the CLS
- command.
-
- line 60 dir$="\stos"
-
- This is important. It tells STOS
- where to look for the picture file
- on disk. Notice the BACKSLASH '\'
- it wont work if you miss it from the
- command.
-
- line 70 load "pic.pi1"
-
- This loads the file to the screen,
- from within the STOS folder on your
- language disk. It looks for a file
- called 'PIC.PI1'. If not found the
- programme will stop dead. If you
- were in medium res then the picture
- is somewhat scrambled. Do not
- worry, it will sort itself out soon
- enough. Notice that the file name
- and file type are separated by a
- full stop and not a comma.
-
- 80 reserve as screen 6
-
- This reserves a memory bank as a
- screen bank, and allows you to load
- pictures into that bank. It also
- allows you to save them as well as
- moving them about.
-
- 90 load "pic.pi1",6
-
- You should have an idea about this
- line. It loads the same picture
- into bank 6. Notice the comma
- before the number. It wont work if
- you miss the comma off.
-
- 100 print "press any key"
-
- This just tells you that the
- computer is waiting. You could use
- the LOCATE command discussed in the
- previous three tutorials to place
- this in a better spot, but I wanted
- to keep this simple.
-
- 110 wait key
-
- This tells the computer to wait for
- a keypress before continuing. WAIT
- 100 could have been used to pause
- for a short time, where upon the
- computer would have waited a short
- while before moving on. But I
- wanted you to know what is happening
- and why.
-
- 120 if mode<>0 then mode 0
-
- This line would normally appear near
- the start of a programme. It checks
- to see if the screen is set to low
- res or not. If it is then nothing
- happens, if not then it changes to
- low res. The mode being how many
- dots appear on the screen. More
- dots means a better picture, but
- less colours.
-
- 130 appear 6
-
- This command makes the contents of
- bank 6 appear to the screen.
- However, if you move the mouse
- around, then you will see that the
- picture starts to disappear. Do you
- know why? Well it is because the
- appear command only places the
- picture to the physical screen.
- There is a Logical and background
- screen as well. But as this is only
- about loading and saving, I am not
- going to go into the different
- screens. That will come in a couple
- of tutorials time.
-
- 140 dir$="A:\"
-
- This resets Stos to the root
- directory of drive 'A:'.
-
-
- [ ] is used to enclose direct
- commands where you copy everything
- except the [] and then press either
- the RETURN or ENTER key.
-
- It does not matter whether you use
- capitals or not, but you must enter
- everything enclosed within the [ ]
- paying attention to full stops and
- commas.
-
- To load the file you type [LOAD
- "T4LES1.ASC"]
-
- Then enter [LIST] to have a look at
- what has been entered.
-
- Now we are going to save the file.
-
- Type [SAVE"TRASH1.BAS"] or press
- [F4] and type in the name and press
- return.
-
- Now enter [MODE1]
-
- The screen should have changed, and
- the writing on it should be smaller,
- as we are now in medium resolution.
-
- now enter [RUN]
-
- It should have loaded a picture from
- disk and displayed it to screen.
- Because the picture is in the wrong
- resolution it displayed a scrambled
- picture to screen.
-
- Then it waits for you to press a
- key, before changing resolution and
- moving the picture from bank 6 and
- displaying it to screen.
-
- So now you know what happens if you
- use the wrong picture and screen
- resolution.
-
- enter [DIR]
-
- Pay attention to the files on disk.
- DIR displays the DIRectory contents
- of whichever folder you are in at
- the time. Now delete line 140 by
- typing DELETE 140 and pressing
- return. You could also just type
- the 140 and press return to delete a
- single line, as line numbers without
- any code are not entered but are
- deleted instead.
-
- Now save the file as "TRASH2.BAS".
- and use the DIR command again. This
- time the contents are different, and
- there is no TRASH1.BAS. Do you know
- why? Well, it is because you are
- still in the STOS folder, and that
- is where you have saved to.
- TRASH1.BAS is out side of the
- folder.
-
- We have done three very important
- things now. We have learnt how to
- load, how to save and how to move
- from one folder into another within
- Stos.
-
- But now for something a bit easier.
-
- enter [Dir$ = "A:\"]
-
- enter [LIST]
-
- You should see the lines of code
- from 10 to 130, or to 140 if you did
- not delete the last line, plus
- memory bank 6. Which if you
- remember holds the picture.
-
- Now, how do you get rid of what's on
- screen? Well if you just want to
- tidy up the screen then you would
- use the CLS command.
-
- enter [CLS] then [LIST]
-
- You should see the same as before.
-
- But what if you wanted to get rid of
- the memorybank but keep the code or
- perhaps the other way round.
-
- enter [CLEAR} then [LIST]
-
- To dispose of the memory banks you
- use the CLEAR command. This
- disposes not only of all the banks
- but also the value of all variables
- as well - in this case we do not
- have any variables so it does not
- matter.
-
- There is a way to get rid of just
- one bank at a time, but that will be
- discussed next time.
-
- However, what if you wanted to keep
- the banks but get rid of the code?
- Well in that case you would use the
- DELETE command.
-
- enter [LOAD"trash1.bas"]
-
- Now enter [list]
-
-
-
- Now we start on something a bit
- different. type [NEW].
-
- Now type [DIR] if you are not in
- the root directory, then type [DIR$
- = "A:\"] to move there and load the
- trash1.bas file again.
-
- Now to add some more lines to it.
- 150 SAVE "TRASH3.BAS"
- 160 SAVE "TRASH1.mbk",6
- 170 ERASE 6: SAVE "TRASH1.BAS"
-
- You have now saved the picture to
- disk from bank six, or you will have
- when you run the programme. Once
- you have [RUN] the programme then
- [DIR] again.
-
- You will see something interesting.
- Trash1.bas is not the same size as
- trash3.bas. And there is also a
- trash1.bak file as well.
-
- This is the important part of the
- whole lesson. Stos makes duplicates
- of the BASic files when you save
- them more than once, but it does not
- do this to the other files. So
- what? Well if you are pushed for
- space on disk, you do not really
- want the memory banks to be saved
- twice, so it is better to split them
- and save each separate.
-
-
- Now, type [NEW] then
- [LOAD"TRASH1.MBK,6"] then [LIST].
-
- Notice the comma after MBK, and the
- full stop before it, and that the 6
- is included within the quotes.
-
- You will see that there is no BASic
- file, but there is a memory bank
- file which is bank 6. Stos tells
- you it is a screen bank by its name,
- but there are ways of saving screens
- to banks other than as screen banks.
-
- NOW type [APPEAR 6]
-
- then move the mouse around the
- screen.
-
- Now type [CLS] then
- [LOAD"trash1.bas"]
-
- Then [LIST] Then [APPEAR 6]
-
- You will find that the memory bank
- has been erased. This is because
- Stos deletes everything and erases
- everything when it loads a BASic
- file.
-
- Now type [LOAD"trash1.mbk,6"] again.
- and then [LIST].
-
- This time you will see that the
- Basic code has not been deleted, and
- that the memory bank 6 has been
- loaded.
-
- Type [APPEAR 6] to make sure that it
- is there. I assume that you know
- how to change resolution if you are
- in medium res. [MODE0] if you have
- forgotten.
-
-
-