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

380 Commits

Author SHA1 Message Date
Virgil Dupras
eec9549bde Make rdln use system RAM 2020-05-14 14:26:56 -04:00
Virgil Dupras
8a58449776 Add word ERR 2020-05-14 11:57:26 -04:00
Virgil Dupras
5446afd87d emul: rename stage2 to stage 2020-05-14 10:55:39 -04:00
Virgil Dupras
9d4d9de511 emul: remove stage1 2020-05-14 10:49:24 -04:00
Virgil Dupras
e6bac985fa Cross-compiles in a single stage!
Finally got rid of the XPACKed core and managed to cross-compile
all core words, which greatly simplifies the bootstrapping process.
2020-05-14 10:17:38 -04:00
Virgil Dupras
68262f925b Almost done De-XPACKing! 2020-05-14 09:58:48 -04:00
Virgil Dupras
640e3321fc Move a bunch of words from XPACKed core to xcomp core 2020-05-14 09:54:33 -04:00
Virgil Dupras
4143e2a699 Improve late-stage xcomp 2020-05-14 09:45:42 -04:00
Virgil Dupras
179c66be8a Move a bunch of words from XPACKed core to xcomp core 2020-05-14 08:50:43 -04:00
Virgil Dupras
74896051bb Move BOOT, (boot<) and INTEPRET to high xcomp
Saves us an (ok) indirection and will save us more soon.
2020-05-14 08:45:01 -04:00
Virgil Dupras
40a756cf1c Move a bunch of words from XPACKed core to xcomp core 2020-05-14 08:18:53 -04:00
Virgil Dupras
51997533ff Move a bunch of words from XPACKed core to xcomp core 2020-05-14 07:58:55 -04:00
Virgil Dupras
80d730318a Simplify LOAD's INTERPRET exit mechanism 2020-05-13 22:55:52 -04:00
Virgil Dupras
2e9e7047bf Make INTERPRET break on ASCII EOT
This should allow me to simplify LOAD's exit mechanism on block
end.
2020-05-13 21:44:46 -04:00
Virgil Dupras
052d59a3a2 TOWORD: tiny optimization
My mind is getting forthy.
2020-05-13 20:59:00 -04:00
Virgil Dupras
33d37d4ce9 WORD: don't overwrite RAM on words over 31 chars
This allows me to reclaim some RAM I hadn't even noticed I
needlessly monopolise.
2020-05-13 20:39:53 -04:00
Virgil Dupras
76037ca1e7 Simplify boot process
That INIT thing is unnecessary.
2020-05-13 14:19:54 -04:00
Virgil Dupras
bb77cd0759 xcomp: add overrides into a loadable block
Makes xcomp.fs units shorter.
2020-05-13 13:33:24 -04:00
Virgil Dupras
0434d02818 xcomp: implement X['] 2020-05-13 13:24:58 -04:00
Virgil Dupras
7c20501f27 Move core's blk to xcomp core (low and high)
TODO: implement X['] so that I can remove those XCURRENT patterns.
2020-05-13 10:50:46 -04:00
Virgil Dupras
d956386e9b Move core's readln to xcomp core (high) 2020-05-13 09:28:32 -04:00
Virgil Dupras
029df00ad4 Free some space for xcomp core 2020-05-13 09:11:57 -04:00
Virgil Dupras
56af516d07 Move core's fmt to xcomp core (high) 2020-05-13 09:02:44 -04:00
Virgil Dupras
e2e9faef2c Move a bunch of words from core to xcomp core 2020-05-13 08:50:07 -04:00
Virgil Dupras
d6a3e79394 Free some space for xcomp core low 2020-05-13 08:00:49 -04:00
Virgil Dupras
ddf23e3d02 Move a bunch of words from core to xcomp core 2020-05-13 07:55:36 -04:00
Virgil Dupras
cbf5baf3b6 Pack core words a bit
This leaves space for xcomp-core which is growing.
2020-05-12 21:27:06 -04:00
Virgil Dupras
dfe474ca0e xcomp: add XCOMPILE and X[COMPILE]
This allows us to move words like ABORT" to xcomp-core, which is
I think the last roadblock before being able to unify all drivers
into a single xcomp layer.
2020-05-12 21:08:18 -04:00
Virgil Dupras
1094ec9c57 Make DO..LOOP stable
DO and LOOP now only compile words from stable ABI, which make them
suitable for xcomp. This will greatly simplify driver writing and
allow us to mostly avoid the low/high divide in drivers.

LEAVE is still xcomp-incompatible though.

This make us very very tight for "<0x100" limit for literal words.
Hopefully, we won't need more stuff in that area of the binary...
2020-05-12 10:40:59 -04:00
Virgil Dupras
b760c2d353 SCPY: don't copy the NULL
This makes [entry] much simpler. Also, remove unused LITS word.
2020-05-12 07:36:20 -04:00
Virgil Dupras
231d727598 Move a few words from core to xcomp core 2020-05-12 07:21:34 -04:00
Virgil Dupras
da371451cc Replace INITIAL_SP with PS_ADDR conf
Now I struggle to remember why I ever did things they way I did.
There must have been a reason...
2020-05-11 21:08:24 -04:00
Virgil Dupras
a476773813 Add words BIT@ and BIT! 2020-05-10 08:40:49 -04:00
Virgil Dupras
e06d6c5345 ti84: we have a prompt 2020-05-09 14:28:55 -04:00
Virgil Dupras
4ce0727c72 ti84: kbd driver wip 2020-05-09 11:55:58 -04:00
Virgil Dupras
afc2327770 Split icore in 2 parts
The goal is to insert device drivers in between.
2020-05-08 21:47:03 -04:00
Virgil Dupras
baf725aa38 Move a bunch of words from core to inner core
That makes it easier to write drivers that can be xcompiled.
2020-05-08 20:55:50 -04:00
Virgil Dupras
b90efb0f7f ti84: first glyph on screen!
On the emulator of course...
2020-05-08 09:07:44 -04:00
Virgil Dupras
58ec54fc97 ti84: wip
Gave more priority to CPU in the emulator because initialization would
otherwise be horrendously slow.
2020-05-08 07:56:34 -04:00
Virgil Dupras
24e588019b Add words RSHIFT and LSHIFT 2020-05-07 15:41:43 -04:00
Virgil Dupras
eaeb138a0c Add words C@- C!- and MOVE- 2020-05-06 20:37:08 -04:00
Virgil Dupras
58ece9f9a1 editor: implement I command
Also, made LIST properly handle full 64-chars lines not ending with
a null or CR. Previously, such a line would be accompanied by its
following line, duplicating that line's output.
2020-05-06 12:19:36 -04:00
Virgil Dupras
f54b1dc504 Add 2>R and 2R>
This allows us to make DO..LOOP more compact.
2020-05-06 09:55:05 -04:00
Virgil Dupras
60b4bbf28a Fix DUMP's broken "round up to next 8" logic
This was caused by the removal of signed-ness a long while ago.
2020-05-05 22:09:11 -04:00
Virgil Dupras
31119c2de3 xcomp: move all offset spitting to the end of the unit
I'd like to move this code, along with all recipe contents, to blk/.
It's easier if "emul-related" code is gathered at the same place.
2020-05-05 20:10:04 -04:00
Virgil Dupras
fa79e3d8a6 Make (print) stop on CR
Lines edited with the Block editor end with 0xd and (print) spits
spurious CR when printing those lines.

Also, properly initialize ACC in BROWSE.
2020-05-05 15:49:50 -04:00
Virgil Dupras
c681cb639d Add words >< and =><= 2020-05-04 22:30:29 -04:00
Virgil Dupras
c494917452 blk: Add LOAD+ and LOADR+
And use them in all places they make sense.
2020-05-04 21:43:48 -04:00
Virgil Dupras
24e9fa0c30 Add word NL 2020-05-04 08:10:18 -04:00
Virgil Dupras
a3c3a2f44a Remove unused DELW 2020-05-03 20:36:35 -04:00
Virgil Dupras
47a9c89f19 Update READMEs 2020-05-03 12:51:21 -04:00
Virgil Dupras
f023f9bcb4 Pack core words blks a bit tighter
With all this recent movements, we had a bit of a fragmentation
issue.
2020-05-02 21:47:32 -04:00
Virgil Dupras
3d908cef3a Move all parsing words to Inner core
This allows us to get rid of the (parse*) indirection.
2020-05-02 21:21:47 -04:00
Virgil Dupras
8009270e79 Optimize parsing words 2020-05-02 20:32:20 -04:00
Virgil Dupras
931c812394 Remove cmp
Not worth the complexity and space.
2020-05-02 19:57:56 -04:00
Virgil Dupras
0b3a328e65 Add a layer of indirection for KEY 2020-05-02 11:17:28 -04:00
Virgil Dupras
446a58006d Remove one of the 2 indirection layers for EMIT
2 was overkill
2020-05-02 10:26:34 -04:00
Virgil Dupras
3a27479f2b fix stupid typo
I don't believe this, one hour of my life I'll never get back.
2020-05-02 08:06:37 -04:00
Virgil Dupras
2a578b3352 editor: implement F 2020-05-01 21:52:38 -04:00
Virgil Dupras
ecca70c7f3 Add layer of indirection to EMIT
This would allow things like temporary giving control to the *CL
line on the TRS-80. For example... A very far fetched example. Not
at all the only *raison d'etre* of the layer...
2020-05-01 20:05:15 -04:00
Virgil Dupras
5bf3baff05 editor: add edit buffer
Also, add word "C!+" and fix PSP leak in FILL.
2020-05-01 13:17:40 -04:00
Virgil Dupras
f38de1c151 Introduce the notion of Extra words 2020-04-29 21:52:18 -04:00
Virgil Dupras
0cf26547ff Add words FLUSH and COPY 2020-04-29 20:21:18 -04:00
Virgil Dupras
581f04a4bc Keep stage1 bootstrap bin instead of stage 0
XPACKed source needing to be kept in bootstrap bin didn't make
much sense. With the removal of stripfc, it makes more sense to keep
the compiled form of stage 1 in repository as a bootstrap binary.

Also, rename it to forth.bin.
2020-04-29 19:38:43 -04:00
Virgil Dupras
1b2c4b519e icore: add BIN+
This allows us to write LATEST at proper offset in emul/stage1.fs in
cases where we set a nonzero BIN(.
2020-04-29 11:42:09 -04:00
Virgil Dupras
61b2e02351 xcomp: remove XOFF and use ORG and BIN( instead 2020-04-28 09:37:00 -04:00
Virgil Dupras
4501313410 Add [IF] .. [THEN]
Will be useful as kinds of "#ifdef"s during xcomp.
2020-04-28 08:28:59 -04:00
Virgil Dupras
2b2ccad96c Add word FILL 2020-04-27 21:22:06 -04:00
Virgil Dupras
f605e2d85c Give CASE's default branch access to its input value
ref #97
2020-04-27 20:44:21 -04:00
Virgil Dupras
295b4b6e0a z80a: add BIN( parameter
Will be useful for assembling binaries for the TRS-80 which can't start
at addr 0.
2020-04-27 15:11:38 -04:00
Virgil Dupras
dee7eea497 Move link.fs to blkfs 2020-04-26 14:37:54 -04:00
Virgil Dupras
a2f164ecc3 emul: bootstrap to stage2 from within Collapse OS!
Big bootstrapping change which greatly reduces the role of the modern
operating system in the bootstrapping process.
2020-04-26 10:24:09 -04:00
Virgil Dupras
4b7247a971 emul: use LATEST instead of binary size as start addr in stage
More reliable.
2020-04-26 08:37:12 -04:00
Virgil Dupras
898684a795 emul: merge pre.fs and emul.fs into stage1.fs 2020-04-25 22:45:53 -04:00
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