mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 12:58:09 +11:00
forth: simplify build process
Make LATEST configurable through a value in the binary instead of through a ZASM constant. This enables the simple concatenation of compiled dicts and simplifies the build process.
This commit is contained in:
parent
b7244f8985
commit
e846d07238
@ -30,7 +30,7 @@ shell/shell: shell/shell.c $(SHELLOBJS) shell/shell-bin.h
|
||||
# z80c.bin is not in the prerequisites because its a bootstrap binary that
|
||||
# should be updated manually through make fbootstrap.
|
||||
forth/forth0.bin: forth/stage0.asm $(ZASMBIN)
|
||||
$(ZASMBIN) $(KERNEL) ../forth forth/z80c.bin forth/stagec.asm < forth/stage0.asm | tee $@ > /dev/null
|
||||
$(ZASMBIN) $(KERNEL) ../forth < forth/stage0.asm | cat - forth/z80c.bin | tee $@ > /dev/null
|
||||
|
||||
forth/forth0-bin.h: forth/forth0.bin
|
||||
./bin2c.sh KERNEL < forth/forth0.bin | tee $@ > /dev/null
|
||||
@ -44,8 +44,8 @@ forth/stage1dbg: forth/stage.c $(OBJS) forth/forth0-bin.h
|
||||
forth/core.bin: $(FORTHSRC_PATHS) forth/stage1
|
||||
cat $(FORTHSRC_PATHS) | ./forth/stage1 | tee $@ > /dev/null
|
||||
|
||||
forth/forth1.bin: forth/stage1.asm forth/forth0.bin forth/core.bin $(ZASMBIN)
|
||||
$(ZASMBIN) $(KERNEL) ../forth forth/z80c.bin forth/core.bin forth/stagec.asm < forth/stage1.asm | tee $@ > /dev/null
|
||||
forth/forth1.bin: forth/forth0.bin forth/core.bin
|
||||
cat forth/forth0.bin forth/core.bin > $@
|
||||
|
||||
forth/forth1-bin.h: forth/forth1.bin
|
||||
./bin2c.sh KERNEL < forth/forth1.bin | tee $@ > /dev/null
|
||||
|
@ -76,6 +76,12 @@ int main(int argc, char *argv[])
|
||||
for (int i=0; i<sizeof(KERNEL); i++) {
|
||||
m->mem[i] = KERNEL[i];
|
||||
}
|
||||
|
||||
// Our binaries don't have their LATEST offset set yet. We do this
|
||||
// on the fly, which is the simplest way to proceed ( bash script to update
|
||||
// LATEST after compilation is too simplicated )
|
||||
m->mem[0x08] = sizeof(KERNEL) & 0xff;
|
||||
m->mem[0x09] = sizeof(KERNEL) >> 8;
|
||||
// Run!
|
||||
running = 1;
|
||||
|
||||
|
@ -79,6 +79,13 @@ int main(int argc, char *argv[])
|
||||
for (int i=0; i<sizeof(KERNEL); i++) {
|
||||
m->mem[i] = KERNEL[i];
|
||||
}
|
||||
|
||||
// Our binaries don't have their LATEST offset set yet. We do this
|
||||
// on the fly, which is the simplest way to proceed ( bash script to update
|
||||
// LATEST after compilation is too simplicated )
|
||||
m->mem[0x08] = sizeof(KERNEL) & 0xff;
|
||||
m->mem[0x09] = sizeof(KERNEL) >> 8;
|
||||
|
||||
// Run!
|
||||
running = 1;
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
.inc "stagec.asm"
|
||||
.equ RAMSTART 0xe800
|
||||
.equ STDIO_PORT 0x00
|
||||
.inc "forth.asm"
|
||||
|
||||
.bin "z80c.bin"
|
||||
CODE_END:
|
||||
|
@ -1,6 +0,0 @@
|
||||
.inc "stagec.asm"
|
||||
.inc "forth.asm"
|
||||
|
||||
.bin "z80c.bin"
|
||||
.bin "core.bin"
|
||||
CODE_END:
|
@ -1,4 +0,0 @@
|
||||
.equ RAMSTART 0xe800
|
||||
.equ HERE_INITIAL CODE_END ; override
|
||||
.equ LATEST CODE_END ; override
|
||||
.equ STDIO_PORT 0x00
|
@ -38,10 +38,6 @@
|
||||
.equ SYSVNXT @+WORD_BUFSIZE
|
||||
.equ RAMEND @+SYSV_BUFSIZE+2
|
||||
|
||||
; (HERE) usually starts at RAMEND, but in certain situations, such as in stage0,
|
||||
; (HERE) will begin at a strategic place.
|
||||
.equ HERE_INITIAL RAMEND
|
||||
|
||||
; *** Stable ABI ***
|
||||
; Those jumps below are supposed to stay at these offsets, always. If they
|
||||
; change bootstrap binaries have to be adjusted because they rely on them.
|
||||
@ -53,7 +49,9 @@
|
||||
; 3
|
||||
jp find
|
||||
nop \ nop ; unused
|
||||
nop \ nop \ nop ; unused
|
||||
; 8
|
||||
nop \ nop ; Placeholder for LATEST
|
||||
nop ; unused
|
||||
; 11
|
||||
jp cellWord
|
||||
jp compiledWord
|
||||
@ -158,12 +156,12 @@ forthMain:
|
||||
ld sp, 0xfffa
|
||||
ld (INITIAL_SP), sp
|
||||
ld ix, RS_ADDR
|
||||
; LATEST is a label to the latest entry of the dict. This can be
|
||||
; overridden if a binary dict has been grafted to the end of this
|
||||
; binary
|
||||
ld hl, LATEST
|
||||
; LATEST is a label to the latest entry of the dict. It is written at
|
||||
; offset 0x08 by the process or person building Forth.
|
||||
ld hl, (0x08)
|
||||
ld (CURRENT), hl
|
||||
ld hl, HERE_INITIAL
|
||||
; For now, we'll always make HERE start right after LATEST. This will
|
||||
; not work on ROM-based system, but I'll adjust later.
|
||||
ld (HERE), hl
|
||||
ld hl, .bootName
|
||||
call find
|
||||
@ -400,6 +398,7 @@ litWord:
|
||||
ld (IP), hl
|
||||
jp next
|
||||
|
||||
.fill 3
|
||||
; *** Dict hook ***
|
||||
; This dummy dictionary entry serves two purposes:
|
||||
; 1. Allow binary grafting. Because each binary dict always end with a dummy
|
||||
|
Loading…
Reference in New Issue
Block a user