This commit is contained in:
Virgil Dupras 2020-10-24 20:41:51 -04:00
джерело efe4b13a4e
коміт 939c018792
5 змінених файлів з 3504 додано та 0 видалено

27
emul/8086/Makefile Normal file

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

8
emul/8086/README.md Normal file

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

3444
emul/8086/cpu.c Executable file

Різницю між файлами не показано, бо вона завелика Завантажити різницю

3
emul/8086/cpu.h Executable file

@ -0,0 +1,3 @@
void exec86(int execloops);
void reset86();
void printregs();

22
emul/8086/forth.c Normal file

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