Amos Professional Manual Contents Index
Machine Code
- When the routine i's called from AMOS Professional Basic, certain registers will contain
valuable information. Register A3 will hold the parameter list. Register A5 will contain the
AMOS Professional data zone, which allows access to many internal functions directly from
the machine code program.
- Although routines can alter any register, the A7 stack should be left unchanged. Also note that
registers A3 to A6 will not be returned in AREG functions.
Creating a machine code language procedure
Machine code procedures are installed using the [Inset Program] option from the
[Editor/Procedures] menu. The following steps should be followed:
- Create a dummy procedure from the AMOS Professional Editor, like this:
X> Procedure _MACHINE[A,A$]
End Proc
Existing closed procedures may also be used for this purpose, and it is perfectly legal to update a
routine after the machine code program has been re-assembled.
- Position the text cursor inside the empty procedure.
- Select [Insert Program] from the menu. You will now be prompted with a standard AMOS
Professional file selector.
- Select the machine language program from the disc. It must be a normally assembled machine
language which be run under CLI. A Workbench program or other commercial program
cannot be inserted into a procedure. If this advice is ignored, your Amiga will crash when
such a program is executed! The code must be PC relative, because AMOS Professional will
ignore any relocation information in the file. The code must use a single segment only,
because AMOS Professional will only load the first CODE segment into memory.
- AMOS Professional will now close the procedure and insert the selected machine language
routine into memory. Any existing Basic instructions in the procedure will be removed!
Once the machine code is installed in this manner, it will be called automatically whenever the
new procedure is run from AMOS Professional Basic.
Communicating with a machine code procedure
There are two methods of exchanging information with a machine code procedure.
With the first method, values are loaded into the appropriate Address and Data registers, before
the procedure is called using the AREG and DREG functions. For example:
X> Dreg(0)=1 : Dreg(1)=Varptr(A$) : _MACHINE
Procedure _MACHINE