10
K
A
DAK
AMX 68000 Target Guide
2.2 Task Scheduling Hooks
There are four critical points within the AMX Task Scheduler. These critical points
occur when:
a task is started
a task ends
a task is suspended
a task is allowed to resume.
AMX allows a unique application procedure to be provided for each of these critical
points. Pointers to your procedures are installed with a call to procedure cjkshook. You
must provide a separate procedure for each of the four critical points. Since these
procedures execute as part of the AMX Task Scheduler, their operation is critical. These
procedures must be coded in assembler using techniques designed to ensure that they
execute as fast as possible.
The AMX Task Scheduler calls each of your procedures with the same calling
conventions.
Upon entry to your scheduling procedures, the following conditions exist:
Interrupts are disabled and must remain so.
The Task Control Block address is in register A1.
The stack pointer in register SP references the task's stack.
The return address is on the stack at (SP).
Registers D0, D1, A0, A1, A2 and A3 are free for use.
Condition code flags in the status register (SR) can be altered.
All other registers must be preserved.
Your procedures receive a pointer to the Task Control Block (TCB) of the task which is
being started, ended, suspended or resumed. If you include AMX header file
CJ532K.DEF in your assembly language module, you can reference the private region
within the TCB reserved for your use as XTCBUSER(A1).
Your procedures are free to temporarily use the task's stack.