diff --git a/emul/.gitignore b/emul/.gitignore index 0f177a7..8843965 100644 --- a/emul/.gitignore +++ b/emul/.gitignore @@ -1,8 +1,6 @@ /forth/stage1 /forth/stage1dbg /forth/stage2 -/forth/stage2dbg /forth/forth -/runbin/runbin /*/*-bin.h /*/*.bin diff --git a/emul/Makefile b/emul/Makefile index 5b57d05..d07c76b 100644 --- a/emul/Makefile +++ b/emul/Makefile @@ -1,4 +1,4 @@ -TARGETS = runbin/runbin forth/forth +TARGETS = forth/forth BIN2C = ../tools/bin2c # Those Forth source files are in a particular order BOOTSRCS = ./forth/conf.fs \ @@ -58,9 +58,6 @@ forth/stage2: forth/stage.c $(OBJS) forth/forth1-bin.h forth/forth: forth/forth.c $(OBJS) forth/forth1-bin.h $(CC) forth/forth.c $(OBJS) -o $@ -runbin/runbin: runbin/runbin.c $(OBJS) - $(CC) runbin/runbin.c $(OBJS) -o $@ - libz80/libz80.o: libz80/z80.c $(MAKE) -C libz80/codegen opcodes $(CC) -Wall -ansi -g -c -o libz80/libz80.o libz80/z80.c diff --git a/emul/README.md b/emul/README.md index 041994e..8103a62 100644 --- a/emul/README.md +++ b/emul/README.md @@ -49,14 +49,6 @@ the power of a full Forth intepreter, including an assembler, to assemble Normally, running this step should yield the exact same `boot.bin` and `z80c.bin` as before, unless of course you've changed the source. -## runbin - -This is a very simple tool that reads binary z80 code from stdin, loads it in -memory starting at address 0 and then run the code until it halts. The exit -code of the program is the value of `A` when the program halts. - -This is used for unit tests. - ## Problems? If the libz80-wrapped zasm executable works badly (hangs, spew garbage, etc.), diff --git a/emul/runbin/runbin.c b/emul/runbin/runbin.c deleted file mode 100644 index 5501d7a..0000000 --- a/emul/runbin/runbin.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -#include "../emul.h" - -/* runbin loads binary from stdin directly in memory address 0 then runs it - * until it halts. The return code is the value of the register A at halt time. - */ - -static void iowr_stderr(uint8_t val) -{ - fputc(val, stderr); -} - -int main() -{ - Machine *m = emul_init(); - m->iowr[0] = iowr_stderr; - // read stdin in mem - int i = 0; - int c = getchar(); - while (c != EOF) { - m->mem[i] = c & 0xff; - i++; - c = getchar(); - } - if (!i) { - fprintf(stderr, "No input, aborting\n"); - return 1; - } - emul_loop(); - return m->cpu.R1.br.A; -} -