2017-04-05 05:13:09 +00:00
|
|
|
#pragma rtl
|
|
|
|
|
|
|
|
#include <appletalk.h>
|
2017-03-31 23:04:57 +00:00
|
|
|
#include <locator.h>
|
2017-04-05 05:13:09 +00:00
|
|
|
#include <desk.h>
|
2017-03-31 23:04:57 +00:00
|
|
|
#include <orca.h>
|
2017-04-10 03:06:13 +00:00
|
|
|
#include <gsos.h>
|
2017-03-31 23:04:57 +00:00
|
|
|
#include "installcmds.h"
|
|
|
|
#include "aspinterface.h"
|
|
|
|
#include "asmglue.h"
|
|
|
|
|
2017-04-10 03:06:13 +00:00
|
|
|
extern Word *unloadFlagPtr;
|
|
|
|
|
|
|
|
FSTInfoRecGS fstInfoRec;
|
|
|
|
|
2017-04-05 05:13:09 +00:00
|
|
|
void pollTask(void);
|
|
|
|
|
|
|
|
static struct RunQRec {
|
|
|
|
Long reserved1;
|
|
|
|
Word period;
|
|
|
|
Word signature;
|
|
|
|
Long reserved2;
|
|
|
|
Byte jml;
|
|
|
|
void (*proc)(void);
|
|
|
|
} runQRec;
|
|
|
|
|
|
|
|
|
2017-04-10 03:06:13 +00:00
|
|
|
void setUnloadFlag(void) {
|
|
|
|
if (*unloadFlagPtr == 0)
|
|
|
|
*unloadFlagPtr = 1;
|
|
|
|
}
|
|
|
|
|
2017-03-31 23:04:57 +00:00
|
|
|
int main(void) {
|
2017-04-10 03:06:13 +00:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check for presence of AppleShare FST. We error out and unload
|
|
|
|
* if it's not present. Our code doesn't directly depend on the
|
|
|
|
* AppleShare FST, but in practice it's not useful without it.
|
|
|
|
* This also ensures lower-level AppleTalk stuff is present.
|
|
|
|
*/
|
|
|
|
fstInfoRec.pCount = 2;
|
|
|
|
fstInfoRec.fileSysID = 0;
|
|
|
|
for (i = 1; fstInfoRec.fileSysID != appleShareFSID; i++) {
|
|
|
|
fstInfoRec.fstNum = i;
|
|
|
|
GetFSTInfoGS(&fstInfoRec);
|
|
|
|
if (toolerror() == paramRangeErr)
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2017-04-05 05:13:09 +00:00
|
|
|
LoadOneTool(54, 0x0300); /* load Marinetti 3.0+ */
|
|
|
|
if (toolerror())
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Put Marinetti in the default TPT so its tool stub won't be unloaded,
|
|
|
|
* even if UnloadOneTool is called on it. Programs may still call
|
|
|
|
* TCPIPStartUp and TCPIPShutDown, but those don't actually do
|
|
|
|
* anything, so the practical effect is that Marinetti will always
|
|
|
|
* be available once its init has loaded (which may not have happened
|
|
|
|
* yet when this init loads).
|
|
|
|
*/
|
|
|
|
SetDefaultTPT();
|
2017-03-31 23:04:57 +00:00
|
|
|
|
2017-04-05 05:13:09 +00:00
|
|
|
RamForbid();
|
2017-03-31 23:04:57 +00:00
|
|
|
installCmds();
|
2017-04-05 05:13:09 +00:00
|
|
|
RamPermit();
|
|
|
|
|
|
|
|
runQRec.period = 1;
|
|
|
|
runQRec.signature = 0xA55A;
|
|
|
|
runQRec.jml = 0x5C;
|
|
|
|
runQRec.proc = pollTask;
|
|
|
|
AddToRunQ((Pointer)&runQRec);
|
2017-04-10 03:06:13 +00:00
|
|
|
|
|
|
|
return;
|
2017-04-05 05:13:09 +00:00
|
|
|
|
2017-03-31 23:04:57 +00:00
|
|
|
error:
|
2017-04-10 03:06:13 +00:00
|
|
|
setUnloadFlag();
|
2017-03-31 23:04:57 +00:00
|
|
|
return;
|
|
|
|
}
|
2017-04-05 05:13:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
#pragma databank 1
|
|
|
|
void pollTask(void) {
|
|
|
|
Word stateReg;
|
|
|
|
|
|
|
|
IncBusyFlag();
|
|
|
|
stateReg = ForceRomIn();
|
|
|
|
|
|
|
|
PollAllSessions();
|
|
|
|
runQRec.period = 4*60;
|
|
|
|
|
|
|
|
RestoreStateReg(stateReg);
|
|
|
|
DecBusyFlag();
|
|
|
|
}
|
|
|
|
#pragma databank 0
|