home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
aminet
/
amos136.dms
/
amos136.adf
/
About_AMOS_1.36
< prev
next >
Wrap
Text File
|
1993-03-15
|
55KB
|
1,485 lines
-----------------------------------------------------------------------------
AMOS BASIC VERSION 1.36 UPDATER
By François Lionet
AMOS (c) 1990 / 1991 / 1992 / 1993 Europress Software Ltd.
-----------------------------------------------------------------------------
Important copyright notes
---------------------------
The AMOS Basic 1.36 Updater is public domain. You can (and you
are encouraged to) copy and distribute it freely. It does not mean
AMOS Basic itself is public domain. Copyright remains on the
interpreter, and on the updated version.
You need AMOS Basic V1.1, V1.21, V1.23, V1.3, V1.31, V1.32, V1.34
to make the adaptation.
------------------------------------------------------------------------------
Move the mouse pointer to read the text.
------------------------------------------------------------------------------
Foreword.
-------------------------------------------------------------------------
Welcome to a new update of AMOS! This update of the software brings you
only one new thing, but a big one: it works on a AA machine. You can now
start AMOS from a AA workbench, and flip between them as normal.
If you own V1.34 of AMOS, you will find that this is the only modification
to the software. If you intend to compile programs and make them available
to the Amiga community, make sure that you compile them with Compiler
V1.36, which also works under the AA chipset. The V1.36 Compiler Updater
is also available in PD.
If you own a previous version of AMOS, this version will bring you a much
safer environment, better accessories: a lot of work has been done
between V1.2 and V1.34 of AMOS... Make sure you read all the documentation
to receive all the information about the new instructions...
All the best! François 01/02/1993.
Contents.
---------------------------------------------------------------------------
* Enhancements to V1.34
* Bugs removed from V 1.31
* New instructions in V 1.36
* Manual main bugs
* Safe AmigaDos EXECUTE function
* Time and Data procedures
* Modifications up to V 1.2x
- Bob flipping
- Serial port (modified since V1.23!)
- Multi-tasking
- Folders
- Interlace
- Other bits
- Converting your 1.2 .Env file to 1.3
Introduction.
-----------------------------------------------------------------------------
AMOS Basic has gone through a number of changes during the course of its
existence. Rather than rest on our laurels, we've steadily updated the
system to include many new features suggested by AMOS users. Incredibly
enough, we've placed these improvements on the public domain. Special
updater discs are available from the official AMOS PD. library or your local
PD. library. So whatever your version of AMOS Basic, you can upgrade to the
latest system for the price of a disc.
Here's a list of the versions of AMOS Basic to date:
AMOS 1.1
The original!
AMOS 1.2
This included several new commands such as a BANK SWAP. There was also a
whole new set of SPRITE flipping routines introduced which allowed you to
display a single image in several orientations.
The file-selector was completely reworked, and allowed you to
change the current disc by pressing the RIGHT mouse button and simply
clicking on the new device name with the mouse. The UP/DOWN arrows were
repositioned at the top of the scroll bar for maximum speed, and the
PARENT button was repositioned to the far left corner and reduced in
size.
AMOS 1.23
Added the SERIAL extension, SPRITE compactor and procedure locking utility.
AMOS 1.3
This version comes with the compiler and includes a range of turbo-charged
Bob and screen copy routines written by Gary Symons. These optimise the
performance of commands such as SCREEN COPY and PASTE BOB/ICON, leading to
dramatic speed improvements in many games.
AMOS 1.31
Only minor internal modifications done since version 1.3.
AMOS 1.34
By cleaning up the code dramatically, we've been able to get rid of many
little but annoying problems. It also includes major enhancement to the
music routines.
AMOS 1.36
AMOS now works on a AA machine.
Improvements (from 1.31).
-------------------------------------------------------------------------
* AMOS now works on a AA machine.
You can as usual flip between a AA workbench and the AMOS Program.
The new method used on a AA machine makes it impossible to work under
interrupts. That's why you will discover that it Amiga-A does not respond
when a disc activity is taking place, but only when disc access is over.
The new method used on a AA machine makes it impossible to work under
interrupts. That's why you will discover that it Amiga-A does not respond
when a disc activity is taking place, but only when disc access is over.
* Versions.AMOS. This little program will explore the whole contents
of your AMOS_System directory, and load the beginning of each file.
It will look for a special string that contains the version number,
and display it onto the screen.
You will know at a glance all the version numbers of your programs!
* The directory system has been totally re-written.
You can now, safely use DIR$= to set the current directory, and it does not
leave a Lock as it used to.
More than that, =DIR$ does not crash any more when it cannot find a disc
in the drive.
The file selector now automatically sets the dir to the current path when
you select a file. Note that the SET DIR button still works, if you want
to quickly set the directory, without loading a file.
To sum-up, AMOS now has one current path, automatically set by the file
selector or by the DIR$= instruction.
* Hexadecimal and binary tokenisation now stops on spaces. It makes possible
to tokenise such a line:
If A=$1234 And B=2
It was impossible before, as the A of "And" was used as part of the hexadecimal
number!
* AMOS now closes the workbench under 2.0. If you want to prevent that,
you have to use the configuration program, in the SET EDITOR menu.
New in version 1.36, the CLOSE WORKBENCH instruction will not have any
effect if you choose not to close the workbench in the configuration
program.
More than just preventing AMOS from closing the workbench upon loading, it
is preventing any AMOS program from closing it.
You are now the master of your own Workbench!
* The Requester now appear under AMOS on a 2.0 system. It does not crash as it
used to sometimes under 1.3. The disc-inserted detection has been improved,
it detects all disc-changes now. It also works with one option requesters.
* The disk-font library only loads when you call it the first time. It means
you may have to re-insert the Workbench disc upon running a new program, as
you would do if it was using floating point numbers.
* Load IFF accepts new colour palettes, with colours defined on 8 bytes,
instead of 4 (this palette are saved by some new software).
* Physical drives are now listed in the device list (in file selector and
in =Dev First / =Dev Next). Some devices (like "Work:") are defined in both
logical and physical list. You will find them twice in the list. This is
normal!
* Copy now works with ODD addresses, and ODD lengths. I should have done this
improvement much sooner.
* You can now recover from an "Out of variable space" error, it does not
stop the program as it used to. All you'll have to do in this case, is free
a couple of strings from memory.
* Sound samples of any length are perfectly played.
* Autoback 2 mode does not produce a flash in the bobs as it used to,
sometime. It gives a much better display. On the other hand, pasting and
printing in this mode will take one VBL longer than before.
Bugs removed (from V1.31).
--------------------------------------------------------------------------
* ICONS used to be in transparent mode upon loading, instead of being
in replace mode, as stated in the manual.
* CBLOCK did not work for blocs larger than 480 pixels.
* The inactive mouse-zone (when the mouse pointer was exactly over the top
of the horizontal slider, no keyboard input was processed) has been removed.
* The disappearing line bug has been removed from the editor!
* Def Fn does not crash any more with no parameters.
* Set Rainbow does not crash with negative parameters in definition strings.
* Error n instruction now reports errors over 50.
* AMOS now saves Workbench icons properly, not all placed over each other, as
it used to!
* EVERY command works fine. At last.
* PLOAD used to leave a lock in the system.
* =DRIVE() does not display a requester if the device does not exist. This
was really stupid, as this instruction was used to determine existing devices!
* Music banks are now detected upon running. It means you can safely save
them with the program.
* Arrays now work fine when you access elements higher that 65536.
* On Menu Proc used to block the machine under certain circumstances.
* Bobs can now be displayed on VERY large bitmaps.
* Marks did not work on A3000.
* Opening procedures with errors within, used to position the cursor at
the beginning of the text.
* INPUT #x,A$(n) did not ask for a proper string space. The result in
worse cases was a crash, as the incoming string erased crucial AMOS pointers.
* Note on serial interface problems.
A lot of users have reported to us problems when they were using the serial
extension. Their programs used to work the first time, and crash on
the next RUN.
Amazingly enough, this bug does not come from AMOS, but from Commodore.
Commodore released a few years ago a bugged version of the serial.device.
Bad luck, this bugged version happened to be duplicated on our AMOS Master.
At that moment we didn't realise this. As soon as we were made aware of the
problem, we re-mastered the AMOS discs. But too late, some version of AMOS
have got the wrong device.
The updater will save a good version of the serial.device on
the copy of your AMOS Master.
New music instructions.
-----------------------------------------------------------------------
The music extension has been considerably enhanced. We've listened to your
requests:
* Playing Soundtracker modules.
SoundTracker is moving too fast for us. Every month or so, a new program
pops up, with new instructions, making the SoundTracker converter obsolete.
The SoundTracker converter works fine with modules up to NoiseTracker V2.0.
Above this version, some effects may be badly converted.
Anyway, you thought that this converter program was not a very good idea.
That's why we have directly implemented a Tracker player in the music
extension. The chosen one is "Startracker player", because it contains
all the latest and main effects (today!), and it has the ability to play
synthetic instruments.
Here are the new instructions:
TRACK LOAD "Name_Of_The_Module",Bank
------------------------------------
Load up a tracker module into a chip memory bank. It will of course it reserve
the bank for you, and choose the correct bank size.
If AMOS detects a Startracker synthetic instrument file (which must have
a ".NT" extension appended to the file name), it will load it AS WELL into the
bank. In fact you don't have to worry about it.
TRACK PLAY [Bank],[Pattern]
---------------------------
Plays a tracker module loaded into a bank.
"Bank" is the number of the bank to be played. If omitted, it is the last loaded
with the TRACK LOAD instruction, or upon running, bank number 5.
"Pattern" is the first pattern to be played. Use this with caution, as NO CHECK
is done on the number of the pattern. You can very simply crash the computer
by giving a bad value. This parameter is intended to allow you to have
more than one music in a tracker bank...
TRACK LOOP ON / OFF
-------------------
Enable or disable looping when the tracker music is finished.
TRACK STOP
----------
Stops a tracker music being played.
IMPORTANT NOTES:
-----------------
The Tracker-playing instructions are implemented to give you a quick way
of playing modules. It is not as powerful as the normal AMOS music system.
For example :
* Do not play a normal AMOS music while playing a tracker module,
this can lead to unpredictable results.
* Do not start any sample, or sound effect when a Tracker module is played.
* A Tracker module uses and initialises all four voices, even if your music
is only on 3 or 2. So do not play any sample on the other voices you think
are free. They are not!
* VOLUME instructions do not have any effect on the Tracker music, but
=VU METER works fine with a Tracker module.
... if you want to make sound effects while a music is playing, then you
should use the Soundtracker converter, and the normal AMOS Music system...
Improvements in sample playing:
--------------------------------
Here again we have listened to your complaints! You'll be happy to
know that you can now play samples of any length, and that the small
tick at the beginning have been removed.
But much more than that, we have made it possible to play samples bigger
than the actual memory of your Amiga, with the new double-buffer
sample instructions.
Floppy users : sorry, these new instructions will not be useable by you,
but at a very low sample playing rate (like 4000-5000 Herz). The disc
data output speed is just too low.
Theses new instructions were designed mainly for CDTV and multimedia
purposes...
A working example of this instruction is given in the file
"Sample_Double_Buffering.AMOS" you will find on your updated disc.
I have commented this example very carefully, so that everything is clear
to you.
Before running this example, you have to create (or grab) a sound-sample,
any size (preferable big), and copy it onto your hard-drive. You can
easily understand that we could not put a 2 Megabytes sample on the
updater disc!
SLOAD File_Number,Length TO Address
-----------------------------------
A new instruction intended to load parts of a sample, but it can be used
in many other ways.
This instruction is an extended BLOAD
"File_Number" is the number of a file opened previously with the
OPEN IN File_Number,"Name" instruction.
"Length" is the number of bytes to load. If this number is bigger than
the actual size of the file, then only the remaining bytes are loaded, without
errors. You'll get an error if you try to load once more after the end has
been reached.
"Address" is the destination address. Of course, the memory must have been
previously reserved.
The advantage of this instruction, is that you can set the position of the
file pointer with the POF()= instruction before using SLOAD. As you can see,
this instructions can have a lot more usage than just loading samples...
SAM SWAP Voices TO Address,Length
---------------------------------
This instruction initialise the sound-swapping. The actual swapping will only
occur when the actual buffer has been totally played through the speaker.
The swap is done under interrupts, so you will not hear any tick in the
sample.
"Voice" is a bit pattern to define the voice concerned, just like in the
SAM RAW instruction.
"Address" is the address of the next buffer to play. Of course, it must
be in chip memory.
"Length" is the number of bytes to play.
=SAM SWAPPED(Voice_Number)
--------------------------
This function returns a boolean value (TRUE -1, or FALSE 0). It is the
key function in synchronising double buffer players.
"Voice_Number" is the number of the voice you want to have information
about (0 to 3). Do not make mistake, is it NOT a bitpattern.
It returns TRUE if the sample swapping has occurred, it means the new buffer
you have initialised with the SAM SWAP instruction is being played at the
very moment. It returns FALSE if not.
Practically, you can only load a new part of the sample in the free buffer,
when the SAM SWAPPED instruction returns you a TRUE value. It returns FALSE
if the sample swapping has NOT happened.
SAM STOP [Voice_Pattern]
------------------------
This simple instruction seems to have been forgotten in the instruction
set since the beginning. The only way to stop a sample playing, was to
use the PLAY instruction!
"Voice_Pattern" is a bit pattern defining the voices to be stopped, like in
the SAM RAW instruction. All voices will be affected if you omit it.
NOTE: it is perfectly possible to have an AMOS music bank playing on 2
voices, and double-buffered samples playing on the last 2. (hey, but not
a Tracker module, if you remember what I told you!)
Other new instructions (from 1.31).
---------------------------------------------------------------------------
* =COL(Bob)
---------
Well, in fact, it is not a new instruction, but a good enhancement to the
collision detection method.
To detect a collision, I remind you, you have to use one of the
collision detection functions (=BOB COL(), =SPRITE COL(), =BOB SPRITE COL(),
=SPRITE BOB COL()). When this function returns a TRUE value, you have to
explore the =COL() reserved array to find out which bob or sprite created the
collision.
The problem, is that you had to write a loop exploring sequentially all the
COL() array. This was eating a lot of processor time. You could see certain
games slowing down when some bobs were colliding.
I wanted to do something to correct it. But what? The problem with AMOS, is
that if I change the syntax or the behaviour of one instruction to please
certain people, it may (and surely will) not be compatible with thousand
of existing programs!
So I found a -rather tricky- solution to this problem.
=COL(Number) behaves normally if you send it a POSITIVE number as an
argument, this keeps it compatible with all existing programs.
If "Number" is negative, AMOS will first remove the sign, i.e. turn it into
a positive number.
Then it will explore the COL() array himself, and find the first non-zero
value higher than -Number. Then it will not return TRUE or FALSE as it used
to, but the actual number of the bob colliding.
To get the next bob colliding, simply call it again with a this number, minus
one..
Example, this small and fast loop, will give all bobs colliding with bob zero:
B=Bob Col(0)
BB=0
Repeat
BB=Col(-(BB+1))
If BB
Print "Bob";BB;" is colliding..."
Endif
Until BB=0
You can certainly remark that with this method, it is impossible to get the
collision of bob number zero. That's why I say this was not perfect...
=DISC INFO$("Name")
-------------------
...is a new instruction that returns information on any disc.
"Name" is the name of a file or a directory of the disc you want to have
information about. The string returned has the following form:
"NAME_OF_THE_DISC:XXXXXXX" , where XXXXXXX is the free space on the disc.
To get both, use this simple method:
A$=DiscInfo$("Df0:")
C=Instr(A$,":")
N$=Left$(A$,C)
F=Val(A$,C+1)
Print "Name of the disc :";N$;" Free space:";F
= PRG STATE (returns the current status of a program)
-----------------------------------------------------
=PRG STATE
This little handy function let you know how your program was launched.
It returns three possible values:
0 : if your program was run under the AMOS interpreter.
1 : if your program was run under RAMOS run-only.
-1 : if your program is compiled.
Getting the system date and time.
---------------------------------------------------------------------------
You will find on your updated disc a program called "GET_TIME.AMOS".
This program includes two procedures to get the time and date from
the system.
Time.
-----
Call the procedure, and you'll have in Param$ the current clock time under
the following format: 00:00:00
_TIME$
Print Param$
...
11:04:04
Date.
-----
This procedure returns the current date in Param$:
_DATE$
Print Param$
...
21/06/1991
Safe AmigaDos EXECUTE.
------------------------------------------------------------------------------
It is perfectly possible to launch an external program from AMOS. But in order
to do so, you have to know some of the AmigaDos internal functions.
That's why you will find on your updated disc a small program with a
procedure called _EXECUTE.
Just transmit an AmigaDos command to this procedure, and it will launch it
out of AMOS. To run an external program, use:
_EXECUTE["RUN >NIL: <NIL: Program_Name.AMOS"]
You can launch other CLI commands (like "Assign"). Of course
if you want to see the display, you have to perform an AMOS TO BACK
instruction.
As the Amiga is a multitask machine, your AMOS program will go on running
as well as the launched program. Of course the speed will be bit reduced,
depending on the other program.
Manual bugs.
----------------------------------------------------------------------------
This paragraph will just list some of the main errors found in the manual,
like missing instructions.
LLIST
-----
This instruction does not exist, and never did! To print a program:
- Mark the whole text as a block (CONTROL-A)
- Go to the BLOCK menu, and select PRINT BLOCK.
NO ICON MASK [number] (Remove the mask from an icon).
-----------------------------------------------------
This instruction has simply been forgotten in the manual. It simply
does the same job as NO MASK, but for icons.
RAINBOW DEL [Number] (Delete on or all rainbows).
-------------------------------------------------
Another instruction forgotten in the manual, but very useful when you
want to get rid of a rainbow!
"Number" specify the number of the rainbow to remove, or all if omitted.
= TEXT STYLES (Returns the current font attributes).
----------------------------------------------------
This instruction is badly spelt in the manual. You must add an "S" to it!
New instructions in V 1.3x / V 1.2x.
----------------------------------------------------------------------------
The following part of text grabs some parts of the previous "About_AMOS_1.3",
found on the AMOS 1.31 PD. update.
Anyway, you should (must) read it, as we have added some instructions
that mysteriously disappeared from the documentation.
Multi tasking improvements.
---------------------------------------------------------------------------
MULTI WAIT (Force a multi-task wait vbl)
----------
MULTI WAIT
To make effective multi-tasking programs, you must not grab most of the
processor time, leaving only a limited amount of power for other tasks.
MULTI WAIT does a MULTI-TASK wait vbl. You should use it in your
programs main loop, when you wait for example, for a menu item to be
selected.
Note that you should not use this instruction to make accurate
screen synchronisation as it is designed to multi-task. This instruction
is not consistent at all! It may skip many VBLs, depending on the number
of running tasks at the time.
If you missed it elsewhere in the manual, Multitasking can be
activated by pressing Amiga+A to flick between AMOS and the CLI or
Workbench environments. This allows systems with at least 1 meg to run
AMOS and programs like DPaint III at the same time!
AMOS TO BACK (Hide AMOS from view and show the Workbench)
----------------------------------------------------------
AMOS TO BACK
This will bring forward the Workbench display, allowing you to access
other programs.
AMOS TO FRONT (Switch AMOS to the display)
-------------------------------------------
AMOS TO FRONT
AMOS is forced back onto the display with this command, leaving the
Workbench hidden.
AMOS HERE (Report which task is on display)
--------------------------------------------
AMOS HERE
This returns TRUE if AMOS is currently displayed and FALSE if the
Workbench is in view.
AMOS LOCK (Forgotten instruction : Locks AMOS in front position)
----------------------------------------------------------------
AMOS LOCK
This instruction first does an "AMOS TO FRONT", and then disable
the AMIGA-A system. Use this instruction if you do not want people
to know your program was written in AMOS.
AMOS UNLOCK (Forgotten instruction : make AMIGA-A active)
---------------------------------------------------------
AMOS UNLOCK
Just restores the AMIGA-A Workbench/AMOS flipping. You may want people to
stay under AMOS during certain parts of your program for example, to
see your name (!) and then free them.
Swapping banks.
-------------------------------------------------------------------------
BANK SWAP number1,number2
-------------------------
This instruction will swap the pointers of the two banks. Useful if you
want to turn an icon bank into a sprite bank. Example:
Bank Swap 1,2
or have more than one music bank at the same time, for example:
Bank Swap 3,5
Display-handling enhancements.
------------------------------------------------------------------------
LACED (Function to open an interlaced screen)
---------------------------------------------
To open an interlaced screen use the following syntax:
SCREEN OPEN 0,320,200,16,LACED [+HIRES] [+LOWRES]
LACED is a function that returns 4.
Important: As soon as one screen is opened with Interlace, all the other
screens turn to interlace. The interlacing will only truly effect the
screen actually opened with LACED. All the others will just have their
vertical lines doubled on the screen to adjust to the special mode.
Interlaced mode is perfect for displaying pictures, but
animation runs at half normal speed. Games should not be written in
Interlace!
As soon as the last interlaced screen is closed the whole
display returns to normal mode. Your TV monitor might not like lots of
fast switching from normal mode to Interlace, so you are advised not to
do this excessively.
All normal operations are available in interlaced screens:
Screen Offset, Screen Display and so on. The only problem that arises is
due to interlacing being software driven in AMOS. The bitplanes are
changed during the vertical blank and this particular interlace process
is forbidden during copper list calculation.
So if you have a large copper list (i.e.. four screens, one
interlaced, and a rainbow), and have a copper calculation to do, the
interlaced screen will display only half of the picture during the
calculation. Nothing can be done to solve this, it is simply a
limitation of the whole system.
There are two extra screen commands in AMOS now. These allow a program
to work out what type of display it is being run on:
DISPLAY HEIGHT (Report how tall a screen can be)
-------------------------------------------------
=DISPLAY HEIGHT
This command returns 311 in PAL and 263 in NTSC.
NTSC (Flags the type of display in operation)
---------------------------------------------
=NTSC
This returns TRUE if the system is in NTSC mode or FALSE if in PAL.
Ideal for international software development!
NTSC refreshes the screen at 60 times a second whereas PAL
screens refresh at only 50 times a second. However, AMOS1.3 compensates
for this and now music runs at exactly the same speed in PAL and NTSC
AMAL also relies on the interrupt routine but is not slowed down
to comply with PAL speeds. You must therefore be careful not to
synchronise music and animations by just relying on the speed they run
at. Check that an animation frame has been reached or the music has
played a certain note. Using this technique you'll ensure the software
executes at the right points on all systems.
Requester enhancements.
-------------------------------------------------------------------------
REQUEST (Generate a requester routine)
---------------------------------------
REQUEST ON
This will make AMOS use its own requester routine and is the
default.
REQUEST OFF
AMOS will always select the CANCEL button of the requester if this
command is used. The actual requester will not be displayed, so this is
ideal for error trapping within a program.
REQUEST WB
This tells AMOS to switch back to Workbench's system requester. You'll
come back to AMOS as soon as you have chosen one of the options.
Note: If you don't load up the Requester (by deleting it from the
extension list using the config file), the normal Workbench requester
will be used for displaying messages.
This does have a bad side-effect though, AMOS will seem to have crashed
when a requester appears. If this happens you must simply press Amiga+A
to return to the Workbench, answer the question and press Amiga+A once
again to return to AMOS. It's only best to avoid loading the requester
when memory is very low!
Bob and sprite flipping commands.
---------------------------------------------------------------------------
In a great number of games, the main character needs to animate left to
right, and up and down. Up to now, you were obliged to keep in the
sprite bank reversed copies of small animation sequences for the main
character. As the main character usually has the best animation, you
lose an enormous amount of space!
For the game RanXerox, for which AMOS author François Lionet
wrote the sprite routines, a flipping routine was developed which
allowed just one copy of the main character to be kept in the bank. This
routine has been enhanced and placed into AMOS.
How does it work? Imagine your character is walking to the left
and then back to the right. You would only have in your bank the image
of him walking to the right. To display this right image, you simply
refer to the image number in the bank as usual.
To display the image reversed in the X axis (left walking
image), you set bit number 15 of the image number to 1. Don't panic, you
can simply do it with:
$8000+Image number
So:
Bob 1,160,100,1
will display your character walking right, and:
Bob 1,160,100,$8000+1
will display it walking left. The same principle is used for vertical
reversing. For this, bit number 14 is used - add $4000 to the image
number. To have a vertical and horizontal reversing, use $C000.
The symmetry is a full symmetry: The hot spot of the bob is also
reversed. For example, if we had put the hot spot in X under the feet of
our character, the reversed version would also have it under his feet.
So be careful if you set the hot spot on the top left corner on a bob,
the reversed image will be displayed at the top left!
You might say that $8000 and $C000 are a bit weird to use. We
have provided special functions to give a better AMOS interface:
=HREV(image) adds $8000 to the image
=VREV(image) adds $4000
=REV(image) adds $C000
Use them in place of the hex values:
Bob 1,160,100,10
Bob 1,160,100,HREV(10)
Bob 1,160,100,VREV(10)
Bob 1,160,100,REV(10)
To allow easy use of the bob flipper in AMAL, we have implemented
Hexadecimal evaluation. So you can use hex notation to refer easily to
reversed bobs. If hex frightens you, just add $8000, $4000 or $C000
before all references in your AMAL strings. Example:
Old AMAL string:
"Anim 0,(1,2)(2,2)(3,2)(4,2)"
New reversed string:
"Anim 0,($8000+1,2)($8000+2)($8000+3)($8000+4)"
or
"Anim 0,($8001,2)($8002,2)($8003,2)($8004,2)"
If you use a register to calculate the image number, do not try to
modify the calculation itself, but only when you assign the register to
the image.
Old AMAL string:
For R0=1 To 10; Let A=R0; Next R0
New one:
For R0=1 To 10; Let A=$C000+R0; Next R0
How does the flip routine work?
It is really important for you to understand how it works internally, so
that you do not ask this system to do things it is not designed to do.
The reversing system is designed to free memory before trying to
be fast (although we would not mind if it was actually fast, would we?).
Concessions had to be made to have it fast, and at the same time easy
and powerful.
The routine actually works right in the middle of the bank, and
does not use any extra memory. The bobs are flipped during the update
process, just before a bob is redrawn on the screen. AMOS looks to see
if the image needs to be flipped in the bank. If it does, it is flipped
and a flag is set within the bank. On the next update, if the bob image
has not changed, it will not be flipped, thus saving a lot of time.
If you understand the above, you will also realise one big
limitation. It is not wise to use more than one flipped bob pointing to
the same image. Let's see the next example:
Bob 1,160,100,1
Bob 2,160,150,$8001
Bob 3,20,20,$4001
Bob 4,20,100,$C001
Update
During the UPDATE process, AMOS will first draw bob number 1. No
problem, it is in the right position. Then bob number 2 - AMOS needs to
reverse it in X. Bob number 3 needs a Y and an X reversing (to put the
bob back to normal in X!). Then bob number 4 needs an X flipping.
On the next update, providing the bob's image has not changed,
to display bob 1, AMOS will have to flip it in X and Y, then bob 2...
As you can see, for each UPDATE, that is, every 50th of second,
if the bobs move they need to be reversed! This will work, but will take
a lot of processor time, and the animation will be disastrous.
So the golden rule is, use the reversed bobs for objects alone
on a screen (or be sure that normal and reversed images are not
displayed at the same time on the screen). If you want, you can have two
bobs like this - experiment!
We told you before that this system was for use with bobs. Yes,
it is totally automatic with bobs. But as it directly affects the sprite
bank, you can also use it with sprites.
When a hardware computed sprite is calculated, AMOS looks into
the sprite bank and gets the image from it. If the image is reversed at
that moment, the hardware sprite will display a reversed image. You can
therefore have reversed hardware sprites using this method. But you
cannot do this for example:
Sprite 1,200,200,$8001
Pasting flipped bobs
PASTE BOB also accepts reversed images. A simple trick to reverse an
image in the bank without having to display a bob, is to PASTE the
reversed image outside of the screen. Example:
Paste Bob 500,500,$C000
This will reverse image 4 in the bank, without any output (and quite
fast).
Collision detection
This is an important point, and you have to be very careful when you
detect collisions with reversed bobs!
The collision detection uses the shapes in the bank at the very
moment it is called. Let's see an example that will never work:
Bob 1,160,100,1
Do
Bob 2,XScreen(XMouse),YScreen(YMouse),$8001
Wait Vbl
Exit if Bob Col(1)
Loop
Why doesn't it work? We have two reversed images of the same definition
in the bank. After the updating process, the image in the bank is left
reversed. So the Bob Col instruction will take bob shape 1, the reversed
image, and this will not work!
So remember: Thou shalt never use collision detection with more
than one reversed image on the screen!
How is it coded into the sprite bank?
Two bits of each images X Hot Spot are used to flag the flipping (at
SPRITE BASE+6).
Bit number 15 for X 0 if normal, 1 if reversed
Bit number 14 for Y 0 if normal, 1 if reversed
Before RUN and SAVE, the bank is restored to its normal state, so that
it is still compatible with version 1.1.
Block flipping
The flip routine can also be used for blocks.
HREV BLOCK (Flip a block horizontally)
HREV BLOCK image
Flips block number image horizontally.
VREV BLOCK (Flip a block vertically)
VREV BLOCK image
Flips block number image vertically.
Altering the Bob drawing order.
-----------------------------------------------------------------------
PRIORITY REVERSE ON/OFF (Change the order in which Bobs are printed to
-----------------------------------------------------------------------
the screen)
PRIORITY REVERSE ON
PRIORITY REVERSE OFF
PRIORITY REVERSE ON, reverses the entire bob's priority table. This
means that bob number 1 will be the first one drawn in front of all
other bobs, 2 will come in second etc... This priority list is
compatible with STOS.
This instruction has another feature when used in conjunction
with the PRIORITY ON command. The bobs are not printed from TOP to
BOTTOM any more, but from BOTTOM to TOP! The highest bob on the screen
will be displayed in front of the others.
Squash a bob routine.
-----------------------------------------------------------------------
This routine was originally written for a Fun School 3 program called
Letters. Each letter in the alphabet is displayed as a single large
sprite. This requires a total of 52 separate images, taking up a massive
110k of memory. Since only a couple of images are displayed at a time,
most of this space is actually wasted. So a small routine was written to
pack the unused sprites into a spare memory bank. This allowed us to
compress the entire sprite bank into just 26k!
AMOS Squash is now available on the public domain. Feel free to
use it in any of your own programs. It's especially useful for the
massive Level Guardians in an arcade game. These can be compressed into
a fraction of their normal size, and can be instantly retrieved at the
appropriate point in your program.
Using AMOS Squash
The packer program comes in two separate parts. The first program loads
a sprite bank into memory and compacts your images. It can be found in
the file Squash_a_bob.AMOS
In order to use this routine, you need to perform the following
simple procedure:
Load a sprite bank from the disc using the file-selector.
Enter the number of the first sprite you wish to pack.
Enter the number of the final sprite in your list.
Input the number of colours used by your sprite images.
Choose a new memory bank to hold your squashed images.
The squasher routine will now be executed and your selected images will
be quickly compressed. After it has concluded, you will be given an
option to save your compacted images onto the disc.
Note that no colour information is saved with these images. So
you may need to make a note of the current colour settings before
proceeding any further.
Once you've squashed your images, you can load them into your
AMOS Basic programs with the help of three small procedures. These can
be found in the file Squash_procs.AMOS and can be incorporated into your
program using the MERGE command from the AMOS Editor menu.
The squash routines are remarkably easy to use. The first stage
is to load your original sprite bank from Direct mode and delete the
images you have just compressed. Use a line like:
Del Sprite start To finish
This erases your old images from memory, saving you a considerable
amount of storage space. You can now enter your packed images from the
disc with the LOAD command:
Load "images.abk"
At the start of your program, you should initialise the compaction
system with a call to the PBOB_INIT procedure:
PBOB_INIT[bank,cols,max_x,max_y]
Where:
bank is the bank number containing your compressed images
cols holds the number of colours
max_x stores the maximum width of your images
max_y holds the maximum height of your images
The action of this procedure is to prepare a temporary screen for the
squasher utility. Your images can now be unpacked as and when they are
required, using a simple call to the PBOB routine.
PBOB[source,dest]
source is the number of the image to be unpacked. This is the original
image number from the sprite bank.
dest is the number of the new image you wish to install in the sprite
bank. Choose the number of the last sprite in the bank plus one.
Once you've installed your image into memory, you can animate it
directly with the various SPRITE or BOB commands. PBOB can be called as
many times as you wish. So the same image number can be re-used again
and again.
Finally, add a call to the PBOB_END procedure towards the end of
your program. This will erase the hidden screen created by PBOB_INIT.
Serial port commands extension.
-------------------------------------------------------------------------
Welcome to the intriguing world of AMOS communications. The serial
extension is intended for those of you who wish to transfer information
between several different computers using the Amiga's serial port.
The extension provides you with a total of 15 new commands. You
can use these commands to create amazing multi-user games. It's also
possible to access a Midi interface which has been plugged into the
Amiga's serial port. So musicians will be able to control their
instruments directly from AMOS Basic. Wow! As you would expect, full
multitasking is supported.
Opening the serial port
SERIAL OPEN (Opens a channel for Serial I/O)
--------------------------------------------
SERIAL OPEN Channel, Port_no [,Shared, Xdisabled, 7wires]
Opens a communication channel to a serial device.
Channel This is an identification number which will be used for all
subsequent communication commands. Allowable values range from 0 to 3.
Port_no Specifies the logical device number of the serial port.
Normally, this value should be set to zero. However, if you've plugged a
MULTI SERIAL card into your Amiga, you can access your additional ports
using the numbers from one onwards.
Shared (optional) This is a flag which informs AMOS that the device can
be shared with other tasks which are currently running on your Amiga.
It's used in multitasking. A value of FALSE (zero) will grab the channel
for AMOS Basic, and will deny access to any other program. If it's is
set to TRUE (-1), the serial port can be shared between several programs
in memory. Beware: This system must be used with extreme care or the
Amiga could easily crash!
Xdisabled (optional) Toggles XON/XOFF checking during transmission of
your data over the serial line. It's essential to set this flag when you
are first opening the device, even if it will only be required later.
The default value is FALSE (0) and disables the system. If you want to
enable the checking, use a value of TRUE (-1). After the port has been
opened, you'll then need to set the XON and XOFF characters using a
separate call to the SERIAL X command.
7Wires (optional) A value of TRUE (-1) tells the device to use the 7
wires system as explained in the official Commodore documentation. The
default is FALSE (0).
When you call the Serial Open command for the first time, it will
automatically load the SERIAL.DEVICE library from your system disc. So
make sure it's available from the current drive.
Default settings depends on the number in "Port_no":
-Port_no=0 refers to the default serial port, it will be opened using the
parameters set in the "Preference" workbench program. You should open this
port if you use the workbench.
-Port_no=1 refers to the built in serial port. Every Amiga has one. This
is the port you should open. The default settings will be set for this port
to use the French minitel: 1200 Baud, 7 bits, 1 stop bit, Even parity.
This can be easily changed using the SERIAL SPEED, SERIAL BIT or
SERIAL PARITY instructions if required.
-Port_no>1 can only be used if you have a multi-serial card.
Closing the serial port
SERIAL CLOSE (Closes one or more serial channels)
-------------------------------------------------
SERIAL CLOSE [Channel]
If you don't include the channel number, SERIAL CLOSE will close all
currently opened serial channels with absolutely no error checking. The
optional channel number allows you to close a single channel and uses
all the normal error checks.
Note: Whenever a program is RUN from AMOS Basic, any opened channels
will be automatically closed for you.
Sending information through the serial port
SERIAL SEND (Output a string via a serial channel)
---------------------------------------------------
SERIAL SEND Channel, t$
Sends the string t$ straight to the specified serial channel. It does
not wait for the data to be transmitted through the actual port. You'll
therefore need to use the =SERIAL CHECK(Channel) function to detect when
the transmission has been completed.
SERIAL OUT (Outputs a memory block via a serial channel)
---------------------------------------------------------
SERIAL OUT Channel, Address, Length
This is identical to Serial Send except that it works with RAW data.
Address is the address of your data in memory.
Length is the number of bytes to be sent.
Reading information from the serial port
SERIAL GET (Gets a byte from a serial device)
----------------------------------------------
=SERIAL GET(Channel)
Reads a single byte from the serial device. If nothing is available a
value of -1 will be returned.
SERIAL INPUT$ (Gets a string from the serial port)
---------------------------------------------------
=SERIAL INPUT$(Channel)
Reads an entire string of characters from the serial port. If there's no
data, the command will return an empty string "". Otherwise the string
will contain all the bytes which have been sent over the serial line up
to the present time.
Be careful when using this command with high speed transfers
(such as MIDI). If you wait too long between each SERIAL INPUT$ command,
you can overload the system completely, and generate annoying errors
such as "string too long" or "serial device buffer over-run".
Setting the serial parameters
SERIAL SPEED (Sets the transfer baud rate for a serial channel)
----------------------------------------------------------------
SERIAL SPEED Channel, Baud rate
Sets the current transfer rate of the appropriate channel. The same
value will be used for both reading and writing operations. Note that
you can't set split baud rates for a single channel. If the baud rate
you have specified is not supported by the current device, it may be
rejected by the system.
SERIAL BITS (Sets the Nbit & Stopbit part of a protocol)
---------------------------------------------------------
SERIAL BITS Channel, Nbits, Stopbits
Assigns the number of bits which will be used for each character you
transmit.
Nbits is the number of bits
Stopbits is the number of STOP bits
SERIAL PARITY (Sets the parity checking, correct version)
----------------------------------------------------------
SERIAL PARITY Channel, Parity
Sets the parity checking you are using for the current serial channel.
Here's a list of the available options.
Parity can have 5 different states:
-1 : no parity
0 : EVEN parity
1 : ODD parity
2 : SPACE parity
3 : MARK parity
See the Commodore documentation for a full explanation of this system.
SERIAL X (Sets XON/XOFF)
-------------------------
SERIAL X Channel, Xmode (Activates/deactivates the XON/XOFF handshaking
system)
A value of TRUE for Xmode disables handshaking. Any other value turns it
on. Xmode should be loaded with the correct control characters. These
must be specified in the following format:
Xmode=XON*$10000000+XOFF*$10000
Check Commodore's documentation for more information.
Other commands
SERIAL BUFFER (Sets the size of the serial buffer)
---------------------------------------------------
SERIAL BUFFER Channel, Length
Allocates length bytes of buffer space for the required channel. Note
that the default value is 512 bytes and the minimum allocation is 64
bytes.
It's a good idea to increase the buffer size for high speed
transfers.
SERIAL FAST (Switches on FAST transfer mode)
---------------------------------------------
SERIAL FAST Channel
This sets a special fast flag in the current device and disables a lot
of internal checking which would otherwise slow down the communication
process. Use it for high speed transfers such as MIDI.
Warning: When you call this command, the protocol will be changed to:
PARITY EVEN,NO XON/XOFF and 8 bits.
SERIAL SLOW (Switches serial transfer back into SLOW mode)
-----------------------------------------------------------
SERIAL SLOW Channel
Slows the serial device back to normal speed and reactivates all the
error checks.
SERIAL CHECK (Reports on current serial device activity)
---------------------------------------------------------
=SERIAL CHECK(Channel)
Asks the device for a read-out of its current status. You can use it to
check whether all the information you've transferred with a previous
SERIAL SEND command has been sent.
CHECK=FALSE (0) -> if the last serial command is still being
executed.
CHECK=TRUE (-1) -> All done!
SERIAL ERROR (Reports success or failure of last transfer)
-----------------------------------------------------------
=SERIAL ERROR(Channel)
Looks for the ERROR byte in the serial device. A value of zero indicates
that everything is fine. Otherwise, the last transmission was faulty.
Sending large strings
Transmitting a large string may take quite a long time, especially at
low baud rates. As AMOS is multitasking, your program will continue to
run AFTER a SERIAL SEND instruction.
It's essential to avoid provoking a garbage collection before
the transfer has been completed, otherwise your data will be corrupted.
So:
Use the =SERIAL CHECK function before doing a lot of string work.
Perform a garage collection using X=FREE to ensure that your program
will not provoke one automatically.
Use the SERIAL OUT channel,address,length instruction
with 'address' containing the location of a previously reserved memory
bank.
More information
More information about the Amiga's serial system can be found in the
Commodore ROM KERNEL Reference Manual, Library and Devices. This will
allow expert users to make maximum use of the serial device.
Searching for the current devices.
----------------------------------------------------------------------------
AMOS can report back to you the current list of devices using the
following commands.
=DEV FIRST$ (Get first device from the current device list)
------------------------------------------------------------
dev$=DEV FIRST$("filter")
Works the same as Dir First$ and Dir Next$, but reports back the device
list. Note that you should remove the spaces with -" " to get the right
name.
=DEV NEXT$ (Get the next device satisfying the filter)
-------------------------------------------------------
dev$=DEV NEXT$
Gets the next device from the device list. A null string indicates the
end of the list has been reached. Example:
Print Dev First$
Do
A$=Dev Next$
A$=A$-" "
If A$="" then End
Print A$
Loop
ABOUT CONFIGURATION FILES (to read only if you come from V1.2x).
--------------------------------------------------------------------------
AMOS1.3 needs a new configuration file called "AMOS1_3_PAL.ENV" or
"AMOS1_3_NTSC.ENV". You'll also find on your updated disc a new
configuration program call CONFIG1_.AMOS.
This new program has on new option: "Load AMOS1.2 configuration".
As you can imagine, this option turns your 1.2 configuration file
into a 1.3 configuration file, without modifying your settings.
Be careful with the extensions: the Config1_3 program adds ".Lib"
to all extensions name found in the "Extensions loaded" list, and the
new extension name are not compatible any more with the old ones.
This is perfect for all official extension: Compact, Music, Request,
Serial. but AMOS will refuse to boot if any other extension is found
in the list.
So erase ALL unwanted extensions BEFORE saving your 1.3 configuration!
Loading AMOS from within a folder.
--------------------------------------------------------------------------
Although it is perfectly possible to copy the AMOS_System folder
in the middle of another folder (explained later), you should avoid
to do so, if you do not want later hassle with other programs that
DO assume the position of the AMOS_System folder (like the 3d
extension for example, and a number of other extensions).
AMOS does a number of housekeeping chores before fully loading up and
presenting itself to you. One of these is to locate all its default
files like the sprite pointer, default font and so on. The procedure and
logic it uses is as follows:
1 Check the current system to define if a PAL or NTSC screen is in
use.
2 Depending on the system it will look for the AMOS1_3_PAL.Env or
AMOS1_3_NTSC.Env.
3 Failing to find one of these files, it will look for the AMOS
System folder in the root directory of the current drive. If this also
fails, AMOS gives up trying to load and returns to the Workbench.
4 If AMOS picks up Default.Env at point 2, it will examine the
environment file to find out where the other files are located. This is
the key to relocating AMOS anywhere on a disc.
Let's assume we want to set up AMOS within a folder called UTILS on a
hard disc. First we must copy across the following files from the AMOS
Program disc to the hard disc path Dh0:UTILS/
AMOS_System A folder containing all the default files
AMOS1.3 The Main AMOS file
The files AMOS1_3_PAL.Env and AMOS1_3_NTSC.Env must be moved from the
AMOS system folder to the Utils folder.
AMOS_System
AMOS1.3
AMOS1_3_PAL.Env
AMOS1_3_NTSC.Env
Now we must change the Env files so that they tell AMOS where all the
data files are. To do this you'll have to boot a normal copy of AMOS and
run the Config.AMOS program. Simply ensure that the loaded extensions
and default files have the correct path and filenames.
In our example all the files are inside the directory
AMOS_System. Just make sure that the extensions read as follows:
1-:AMOS_System/Music
2-:AMOS_System/Compact
3-:AMOS_System/Request
4-:AMOS_System/3D ;Only if you have AMOS 3D
5-:AMOS_System/Compiler ;Only if you have the AMOS Compiler
6-:AMOS_System/Serial
The default filenames must be set as:
1-:AMOS_System/Def_Icon
2-:AMOS_System/Mouse.Abk
3-:AMOS_System/Default.Font
4-:AMOS_System/Default.Key
An important point to note is that only the extra part of the pathname
is required. AMOS adds AMOS_System onto the current path (in this case
Dh0:UTILS) to find the full path: Dh0:UTILS/AMOS_System/
Hard disc users will find this information very helpful and it
will avoid having the AMOS_System folder stuck in the root directory of
the hard disc. Anyone developing a CDTV application in AMOS will also
need to use this feature. The above information is also true for the
RAMOS runtime system, the only difference being that RAMOS doesn't
require the PAL or NTSC files.
IMPORTANT: AMOS 1.3 needs the W.LIB to work. This file includes all
graphic primitive such as screens sprites and bobs. To locate this file
on the disc, AMOS takes the pathname of "Mouse.Abk" file, remove the
"Mouse.Abk" and replace it by "W.Lib". So you MUST put this file near
Mouse.Abk, otherwise AMOS1.3 WILL NOT LOAD!
The future of AMOS.
---------------------------------------------------------------------------
AMOS will constantly be updated so that it keeps up-to-date with new
trends on the Amiga scene. For the latest AMOS update information
contact Sandra Sharkey of the AMOS PD. Library: 25 Park Road, Wigan, WN6
7AA, England. Telephone 10am to 3pm on (0942) 495261.