This Chapter deals with the exploitation of the Amiga's operating system, providing a vast range of possibilities for the experienced system programmer. System libraries are dealt with first, and then devices are examined.
Accessing the system libraries
All of the most useful calls to the Amiga's internal system libraries are already built in to AMOS
Professional. You are able to call any library directly from an AMOS Professional program, as
well as access all devices connected to your computer. If you really need to make contact with
these libraries and devices, the following functions are supplied. Please take note that using
them without precise knowledge is a recipe for disaster!
AMOS Professional is able to execute commands from any library installed in your Amiga. These options use the standard AMOS Professional channel system to deal with Input/Output structures. Total access to all the standard data structures is also provided via the powerful STRUC function, which automatically senses the type of element to be manipulated.
LIB OPEN
instruction: open a library for use
Lib Open channel number,"name.library",version
The LIB OPEN command calls the OPEN LIBRARY function from EXEC. If the library is external, it will be loaded into memory from the "Libs:" folder of your current start-up disc. If a problem is encountered, you will be helped by the relevant error message from AMOS Professional, and the error can easily be intercepted using a TRAP command.
After the library has been initialised successfully, it remains open until the program is run again from the Editor, or your variables are re-set using a CLEAR command, or a LIB CLOSE command is called.
Three parameters are needed for a LIB OPEN instruction. The number of a new AMOS Professional channel, to be used to refer to this library throughout the AMOS Professional program. Then the name of the library that is to be opened, given in standard Commodore format. Lastly, the minimum version number of the library that is to be installed in memory should be specified. If you are unsure of this parameter, use a value of zero.
LIB CLOSE
instruction: close one or all currently open libraries
Lib Close
Lib Close channel number
Used on its own, the LIB CLOSE command closes all open libraries in a single operation. If an optional Channel number is included, an individual library may be closed. Please note that if a selected library does not exist, no error will be reported!
LIB CALL
function: call a function from a library
result=Lib Call(channel number,function offset)
This important function acts as the gateway to all the functions in the selected library. It calls the required function and returns the result to your AMOS Professional program.