AFPBridge/installcmds.c
Stephen Heumann 503b15b5e4 Make afpbridge an init.
This currently uses the run queue to poll for messages from the server, which works OK in typical desktop programs but not in other environments.
2017-04-05 00:24:54 -05:00

42 lines
929 B
C

#pragma noroot
#include <types.h>
#include <AppleTalk.h>
#include "asmglue.h"
#include "cmdproc.h"
typedef struct NewCmd {
Word cmdNum;
void (*cmdAddr)(void);
} NewCmd;
NewCmd newCmds[] = {
{aspGetStatusCommand, cmdProc},
{aspOpenSessionCommand, cmdProc},
{aspCloseSessionCommand, cmdProc},
{aspCommandCommand, cmdProc},
{aspWriteCommand, cmdProc},
{0, 0}
};
LongWord *cmdTable = (LongWord *)0xE1D600;
#define MAX_CMD rpmFlushSessionCommand
LongWord oldCmds[MAX_CMD + 1]; /* holds old entries for commands we changed */
void installCmds(void) {
Word savedStateReg;
NewCmd *cmd;
savedStateReg = ForceLCBank2();
for (cmd = newCmds; cmd->cmdNum != 0; cmd++) {
oldCmds[cmd->cmdNum] = cmdTable[cmd->cmdNum];
cmdTable[cmd->cmdNum] =
(oldCmds[cmd->cmdNum] & 0xFF000000) | (LongWord)cmd->cmdAddr;
}
RestoreStateReg(savedStateReg);
}