Commit Graph

157 Commits

Author SHA1 Message Date
Virgil Dupras 031bfc6d72 forth: setup SYSVNXT in Forth code 2020-03-30 21:48:56 -04:00
Virgil Dupras e5ab0dd1c9 forth: a little bit of ASM routine inlining 2020-03-30 21:33:37 -04:00
Virgil Dupras 5c03b33982 forth: remove sysvarWord type
Not needed anymore. CONSTANT does the trick.
2020-03-30 21:19:48 -04:00
Virgil Dupras 05045b2aa4 forth: move stable ABI stuff at the top of forth.asm
Now we're having a real nice and tidy forth.asm...
2020-03-30 21:02:19 -04:00
Virgil Dupras f366732424 forth: Forth-ify "DOES>" 2020-03-30 20:01:59 -04:00
Virgil Dupras 36e200adbb forth: Forth-ify "SCPY" 2020-03-30 17:59:30 -04:00
Virgil Dupras 5b01f797fc forth: Forth-ify "(find)" 2020-03-30 17:36:15 -04:00
Virgil Dupras de3da19333 forth: Forth-ify "NOT" 2020-03-30 17:26:51 -04:00
Virgil Dupras 4756fb7763 forth: Forth-ify "(parsed)" 2020-03-30 17:21:13 -04:00
Virgil Dupras 80985460d4 forth: remove JTBL
We refer to stable offset as direct numbers instead of offset to JTBL.
Simpler that way.
2020-03-30 17:05:00 -04:00
Virgil Dupras 61195a987d forth: Forth-ify "HERE", "CURRENT" and "JTBL" 2020-03-30 15:11:23 -04:00
Virgil Dupras a9cf861cfd forth: Forth-ify "(parse*)" 2020-03-30 14:49:20 -04:00
Virgil Dupras f9d45f7f53 forth: Forth-ify "FLAGS" 2020-03-30 14:29:21 -04:00
Virgil Dupras 162ff2c5cb forth: Forth-ify "!" 2020-03-30 14:09:39 -04:00
Virgil Dupras 8ef9e7d0da forth: Forth-ify "@" 2020-03-30 14:05:07 -04:00
Virgil Dupras f9c3a0444c forth: Forth-ify "DROP" 2020-03-30 13:57:06 -04:00
Virgil Dupras 49994f09ce forth: add word "2DROP" 2020-03-30 13:54:46 -04:00
Virgil Dupras 8186511727 forth: fix bootstrapping issues with "LITN" and "+" 2020-03-30 13:50:53 -04:00
Virgil Dupras 395eb04fac forth: Forth-ify "C<" 2020-03-30 08:37:33 -04:00
Virgil Dupras f6cba4b1cf forth: Forth-ify "QUIT" 2020-03-30 08:25:22 -04:00
Virgil Dupras da9f9f9899 forth: melt boot binary 2020-03-30 08:11:16 -04:00
Virgil Dupras d09ec0d757 forth: Forth-ify "SWAP" 2020-03-30 08:06:11 -04:00
Virgil Dupras cc4700e389 forth: Forth-ify "DUP" 2020-03-30 08:02:20 -04:00
Virgil Dupras 09cd25df29 forth: Forth-ify "OVER" 2020-03-30 07:58:16 -04:00
Virgil Dupras 9cfddea940 forth: Forth-ify "+" 2020-03-30 07:54:45 -04:00
Virgil Dupras a2c258afba forth: Forth-ify "CMP"
forth.asm under 1K lines!
2020-03-30 07:52:24 -04:00
Virgil Dupras 7c9d799d93 forth: Forth-ify "SCMP" 2020-03-30 07:48:07 -04:00
Virgil Dupras d2dcd96ce1 emul: add useful emul_trace() debugging tool 2020-03-29 22:13:54 -04:00
Virgil Dupras 48078d9c9c forth: Replace "SKIP?" with "(?br)"
There is an alternate git history where I continued the Forth-ification of
words, including "SKIP?", but that was a bad idea: because that word was
written by flow control immediates, I stepped into quicksands where stability
became necessary in z80c.fs and I couldn't gracefully get out of it.

I'm stepping back and take this opportunity to replace the shoddy SKIP? algo
with a more straightforward (?br) implementation.

