Virgil Dupras 3 лет назад
Родитель
Сommit
939c018792
5 измененных файлов: 3504 добавлений и 0 удалений
  1. +27
    -0
      emul/8086/Makefile
  2. +8
    -0
      emul/8086/README.md
  3. +3444
    -0
      emul/8086/cpu.c
  4. +3
    -0
      emul/8086/cpu.h
  5. +22
    -0
      emul/8086/forth.c

+ 27
- 0
emul/8086/Makefile Просмотреть файл

@@ -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
- 0
emul/8086/README.md Просмотреть файл

@@ -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
- 0
emul/8086/cpu.c
Разница между файлами не показана из-за своего большого размера
Просмотреть файл


+ 3
- 0
emul/8086/cpu.h Просмотреть файл

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

+ 22
- 0
emul/8086/forth.c Просмотреть файл

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

Загрузка…
Отмена
Сохранить