@@ -0,0 +1,27 @@ | |||||
TARGETS = forth | |||||
OBJS = cpu.o | |||||
CDIR = ../../cvm | |||||
STAGE = $(CDIR)/stage | |||||
BLKFS = $(CDIR)/blkfs | |||||
.PHONY: all | |||||
all: $(TARGETS) | |||||
forth: forth.c $(OBJS) | |||||
$(CC) forth.c $(OBJS) -lncurses -o $@ | |||||
emul.o: emul.c forth.bin $(BLKFS) | |||||
$(CC) -DFBIN_PATH=\"`pwd`/forth.bin\" -DBLKFS_PATH=\"`pwd`/$(BLKFS)\" -c -o emul.o emul.c | |||||
forth.bin: xcomp.fs $(STAGE) $(BLKFS) | |||||
$(CDIR)/stage < xcomp.fs > $@ | |||||
$(BLKFS): $(STAGE) | |||||
$(STAGE): | |||||
$(MAKE) -C $(CDIR) all | |||||
.PHONY: clean | |||||
clean: | |||||
rm -f $(TARGETS) $(OBJS) forth.bin | |||||
@@ -0,0 +1,8 @@ | |||||
# 8086 emulator | |||||
This is a work in progress. The goal is to have something lighter than QEMU to | |||||
run Collapse OS on and also something that is easier to plug with my stuff. | |||||
Something I could run without BIOS (have my own studs for INT 10 and INT 13). | |||||
My first try was with 8086tiny, but this code is messy. Fake86 is a bit bigger, | |||||
but also cleaner. |
@@ -0,0 +1,3 @@ | |||||
void exec86(int execloops); | |||||
void reset86(); | |||||
void printregs(); |
@@ -0,0 +1,22 @@ | |||||
#include <stdint.h> | |||||
#include <stdio.h> | |||||
#include "cpu.h" | |||||
extern uint8_t RAM[0x100000]; | |||||
int main(int argc, char *argv[]) | |||||
{ | |||||
int i = 0; | |||||
int ch = 0; | |||||
reset86(); | |||||
ch = getchar(); | |||||
while (ch != EOF) { | |||||
RAM[i++] = ch; | |||||
ch = getchar(); | |||||
} | |||||
printregs(); | |||||
exec86(1); | |||||
printregs(); | |||||
return 0; | |||||
} |