(br) and (?br) will always stay in boot code where it's easier manage a stable
ABI.
2020-03-29 09:10:23 -04:00
Virgil Dupras 9fcfebd84c forth: Forth-ify "WS?" 2020-03-28 13:18:43 -04:00
Virgil Dupras a17da42021 forth: remove unused (fbr) and (bbr) 2020-03-28 13:12:07 -04:00
Virgil Dupras c1693c6256 forth: Forth-ify "TOWORD" 2020-03-28 13:02:04 -04:00
Virgil Dupras 8b7947bc6a forth: Forth-ify "WORD" 2020-03-28 12:55:22 -04:00
Virgil Dupras 6e3b47f4a4 forth: Replace "(fbr)" and "(bbr)" words by "(br)"
I can't get rid of "(fbr)" and "(bbr)" just yet, but soon...
2020-03-28 11:31:16 -04:00
Virgil Dupras 758ec025dc forth: Forth-ify "LITN" 2020-03-28 10:38:05 -04:00
Virgil Dupras 1227ee7155 forth: Forth-ify "EMIT" 2020-03-28 10:25:02 -04:00
Virgil Dupras 2db6ebc247 forth: Forth-ify "BYE" 2020-03-28 10:14:27 -04:00
Virgil Dupras e0eaa8ba63 forth: Forth-ify "ABORT" 2020-03-28 10:11:52 -04:00
Virgil Dupras 8d8e1d93da forth: slightly improve assembler 2020-03-28 09:39:24 -04:00
Virgil Dupras ab98e9bcd1 forth: Forth-ify "(uflw)" 2020-03-28 09:19:40 -04:00
Virgil Dupras 5471ef02a7 forth: Forth-ify "BOOT" 2020-03-28 09:08:46 -04:00
Virgil Dupras 408d93bd23 forth: Forth-ify "IMMED?" 2020-03-27 21:58:24 -04:00
Virgil Dupras 8f990ff954 forth: Forth-ify "IMMEDIATE" 2020-03-27 21:36:05 -04:00
Virgil Dupras 26871be6f2 forth: Forth-ify "C," 2020-03-27 19:12:46 -04:00
Virgil Dupras 49101915fb forth: Forth-ify "(entry)" 2020-03-27 16:52:42 -04:00
Virgil Dupras 799ea72974 forth: Forth-ify ":"!!!
Lifting ourselves by the bootstraps!
2020-03-27 16:21:34 -04:00
Virgil Dupras f40c14715e forth: take advantage of the new [] mode 2020-03-27 15:35:58 -04:00
Virgil Dupras 839021e0f8 forth: Forth-ify "(print)" 2020-03-27 12:39:59 -04:00
Virgil Dupras edcd80e3a6 forth: Forth-ify "(parse)" 2020-03-27 11:49:50 -04:00
Virgil Dupras 941224be94 forth: Forth-ify "-" 2020-03-27 11:36:58 -04:00
Virgil Dupras 005dd98fc2 forth: Forth-ify "R>" and ">R" 2020-03-27 11:27:40 -04:00
Virgil Dupras 1e7e696e4a forth: Forth-ify ";"!!!
Ain't that not self-bootstrapping enough to your taste? Whoa, I'm
getting dizzy...
2020-03-27 09:32:03 -04:00
Virgil Dupras dad0081123 forth: Forth-ify "INTERPRET"!!!
Now we're seriously getting into real boostrapping territory...
2020-03-27 08:23:45 -04:00
Virgil Dupras 40eda1d933 forth: Forth-ify "*" 2020-03-26 14:36:14 -04:00
Virgil Dupras e82f13acf1 forth: Forth-ify "I", "I'", "J" 2020-03-26 14:11:22 -04:00
Virgil Dupras cf2f6703bb forth: make forth/forth.asm spit whole binary
emul/forth/stage{0,1}.asm now only configure constants and append
binaries.
2020-03-26 12:17:02 -04:00
Virgil Dupras 966f6df0c5 forth: Forth-ify "KEY" 2020-03-26 12:12:11 -04:00
Virgil Dupras 636407969d forth: Forth-ify "(emit)" 2020-03-26 12:05:48 -04:00
Virgil Dupras 42abbe75aa forth: remove 0 and 1 constants
They do save space (nearly 100b), but they complicate our Forth-ification
process. We'll re-add them later.
2020-03-26 11:05:58 -04:00
Virgil Dupras 6eaabb9bbe forth: make word name of variable length
This allows us to save a whole 500 bytes on the final binary size!

