Add support for calling asynchronous completion routines.

At this point it can connect and largely work, but there are still several issues.
This commit is contained in:
Stephen Heumann 2017-04-02 19:01:49 -05:00
parent 1bd953dd40
commit 17421e0ba5
5 changed files with 50 additions and 8 deletions

View File

@ -1,6 +1,6 @@
CFLAGS = -i -w
DSITEST_OBJS = dsitest.o aspinterface.o dsi.o readtcp.o endian.o tcpconnection.o atipmapping.o asmglue.o
DSITEST_OBJS = dsitest.o aspinterface.o dsi.o readtcp.o endian.o tcpconnection.o atipmapping.o asmglue.o cmdproc.o
DSITEST_PROG = dsitest
AFPMOUNTER_OBJS = afpmounter.o callat.o endian.o
@ -14,7 +14,7 @@ AFPBRIDGE_PROG = afpbridge
PROGS = $(DSITEST_PROG) $(AFPMOUNTER_PROG) $(DUMPCMDTBL_PROG) $(AFPBRIDGE_PROG)
.PHONY: $(PROGS)
.PHONY: default
default: $(PROGS)
$(DSITEST_PROG): $(DSITEST_OBJS)

View File

@ -10,6 +10,7 @@
#include "endian.h"
#include "readtcp.h"
#include "asmglue.h"
#include "cmdproc.h"
static void CompleteCommand(Session *sess, Word result);
static void EndSession(Session *sess, Boolean callAttnRoutine);
@ -253,7 +254,9 @@ static void CompleteCommand(Session *sess, Word result) {
commandRec->result = result;
// TODO call completion routine
if ((commandRec->async & AT_ASYNC) && commandRec->completionPtr != NULL) {
CallCompletionRoutine((void *)commandRec->completionPtr);
}
}

View File

@ -1,13 +1,16 @@
case on
RamGoComp gequ $E1100C
RamForbid gequ $E11018
RamPermit gequ $E1101C
* Location of command rec ptr on entry to an AppleTalk command procedure
* (in the system zero page, which is the current direct page)
cmdRecPtr gequ $80
* Bogus segment to go into the .root file and force generation of .a/.o file
bogus private
nop
end
* Location to put completion routine ptr before calling RamGoComp
compPtr gequ $84
* AppleTalk command procedure (which acts as a dispatcher for all commands)
cmdProc start
@ -21,3 +24,32 @@ cmdProc start
sta 6,s
jml DispatchASPCommand
end
CallCompletionRoutine start
phb
jsl ForceLCBank2 ;use LC bank 2
pha
phd
lda #0 ;set direct page = system zero page
tcd
jsl RamForbid
lda 9,s
sta compPtr
lda 9+2,s
sta compPtr+2
ora 9,s
beq skip ;skip call if compPtr = 0
jsl >RamGoComp
skip jsl RamPermit
pld
jsl RestoreStateReg
pla
sta 3,s
pla
sta 3,s
plb
rtl
end

7
cmdproc.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef CMDPROC_H
#define CMDPROC_H
void cmdProc(void);
void CallCompletionRoutine(void *);
#endif

View File

@ -3,8 +3,8 @@
#include <types.h>
#include <AppleTalk.h>
#include "asmglue.h"
#include "cmdproc.h"
extern void cmdProc(void);
extern LongWord completionRtn;
typedef struct NewCmd {