General AMX Operation
K
A
DAK
21
Permanent Launch
In most applications, your AMX operating system is resident in ROM or loaded into
RAM. AMX is started in real mode and given permanent control of the processor.
An AMX system can be launched permanently from a main program coded in C as
illustrated in the following example.
The implication of starting AMX from a main C program is that a C startup module has
already provided a stack before procedure main was called. The main procedure calls
AMX at its entry point ajentr with three parameters. The first parameter is the launch
parameter. The value AMLPVA indicates that the launch is permanent (bit 0 is 0), vectors
are alterable (bit 1 set by AMLPVA) and interrupts are to be disabled during the launch (bit
2 is 0).
The second parameter is the pointer to your application's User Parameter Table in the
System Configuration Module which defines the characteristics of your AMX system.
The third parameter, NULL, must be present but is not used by AMX because the launch is
permanent.
/* Start AMX for permanent execution */
#include "amx831sd.h" /* AMX Structure Definitions */
void main()
{struct amxupts FAR *uptp; /* User Parameter Table pointer*/
:
ajupt(&uptp); /* Fetch pointer to UPT */
/* Start AMX: no exit, */
/* vectors alterable and */
/* interrupts disabled */
ajentr(AMLPVA, uptp, NULL);
}
If the vector table is in ROM or, for any reason, is not to be altered by AMX, set the
launch parameter to 0 instead of AMLPVA. In this case, you will not be able to use AMX
services to dynamically install pointers to Interrupt Service Procedures into the vector
table.
If you wish interrupts enabled during the launch process, add AMLPIE to the launch
parameter. Be sure that interrupts from a particular device are inhibited until you have
installed an ISP to handle interrupts from the device.