-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[embed] DCPU-16 working with the new split main.ft
- Loading branch information
1 parent
5c45b7d
commit b86523f
Showing
8 changed files
with
96 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,7 @@ | ||
\ Entry point for metacompiling the portable kernel to DCPU-16. | ||
\ Most of the heavy lifting is done in other files, this is just orchestrating. | ||
\ Unified entry point for building the interactive Forth system on DCPU-16. | ||
|
||
REQUIRE ../host/vocabularies.ft | ||
|
||
host definitions | ||
|
||
\ Metacompiler configuration ================================================= | ||
host REQUIRE ../host/configuration.ft \ Default interactive is fine. | ||
|
||
interactive-forth! | ||
16 config char-bits ! | ||
1 config cell-width ! | ||
1 config instr-width ! | ||
|
||
config little-endian? OFF | ||
|
||
\ XXX: Playing with separate spaces. | ||
\ separate-spaces! | ||
\ config data-space-blank? ON | ||
|
||
\ Target spaces ============================================================== | ||
REQUIRE ../host/spaces.ft | ||
|
||
' <be16@> IS <tc@*> | ||
' <be16!> IS <tc!*> | ||
|
||
$0 code-there ORG! | ||
\ $4000 name-there ORG! $8000 name-there space>offset ! | ||
\ $6000 data-there ORG! | ||
|
||
|
||
REQUIRE assembler.ft \ DCPU-16 assembler | ||
|
||
|
||
host REQUIRE ../host/helpers.ft | ||
host REQUIRE model.ft \ Add the DCPU-16 model words | ||
host REQUIRE ../host/dictionary.ft | ||
host REQUIRE ../host/mirrors.ft | ||
|
||
?stack-clear | ||
|
||
\ Now we have what we need to metacompile the CODE definitions at the heart of | ||
\ the new kernel. | ||
host REQUIRE kernel.ft | ||
|
||
\ Overwrite the jump target of the entry code to be main. | ||
\ The instruction is at $0000 and its target argument at $0001. | ||
main 1 tcode! | ||
|
||
\ The main part of the metacompiler | ||
?stack-clear | ||
host REQUIRE ../host/metacompiler.ft | ||
|
||
\ Now an interleaved dance of shared and target-specific metacompiled code. | ||
host REQUIRE ../shared/basics.ft | ||
host REQUIRE branches.ft \ Target-specific branching helpers. | ||
host REQUIRE ../shared/control-structures.ft | ||
host REQUIRE ../shared/exceptions.ft | ||
host REQUIRE model-target.ft | ||
host REQUIRE ../shared/input.ft | ||
host REQUIRE ../shared/core2.ft | ||
host REQUIRE ../shared/refill.ft | ||
host REQUIRE lib.ft \ Division etc. helpers | ||
host REQUIRE hardware.ft \ Hardware handling | ||
host REQUIRE screen.ft | ||
host REQUIRE ../shared/output.ft | ||
host REQUIRE ../shared/error-messages.ft | ||
host REQUIRE intro.ft \ DCPU-16/Risque-16 HW init; intro msg | ||
host REQUIRE ../shared/init.ft \ Shared init code. | ||
|
||
\ NB: You should always include tail.ft as the last stage of your build. | ||
\ It actually emits the assembled image. | ||
|
||
\ Known-missing words ======================================================== | ||
\ Core: ENVIRONMENT? WORD | ||
REQUIRE preamble.ft | ||
host REQUIRE spaces.ft | ||
host REQUIRE system.ft | ||
host REQUIRE disks.ft | ||
host REQUIRE finalize.ft |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
\ Entry point for metacompiling the portable kernel to DCPU-16. | ||
\ Most of the heavy lifting is done in other files, this is just orchestrating. | ||
|
||
REQUIRE ../host/vocabularies.ft | ||
REQUIRE ../host/helpers.ft | ||
|
||
native definitions | ||
[undefined] machine [IF] | ||
DEFER machine | ||
:noname S" dcpu16" ; IS machine | ||
[THEN] | ||
|
||
native DEFER tcforth-output | ||
:noname ( -- c-addr u ) | ||
pad S" forth-" cat machine cat S" .bin" cat | ||
pad tuck - ; IS tcforth-output | ||
|
||
host definitions | ||
|
||
\ Metacompiler configuration ================================================= | ||
host REQUIRE ../host/configuration.ft \ Default interactive is fine. | ||
|
||
interactive-forth! | ||
16 config char-bits ! | ||
1 config cell-width ! | ||
1 config instr-width ! | ||
|
||
config little-endian? OFF | ||
|
||
\ XXX: Playing with separate spaces. | ||
\ separate-spaces! | ||
\ config data-space-blank? ON |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
\ Target spaces ============================================================== | ||
REQUIRE ../host/spaces.ft | ||
|
||
\ Address units are 16-bit values stored on the host as 2 bytes, big-endian. | ||
' <be16@> IS <tc@*> | ||
' <be16!> IS <tc!*> | ||
|
||
$0 code-there ORG! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
REQUIRE assembler.ft \ DCPU-16 assembler | ||
|
||
host REQUIRE ../host/helpers.ft | ||
host REQUIRE model.ft \ Add the DCPU-16 model words | ||
host REQUIRE ../host/dictionary.ft | ||
host REQUIRE ../host/mirrors.ft | ||
|
||
?stack-clear | ||
|
||
\ Now we have what we need to metacompile the CODE definitions at the heart of | ||
\ the new kernel. | ||
host REQUIRE kernel.ft | ||
|
||
\ Overwrite the jump target of the entry code to be main. | ||
\ The instruction is at $0000 and the jump target is at $0001. | ||
main 1 tcode! | ||
|
||
\ The main part of the metacompiler | ||
?stack-clear | ||
host REQUIRE ../host/metacompiler.ft | ||
|
||
\ Now an interleaved dance of shared and target-specific metacompiled code. | ||
host REQUIRE ../shared/basics.ft | ||
host REQUIRE branches.ft \ Target-specific branching helpers. | ||
host REQUIRE ../shared/control-structures.ft | ||
host REQUIRE ../shared/exceptions.ft | ||
host REQUIRE model-target.ft | ||
host REQUIRE ../shared/input.ft | ||
host REQUIRE ../shared/core2.ft | ||
host REQUIRE ../shared/refill.ft | ||
host REQUIRE lib.ft \ Division etc. helpers | ||
host REQUIRE hardware.ft \ Hardware handling | ||
host REQUIRE screen.ft | ||
host REQUIRE ../shared/output.ft | ||
host REQUIRE ../shared/error-messages.ft | ||
host REQUIRE intro.ft \ DCPU-16/Risque-16 HW init; intro msg | ||
host REQUIRE ../shared/init.ft \ Shared init code. | ||
|
||
\ NB: You should always include tail.ft as the last stage of your build. | ||
\ It actually emits the assembled image. | ||
|
||
\ Known-missing words ======================================================== | ||
\ Core: ENVIRONMENT? WORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
host definitions | ||
native definitions | ||
|
||
\ Converts the name text to upper-case. | ||
: >upper ( ch -- ch' ) dup 'a' 'z' 1+ within IF 'a' 'A' - - THEN ; | ||
|
||
: ?stack-clear ( -- ) depth IF ." Stack not clear: " .s cr abort THEN ; | ||
|
||
: cat ( dst src u -- dst' ) | ||
rot swap 2dup + >R move R> ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters