浏览代码

emul/8086: wip

master
Virgil Dupras 3 年前
父节点
当前提交
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;
}

正在加载...
取消
保存