This change comes after I took a look at the hex dump and saw that one letter
constants in z80a.fs took a lot of space.
2020-03-26 10:53:33 -04:00
Virgil Dupras 52e6eaafc7 forth: Forth-ify "/MOD" 2020-03-25 22:51:23 -04:00
Virgil Dupras 61bb22e8c9 forth: straighten out "/MOD"
The removal of the "divide" routine highlighted the fact that
nativeWord wasn't properly stabilized.
2020-03-25 21:49:09 -04:00
Virgil Dupras c2d8fc845d forth: bring ." and ABORT" down to core.fs level 2020-03-25 20:39:07 -04:00
Virgil Dupras 6d8edeec63 forth: Forth-ify "C!" and "C@" 2020-03-25 17:52:51 -04:00
Virgil Dupras 66412a1c30 forth: Forth-ify "XOR" 2020-03-25 17:24:46 -04:00
Virgil Dupras 1871f7cdb4 forth: Forth-ify "OR" 2020-03-25 17:19:47 -04:00
Virgil Dupras eb6a07a162 forth: Forth-ify "PC@" 2020-03-25 17:13:10 -04:00
Virgil Dupras 7beac94b5a forth: Forth-ify "PC!" 2020-03-25 17:07:15 -04:00
Virgil Dupras 3a08fa7e74 forth: add a stable ABI 2020-03-24 23:02:06 -04:00
Virgil Dupras f0ab57c8cc forth: Forth-ify "AND" 2020-03-24 22:09:52 -04:00
Virgil Dupras 6c5f39806b forth: improve bootstrap process 2020-03-24 21:13:02 -04:00
Virgil Dupras d6516e2122 forth: Forth-ify "2*" stack management words 2020-03-24 14:44:10 -04:00
Virgil Dupras 67c55b0b2f forth: Forth-ify ROT, a native word!
This requires us to significantly adjust our build process, which
now has 3 stages.
2020-03-24 13:46:05 -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 33e47d4938 forth: begin z80 assembler 2020-03-21 21:23:13 -04:00
Virgil Dupras f4b969986d forth: Forth-ify "."" 2020-03-21 17:21:01 -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 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 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 1df9c4fc1b forth: split forth source into multiple files 2020-03-17 21:44:32 -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 f404c2f4d0 forth: TIL forth source file extension is "fs" 2020-03-16 19:51:10 -04:00
Virgil Dupras c3838714d5 forth: improve execution model
My approach with RS was slightly wrong: RS' TOP was always containing current
IP. It worked, but it was problematic when came the time to introduce
RS-modifying words: it's impossible to modify RS in a word without immediately
messing your flow.

Therefore, what used to be RS' TOS has to be a variable that isn't changed
midway by RS-modifying words. I guess that's why RS is called *return* stack...
2020-03-13 16:01:09 -04:00
Virgil Dupras a8e573c84a forth: add bin dict compilation stage!
Big one.

This allows us to write higher order words directly in Forth, which is much
more convenient than writing post-immediate (see "NOT" structure in diff if
you want to see what I mean) structures in ASM.

These structures can then be written to ROM (rather than loaded in RAM for
definitions loaded at run-time).

That's quite a bit of tooling that was added, 2 compilations stages, but I
think it's well worth it.
2020-03-12 00:14:44 -04:00
Virgil Dupras abdf2c8adc emul/forth: allow running commands from file 2020-03-11 19:03:47 -04:00
Virgil Dupras e95614755b emul: add forth target 2020-03-09 22:26:02 -04:00
Virgil Dupras 49228e418c apps/forth: new (WIP) application 2020-03-07 12:13:15 -05:00
Virgil Dupras a442c46935 sms/vdp: highlight cursor with inverted palette 2020-02-26 09:43:50 -05:00
Virgil Dupras 247b200dcc New kernel module: grid 2020-02-24 20:36:08 -05:00
Virgil Dupras 6224ea2fe9 zasm: use printcrlf instead of hardcoded CRLF 2020-02-23 18:52:25 -05:00
Virgil Dupras 0f2b3aca24 zasm: allow zasm to omit its 3rd argument
A bug in rdWS made zasm error out when omiting its 3rd argument.

fixes #90
2020-02-18 15:46:55 -05:00
Virgil Dupras e1e0676191 emul/hw/sms: add A/B ports and a Genesis pad
This makes the emulator suitable to run the base SMS recipe.
2020-01-10 21:20:44 -05:00
Virgil Dupras b60252e330 emul/hw/(ti|sms): detect window being closed
Previously, it would never get out of the event loop.
2020-01-10 16:59:48 -05:00
Virgil Dupras 66744c0026 emul/hw/(ti|sms): fix compilation with gcc
It seems to be picky about where it accepts its link flags.
2020-01-09 08:36:29 -05:00