mirror of
https://github.com/sheumann/AFPBridge.git
synced 2025-02-10 22:30:38 +00:00
Add utility for dumping the AppleTalk command table, and glue code for accessing it.
This commit is contained in:
parent
7d79acda96
commit
65da8f895e
19
Makefile.mk
19
Makefile.mk
@ -6,8 +6,13 @@ DSITEST_PROG = dsitest
|
||||
AFPMOUNTER_OBJS = afpmounter.o callat.o endian.o
|
||||
AFPMOUNTER_PROG = afpmounter
|
||||
|
||||
.PHONY: default
|
||||
default: $(DSITEST_PROG) $(AFPMOUNTER_PROG)
|
||||
DUMPCMDTBL_OBJS = dumpcmdtbl.o asmglue.o
|
||||
DUMPCMDTBL_PROG = dumpcmdtbl
|
||||
|
||||
PROGS = $(DSITEST_PROG) $(AFPMOUNTER_PROG) $(DUMPCMDTBL_PROG)
|
||||
|
||||
.PHONY: $(PROGS)
|
||||
default: $(PROGS)
|
||||
|
||||
$(DSITEST_PROG): $(DSITEST_OBJS)
|
||||
occ $(CFLAGS) -o $@ $(DSITEST_OBJS)
|
||||
@ -15,12 +20,12 @@ $(DSITEST_PROG): $(DSITEST_OBJS)
|
||||
$(AFPMOUNTER_PROG): $(AFPMOUNTER_OBJS)
|
||||
occ $(CFLAGS) -o $@ $(AFPMOUNTER_OBJS)
|
||||
|
||||
endian.o: endian.asm
|
||||
occ $(CFLAGS) -c $<
|
||||
$(DUMPCMDTBL_PROG): $(DUMPCMDTBL_OBJS)
|
||||
occ $(CFLAGS) -o $@ $(DUMPCMDTBL_OBJS)
|
||||
|
||||
callat.o: callat.asm
|
||||
occ $(CFLAGS) -c $<
|
||||
%.macros: %.asm
|
||||
macgen $< $@ /lang/orca/Libraries/ORCAInclude/m16.*
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) $(DSITEST_OBJS) $(DSITEST_PROG) $(AFPMOUNTER_PROG) $(AFPMOUNTER_OBJS) > .null
|
||||
$(RM) $(PROGS) *.o *.root > .null
|
||||
|
29
asmglue.asm
Normal file
29
asmglue.asm
Normal file
@ -0,0 +1,29 @@
|
||||
case on
|
||||
mcopy asmglue.macros
|
||||
|
||||
LCBANK2 gequ $C083
|
||||
STATEREG gequ $C068
|
||||
|
||||
ForceLCBank2 start
|
||||
short i,m
|
||||
lda >STATEREG ;get original state reg.
|
||||
tax
|
||||
lda >LCBANK2 ;force LC bank 2
|
||||
lda >LCBANK2
|
||||
long i,m
|
||||
txa
|
||||
rtl
|
||||
end
|
||||
|
||||
RestoreStateReg start
|
||||
short m
|
||||
plx
|
||||
pla
|
||||
ply
|
||||
pha
|
||||
phx
|
||||
tya
|
||||
sta >STATEREG
|
||||
long m
|
||||
rtl
|
||||
end
|
12
asmglue.h
Normal file
12
asmglue.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef ASMGLUE_H
|
||||
#define ASMGLUE_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
extern Word ForceLCBank2(void);
|
||||
extern void RestoreStateReg(Word);
|
||||
|
||||
void IncBusyFlag(void) inline(0, 0xE10064);
|
||||
void DecBusyFlag(void) inline(0, 0xE10068);
|
||||
|
||||
#endif
|
40
asmglue.macros
Normal file
40
asmglue.macros
Normal file
@ -0,0 +1,40 @@
|
||||
macro
|
||||
&l long &a,&b
|
||||
lclb &i
|
||||
lclb &m
|
||||
&a amid &a,1,1
|
||||
&m setb ("&a"="M").or.("&a"="m")
|
||||
&i setb ("&a"="I").or.("&a"="i")
|
||||
aif c:&b=0,.a
|
||||
&b amid &b,1,1
|
||||
&m setb ("&b"="M").or.("&b"="m").or.&m
|
||||
&i setb ("&b"="I").or.("&b"="i").or.&i
|
||||
.a
|
||||
&l rep #&m*32+&i*16
|
||||
aif .not.&m,.b
|
||||
longa on
|
||||
.b
|
||||
aif .not.&i,.c
|
||||
longi on
|
||||
.c
|
||||
mend
|
||||
macro
|
||||
&l short &a,&b
|
||||
lclb &i
|
||||
lclb &m
|
||||
&a amid &a,1,1
|
||||
&m setb ("&a"="M").or.("&a"="m")
|
||||
&i setb ("&a"="I").or.("&a"="i")
|
||||
aif c:&b=0,.a
|
||||
&b amid &b,1,1
|
||||
&m setb ("&b"="M").or.("&b"="m").or.&m
|
||||
&i setb ("&b"="I").or.("&b"="i").or.&i
|
||||
.a
|
||||
&l sep #&m*32+&i*16
|
||||
aif .not.&m,.b
|
||||
longa off
|
||||
.b
|
||||
aif .not.&i,.c
|
||||
longi off
|
||||
.c
|
||||
mend
|
24
dumpcmdtbl.c
Normal file
24
dumpcmdtbl.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <types.h>
|
||||
#include "asmglue.h"
|
||||
|
||||
LongWord *cmdTable = (LongWord *)0xE1D600;
|
||||
|
||||
LongWord cmdTableCopy[256];
|
||||
|
||||
int main(void) {
|
||||
int i;
|
||||
Word savedStateReg;
|
||||
|
||||
IncBusyFlag();
|
||||
savedStateReg = ForceLCBank2();
|
||||
for (i = 0; i <= 0xFF; i++) {
|
||||
cmdTableCopy[i] = cmdTable[i];
|
||||
}
|
||||
RestoreStateReg(savedStateReg);
|
||||
DecBusyFlag();
|
||||
|
||||
for (i = 0; i <= 0xFF; i++) {
|
||||
printf("%02x: %08lx\n", i, cmdTableCopy[i]);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user