emul: remove stage1

This commit is contained in:
Virgil Dupras 2020-05-14 10:49:24 -04:00
parent e6bac985fa
commit 9d4d9de511
5 changed files with 25 additions and 52 deletions

View File

@ -14,24 +14,12 @@ $(BLKPACK):
$(BIN2C): $(BLKPACK)
$(BLKUNPACK): $(BLKPACK)
stage0.bin: stage2 xcomp.fs
cat xcomp.fs | ./stage2 > stage0.bin
stage0-bin.h: stage0.bin $(BIN2C)
$(BIN2C) KERNEL < stage0.bin > $@
stage1: stage.c $(OBJS) stage0-bin.h
$(CC) stage.c $(OBJS) -o $@
stage1dbg: stage.c $(OBJS) stage0-bin.h
$(CC) -DDEBUG stage.c $(OBJS) -o $@
# not dependent on forth.bin to avoid circular deps.
forth-bin.h: $(BIN2C)
$(BIN2C) KERNEL < forth.bin > $@
stage2: stage.c $(OBJS) forth-bin.h blkfs-bin.h
$(CC) -DSTAGE2 stage.c $(OBJS) -o $@
$(CC) stage.c $(OBJS) -o $@
blkfs: $(BLKPACK)
$(BLKPACK) ../blk > $@
@ -51,8 +39,8 @@ emul.o: emul.c
.PHONY: updatebootstrap
updatebootstrap: stage1 stage1.fs
./stage1 < stage1.fs > forth.bin
updatebootstrap: stage2 xcomp.fs
./stage2 < xcomp.fs > forth.bin
.PHONY: pack
pack:

Binary file not shown.

View File

@ -2,12 +2,8 @@
#include <stdio.h>
#include <unistd.h>
#include "emul.h"
#ifdef STAGE2
#include "forth-bin.h"
#include "blkfs-bin.h"
#else
#include "stage0-bin.h"
#endif
/* Staging binaries
@ -74,7 +70,6 @@ static void iowr_here(uint8_t val)
end_here |= val;
}
#ifdef STAGE2
static void iowr_blk(uint8_t val)
{
blkid <<= 8;
@ -86,7 +81,6 @@ static uint8_t iord_blkdata()
{
return BLKFS[blkpos++];
}
#endif
int main(int argc, char *argv[])
{
@ -95,10 +89,8 @@ int main(int argc, char *argv[])
m->iord[STDIO_PORT] = iord_stdio;
m->iowr[STDIO_PORT] = iowr_stdio;
m->iowr[HERE_PORT] = iowr_here;
#ifdef STAGE2
m->iowr[BLK_PORT] = iowr_blk;
m->iord[BLKDATA_PORT] = iord_blkdata;
#endif
// initialize memory
for (int i=0; i<sizeof(KERNEL); i++) {
m->mem[i] = KERNEL[i];

View File

@ -1,28 +0,0 @@
: EFS@
256 /MOD 3 PC! 3 PC!
1024 0 DO
4 PC@
BLK( I + C!
LOOP
;
: EFS!
256 /MOD 3 PC! 3 PC!
1024 0 DO
BLK( I + C@ 4 PC!
LOOP
;
: INIT
CURRENT @ HERE !
BLK$
['] EFS@ BLK@* !
['] EFS! BLK!* !
RDLN$
LIT< _sys [entry]
." Collapse OS" NL
;
(entry) _
H@ 0x08 BIN+ ! ( update LATEST )
," INIT "
H@ 256 /MOD 2 PC! 2 PC!

View File

@ -9,11 +9,32 @@
393 LOAD ( xcomp core low )
: (emit) 0 PC! ;
: (key) 0 PC@ ;
: EFS@
256 /MOD 3 PC! 3 PC!
1024 0 DO
4 PC@
BLK( I + C!
LOOP
;
: EFS!
256 /MOD 3 PC! 3 PC!
1024 0 DO
BLK( I + C@ 4 PC!
LOOP
;
420 LOAD ( xcomp core high )
(entry) _
( Update LATEST )
PC ORG @ 8 + !
," CURRENT @ HERE ! "
," ' (key) 12 RAM+ ! "
," : INIT "
," BLK$ "
," ['] EFS@ BLK@* ! "
," ['] EFS! BLK!* ! "
," RDLN$ "
," LIT< _sys [entry] "
," LIT< CollapseOS (print) NL "
," ; INIT "
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!