diff --git a/emul/Makefile b/emul/Makefile index 0529287..e5a3335 100644 --- a/emul/Makefile +++ b/emul/Makefile @@ -58,7 +58,7 @@ blkfs: $(BLKPACK) blkfs-bin.h: blkfs $(BIN2C) $(BIN2C) BLKFS < blkfs > $@ -forth: forth.c $(OBJS) forth1-bin.h blkfs +forth: forth.c $(OBJS) forth1-bin.h blkfs-bin.h $(CC) forth.c $(OBJS) -o $@ libz80/libz80.o: libz80/z80.c diff --git a/emul/forth.c b/emul/forth.c index 1629162..4677eac 100644 --- a/emul/forth.c +++ b/emul/forth.c @@ -4,6 +4,7 @@ #include #include "emul.h" #include "forth1-bin.h" +#include "blkfs-bin.h" // in sync with glue.asm #define RAMSTART 0x900 @@ -102,6 +103,12 @@ int main(int argc, char *argv[]) return 1; } blkfp = fopen("blkfs", "r+"); + if (blkfp) { + fprintf(stderr, "Using blkfs file\n"); + } else { + blkfp = fmemopen((char*)BLKFS, sizeof(BLKFS), "r"); + fprintf(stderr, "Using in-memory read-only blkfs\n"); + } Machine *m = emul_init(); m->ramstart = RAMSTART; m->iord[STDIO_PORT] = iord_stdio;