1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-17 08:08:07 +11: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) blkfs-bin.h: blkfs $(BIN2C)
$(BIN2C) BLKFS < blkfs > $@ $(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 $@ $(CC) forth.c $(OBJS) -o $@
libz80/libz80.o: libz80/z80.c libz80/libz80.o: libz80/z80.c

View File

@ -4,6 +4,7 @@
#include <termios.h> #include <termios.h>
#include "emul.h" #include "emul.h"
#include "forth1-bin.h" #include "forth1-bin.h"
#include "blkfs-bin.h"
// in sync with glue.asm // in sync with glue.asm
#define RAMSTART 0x900 #define RAMSTART 0x900
@ -102,6 +103,12 @@ int main(int argc, char *argv[])
return 1; return 1;
} }
blkfp = fopen("blkfs", "r+"); 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(); Machine *m = emul_init();
m->ramstart = RAMSTART; m->ramstart = RAMSTART;
m->iord[STDIO_PORT] = iord_stdio; m->iord[STDIO_PORT] = iord_stdio;