mirror of
https://github.com/sheumann/AFPBridge.git
synced 2024-06-07 16:21:41 +00:00
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.
This commit is contained in:
parent
1f6122ba39
commit
503b15b5e4
|
@ -9,7 +9,7 @@ AFPMOUNTER_PROG = afpmounter
|
||||||
DUMPCMDTBL_OBJS = dumpcmdtbl.o asmglue.o
|
DUMPCMDTBL_OBJS = dumpcmdtbl.o asmglue.o
|
||||||
DUMPCMDTBL_PROG = dumpcmdtbl
|
DUMPCMDTBL_PROG = dumpcmdtbl
|
||||||
|
|
||||||
AFPBRIDGE_OBJS = afpbridge.o aspinterface.o dsi.o readtcp.o endian.o tcpconnection.o atipmapping.o asmglue.o installcmds.o cmdproc.o callat.o
|
AFPBRIDGE_OBJS = afpinit.o afpbridge.o aspinterface.o dsi.o readtcp.o endian.o tcpconnection.o atipmapping.o asmglue.o installcmds.o cmdproc.o callat.o
|
||||||
AFPBRIDGE_PROG = afpbridge
|
AFPBRIDGE_PROG = afpbridge
|
||||||
|
|
||||||
PROGS = $(DSITEST_PROG) $(AFPMOUNTER_PROG) $(DUMPCMDTBL_PROG) $(AFPBRIDGE_PROG)
|
PROGS = $(DSITEST_PROG) $(AFPMOUNTER_PROG) $(DUMPCMDTBL_PROG) $(AFPBRIDGE_PROG)
|
||||||
|
@ -28,10 +28,15 @@ $(DUMPCMDTBL_PROG): $(DUMPCMDTBL_OBJS)
|
||||||
|
|
||||||
$(AFPBRIDGE_PROG): $(AFPBRIDGE_OBJS)
|
$(AFPBRIDGE_PROG): $(AFPBRIDGE_OBJS)
|
||||||
occ $(CFLAGS) -o $@ $(AFPBRIDGE_OBJS)
|
occ $(CFLAGS) -o $@ $(AFPBRIDGE_OBJS)
|
||||||
|
chtyp -tpif $@
|
||||||
|
|
||||||
%.macros: %.asm
|
%.macros: %.asm
|
||||||
macgen $< $@ /lang/orca/Libraries/ORCAInclude/m16.*
|
macgen $< $@ /lang/orca/Libraries/ORCAInclude/m16.*
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
install: $(AFPBRIDGE_PROG)
|
||||||
|
cp $(AFPBRIDGE_PROG) "*/System/System.Setup"
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(PROGS) *.o *.root > .null
|
$(RM) $(PROGS) *.o *.root > .null
|
||||||
|
|
76
afpbridge.c
76
afpbridge.c
|
@ -1,40 +1,66 @@
|
||||||
|
#pragma rtl
|
||||||
|
|
||||||
|
#include <appletalk.h>
|
||||||
#include <locator.h>
|
#include <locator.h>
|
||||||
#include <tcpip.h>
|
#include <desk.h>
|
||||||
#include <orca.h>
|
#include <orca.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include "installcmds.h"
|
#include "installcmds.h"
|
||||||
#include "aspinterface.h"
|
#include "aspinterface.h"
|
||||||
#include "dsi.h"
|
|
||||||
#include "asmglue.h"
|
#include "asmglue.h"
|
||||||
|
|
||||||
|
void pollTask(void);
|
||||||
|
|
||||||
|
static struct RunQRec {
|
||||||
|
Long reserved1;
|
||||||
|
Word period;
|
||||||
|
Word signature;
|
||||||
|
Long reserved2;
|
||||||
|
Byte jml;
|
||||||
|
void (*proc)(void);
|
||||||
|
} runQRec;
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
Boolean loadedTCP = FALSE;
|
LoadOneTool(54, 0x0300); /* load Marinetti 3.0+ */
|
||||||
Boolean startedTCP = FALSE;
|
if (toolerror())
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (!TCPIPStatus() || toolerror()) {
|
/*
|
||||||
LoadOneTool(54, 0x0300); /* load Marinetti 3.0+ */
|
* Put Marinetti in the default TPT so its tool stub won't be unloaded,
|
||||||
if (toolerror())
|
* even if UnloadOneTool is called on it. Programs may still call
|
||||||
goto error;
|
* TCPIPStartUp and TCPIPShutDown, but those don't actually do
|
||||||
loadedTCP = TRUE;
|
* anything, so the practical effect is that Marinetti will always
|
||||||
TCPIPStartUp();
|
* be available once its init has loaded (which may not have happened
|
||||||
if (toolerror())
|
* yet when this init loads).
|
||||||
goto error;
|
*/
|
||||||
startedTCP = TRUE;
|
SetDefaultTPT();
|
||||||
}
|
|
||||||
|
|
||||||
|
RamForbid();
|
||||||
installCmds();
|
installCmds();
|
||||||
|
RamPermit();
|
||||||
|
|
||||||
while (TRUE) {
|
runQRec.period = 1;
|
||||||
IncBusyFlag();
|
runQRec.signature = 0xA55A;
|
||||||
PollAllSessions();
|
runQRec.jml = 0x5C;
|
||||||
DecBusyFlag();
|
runQRec.proc = pollTask;
|
||||||
asm { cop 0x7f }
|
AddToRunQ((Pointer)&runQRec);
|
||||||
}
|
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (startedTCP)
|
|
||||||
TCPIPShutDown();
|
|
||||||
if (loadedTCP)
|
|
||||||
UnloadOneTool(54);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma databank 1
|
||||||
|
void pollTask(void) {
|
||||||
|
Word stateReg;
|
||||||
|
|
||||||
|
IncBusyFlag();
|
||||||
|
stateReg = ForceRomIn();
|
||||||
|
|
||||||
|
PollAllSessions();
|
||||||
|
runQRec.period = 4*60;
|
||||||
|
|
||||||
|
RestoreStateReg(stateReg);
|
||||||
|
DecBusyFlag();
|
||||||
|
}
|
||||||
|
#pragma databank 0
|
||||||
|
|
20
afpinit.asm
Normal file
20
afpinit.asm
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
case on
|
||||||
|
|
||||||
|
dummy private
|
||||||
|
jml InitStart
|
||||||
|
end
|
||||||
|
|
||||||
|
unloadFlagPtr data
|
||||||
|
ds 4
|
||||||
|
end
|
||||||
|
|
||||||
|
InitStart private
|
||||||
|
tay
|
||||||
|
tsc
|
||||||
|
clc
|
||||||
|
adc #4
|
||||||
|
sta >unloadFlagPtr
|
||||||
|
lda #0
|
||||||
|
sta >unloadFlagPtr+2
|
||||||
|
tya
|
||||||
|
end
|
|
@ -39,7 +39,3 @@ RestoreStateReg start
|
||||||
long m
|
long m
|
||||||
rtl
|
rtl
|
||||||
end
|
end
|
||||||
|
|
||||||
completionRtn data
|
|
||||||
ds 4
|
|
||||||
end
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
#include "asmglue.h"
|
#include "asmglue.h"
|
||||||
#include "cmdproc.h"
|
#include "cmdproc.h"
|
||||||
|
|
||||||
extern LongWord completionRtn;
|
|
||||||
|
|
||||||
typedef struct NewCmd {
|
typedef struct NewCmd {
|
||||||
Word cmdNum;
|
Word cmdNum;
|
||||||
void (*cmdAddr)(void);
|
void (*cmdAddr)(void);
|
||||||
|
@ -27,17 +25,10 @@ LongWord *cmdTable = (LongWord *)0xE1D600;
|
||||||
|
|
||||||
LongWord oldCmds[MAX_CMD + 1]; /* holds old entries for commands we changed */
|
LongWord oldCmds[MAX_CMD + 1]; /* holds old entries for commands we changed */
|
||||||
|
|
||||||
ATGetInfoRec getInfoRec;
|
|
||||||
|
|
||||||
void installCmds(void) {
|
void installCmds(void) {
|
||||||
Word savedStateReg;
|
Word savedStateReg;
|
||||||
NewCmd *cmd;
|
NewCmd *cmd;
|
||||||
|
|
||||||
getInfoRec.async = 0;
|
|
||||||
getInfoRec.command = atGetInfoCommand;
|
|
||||||
_CALLAT(&getInfoRec);
|
|
||||||
completionRtn = getInfoRec.completionRtn;
|
|
||||||
|
|
||||||
savedStateReg = ForceLCBank2();
|
savedStateReg = ForceLCBank2();
|
||||||
|
|
||||||
for (cmd = newCmds; cmd->cmdNum != 0; cmd++) {
|
for (cmd = newCmds; cmd->cmdNum != 0; cmd++) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user