Parcourir la source

emul/8086: and we have liftoff!

Getting a Collapse OS prompt.
master
Virgil Dupras il y a 3 ans
Parent
révision
d11ac3f006
6 fichiers modifiés avec 26 ajouts et 11 suppressions
  1. +2
    -4
      emul/8086/Makefile
  2. +3
    -2
      emul/8086/cpu.c
  3. +1
    -1
      emul/8086/cpu.h
  4. +0
    -3
      emul/8086/foo.asm
  5. +6
    -1
      emul/8086/forth.c
  6. +14
    -0
      emul/8086/xcomp.fs

+ 2
- 4
emul/8086/Makefile Voir le fichier

@@ -13,10 +13,8 @@ forth: forth.c forth.bin $(OBJS)
emul.o: emul.c $(BLKFS)
$(CC) -DFBIN_PATH=\"`pwd`/forth.bin\" -DBLKFS_PATH=\"`pwd`/$(BLKFS)\" -c -o emul.o emul.c

forth.bin: foo.asm
nasm -o $@ foo.asm
#forth.bin: xcomp.fs $(STAGE) $(BLKFS)
# $(CDIR)/stage < xcomp.fs > $@
forth.bin: xcomp.fs $(STAGE)
$(CDIR)/stage < xcomp.fs > $@

$(BLKFS): $(STAGE)



+ 3
- 2
emul/8086/cpu.c Voir le fichier

@@ -1217,13 +1217,13 @@ void intcall86(uint8_t intnum) {
tf = 0;*/
}

void exec86(int execloops) {
int exec86(int execloops) {
int loopcount;
uint8_t docontinue;
static uint16_t firstip;

for (loopcount = 0; loopcount < execloops; loopcount++) {
if (hltstate) return;
if (hltstate) return 0;

reptype = 0;
segoverride = 0;
@@ -3393,6 +3393,7 @@ void exec86(int execloops) {
break;
}
}
return 1;
}

void reset86() {


+ 1
- 1
emul/8086/cpu.h Voir le fichier

@@ -53,5 +53,5 @@ void write86 (uint32_t addr32, uint8_t value);
void writew86 (uint32_t addr32, uint16_t value);
uint8_t read86 (uint32_t addr32);
uint16_t readw86 (uint32_t addr32);
void exec86(int execloops);
int exec86(int execloops); // returns 0 if halted
void reset86();

+ 0
- 3
emul/8086/foo.asm Voir le fichier

@@ -1,3 +0,0 @@
mov al, 'X'
int 1
hlt

+ 6
- 1
emul/8086/forth.c Voir le fichier

@@ -19,9 +19,14 @@ void int1() {
putchar(getreg8(regal));
}

void int2() {
putreg8(regal, getchar());
}

int main(int argc, char *argv[])
{
INTHOOKS[1] = int1;
INTHOOKS[2] = int2;
reset86();
// initialize memory
FILE *bfp = fopen(FBIN_PATH, "r");
@@ -36,6 +41,6 @@ int main(int argc, char *argv[])
c = getc(bfp);
}
fclose(bfp);
exec86(100);
while (exec86(100));
return 0;
}

+ 14
- 0
emul/8086/xcomp.fs Voir le fichier

@@ -0,0 +1,14 @@
0xff00 CONSTANT RS_ADDR
0xfffa CONSTANT PS_ADDR
RS_ADDR 0x80 - CONSTANT SYSVARS
30 LOAD ( 8086 asm )
262 LOAD ( xcomp ) 270 LOAD ( xcomp overrides )
445 461 LOADR ( 8086 boot code )
353 LOAD ( xcomp core low )
CODE (emit) AX POPx, 1 INT, ;CODE
CODE (key) 2 INT, AH 0 MOVri, AX PUSHx, ;CODE
380 LOAD ( xcomp core high )
(entry) _ ( Update LATEST ) PC ORG @ 8 + !
EOT,
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!

Chargement…
Annuler
Enregistrer