mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 09:38:06 +11:00
emul/8086: wip
This commit is contained in:
parent
efe4b13a4e
commit
939c018792
27
emul/8086/Makefile
Normal file
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
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
3444
emul/8086/cpu.c
Executable file
File diff suppressed because it is too large
Load Diff
3
emul/8086/cpu.h
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
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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user