B-12
K
DAK
AMX 68000 Target Guide
Example #include "CJZZZ.H"
void CJ_CCPP dowork(struct cjxjbuf *jbp);
static struct cjxjbuf jumpbuffer;
#define STACKSIZE 512 /* Stack size (longs) */
#define STACKDIR 1 /* 0=grows up; 1=grows down */
static long newstack[STACKSIZE];
#if (STACKDIR == 1)
#define STACKP (&newstack[STACKSIZE - 1])
#else
#define STACKP newstack
#endif
void CJ_CCPP taskbody(void) {
if (cjcfjset(&jumpbuffer) == 0)
/* Switch to new stack and do work */
cjcfstkjmp(&jumpbuffer, STACKP,
(CJ_VPPROC)dowork);
/* Never returns to here */
/* Do work using original stack */
dowork(NULL);
}
void CJ_CCPP dowork(struct cjxjbuf *jbp) {
/* Do work */
/* If jump buffer provided, then use long jump to */
/* restore the original stack and return */
if (jbp != NULL)
cjcfjlong(jbp, 1);
}
See Also cjcfstkjmp
Comments to this Manuals