Skip to content
This repository was archived by the owner on Feb 10, 2021. It is now read-only.

Commit 9135aa2

Browse files
committed
DX-Forth shows banner\!
1 parent 97b75e3 commit 9135aa2

File tree

3 files changed

+62
-32
lines changed

3 files changed

+62
-32
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
; DX-Forth Copy Loop
2+
; Copyright (c) 2017-2019 Samuel A. Falvo II
3+
; See LICENSE file in this or nearest parent directory.
4+
;
5+
; V1.1 : 2018-??-??
6+
; Initial release for Kestrel-3/E2.
7+
; BIOS dependency removed; DX-Forth *is* the new BIOS.
8+
;
9+
; This code takes control immediately after the CPU boots.
10+
; Because the Kestrel-3's ROM is so slow (40+ cycles overhead
11+
; per fetch!), and because the Forth environment was designed
12+
; to be loaded into RAM for the Kestrel-2DX originally,
13+
; this loop exists to migrate the contents of DX-Forth in ROM
14+
; into RAM for final execution.
15+
16+
include "regs.i"
17+
include "dxforth.regs.i"
18+
19+
20+
; This is the cold-boot entry point of the KCP53K
21+
; family of processors. Our task is to copy the
22+
; DX-Forth image to its final resting place in RAM.
23+
; Then, jump into RAM to start the DX-Forth image.
24+
_bios_entry:
25+
auipc gp,0 ; GP := 0, basically.
26+
lw a0,_n1-_bios_entry(gp)
27+
lw a1,_n2-_bios_entry(gp)
28+
lw a2,_n3-_bios_entry(gp)
29+
30+
_bios_copy:
31+
ld a3,0(a0)
32+
sd a3,0(a2)
33+
addi a0,a0,8
34+
addi a2,a2,8
35+
blt a0,a1,_bios_copy
36+
37+
_bios_boot:
38+
lw D,_n3-_bios_entry(gp)
39+
jalr x0,0(D)
40+
41+
_n1: word _start
42+
_n2: word _end
43+
_n3: word $40000000
44+
45+
; This is the official starting image of the DX-Forth
46+
; program image. This jump instruction will appear
47+
; at $40000000 if all goes according to plan, and this
48+
; will then cause DX-Forth to launch.
49+
_start:
50+
incbin "dxforth-image.bin"
51+
_end:

software/src/e2/dxforth/dxforth.asm.m4

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,15 @@
1212
include "regs.i"
1313
include "dxforth.regs.i"
1414

15+
; Alas, HWORD references within the binary image assume that
16+
; we load the DX-Forth image on a 64KB boundary. For this
17+
; reason, we assemble the DX-Forth body of code as a separate
18+
; module, with the origin at 0. We rely on run-time relocation
19+
; to compute absolute addresses.
20+
;
21+
; Just remember to copy this image so that it lies on a 64KB
22+
; boundary.
1523

16-
; This is the cold-boot entry point of the KCP53K
17-
; family of processors. Our task is to copy the
18-
; DX-Forth image to its final resting place in RAM.
19-
; Then, jump into RAM to start the DX-Forth image.
20-
_bios_entry:
21-
auipc gp,0 ; GP := 0, basically.
22-
lw a0,_n1-_bios_entry(gp)
23-
lw a1,_n2-_bios_entry(gp)
24-
lw a2,_n3-_bios_entry(gp)
25-
26-
_bios_copy:
27-
ld a3,0(a0)
28-
sd a3,0(a2)
29-
addi a0,a0,8
30-
addi a2,a2,8
31-
blt a0,a1,_bios_copy
32-
33-
_bios_boot:
34-
lw D,_n3-_bios_entry(gp)
35-
jalr x0,0(D)
36-
37-
_n1: word _start
38-
_n2: word _end
39-
_n3: word $40000000
40-
41-
; This is the official starting image of the DX-Forth
42-
; program image. This jump instruction will appear
43-
; at $40000000 if all goes according to plan, and this
44-
; will then cause DX-Forth to launch.
4524
_start:
4625
jal x0,start_dxforth
4726

@@ -2214,4 +2193,3 @@ __cm: jal W,_docol
22142193

22152194
align 8
22162195
_dxforth_end:
2217-
_end:
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
redo-ifchange ../../../bin/a dxforth.asm
1+
redo-ifchange ../../../bin/a dxforth.asm dxforth-boot.asm
22
exec >&2
3-
../../../bin/a from dxforth.asm to $3
3+
../../../bin/a from dxforth.asm to dxforth-image.bin
4+
../../../bin/a from dxforth-boot.asm to $3

0 commit comments

Comments
 (0)