emul: embed blkfs in forth binary
This will allow us to read from blkfs in tests.
This commit is contained in:
parent
1bd191e86a
commit
b5c370a936
@ -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
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <termios.h>
|
||||
#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;
|
||||
|
Loading…
Reference in New Issue
Block a user