Commit Graph

786 Commits

Author SHA1 Message Date
Virgil Dupras ca7c21d49f forth: make "(entry)" call WORD itself
Otherwise, when a defining word would be called outside a definition
itself, it would get the name of the last parsed word, that is,
itself!

For example, dummy.fs, instead of creating a "_______" entry, created
a "(entry)" entry...
2020-03-22 22:27:54 -04:00
Virgil Dupras 5387e08437 forth: make bin staging process a bit less hackish
The goal being to add a new native code dict staging phase.
2020-03-22 21:46:43 -04:00
Virgil Dupras ffe61a12f8 forth: make prev word field relative
This should help with upcoming challenges in bootstrapping z80 code
compiled through Forth.
2020-03-22 17:41:59 -04:00
Virgil Dupras 00de336976 forth: add "CODE"!!! 2020-03-22 12:08:50 -04:00
Virgil Dupras 46833f3819 forth: Forth-ify "LIT", "LITS", "LIT<" 2020-03-22 11:56:40 -04:00
Virgil Dupras 54fd5fbb2b forth: Forth-ify "CREATE" 2020-03-22 11:49:09 -04:00
Virgil Dupras 1e886f5f34 forth: add word "ROUTINE" 2020-03-22 11:25:39 -04:00
Virgil Dupras 33e47d4938 forth: begin z80 assembler 2020-03-21 21:23:13 -04:00
Virgil Dupras d5b6659507 forth: forgot to commit high.fs... 2020-03-21 21:22:07 -04:00
Virgil Dupras ac914c3847 forth: consolidation 2020-03-21 18:40:30 -04:00
Virgil Dupras f4b969986d forth: Forth-ify "."" 2020-03-21 17:21:01 -04:00
Virgil Dupras def4ebd7ea forth: add word "LITS" 2020-03-21 16:31:53 -04:00
Virgil Dupras 145fdd8e05 forth: rename "LITS" to "LIT<" 2020-03-21 16:27:21 -04:00
Virgil Dupras 4627e1c977 forth: Forth-ify "ABORT"" 2020-03-21 16:17:51 -04:00
Virgil Dupras 6487c713ef forth: fix prompt in QUIT conditions 2020-03-21 15:22:37 -04:00
Virgil Dupras 9791c0957d forth: make readline skip prompt when appropriate 2020-03-21 14:59:12 -04:00
Virgil Dupras b47a3ee234 forth: add words "AND", "OR", "XOR" 2020-03-21 14:47:38 -04:00
Virgil Dupras c1ece95089 forth: implement readline in Forth
The commit ended up being much bigger than anticipated. This was a long thread
of underlying complexities. This lead to the creation of interesting concepts
such as (sysv).
2020-03-21 12:57:49 -04:00
Virgil Dupras 2feb246334 forth: give WORD its own buffer
You'll soon see where I'm going with this...
2020-03-19 21:56:53 -04:00
Virgil Dupras 61abafbc1a forth: a little housekeeping 2020-03-19 21:45:27 -04:00
Virgil Dupras abb84b01db forth: Word-ify "readword" 2020-03-19 21:40:35 -04:00
Virgil Dupras 5458a1f7ff forth: a little housekeeping 2020-03-19 17:39:44 -04:00
Virgil Dupras cf95bbcace forth: inline kernel/stdio 2020-03-19 17:26:45 -04:00
Virgil Dupras 6134694513 forth: put all ASM code in the same file 2020-03-19 17:01:15 -04:00
Virgil Dupras f420db135d forth: a little house cleaning 2020-03-19 16:36:54 -04:00
Virgil Dupras af5a97243a forth: implement "0b" number parsing 2020-03-19 16:03:35 -04:00
Virgil Dupras f0cbda1f2e tests: add Forth tests
Modest first step
2020-03-19 15:43:48 -04:00
Virgil Dupras b335e538b4 Move "forth" folder to project's root folder
It's not really an App.
2020-03-18 22:25:44 -04:00
Virgil Dupras ae6334906c forth: inline kernel's core and str units 2020-03-18 22:18:07 -04:00
Virgil Dupras 548facac0b forth: Implement "(parseh)" 2020-03-18 21:52:55 -04:00
Virgil Dupras d874f20278 forth: Add "DO" and "LOOP"
Also, un-IMMEDIATE "LITN" it didn't make any sense.
2020-03-18 20:04:44 -04:00
Virgil Dupras 587d1d0d69 forth: add word "UNTIL" 2020-03-18 16:39:22 -04:00
Virgil Dupras 1df9c4fc1b forth: split forth source into multiple files 2020-03-17 21:44:32 -04:00
Virgil Dupras 9451c599e0 forth: Make (parse) indirect and Forth-ify (parsec) 2020-03-17 21:19:56 -04:00
Virgil Dupras 4212d5161f forth: Word-ify number parsing 2020-03-17 17:46:58 -04:00
Virgil Dupras 707f1dbae1 forth: Word-ify "[COMPILE]" 2020-03-17 17:29:03 -04:00
Virgil Dupras b72901175e forth: Word-ify "[']" and "'" 2020-03-17 16:17:51 -04:00
Virgil Dupras d91af99fde forth: make "'" push 0 when not finding a word 2020-03-17 15:54:17 -04:00
Virgil Dupras 3a70dff53d forth: add word 'ABORT"' 2020-03-17 15:31:15 -04:00
Virgil Dupras 25b6e75cf7 forth: add words "."" and "(print)" 2020-03-17 15:22:13 -04:00
Virgil Dupras a40926d710 forth: check PS everywhere
It turns out we have to...
2020-03-17 14:56:08 -04:00
Virgil Dupras 6314c60ede forth: add word ".X" 2020-03-17 14:05:53 -04:00
Virgil Dupras 549cf74e9d forth: inline code from "apps/lib"
Forth-ification of Collapse OS goes forward. What will happen is that assembly
code in apps/ will become Forth code. The concept of an assembler code library
will become obsolete.

