/* - weather-threads.c - Olamide Adabonyan / Philip Lechowicz - o_mide@yahoo.com / phillech@aol.com */ /******************************************************* Name: TCB (Thread Control Block)... Purpose: - data structure for TCB ********************************************************/ struct TCB { struct TCB *Next; /* Link to Next TCB */ unsigned char *SP; /* Stack Pointer */ unsigned char Id; /* 1,2 or 4 */ unsigned char MoreStack[stacksize]; /* additional stack */ unsigned char CCR; /* Initial CCR */ unsigned char RegB; /* Initial RegB */ unsigned char RegA; /* Initial RegA */ unsigned int RegX; /* Initial RegX */ unsigned int RegY; /* Initial RegY */ void (*PC)(void); /* Initial Program Counter */ }; typedef struct TCB TCBType; typedef TCBType * TCBPtr; TCBPtr RunPt; /* Pointer to thread currently running */ /******************************************************* Name: Threads 1 & 2 Purpose: - create structure and initialize theads 1 & 2 ********************************************************/ //Thread 1 will run the DispWeather program //Thread 2 will run the DispWindDir program TCBType sys[2]= { { &sys[1], /* Pointer to Next */ &sys[0].MoreStack[stacksize-1], /* Initial SP */ 1, /* Id */ { 0}, 0x40,0,0,0,0, /* CCR,B,A,X,Y */ DispWeather, /* Initial PC */ }, { &sys[0], /* Pointer to Next */ &sys[1].MoreStack[stacksize-1], /* Initial SP */ 2, /* Id */ { 0}, 0x40,0,0,0,0, /* CCR,B,A,X,Y */ DispWindDir, /* Initial PC */ } };