home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
STOS_FC
/
STOSFC01.MSA
/
EXTENTON.EXT_CONTROL.TXT
< prev
next >
Wrap
Text File
|
1987-04-21
|
18KB
|
493 lines
Stos Control Extension V3.0
Shareware version
Copyright L.J.Greenhalgh 1994
These files may be freely distributed providing they are not
altered in any way.
I am not responsible for any damage which occurs to your ST as a
result of using this extension.Read the parallel instrucion VERY
carefully.
If you find this extension useful then please consider registering ,
not only will you receive the lastest version of the extension , but
you will also receive loads of extra graphics and source which will
enable you to get the most out of this extension.I have many more
ideas for commands especially where the STE is concerned , but these
will only see the light of day if people register!
Installation
Copy the file EXTENSION\CONTROL.EXW into your STOS folder.
Copy the file EXTENSION\CONTROL.ECW into you Compiler folder.
Run Stos
STOS may be powerful and easy to learn but it is very
unstructured when compared to languages like C and GFA basic .This
extension adds a switch construct to STOS which makes program listings
shorter and more readable as well as many other useful
commands.Welcome to the control extension .Come let us enter.....
Command Listing
ctrl
Switch on (INTEGER)
Case(INTEGER)
Switch off
otherwise
write STRING,ADDRESS
cmove INTEGER,INTEGER
cremember
crecall
A=add(A,I,L,R)
A=exist$(FILENAME$+CHR$(0))
Parallel port commands
INTEGER=parallel(PORTNUMBER)
para on
para off
INTEGER=para left(PORTNUMBER)
INTEGER=para right(PORTNUMBER)
INTEGER=para up(PORTNUMBER)
INTEGER=para down(PORTNUMBER)
INTEGER=para fire(PORTNUMBER)
Zone Commands
init megazone STARTZONE,NUMBEROFZONES
set megazone STARTZONE,ZOMENUMBER,X1,Y1,X2,Y2
range megazone STARTZONE,LOWERRANGE,UPPERRANGE
Z=test megazone (STARTZONE,X,Y)
del megazone STARTZONE
Screen Commands
screensize WIDTH,HEIGHT
spread ADDRESS,START_COLOUR,END_COLOUR
brdr remove TYPE
hscroll SCREEN,START_Y,END_Y,BITPLANES,NUMBEROFPIXELS
INTEGER=crack pac SCREEN_ADDRESS,DEST_ADDRESS
crack unpac SCREEN_ADDRESS,DEST_ADDRESS,MODE
quick screen$ SCREEN,X,Y,STRING,MODE
image put SCREEN,X,Y,BANK_ADDRESS,NUMBER,MODE
font SCREEN,X,Y,BANK_ADDRESS,STRING
set clip X1,X2,Y1,Y2
INTEGER=font width BANK_ADDRESS
INTEGER=font height BANK_ADDRESS
image palette BANK_ADDRESS
A switch construct is designed to replace the following
code.For this example suppose we have a situation where we click on
a zone and the result is stored in a variable called select.Using
switch as opposed to ON variable GOSUB has the advantage that A
does not have to hold consecutive values.Note we can only switch using
integers.
90 select=zone(0)
100 flag=false
110 if select=1 then gosub 1200:flag=true:rem do loading
120 if select=3 then gosub 4000:flag=true:rem do saving
130 if select=4 then gosub 500:flag=true:rem .....
140 if select=7 then gosub 6000:flag=true do something else
150 if flag=false then gosub 2000:rem well we didnt select 1,3,4 or 7
160 continue program....
This can be replaced by the following code.
90 select=zone(0)
100 switch on(select)
110 if case(1) then gosub 1200:ren do loading
120 if case(3) then gosub 4000:rem so saving
130 if case(4) then gosub 500:rem ...
140 if case(7) then gosub 6000:rem so something else
150 if otherwise then gosub 2000:rem well we didn't select 1,3,4 or 7
160 switch off
switch on (INTEGER)
This stores the value of the variable INTEGER in an internal
store for accessing by the case and otherwise commands.You can nest
your case structures up to a depth of 3.
Case (INTEGER)
returns a value of true if the value of INTEGER is the same as
that for the preceeding switch on ,otherwise it returns false.
otherwise
returns a value of true if none of the preceeding case
statements were true otherwise it returns false.
switch off
ends the current switch construct.
ctrl
Shows the command list.(Thanks Martin!) This is a
wounderful idea , every extension should have one! Note this
does nothing in compiled programs.
write STRING,ADDRESS
writes a copy of STRING starting at ADDRESS.Note if you are
using banks then address must be the actual start of the bank .eg
write "hello",START(10) not write "hello",10.This provides an easy way
to bypass the infamous STOS string bug.It has the advantage over the
copy command in that it will copy strings of non even lengths.
So 10 reserve as data 10,10000
20 write "hello world",start(10)
is equivalent to the following.
10 reserve as data 10,1000
20 s=start(10)
30 a$="hello world"
40 al=len$(a$)
50 for loop=1 to al
60 poke s+loop-1,asc(mid$(a$,loop,1))
70 next loop
cmove INTEGER,INTEGER
Moves the cursor relative to its current postion.Remember to
put a ';' after your print statements otherwise the cursor is moved to
the next line.
cremember
Stores the current cursor position in a safe place.
crecall
moves the cursor back to its cremembered position.These 2
commands mean that you can write subroutines which return the cursor
to its origonal position on exit from the subrountine.
A=add(A,I,L,R)
Adds I to A and then ensures that A is in the range L to R in a
cyclical manner.It is equivalent to the following code
10 A=A+I
20 if A<L then A=R
30 if A>R then A=L
A=exist$(FILENAME$+CHR$(0))
Returns true if the file FILENAME$ exists at the current path , false
if it does not.
Parallel Joystick Commands
Para on/Para off
Initialise/Deactivate parallel port adaptor.
J=parallel(0-1)
Remember those joystick adaptors which plugged into the
parallel port and were used in games like Gauntlet II enabling you
to have 4 players. Well now you can read them from STOS. J
is returned in the following way with the following bits set to 1
if you are performing that action.
bit 0 Up
bit 1 Down
bit 2 Left
bit 3 Right
bit 4 Fire
Because of the fact that one single chip in the ST
controls the printer,sound chip and discdrive , using this command
will deactivate the disc drive (harddrives are unaffected).The para
on command stores the current state of the sound chip ie before the
disc drive is turned off by the parallel command.Using the para off
command restores the sound chip register to its original value
thus restoring the disc drive.
So whenever you want to use the floppy drive after using
the parallel command , use para off.If all else fails type
'boom' or 'shoot' as this also reinitialises the discdrive.The
reason I didn't store and restore the status of the discdrive from
within the parallel command is that it would further slow down
what is already quite a slow process.
eg.
10 para on:rem save sound chip register
.
.
1000 p=parallel(0):rem this will deactivate discdrive
.
.
2000 para off:rem we can now use the floppy drive again.
INTEGER=para right(0-1)
Returns true if the joystick is currently being moved right.
INTEGER=para left(0-1)
Returns true if the joystick is currently being moved left.
INTEGER=para up(0-1)
Returns true if the joystick is currently being moved up.
INTEGER=para down(0-1)
Returns true if the joystick is currently being moved down.
INTEGER=para fire(0-1)
Returns true if the joystick fire button is currently pressed.
Using the parallel commands with STOS Maestro Samples
If you want to use STOS maestro samples with the parallel commands
then make sure that the keyboard click is turned off and that you have
used the sound init command first eg
10 click off:sound init:para on
spread SCREEN_ADDRESS,START_COLOUR,END_COLOUR
spread will produce graduated shades between the colour indexes
START_COLOUR and END_COLOUR.eg if colour 1 was $111 and colour 7 was
$777 then spread logic,1,7 would produce the following colour
values.Note that this will not work correctly on colours which have
the STE's extra bits set.
colour 1= $111
colour 2= $222
colour 3= $333
colour 4= $444
colour 5= $555
colour 6= $666
colour 7= $777
brdr remove TYPE (STFMs only!)
Will remove selected borders depending on the value of TYPE.
TYPE=0 return borders to normal
TYPE=1 bottom border only.
TYPE=2 top border.
TYPE=3 both border!
When using this command you can only read the keyboard by using
HARDKEY command from the misty extension or by peeking the value from
$FFFC02.
Zone Commands
Ever think that 128 zones were too little? well now you can have up to
65536 zones for collison detection.
init mega zone START_ADDRESS,NUMBEROFZONES
Set up replacement zones.You must reserve space for your zones using
either a memory bank or a string and then put the start address into
STARTZONE, the amont of space you need can be calculated by space
=8+NUMBEROFZONES*8.
set megazone START_ADDRESS,ZONENUMBER,X1,Y1,X2,Y2
creates a rectangular zone ,ZONENUMBER with coordinates X1,Y1 to
X2,Y2.
INTEGER=test negazone (START_ADDRESS,X,Y)
Gives you the first zone which contains coordinates X and Y.
range megazone START_ADDRESS,ZONE_S,ZONE_E
Limits subsequent test megazones to a subset of the total number of
zones .This means you can create control panels which can have over-
lapping zones and just test the few you are interestred in.If you want
to reset the tests to the default range use
range megazone START_ADDRESS,1,NUMBEROFZONES
del megazone START_ADDRESS
Deletes all the zones or a subset if you have used range megazone.
hscroll SCREEN_ADDRESS,YSTART,YEND,BITPLANES,NUMBEROFPIXELSTOSCROLL
STOS' horizontal scrolling is appalling , this command attempts to
redress the balance . SCREEN_ADDRESS is as usual . YSTART is the first
line to start the scroll on , YEND is the line to finish the scroll on
.BITPLANES is the pattern of bitplanes to scroll ie %1 , just scroll
bitplane 1, %1111 scroll them all . NUMBER_OF_PIXELS is the number of
pixels to scroll by , if this number is positive then the screen is
scrolled to the right otherwise it is scrolled to the left.Note that
you can only use this command on regular 320 x 200 sized screens.
crack unpac BANK_ADDRESS,SCREEN_ADDRESS,MODE
Crack Art is a wounderful art package and these 2 commands
allow you to pack and unpack lowrez crack art screens . BANK_ADDRESS
and SCREEN_ADDRESS are as normal, if MODE=0 then the palette of the
current screen is not altered , if MODE<>0 then it is.
LENGTH=crack pac SCREEN_ADDRESS,BANK_ADDRESS
As for the STOS pack command
The control extension now includes a complete sprite engine
which is much faster than STOS's existing one . It is similar in
nature to the Missing Link's engine although it is much more flexible
in that you have a variety of choices in how the sprites are placed on
the screen and it is fully compatible with the large hardware scrolled
screens avalaible on the STE . The banks and however are not
compatible with either STOS sprite mbk's or the missing links mbk's or
ICBIS's mbk's.
screen size WIDTH,HEIGHT
This informs the sprite engine what size screens you have set
up for the STE's hardware scrolling .The parameters are the same as
for the hard screensize command from the STE extension . Dont try and
grab screen$ when using screens which are not the usual 320 x 200 ,
because STOS itself is unaware is that the screen size has changed ,
in fact don't try any of STOS's graphics commands on screens that are
not 320 x 200 as you will get very strange results.
quick screen$ SCREEN,X,Y,STRING,MODE
Puts a string stored in screen$ format onto the screen much
faster than its STOS equivalent , plus you can place it on the screen
in either transparent or replace form as well as chooseing whether to
flip it vertically in real time as you plot it.These options are
activated by setting various bits in MODE .
bit 0=0 use replace mode
0=1 use transparent mode
1=0 don't flip vertically
1=1 flip vertically
By using the set clip command you can activate a clipping region .
image put SCREEN_ADDRESS,X,Y,IMAGE_BANK_ADDRESS,IMAGE_NUMBER,MODE
Puts an image NUMBER from bank BANK_ADDRESS onto the screen
SCREEN_ADDRESS using the MODE options from above.Use the program
maker.bas to make these banks.This is a similar command to the Missing
Link's Bob command although it is slightly slower it has far more
flexibilty in that you don't have to store both up and down facing
sprites . This is the only sprite routine avaliable for STOS which is
compatible with the STE's hardware scrolling in that it works on
screens of many different sizes. You can have up to 65536 images in
your bank!
font SCREEN_ADDRESS,X,Y,IMAGE_BANK_ADDRESS,TEXT$
writes a 16 colour font to the screen SCREEN_ADDRESS at the
coordinates X,Y using the images from IMAGE_BANK.Make sure that text$
is in upper case! Use the program maker.bas to make these banks.
eg.
font logic,0,0,start(10),"HELLO"
Note that if you include a chr$(23) in your text string then the
'graphic' cursor will move to the beginning of the next line.
INTEGER=image height BANK_ADDRESS
Gets the height of all the images in the image bank.
INTEGER=image width BANK_ADDRESS
Gets the width of all the images in the image bank.
image palette BANK_ADDRESS
Gets the palette from an image bank.
set clip X1,Y1,X2,Y2
Sets the clipping rectangle for the quick screen$ , image put
and font commands . Note that the X coordinates are rounded to the
nearest multiple of 16.
many image SCREEN_ADDRESS,BANK_ADDRESS,FIRST_XCOORD_ADDRESS,
FIRST_YCOORD_ADDRESS,FIRST_IMAGE_NUMBER_ADDRESS,
NUMBER_TO_PLOT
This plots a large number of images in one go .The images are
all plotted in transparent mode . If bit 31 of an image number is set
then the image is flipped vertically when it is plotted.If any image
number is 0 then that image is not plotted.
eg.
10 mode 0:key off:curs off:hide:flash off
15 dim x(10),y(10),i(10)
20 load "font.mbk",10:st=start(10)
30 for loop=1 to 10
40 x(loop)=loop*32:y(loop)=0:i(loop)=loop
50 next loop
60 many image logic,st,varptr(x(1)),varptr(y(1)),varptr(i(1)),10
Well there you have it. I would like to thank Martin
Cubbit for his excellent articles in the Stosser diskzine which
provided valuable guidence in writing this extension.
Registration
If you would like to register for this extension then
please send a 5 UK pound cheque/postal order or cash to the following
address .
L.J.Greenhalgh
24 Park Avenue,
Rudloe Manor,
Corsham,
Wilts,
SN13 OJT.
England.
email ma2ljg@ss1.bath.ac.uk (valid until june 1995)
+----------------------------------------------------------+
|Please except my registration for the control extension |
+----------------------------------------------------------+
|I wish to pay by cash/cheque/postal order |
+----------------------------------------------------------+
|Machine owned |
+----------------------------------------------------------+
|Bugs |
| |
| |
+----------------------------------------------------------+
|Ideas for new commands |
| |
| |
+----------------------------------------------------------+
|Please send my registration package to: |
| |
| |
| |
| |
| |
| |
| |
+----------------------------------------------------------+