1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-10 02:38:05 +11:00
Commit Graph

356 Commits

Author SHA1 Message Date
Virgil Dupras
bc3aabc84e Update z80c.bin's LATEST during xcomp instead of using slatest 2020-04-25 22:02:44 -04:00
Virgil Dupras
389b23fe1a Change C<? mechanic
It's now a simple flag updated by the C< implementation. No more
routine pointer.

The goal is to avoid tons of "ok" during a LOAD operation.
2020-04-25 09:10:25 -04:00
Virgil Dupras
b5c370a936 emul: embed blkfs in forth binary
This will allow us to read from blkfs in tests.
2020-04-24 18:01:55 -04:00
Virgil Dupras
1bd191e86a Move /emul/forth/* to /emul
Less noisy this way
2020-04-24 17:53:58 -04:00
Virgil Dupras
816563e2e3 Stop LOADing on ABORT
This is done by adding a "C<* override" layer that is reset to 0 on
ABORT.

The problem was that when ABORT happened during a LOAD, we had a
resetted RSP and started from a clean INTERPRET, but LOAD didn't
have the opportunity to restore C<*, which caused it to continue
interpreting from the faulty BLK.

With a C<* override, we don't need to *restore* C<*, we just need to
clear the override.
2020-04-24 14:10:40 -04:00
Virgil Dupras
af39b37dd1 Replace the "> " prompt with the more traditional "ok" one
This is more than cosmetic, it's also highly usable. The presence
or absence of the "ok" message allows us to know whether the command
aborted. Previously, the "> " prompt appeared when the system expected
a prompt in the INTERPRET context, whether the previous command aborted
or not.

Also, this allows us to get rid of that ugly FLAGS global variable.
2020-04-24 12:10:07 -04:00
Virgil Dupras
44403c3d4c Move icore to blkfs
The way is clear for complete stage1 bootstrapping on the RC2014
target!
2020-04-23 15:14:14 -04:00
Virgil Dupras
dd6ce1b8fe Avoid using (xentry) outside xcomp config 2020-04-23 12:09:31 -04:00
Virgil Dupras
fcd77f80ab Use blk's boot.z80 2020-04-22 21:49:44 -04:00
Virgil Dupras
338769a0a8 z80a: add PUSH0, PUSH1, PUSHZ, macros 2020-04-22 19:03:32 -04:00
Virgil Dupras
7464c67c80 boot: fix (roll)
It didn't work for values over 0xff. Duh!
2020-04-22 10:47:23 -04:00
Virgil Dupras
7a0e63746f parse: don't validate 0x and 0b lengths
It doesn't serve much purpose and takes up many precious bytes. And,
after all, parsed didn't do it either...
2020-04-21 20:40:23 -04:00
Virgil Dupras
372524fd19 Move xcomp to blocks 2020-04-21 20:30:14 -04:00
Virgil Dupras
446ce574cd Add words "'S" and "S0" 2020-04-21 07:45:23 -04:00
Virgil Dupras
ae14c55feb boot: a little dereferencing to make things a bit faster 2020-04-20 23:30:08 -04:00
Virgil Dupras
e569e40665 Forth-ify 2DUP 2OVER 2SWAP
2DROP was left in boot.z80 because it's used in icore.
2020-04-20 23:18:57 -04:00
Virgil Dupras
0438cb92fe Add word "ROLL" 2020-04-20 23:06:39 -04:00
Virgil Dupras
4967c2add2 Merge z80c.fs and boot.fs into boot.z80 2020-04-20 21:27:34 -04:00
Virgil Dupras
41ed70f8cb z80c: Add word "PICK" 2020-04-20 21:22:07 -04:00
Virgil Dupras
353d12c27d boot: inline chkRS, make next a bit faster 2020-04-20 20:28:25 -04:00
Virgil Dupras
d466c6d95d emul: make stage2 load z80a from blkfs
This allows us to remove forth/z80a.fs. Another big step towards
self-hosting!
2020-04-19 21:31:41 -04:00
Virgil Dupras
6ae65940d2 Update bootstrap bin
It seems that I had forgotten in an earlier commit.
2020-04-19 20:57:09 -04:00
Virgil Dupras
a70366aa43 drv/sdc: Implement SDC!
This has been tested in the RC2014 emulator. I could edit blocks with
the Block Editor and they would correctly be written to SDC.
2020-04-18 19:39:28 -04:00
Virgil Dupras
c64a8a2e2b drv/sdc: new unit to drive SD card through SPI relay
Goes through initialization in RC2014 emulator.
2020-04-18 11:11:11 -04:00
Virgil Dupras
b062a9092a parse: use "0<" instead of "0 <"
As I wrote in my "Clarify signed-ness" commit, "0 <" is broken.

Also, made this unit a bit more compact. The RC2014 stage1 can
really use some breathing room...
2020-04-18 09:18:09 -04:00
Virgil Dupras
82044454d5 Merge branch 'master' into forth 2020-04-17 20:39:08 -04:00
Virgil Dupras
9c41744e46 emul/hw/rc2014: implement blk write in sdc
All of that should help me implement sdc support much faster in
Forth.
2020-04-17 20:19:55 -04:00
Virgil Dupras
7544b3834b emul/hw/rc2014: implement blkread in sdc
I now get to "fls" in recipes/rc2014/sdcard!
2020-04-17 19:10:22 -04:00
Virgil Dupras
ae470397d7 emul/hw/rc2014: add sdc emulator (wip)
so far, it goes through initialization with the rc2014/sdcard recipe.
2020-04-17 15:11:32 -04:00
Virgil Dupras
9edab10a3a blk: add dirty flag and auto write blocks on fetch
Also, fix some PSP leaks related to LOAD.
2020-04-16 20:59:20 -04:00
Virgil Dupras
eefa8e6de5 Add word "BLK!"
as well as emulator support for it. We can now write an edited
block back to "blkfs".
2020-04-16 17:22:18 -04:00
Virgil Dupras
5d4155aa32 Add words 1+ 2+ 1- 2- and consts 0 1 -1
Saves quite a few bytes in the final binary.
2020-04-15 21:29:39 -04:00
Virgil Dupras
e1e634c815 boot: compaction
It's more hassle than it seems to move the stable ABI...
2020-04-15 20:57:46 -04:00
Virgil Dupras
a56ace4d3e boot: optimize (br) 2020-04-15 20:03:56 -04:00
Virgil Dupras
0750e8d0c0 Use IY for IP instead of RAM+06 2020-04-15 17:01:15 -04:00
Virgil Dupras
2a84a426b4 Strip usages of IY register 2020-04-15 16:53:04 -04:00
Virgil Dupras
2b0186fd58 boot: make routine field 1b
I forgot to do it earlier. NOP having an opcode of 0, it didn't have
any effect.
2020-04-15 16:24:03 -04:00
Virgil Dupras
d2ec5e271c Optimize boot binary's word execution code
Should be significantly faster now. Less push/popping and usage of
DE instead of IY.
2020-04-15 16:09:10 -04:00
Virgil Dupras
d8de8a058a Make word routine refs 1b instead of 2
Saves quite a bit of binary space. More than 300 bytes in forth1.bin
2020-04-15 15:16:11 -04:00
Virgil Dupras
e40c059c26 Make word routines all in the <0x100 range 2020-04-15 14:00:59 -04:00
Virgil Dupras
728e4ce123 Bring EXECUTE word outside of stable ABI 2020-04-15 13:36:28 -04:00
Virgil Dupras
2439f1ed86 Change SCMP for S=
Remove flagsToBC boot routine.
2020-04-15 12:19:58 -04:00
Virgil Dupras
16d5cd91de emul: don't segfault on quit when there is no blkfs 2020-04-15 10:56:49 -04:00
Virgil Dupras
c40f336959 icore: extract "_pdacc" from "(parsed)"
Makes boot binary a bit bigger, but that "_pdacc" word will be
reused in high level apps.
2020-04-15 10:41:27 -04:00
Virgil Dupras
79acf92b28 emul: fix Makefile 2020-04-15 09:01:09 -04:00
Virgil Dupras
aec19e5c87 Add word "LOAD" 2020-04-14 18:15:07 -04:00
Virgil Dupras
a67101fb8b Add word "EMPTY" 2020-04-14 16:07:07 -04:00
Virgil Dupras
b8dd86bd18 Move notes.txt in blk 2020-04-14 14:54:42 -04:00
Virgil Dupras
f59cac0588 blk: first steps 2020-04-14 09:07:20 -04:00
Virgil Dupras
d919a10265 Remove runbin
It's not used
2020-04-13 19:25:28 -04:00
Virgil Dupras
d08a9711c5 boot: make HERE point to RAMEND instead of CURRENT
The former was only used in the peculiar context of "/emul". The
regular case is actually HERE pointing to RAMEND on boot.
2020-04-13 11:43:15 -04:00
Virgil Dupras
d996dd8c9e Add one layer of indirection in subsystem memory management
This allows optional subsystems to not needlessly reserve too much
system memory and it also reduces offsets bookkeeping.
2020-04-12 20:42:00 -04:00
Virgil Dupras
c515720e23 Revert "Remove link.fs"
Let's revisit the relinking approach, with LITA this time.
This reverts commit 6652125d47.
2020-04-11 13:31:17 -04:00
Virgil Dupras
af3db1c3cf Add word "LITA" 2020-04-11 13:13:20 -04:00
Virgil Dupras
3822182226 xcomp: shrink scope
It seems that xcomp can't manage to reliably compile core+ units.
Let's limit the role of xcomp to z80c+icore.

I'm getting a little desperate here. I'll revisit the link.fs approach
with a new idea I had...
2020-04-11 11:38:45 -04:00
Virgil Dupras
6368cc3bac Remove (sysv)
Replace its usages with direct RAM+ offsets. The (sysv) mechanism was
incompatible with cross-compilation of a full interpreter.
2020-04-10 14:57:00 -04:00
Virgil Dupras
a6efb65010 emul: extract capture mark from icore into xstop.fs 2020-04-10 14:16:45 -04:00
Virgil Dupras
f62376bd0a boot: remove _bend
It's not needed anymore now that the boot binary is built in one pass.
2020-04-10 09:59:45 -04:00
Virgil Dupras
7aa1be070b emul: build boot binary in one pass
... instead of building boot.fs, and then z80c.fs/icore.fs in separate
passes. This strengten xcomp by making it support 2 completely separate
dicts (that is, the X dict is *not* connected to the system dict. The chain
now stops at EXIT def in boot.fs).
2020-04-10 09:55:58 -04:00
Virgil Dupras
c8c337fd58 xcomp: widen scope
We can now cross-compile core.fs.
2020-04-10 07:53:41 -04:00
Virgil Dupras
e6d3638f4f Add CURRENT* and simplify xcomp 2020-04-09 12:01:08 -04:00
Virgil Dupras
1b6286dcfe Make (find) 2-layered, the lower layer having CURRENT as a param 2020-04-09 11:20:54 -04:00
Virgil Dupras
66dc621919 xcomp: don't automatically shadow core words 2020-04-09 09:43:48 -04:00
Virgil Dupras
0c3067ed9a icore: simplify definition of ":" and ";" 2020-04-09 09:38:59 -04:00
Virgil Dupras
784b109652 So, why was ":" an immediate again? 2020-04-09 09:27:51 -04:00
Virgil Dupras
afed423530 Remove memory maps
It was a dead end. my new tentative solution is xcomp.
2020-04-09 09:21:55 -04:00
Virgil Dupras
b69ca4488e Add emul_memdump() and stop automatically on ROM write 2020-04-09 08:26:41 -04:00
Virgil Dupras
68f359d6c2 Add xcomp unit for cross compilation
Memory mapping is a dead end too, solution has to be at a higher
level. xcomp is my new approach.
2020-04-09 08:23:53 -04:00
Virgil Dupras
2a2e3a64a4 Move IMMED? from z80c to icore 2020-04-08 20:09:32 -04:00
Virgil Dupras
a7a2f3d08b Move IMMEDIATE from z80c to core
This makes IMMEDIATE affected by memory mappings.
2020-04-08 19:43:44 -04:00
Virgil Dupras
64e441d059 Move SCPY from z80c to icore
This way, it can be affected by memory mappers.
2020-04-08 16:12:34 -04:00
Virgil Dupras
6652125d47 Remove link.fs
This was a dead end.
2020-04-07 21:23:42 -04:00
Virgil Dupras
ba918d0fef Add memory maps 2020-04-07 20:54:10 -04:00
Virgil Dupras
d4324292fb Merge remote-tracking branch 'origin/master' into forth 2020-04-07 19:32:30 -04:00
Byron A. Grobe
217df20d77
Moved tools/bin2c to single-level with other tools. 2020-04-07 16:56:55 -05:00
Virgil Dupras
521ff84ca4 Reserve some RAM for future features 2020-04-07 17:32:04 -04:00
Virgil Dupras
71d1350143 emul/hw/rc2014: add memdump command
Why didn't I think of adding it before?
2020-04-07 13:37:52 -04:00
Virgil Dupras
400f0ab0b0 boot: fix flagsToBC
Why did I ever think that using CM was a good idea? any comparison
with numbers more than 0x8000 apart would be wrong...
2020-04-07 11:26:37 -04:00
Virgil Dupras
1c6e979028 link: new unit to relink dictionaries
Not quite functional yet, but works in toy situations. The goal is to
concatenate RC2014's bootstrapped dict to the boot binary.
2020-04-06 20:59:55 -04:00
Virgil Dupras
974018831e Add chained comparison support 2020-04-05 16:11:17 -04:00
Byron A. Grobe
f65c189e9b
Replace bin2c.sh with a more portable implementation.
`xxd' is not available on all systems, and on others does not support
the `-i' flag. Since bin2c.sh relied on a tool that I can't seem to find
a compatible version of, I have included a simple, portable replacement in C.

Usage remains the same:
bin2c ARRAYNAME < inputfile > outputfile.

This change is also reflected in emul/Makefile.
2020-04-05 13:04:05 -05:00
Virgil Dupras
ba384bfa0f Add stripfc tool 2020-04-04 10:27:21 -04:00
Virgil Dupras
41cefb7460 Extract EMIT-dependent routines from core 2020-04-04 08:08:45 -04:00
Virgil Dupras
d013c572ad Use proper RAM addr for HERE in SCPY 2020-04-04 07:34:38 -04:00
Virgil Dupras
80891d7ec1 Add in-memory bootstrapping system
This should help with the bootstrapping of non-emulated environment.
For example, I have a problem with the RC2014: I can't send it
bootstrap info until the ACIA is up. I need to find a way...
2020-04-03 20:13:11 -04:00
Virgil Dupras
b575d7f863 Move (print) and (uflw) from icore to core 2020-04-03 07:44:44 -04:00
Virgil Dupras
9235fa9223 Add /tools/slatest
To update LATEST offset more easily. Will be useful for recipes.
2020-04-02 23:20:47 -04:00
Virgil Dupras
6bf51ae57c Forth reboot underway! 2020-04-02 20:44:29 -04:00
Virgil Dupras
b162ef84f5 forth: fix broken RAM+ 2020-04-02 13:42:49 -04:00
Virgil Dupras
941791d609 forth: remove RAMSTART and RS_ADDR from stable ABI 2020-04-02 11:39:40 -04:00
Virgil Dupras
2481ed4b66 forth: remove dummy.fs
All "stop pings" are now explicitly made at appropriate places. This
fixes a problem I've introduced in the last commit where RAM+ was
unexpectedly part of a stable ABI because of "HERE" usage in dummy.fs.

This system will, anyways, soon change because boot.bin and z80c.bin
will be built during the same process (but there's a bit of retooling
to do before I get there).
2020-04-02 11:29:23 -04:00
Virgil Dupras
68a7be3707 forth: Remove RAM offsets from stable ABI
Doing this was a bit stupid. These offsets are constants. Moreover,
having them in stable ABI had us construct the boot binary from the
stable ABI of the host, making it very difficult to change RAMSTART
for a new system.
2020-04-02 10:20:51 -04:00
Virgil Dupras
d0c5d3a741 Forth self-bootstraps!!!
This commit cuts Forth's dependency on zasm. It now self-assembles
its own boot-binary! Things are a bit messy now, I'll clean up
later.
2020-04-01 22:19:37 -04:00
Virgil Dupras
e846d07238 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.
2020-04-01 08:54:01 -04:00
Virgil Dupras
b7244f8985 forth: shrink forth.asm's binary size 2020-03-31 22:11:44 -04:00
Virgil Dupras
1e85d60d89 forth: Forth-ify "," 2020-03-31 16:32:50 -04:00
Virgil Dupras
7d5b1f5cea forth: Forth-ify parseDecimal 2020-03-31 15:04:28 -04:00
Virgil Dupras
25814c0b8b forth: add label system to z80 assembler 2020-03-31 09:23:00 -04:00
Virgil Dupras
ce6e31dda1 forth: inline "strcmp" 2020-03-31 08:02:40 -04:00
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
Virgil Dupras
6acd22492c emul/hw/sms: WIP
VDP kinda works. Can see the Collapse OS prompt with SMS base recipe
if `STDIO_GETC` gets replaced with infinite loop (no input emul yet).
2020-01-08 22:06:50 -05:00