1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-01 16:30:57 +11:00
Commit Graph

22 Commits

Author SHA1 Message Date
Virgil Dupras
495537b7f3 Small optimization and block compaction 2021-01-02 16:20:38 -05:00
Virgil Dupras
7dff93f2ff Make word "." a bit more compact 2021-01-02 16:04:36 -05:00
Virgil Dupras
ac3629b817 Make BLK@* and BLK!* into ialiases 2021-01-02 15:51:12 -05:00
Virgil Dupras
421ca5112f Remove one level of C< override
Two was too many.
2021-01-02 15:32:08 -05:00
Virgil Dupras
d09de0a0d3 Integrate RDLN input buffer into sysvars
In the beginning of Collapse OS' Forth version, the readline sub-
system was optional. This is why we had this separate RDLN$ routine
and that the input buffer was allocated at boot time.

It's been a while since the RDLN system has been made mandatory, but
we still paid the complexity tax of this separation. Not anymore.
2021-01-02 14:32:03 -05:00
Virgil Dupras
64f0f6716e Remove 2OVER and 2SWAP
They were unused.
2021-01-02 13:56:36 -05:00
Virgil Dupras
1cbef2f210 Add EOT ASCII const 2021-01-02 13:55:20 -05:00
Virgil Dupras
3d47c28a28 Revisit RDLN words
It's been a long while since I visited this part of the code and it
has become a bit messy after having gone through all evolutions of
the core code.

It is now simpler, more compact.
2021-01-02 13:30:32 -05:00
Virgil Dupras
527f5977d7 Add BS, CR, LF, SPC ASCII consts
Previously, these words would be ascii emitters, but seldom used
except for the SPC emitter. However, I would often end up hardcoding
these constants. With useless emitters removed and ASCII constants
added, we have a more usable system.

Also, fix broken test harness.
2021-01-02 10:26:05 -05:00
Virgil Dupras
cbf9ecfb1e Make NL, renamed to NL> a bit simpler
It doesn't require emitting words anymore. The rename to NL> is
linked to the upcoming commit.
2021-01-02 10:03:27 -05:00
Virgil Dupras
1fb062e121 Remove LF word
Also, remove extraneous uses of it. In the rdln routine, we would
spit a new line after each line input, but that NL was spurious:
we already spit the newline we receive as it is typed.
2021-01-02 09:45:08 -05:00
Virgil Dupras
ba4edbdce3 Spit SPC instead of NL between blknos in LOADR
It's a bit wasteful to spit full NLs.
2021-01-02 09:23:28 -05:00
Virgil Dupras
475caf35f4 Make KEY non-blocking
... and rename it to KEY?. Then, add KEY from KEY? for its blocking
version.

I need this for an upcoming Remote Shell feature. If a Collapse OS
system remotely controls another shell, it needs to be able to poll
both the remote system and the local keyboard at the same time. A
blocking KEY is incompatible with this.

In some places, the polling mechanism doesn't make sense, so this
new KEY? always returns a character. In some places, I just haven't
implemented the mechanism yet, so I kept the old blocking code and
added a "always 1" flag as a temporary shim.

I have probably broken something, but in emulators, Collapse OS runs
fine. It's an important reminder of what will be lost with the new
"dogfooding" approach (see recent mailing list message): without
emulators, it's much harder to to sweeping changes like this without
breaking stuff.

It's fine, I don't expect many more of these core changes to the
system. It's nearly feature-complete.
2021-01-01 08:23:59 -05:00
Virgil Dupras
e3d4afa0c2 Update stage.bin
I forgot to do so when I updated FLUSH.
2020-12-29 21:45:07 -05:00
Virgil Dupras
cbd9f035ae Add ~C!ERR
A ~C! override can, if it wants, go put an error code in there,
which ~AT28 does.

This way, after a copy or xcomp process directly to EEPROM, one
can verify whether all bytes were successfully written by checking
whether "~C!ERR C@" is zero.
2020-12-09 19:52:58 -05:00
Virgil Dupras
dda80801d5 Remove WORD( and PREV
They're only used once.
2020-12-09 17:46:22 -05:00
Virgil Dupras
594b3c3348 Add ~C! to override memory low level write routines
Also, turn AT28! and AT28, into ~AT28, pluggable into ~C!.

~AT28 doesn't check for mismatches. It was too complicated to turn
a mismatch into a compiled word we would jump to next. Data
integrity has to be checked through another path.

Also, remove MOVEW. Without indirect memory access, this word
doesn't make sense. Some AVR-specific words will have to be
defined.
2020-12-08 21:55:39 -05:00
Virgil Dupras
45eceaaf61 Remove indirect memory access
I got bitten again, I've over-designed my solution. The last time
it happened, it was that memory mapping thing I was wanting to add.

The indirect memory access feature I was adding was to solve a
specific problem: Allow Collapse OS to cross-compile directly on a
AT28 EEPROM.

It began well. As long as we were staying in the assembler realm,
things were looking good. However, when we got into the xcomp realm
(B260), things became ugly, and I had to creep up indirection where
I didn't want to.

All of this because I wanted to solve my initial problem in a
slightly more generalized way. The broad idea was that these indirect
memory access could allow xcomp into a broad kind of memory-like
devices.

This idea broke on the "@" part of the equation. If I want
indirections to be two-way and allow xcomp to work properly, I have
to add this indirection to FIND (and possibly others) and this just
isn't practical or elegant.

So, I'm taking a step back and accepting that the solution I design
for now is exclusively for the AT28. What I'm thinking is to add a
low-level hook for memory writing, at the assembly level.
2020-12-07 22:34:53 -05:00
Virgil Dupras
80d1b59050 Add words |M and |L
Splitting a word into MSB/LSB pairs happens often and is worth, I
think, native words. Also, I'm going to need it in the upcoming
commits.
2020-12-07 20:11:49 -05:00
Virgil Dupras
e5a983ab7f Rename A!, A@ and A, to C!*, C@* and C,*
Also, rename "Addressed devices" to "Indirect memory access".

I do this because I need to add indirect versions of !, @ and ,
to allow boostrapping directly to EEPROM and that A,, thing I've
added to assemblers felt like really bad names.

With this change, I'd like to generalize the use of the * suffix
for aliases.
2020-12-07 19:06:58 -05:00
Virgil Dupras
db1d6424b3 Rename (print) to STYPE
This brings us a bit closer to TYPE from Forth 2012. I don't think
I'll add TYPE (sig "addr len") anytime soon because there is few
use cases for it, but having "STYPE" instead of "(print)" feels
cleaner.
2020-11-28 11:28:28 -05:00
Virgil Dupras
532bcc7e78 cvm: split stage and forth xcomp units
I wanted to make CVM's forth use the Grid subsystem, but doing so
would break the stage binary. Hence, this split.
2020-11-14 15:00:03 -05:00