These are the functions supplied by the developer that are dispatched
from the state transitions table produced by ZMech for the crisis.ipd
state diagram.
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void enter_situation_normal(void)
{
out_port = 0x00;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void enter_crisis_level_0(void)
{
out_port = 0x01;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void enter_crisis_level_1(void)
{
out_port = 0x02;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void enter_crisis_level_2(void)
{
out_port = 0x04;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void default_state_handler(void)
{
static int delay = DELAY_1;
delay--;
if (delay <= 0)
{
delay = DELAY_1;
out_port ^= 0x80;
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void situation_normal_state(void)
{
out_port &= ~0x80;
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void crisis_level_0_state(void)
{
static int delay = DELAY_0;
delay--;
if (delay <= 0)
{
delay = DELAY_0;
out_port ^= 0x80;
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void crisis_level_1_state(void)
{
static int delay = DELAY_1;
delay--;
if (delay <= 0)
{
delay = DELAY_1;
out_port ^= 0x80;
}
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
void crisis_level_2_state(void)
{
static int delay = DELAY_2;
delay--;
if (delay <= 0)
{
delay = DELAY_2;
out_port ^= 0x80;
}
}