-
Notifications
You must be signed in to change notification settings - Fork 1
/
installcmds.c
50 lines (40 loc) · 1.39 KB
/
installcmds.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma noroot
#include <types.h>
#include <AppleTalk.h>
#include "asmglue.h"
#include "cmdproc.h"
#include "installcmds.h"
typedef struct NewCmd {
Word cmdNum;
void (*cmdAddr)(void);
LongWord *jslOldCmdLocation;
} NewCmd;
NewCmd newCmds[] = {
{aspGetStatusCommand, cmdProc, NULL},
{aspOpenSessionCommand, cmdProc, NULL},
{aspCloseSessionCommand, cmdProc, NULL},
{aspCommandCommand, cmdProc, NULL},
{aspWriteCommand, cmdProc, NULL},
{nbpLookupNameCommand, nbpCmdProc, NULL},
{pfiLoginCommand, pfiLoginCmdProc, &jslOldPFILogin},
{pfiLogin2Command, pfiLogin2CmdProc, &jslOldPFILogin2},
{pfiLoginContCommand, pfiLoginContCmdProc, &jslOldPFILoginCont},
{pfiListSessions2Command, pfiListSessions2CmdProc, &jslOldPFIListSessions2},
{0, 0, 0}
};
LongWord *cmdTable = (LongWord *)0xE1D600;
LongWord oldCmds[MAX_CMD + 1]; /* holds old entries for commands we changed */
#define JSL 0x22
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;
if (cmd->jslOldCmdLocation != NULL)
*cmd->jslOldCmdLocation = JSL | (oldCmds[cmd->cmdNum] << 8);
}
RestoreStateReg(savedStateReg);
}