However, Forth's core use some of that code. To facilitate the transition, I'm
inlining that code directly in Forth's code.
2020-03-17 12:49:06 -04:00
Virgil Dupras 017a469d9c forth: Forth-ify "." 2020-03-17 12:26:28 -04:00
Virgil Dupras 839d7097e7 forth: add words "MOD" and "/MOD" 2020-03-16 22:36:29 -04:00
Virgil Dupras 5d5517ac44 forth: allow DEFINE's ";" to be at the start of a newline
Previous to this commit, DEFINE's algo would miss a ";" right after a newline.

This allows for a much nicer formatting+comment of core.fs.
2020-03-16 22:09:23 -04:00
Virgil Dupras aec98a7a3a forth: separate COMPILE and [COMPILE] 2020-03-16 21:31:43 -04:00
Virgil Dupras f404c2f4d0 forth: TIL forth source file extension is "fs" 2020-03-16 19:51:10 -04:00
Virgil Dupras 80ab395823 forth: Simplify execution model
Change the mainloop so that words are executed immediately after they're read.
This greatly simplifies execution model and allow the "DEFINE" word to become
an IMMEDIATE and stop its "copy from compiled words" scheme.

The downside to this is that flow control words no longer work when being used
directly in the input buffer. They only work as part of a definition.

It also broke "RECURSE", but I've replaced it with "BEGIN" and "AGAIN".

Another effect of this change is that definitions can now span multiple lines.

All in all, it feels good to get rid of that COMPBUF...
2020-03-15 22:46:17 -04:00
Virgil Dupras 7befe56597 forth: improve input flow
Readline, instead of being triggered by the end of execution of the last
compiled line is now triggered "just in time", by "WORD".

This allows IMMEDIATE words reading input buffer to span multiple lines
( comments for example, but colon definitions will soon follow ).
2020-03-14 19:10:39 -04:00