diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..71e90f7 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +CC = occ +CFLAGS = -w-1 -O-1 + +HTTPTEST_OBJS = httptest.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a +HTTPTEST_PROG = httptest + +NETDISKINIT_OBJS = initstart.a netdiskinit.a hostname.a http.a readtcp.a seturl.a strcasecmp.a tcpconnection.a urlparser.a +# NETDISKINIT_RSRC = +NETDISKINIT_PROG = NetDiskInit + +# NETDISKCDEV_OBJS = +# NETDISKCDEV_RSRC = +# NETDISKCDEV_CDEV = + +PROGS = $(HTTPTEST_PROG) $(NETDISKINIT_PROG) + +.PHONY: default +default: $(PROGS) + +$(HTTPTEST_PROG): $(HTTPTEST_OBJS) + $(CC) $(CFLAGS) -o $@ $^ + +$(NETDISKINIT_PROG): $(NETDISKINIT_OBJS) + $(CC) $(CFLAGS) -o $@ $^ + iix chtyp -tpif $@ + +.PHONY: clean +clean: + rm -f $(PROGS) *.a *.o *.root *.A *.O *.ROOT + +%.a: %.c *.h + $(CC) $(CFLAGS) -c $< + +%.a: %.asm + $(CC) $(CFLAGS) -c $< diff --git a/hostname.c b/hostname.c index 05bc32c..6ebfd88 100644 --- a/hostname.c +++ b/hostname.c @@ -1,3 +1,5 @@ +#pragma noroot + #include #include #include diff --git a/http.c b/http.c index e0b71b0..f59468b 100644 --- a/http.c +++ b/http.c @@ -54,7 +54,7 @@ Boolean BuildHTTPRequest(Session *sess, char *resourceStr) { sizeNeeded = snprintf(sess->httpRequest, sizeNeeded, "GET /%s HTTP/1.1\r\n" "Host: %s\r\n" - "User-Agent: GSRemoteDisk/0.1\r\n" + "User-Agent: GS-NetDisk/1.0a1\r\n" "Accept-Encoding: identity\r\n" //"Accept: */*\r\n" /* default, but some clients send explicitly */ //"Connection: Keep-Alive\r\n" /* same */ diff --git a/main.c b/httptest.c similarity index 100% rename from main.c rename to httptest.c diff --git a/initstart.asm b/initstart.asm new file mode 100644 index 0000000..5031a69 --- /dev/null +++ b/initstart.asm @@ -0,0 +1,16 @@ + case on + +dummy private + jmp InitStart + end + +InitStart private + tay + tsc + clc + adc #4 + sta >unloadFlagPtr + lda #0 + sta >unloadFlagPtr+2 + tya + end diff --git a/netdiskinit.c b/netdiskinit.c new file mode 100644 index 0000000..24fe1c5 --- /dev/null +++ b/netdiskinit.c @@ -0,0 +1,48 @@ +#pragma rtl + +#include +#include +#include +#include +#include + +const char bootInfoString[] = "NetDisk v1.0a1"; + +Word *unloadFlagPtr; + +static void setUnloadFlag(void) { + if (unloadFlagPtr != NULL && *unloadFlagPtr == 0) + *unloadFlagPtr = 1; +} + +int main(void) { + /* + * Load Marinetti. + * We may get an error if the TCPIP init isn't loaded yet, but we ignore it. + * The tool stub is still loaded in that case, which is enough for now. + */ + LoadOneTool(54, 0x0200); + //if (toolerror() && toolerror() != terrINITNOTFOUND) + // goto error; + + /* We're not going to error out, so show boot info. */ + ShowBootInfo(bootInfoString, NULL); + + /* + * Put Marinetti in the default TPT so its tool stub won't be unloaded, + * even if UnloadOneTool is called on it. Programs may still call + * TCPIPStartUp and TCPIPShutDown, but those don't actually do + * anything, so the practical effect is that Marinetti will always + * be available once its init has loaded (which may not have happened + * yet when this init loads). + */ + SetDefaultTPT(); + + // TODO install driver + + return; + +error: + setUnloadFlag(); + return; +} diff --git a/seturl.c b/seturl.c index de2484a..270553e 100644 --- a/seturl.c +++ b/seturl.c @@ -1,3 +1,5 @@ +#pragma noroot + #include #include #include diff --git a/urlparser.c b/urlparser.c index 82d87ef..75ca10c 100644 --- a/urlparser.c +++ b/urlparser.c @@ -1,3 +1,7 @@ +#ifdef __ORCAC__ +# pragma noroot +#endif + #include "urlparser.h" #include