1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-09-29 09:10:56 +10:00

emul: embed blkfs in forth binary

This will allow us to read from blkfs in tests.
This commit is contained in:
Virgil Dupras 2020-04-24 18:01:55 -04:00
parent 1bd191e86a
commit b5c370a936
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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;