************************************************************************* * * * AMOS 1.3 TURBO extension library v1.5 * * * * * * Idea's and improvements may be sent to : * * * * MANUEL ANDRE * * Prins Boudewijnlaan 155/5 * * 2610 WILRIJK * * * * BELGIUM * * * * * * DIAL 03/449.54.18 * * * * I'm also searching for an AMOS-CLUB in BELGIUM... * ************************************************************************* %%% !!!! To all users : read this doc-file carefully... !!!! %%% %%% !!!! Some commands are very difficult to use, so be warned !!!! %%% %%% !!!! If you don't know what you are doing, many crashes !!!! %%% %%% !!!! will come to visit you... !!!! %%% %%% !!!! Commands to be extremely carefull with are : !!!! %%% %%% !!!! Multi Blit !!!! %%% %%% !!!! Reserve Stars !!!! %%% %%% !!!! Display Stars !!!! %%% %%% !!!! F Stars !!!! %%% %%% !!!! Stars Int On !!!! %%% %%% !!!! Blit Int On !!!! %%% *** !!!! This version has some commands which are no longer !!!! *** *** !!!! compatible with the TEST EXTENSION...so take my advice.!!!! *** *** !!!! BEFORE installing the TURBO extension you should save !!!! *** *** !!!! all your programs that are using commands from the !!!! *** *** !!!! TEST EXTENSION in ASCII format. !!!! *** *** !!!! Afterwards you can install the TURBO EXTENSION in the !!!! *** *** !!!! extension list using the CONFIG program. !!!! *** *** !!!! I use the same extension number (nr. 8). Don't forget !!!! *** *** !!!! to copy the file TURBO.LIB into your AMOS_SYSTEM dir. !!!! *** *** !!!! Reboot AMOS and load your ASCII-saved programs. !!!! *** *** !!!! You can save them now (after testing them) in AMOS !!!! *** *** !!!! format. !!!! *** *** !!!! As you can see, the name of my extension has changed...!!!! *** *** !!!! It seemed rather silly to keep up the name TEST, !!!! *** *** !!!! so I've changed it into TURBO EXTENSION !!!! *** *** !!!! !!!! *** *** !!!! I would like to thank the people who support me in my !!!! *** *** !!!! hard and time-consuming work : my wife DOMINIQUE, !!!! *** *** !!!! WIM PEETERS, CHRIS MINNOY, MARC DE PAUW, ERIC FIEVEZ, !!!! *** *** !!!! HERMAN STEVENS, SynTAX/TsL, JOHAN FABRY, THE GRIFTER, !!!! *** *** !!!! MICHAEL COX and all other persons who are using this !!!! *** *** !!!! extension... !!!! *** ========================================================================= *** !!!! Ok guys ! V1.5 has arrived...Without BUGS ??? !!!! *** *** !!!! I don't know...It just happens that I don't have !!!! *** *** !!!! the time for TESTING my own extension ! !!!! *** *** !!!! --->>>> So write me and test this extension! <<<<--- !!!! *** ========================================================================= *** !!!! You can contact me at the following BBS numbers !!!! *** *** !!!! Great Balls Of Fire : 016/640.912 !!!! *** *** !!!! leave a message to Manuel Andre !!!! *** *** !!!! Oberon : 02/731.34.89 !!!! *** *** !!!! leave a message to Manuel Andre !!!! *** *** !!!! Sin City : 03/825.22.74 !!!! *** *** !!!! leave a message to madmax !!!! *** *** !!!! !!!! *** *** !!!! --> You can call me at home : 03/449.54.18 <-- !!!! *** *** !!!! ask for Manuel !!!! *** *** !!!! !!!! *** *** !!!! Leave a message ONLY if YOU are a REGISTERED AMOS user !!!! *** *** !!!! and I will answer your questions as soon as possible !!!! *** *** !!!! I'm working in shifts...so have a little patience... !!!! *** *** !!!! !!!! *** *** !!!! Thank YOU ! !!!! *** ========================================================================= *** !!!! New commands to be expected in the next release ??? !!!! *** *** !!!!........................................................!!!! *** *** !!!! Ok, plans for the near future : !!!! *** *** !!!! GIVE ME SOME IDEA'S ??? !!!! *** *** !!!! Plans for MED/OCTAMED support are dropped !!!! *** *** !!!! because AMOS PRO supports MED ! !!!! *** *** !!!! !!!! *** *** !!!! ANY SUGGESTIONS FOR OTHER COMMANDS ??? !!!! *** ========================================================================= ^^^ ???? Special information ???? ^^^ ^^^ ????........................................................???? ^^^ ^^^ ???? ???? ^^^ ^^^ ???? There are only some commands that are fully ???? ^^^ ^^^ ???? compatible with the AMOS Double Buffer process ! ???? ^^^ ^^^ ???? Cfr.: F Plot. Still all other commands can be used ???? ^^^ ^^^ ???? if you set Autoback to zero (0). ???? ^^^ ^^^ ???? Read the AMOS manual for better understanding of ???? ^^^ ^^^ ???? this technique. Also look in the DEMOS dir for some ???? ^^^ ^^^ ???? ready to run examples. (ASCII format) ???? ^^^ ^^^ ???? ???? ^^^ ^^^ ???? ==================================================== ???? ^^^ ^^^ ???? ???? ^^^ ^^^ ???? It seems that many people have problems in using the ???? ^^^ ^^^ ???? new BLITTER commands when double buffering is enabled.???? ^^^ ^^^ ???? So I've included a little demo that shows how to deal ???? ^^^ ^^^ ???? with it. --> DOUB_BUF_SCROLL.ASC <-- in the DEMOS ???? ^^^ ^^^ ???? directory. ???? ^^^ ^^^ ???? ???? ^^^ ^^^ ???? ==================================================== ???? ^^^ ^^^ ???? ???? ^^^ ^^^ ???? How do you get the best speed results ? ???? ^^^ ^^^ ???? When the program is NOT compiled, the interpreter ???? ^^^ ^^^ ???? has to search through all commands to find the adress ???? ^^^ ^^^ ???? of the routine to be executed...so a lot of precious ???? ^^^ ^^^ ???? time is wasted ! ???? ^^^ ^^^ ???? So, for best speed you should COMPILE your programs ???? ^^^ ^^^ ???? with the WB or CLI option ! And your pants will be ???? ^^^ ^^^ ???? ripped off !!! ???? ^^^ ========================================================================= ** I've included some demo's in ASCII format in the DEMOS dir. ** Include this extension in the extension list as extension nr. 8. ** Change all your config files with the AMOS configuration program ! More information about this in the source file. --> new_extension.s MISCELLANEOUS INSTRUCTIONS : ----------------------------- Multi Yes : enables multitasking. Multi No : disables multitasking. Gives about 10% speed increase... watch out !!! if you disable the multitasking process, you disable the keyboard. So allways enable multitasking if you want some input from the keyboard ! Vbl Wait x : wait until the raster beam has reached a given value. value must be between 0-256 ! I've implemented this one because Wait Vbl doesn't work if you disable interrupts... It also gives a better screen synchronisation than the original Wait Vbl command. Ex.: 'Let's take a standard screen... Screen Open 0,320,200,8,Lowres 'And lot's of scrollers... _SCROLL_NR=0 For I=0 To 100 Step 10 Inc _SCROLL_NR Blit Store Left 0,_SCROLL_NR,0,0 To 320,I,-1 Next I 'So the maximum Y value of the screen that will be 'SCROLLED is 100. The other screen lines will not 'be affected by the scroll. So it has no point waiting 'until the raster beam has reached the TOP of your 'screen before executing your scrollers ! Repeat ' WAIT UNTIL LINE 101 OF YOUR SCREEN IS REACHED... Vbl Wait 101 ' AND EXECUTE THE SCROLLS Multi Blit 1 To 10 Until Mouse Click 'Ok, let's give some more information about this 'procedure... 'A screen display is made of lines and they 'are scanned from the top of the display (line 0) 'to the bottom (line 312 --> PAL, line 262 --> NTSC). 'Now comes the tricky part...It is possible to alter 'anything on the screen even if the raster beam is 'allready further than the area of the screen to be 'changed ! It will only be visible during the next 'scan of the screen. So you are able to use the SCAN 'LINES (more processing time) that are not used by 'the actual screen for displaying more BOBS,SCROLLERS,... 'And this without any annoying flicker on your screen ! 'Sometimes it takes some experimentation to find the 'right value. But a smoother display is guaranteed ! MISCELLANEOUS FUNCTIONS : -------------------------- X=Lsl.b(x,y) : bytewise logical shift to the left. ex.: ANSWER=Lsl.b(value,shift count) A=Lsl.b(5,1) gives A=10 A=Lsl.b(C,1) gives A=10 with C=5 X=Lsl.w(x,y) : wordwise logical shift to the left X=Lsl.w(x,y) : long logical shift to the left The same commands exist for logical shifting to the right... X=Lsr.b(x,y) X=Lsr.w(x,y) X=Lsr.l(x,y) X=L Swap(x) : does the same thing as the machine-language instruction... ex.: A=$FFFF1111 B=L Swap(A) gives B=$1111FFFF X=Test.b(x,y) : compares the lower 8 bits of a variable with a given value results 0 if false -1 if true X=Test.w(x,y) : compares the lower word of a variable with a given value results 0 if false -1 if true X=Raw Key(n) : does the same thing as the Key State function but works even if multitasking is disabled ! Thanks SyNTAX/TsL for a new version that works on all AMIGA versions !!! X=Left Click : I've implemented this function because it seems that when multitasking is disabled the Mouse Key function isn't working anymore... Now you can check for the LEFT mouse-button !!! Returns TRUE if left mouse is pressed... Additinal Zone commands : ------------------------- These commands can be mixed with the normal Zone commands. X=Hit Spr Zone(dx,dy,n) : checks if sprite number N enters a zone. dx and dy are optional. Does the same thing as : A=Hzone(X Sprite(n)+dx,Y Sprite(n)+dy) But it is shorter and faster ! (20 to 50 %) X=Hit Bob Zone(dx,dy,n) : checks if bob number N enters a zone. dx and dy are optional. Does the same thing as : A=Zone(X Bob(n)+dx,Y Bob(n)+dy) But it is shorter and faster ! (20 to 50 %) New Zone commands : ------------------- These commands are not compatible with the normal Zone commands ! Reserve Check x : reserves x check ZONES for my own ZONE (check) routines. Check Erase : releases the memory used by Reserve Check Reset Check z : does allmost the same thing as Reset Zone....except the zone number must be given. Set Check z,x1,y1 To x2,y2 : does the same thing as the Set Zone command. X=Check(start To end,x,y) : Checks if the given coordinates x,y are within a zone. The start and end parameters indicate which zones you want to check. Ideal if there are many zones and you want to exclude some zones... X=Hit Spr Check(start To end,dx,dy,n) : Checks if sprite number N has entered a zone, dx and dy are optional and give a dis- placement in opposite to the sprites hot spot. The start and end parameters indicate which zones you want to check. Ideal if there are many zones and you want to exclude some zones... New graphics instructions : --------------------------- R Move dx,dy : moves relative to the graphics cursor does the same thing as: Gr Locate Xgr+dx,Ygr+dy but is shorter and faster... R Draw dx,dy : draw a line relative to the graphics cursor does the same thing as: Draw Xgr,Ygr to Xgr+dx,Ygr+dy but is shorter and faster... R Box dx,dy : draw a box relative to the graphics cursor. does the same thing as: Box Xgr,Ygr to Xgr+dx,Ygr+dy but is shorter and faster... R Bar dx,dy : draws a filled bar relative to the graphics cursor. does the same thing as: Bar Xgr,Ygr to Xgr+dx,Ygr+dy. but is shorter and faster... Object Limit X : Sets the maximum amount of objects. You MUST set the limit before you can reserve and define the objects. When X is set to zero, the OBJECT structure is erased from memory. In the previous versions of TURBO and TEST EXTENSION you could define max. 32 objects. Now there are no more limits ! You can define upto 32.000 objects. Old object files are compatible with the new ones ! Reserve Object Chip OBJECT,COUNT : reserves COUNT*6 bytes CHIP memory for object OBJECT. At this point you can define upto 32 objects. Ex.: you want to define object number 5 with 10 vectors ( 10 Draw or Move definitions) Reserve Object Chip 5,10 Reserve Object Fast OBJECT,COUNT : reserves COUNT*6 bytes FAST memory for object OBJECT. At this point you can define upto 32 objects. Define Draw OBJECT,ELEMENT To X,Y : Defines vector ELEMENT in object OBJECT as a Draw instruction with X and Y as the coordinates. In opposite to older versions, negative coordinates are now allowed ! Define Move OBJECT,ELEMENT To X,Y : Defines vector ELEMENT in object OBJECT as a Move instruction with X and Y as the coordinates. In opposite to older versions, negative coordinates are now allowed ! Define Stop OBJECT,ELEMENT : Defines vector ELEMENT in object OBJECT as a Stop instruction. Now you can Reserve memory for as many VECTORS as you wish, and you don't have to Define all VECTORS at the beginning of your program! Just put a Stop instruction as the LAST VECTOR... You can add some more VECTORS, just by replacing the Stop instruction by a Define Move, a Define Draw or a Define Attr ! !!! Make sure that the last ELEMENT of an OBJECT definition is !!! !!! a Stop instruction. And nothing unpredictable will happen. !!! Define Attr OBJECT,ELEMENT To COLOUR,DRAWMODE : Defines vector ELEMENT in object OBJECT as an Attribute instruction. Now you can change the Colour and the Drawing-mode in an Object definition. Object Draw OBJECT : Draws object OBJECT as defined in the vector table. R Object Draw OBJECT,X,Y : Draws object OBJECT as defined in the vector table but relative to the X and Y coordinates. Object Mag Draw OBJECT,MUL : Draws object OBJECT as defined in the vector table but the OBJECT coordinates are first multiplied with factor MUL. If you give a negative MUL factor the OBJECT coordinates are divided by factor MUL. R Object Mag Draw OBJECT,X,Y,MUL : Draws object OBJECT as defined in the vector table but relative to the X and Y coordinates and the OBJECT coordinates are multiplied with factor MUL. If you give a negative MUL factor the OBJECT coordinates are divided by factor MUL. Object Erase OBJECT : Erases object definition OBJECT and frees the allocated memory. Allways discard all the Object definitions before quitting AMOS. If not, the reserved memory will be lost... Object Save "NAME",START To END : This instruction will save all DEFINED objects from object START to STOP into object-file "NAME". If "NAME" > 80 chars nothing will happen... If an object is not defined, it will skip to the next object until END is reached. It also writes the header "OBJE" at the beginning of the file. Object Load Chip "NAME",START This instruction loads the file "NAME" and checks if it is an object file. (It checks for the header "OBJE" at the beginning of the file.) If it is an object file, it will define and load all object definitions into object nr. START onwards. How many objects are to be defined is taken out of the object file. Ex.: Define Object chip(1,20) Define Object Chip(2,10) Define Object Chip(3,50) Define object Chip(4,5) Define Move ..... Define Draw ..... " " " " Object Save "DF1:OBJECT1_TO_4",1 To 4 Object Load "DF1:OBJECT1_TO_4",5 This will define and load object 5 to 8. Object Load "DF1:OBJECT1_TO_4",2 will not work. First you must discard objects 2 to 5 !!!!! Maybe I'll change this in the future... Line 3d X,Y,Z To X1,Y1,Z1 : Will draw a line from (X,Y,Z) to (X1,Y1,Z1) in three- dimensional space. To do this I assume a fixed eye position. Further I take the eye position as the origin. To form a perspective view, we need to define a "vanishing point", a theoritical point at which all diminishing parallel lines meet. If you were standing on the white lines in the middle of a straight road and you looked along th road towards the horizon, the vanishing point would be where the white line and the two road edges meet. By taking this eye position, our perspective calculations can be simplified to : X=X*D/Z and Y=Y*D/Z... Where D is the distance between the eye position and the picture plane (the screen). The value I use for D=128. So the greater the value of 'Z' the further away the object and therefore the smaller the resultant 'X' and 'Y' values. This implies that objects appear smaller at a distance ! Eye 3d X,Y : This instruction changes the "point of view" in opposite to the picture plane. If not initialised when using the Line 3d instruction X will have a value of 160 and Y a value of 100. F Plot X,Y,COLOUR : This instruction does the same thing as the normal AMOS Plot instruction, except that it is 2 to 3 times faster than the standard AMOS version and that you must give the COLOUR parameter ! F Plot is now fully compatible with the AMOS double buffering process ! R=F Point(X,Y) : This function does the same thing as the normal AMOS Point instruction, except that it is 2 to 3 times faster than the standard AMOS version ! Blit Store Left screen,blitnr,x,y to x1,y1,shift : Blit Store Left allows you to define up to 96 different scrolling zones. Each of these zones can be associated with a specific scrolling operation which is determined by the variable SHIFT. SCREEN defines the screen that you want to scroll. BLITNR holds the number of the zone and can range from 1 to 96. X,Y refer to the coordinates of the top left-hand corner of the area to be scrolled and X1,Y1 to the point diagonally opposite. The routine now automatically chops the X and X1 values so that they allways ly on a 16 bit boundary ! Ex.: 198 will become 196 , 307 will become 304 SHIFT, if this value is positive the zone will be shifted to the right. Negative values indicate that the scrolling will be to the left. SHIFT values range form -15 to +15. Multi Blit start To end : The Multi Blit command scrolls the screen using the settings you have specified with the Blit Store Left instruction. START and END refer to the zones you wish to scroll. !!! Allways be sure that the screens where you have defined scrolling zones are OPEN when you use this command, if not a crash will be certain. !!! If you have defined only 1 zone you should type : Multi Blit 1 To 1 So with this command you can scroll up to 96 zones in one go ! Why is the Multi Blit command so much faster than the original Scroll command from AMOS ? : speed is gained on two points : A) the BLIITER is fed directly with precalculated values. B) I only use the A and D blitter channels, the Scroll command uses the B,C and D channels. Blit Int On start To end : This command adds a new interrupt server to the VBLANK server chain which will do the same thing as the Multi Blit command ! So the Multi Blit command is now executed every Vbl and is running totally independent of your AMOS PROGRAM ! !!! Allways be sure that the screens where you have defined scrolling zones are OPEN when you use this command, if not a crash will be certain. !!! Advantages : Time is saved for your AMOS PROGRAMS. You don't have to wait for the Vbl to synchronize the Scrolling with your screen display. Disadvantages : None. Hmm... Blit Int Off : Turn off the 'BLITTER' interrupt. Blit Speed blitnr,shift : With this command you can change the SHIFT (speed) value after you have defined a scrolling zone. Only use positive values, it determines itself if the defined scrolling zone is scrolling to the left or to the right ! Blit Erase blitnr : Erases and frees the memory used by a particular scrolling zone. Allways erase all scrolling zones before quitting AMOS or the memory used will be lost ! Blit Left screen,x,y To x1,y1,shift : Does the same thing as the Blit Store Left command except that the scroll will be immediately executed. This command is still much faster than the AMOS Scroll command ! Blit Clear X: This is a simple command for clearing any bitplane of a screen. If X is negative, all bitplanes of a screen willl be erased. But if X is positive (0 excluded), then the X vaue refers to the bitplane that has to be cleared ! An 8 colour screen has 3 bitplanes, 1 -> 3 ! It is about 80 % faster than the Cls command ! Reserve Stars COUNT : Reserves memory for COUNT "STAR" definitions. It also computes in advance the address of the start of every line. This is done for more speed when displaying the 'STARS'. You can calculate the amount of memory needed with this formula: COUNT*8+Heigth of screen*2 At this point you can reserve memory for 4000 'STARS'... So with 4000 'STARS' in a 320 by 250 screen, 32500 bytes are reserved. Define Star NR,X,Y,X SPEED,Y SPEED : Defines 'STAR' NR. X and Y are the initial coordinates of the 'STAR'. X SPEED and Y SPEED define the speed of the 'STAR'. So your 'STARS' can fly in any direction ! Display Stars : Displays the 'STARS' onto the screen and computes the next position of the 'STARS' depending on the X- and Y SPEEDS. I use only 1 bitplane (the first one), so only 1 coloured 'STARS' are possible... But you can change the colour of them with the Palette or Colour instructions ! This also counts for the F Stars command. I use the main processor (the MC68000) for displaying the 'STARS'. So people who have an A3000 or accelerator boards can display many more... Limits on a 68000 system (7.14 Mhz) only 'STARS' displayed : If you use only a X SPEED (Y SPEED = 0), then 670 'STARS' can be displayed in 1 VBL. If you use only a Y SPEED (X SPEED = 0), then 660 'STARS' can be displayed in 1 VBL. But if you use both speeds (X- and Y SPEED <> 0), then 540 'STARS' can be displayed in 1 VBL. !!! Allways be sure that you are displaying the 'STARS' on the screen where you reserved them. This is because I store the start- offsets of every line from the current screen when reserved. This technique gives more speed when the 'STARS' are displayed !!! Stars Speed START To END,X SPEED,Y SPEED : Changes the speed of 'STARS' START To 'STAR' END with the values X SPEED and Y SPEED. F Stars : Displays the 'STARS' onto the screen without computing the next 'STAR' position. So your 'STARS' can be freezed without changing the SPEED of them ! !!! Allways be sure that you are displaying the 'STARS' on the screen where you reserved them. This is because I store the start- offsets of every line from the current screen when reserved. This technique gives more speed when the 'STARS' are displayed !!! Stars Compute START To END : Computes the next position of the 'STARS' START To END without displaying them on the screen. Stars Erase : Gives back to the system the memory used by the Reserve Stars command. Allways erase your 'STARS' before you leave AMOS or the memory will be lost ! Stars Clip X,Y,X1,Y1 : The Stars Clip instruction limits all 'STARS' to a rectangular region of the screen. X,Y represent the coordinates of the top left corner of the rectangle, and X1,Y1 hold the coordinates of the bottom right corner. This instruction works fine now as it is, but is not really finished yet...somethimes you don't get what you want ! The clipping is only implemented in the Display Stars and in the Stars Int On instruction. Stars Int On CLEAR : This command adds a new interrupt server to the VBLANK server chain which will do the same thing as the Display Stars command ! So the Display Stars command is now executed every Vbl and is running totally independent of your AMOS PROGRAM ! If CLEAR <> 0 the display will be cleared before displaying the 'STARS'. This is the 'AUTOMATIC CLEAR MODE'. Only the 'STARFIELD PLANE' is cleared, this is the first bitplane. !!! Allways be sure that the SCREEN where you have reserved the 'STARS' remains open when the 'STARS INTERRUPT' is on. Otherwise a crash will be certain...I store the SCREEN ADRESS of the screen where the Reserve Stars command was executed. So the 'STARS' will only be displayed in that particular screen. !!! Advantages : Time is saved for your AMOS PROGRAMS. You don't have to wait for the Vbl to synchronize the display of the stars with your screen display. Disadvantages : Only the X-speed is changed (for more speed). Can't be used with Double Buffered screens even if Autoback is set to 0 (zero). I'll try to fix this in the future. Stars Int Off : Turn off the 'STARS' interrupt. F Circle X,Y,Radius,Colour : Does the same thing as the normal Circle command but this new version is up to 550 % (for big circles) faster than the ori- ginal AMOS BASIC version ! For smaller circles you get a speed factor lying around 250 to 400 % ... All parameters are the same as in the normal Circle command except that you must give a colour ( C ) parameter... At this point you can only use this command in LOWRES screens or HIRES+LACED screens. Try it in a normal HIRES screen and you'll see what I'm talking about... There is a known bug in this command, do not use a radius above 180...there will be no crash, but the result is definitely not a circle ! F Draw X,Y : Does the same thing as Draw To X,Y. But it is up to 200% faster than the original Draw routine ! (2 bitplane screen) The Set Line MASK command has no effect when using F Draw, this will be corrected in the next version ! F Draw X,Y To X1,Y1 : Does the same thing as Draw X,Y To X1,Y1. But it is up to 200% faster than the original Draw routine ! (2 bitplane screen) The Set Line MASK command has no effect when using F Draw, this will be corrected in the next version !