Browse Source

rc2014: Forth Collapse OS, fully operational!

pull/102/head
Virgil Dupras 4 years ago
parent
commit
58e88119ec
3 changed files with 13 additions and 12 deletions
  1. +6
    -4
      forth/readln.fs
  2. +6
    -7
      recipes/rc2014/README.md
  3. +1
    -1
      recipes/rc2014/run.fs

+ 6
- 4
forth/readln.fs View File

@@ -40,12 +40,14 @@
;

( read one char into input buffer and returns whether we
should continue, that is, whether newline was not met. )
should continue, that is, whether CR was not met. )
: (rdlnc) ( -- f )
( buffer overflow? same as if we typed a newline )
IN> @ IN) @ = IF 0x0a ELSE KEY THEN ( c )
( del? same as backspace )
DUP 0x7f = IF DROP 0x8 THEN
( lf? same as cr )
DUP 0x0a = IF DROP 0xd THEN
( echo back )
DUP EMIT ( c )
( bacspace? handle and exit )
@@ -57,17 +59,17 @@
our string )
IN> @ ! 1 IN> +! ( c )
( if newline, replace with zero to indicate EOL )
DUP 0xa = IF DROP 0 THEN
DUP 0xd = IF DROP 0 THEN
;

( Read one line in input buffer and make IN> point to it )
: (rdln)
( Should we prompt? if we're executing a word, FLAGS bit
0, then we shouldn't. )
FLAGS @ 0x1 AND NOT IF LF '>' EMIT SPC THEN
FLAGS @ 0x1 AND NOT IF '>' EMIT SPC THEN
(infl)
BEGIN (rdlnc) NOT UNTIL
IN( @ IN> !
LF IN( @ IN> !
;

( And finally, implement a replacement for the (c<) routine )


+ 6
- 7
recipes/rc2014/README.md View File

@@ -95,18 +95,17 @@ identify the tty bound to it (in my case, `/dev/ttyUSB0`). Then:

Press the reset button on the RC2014 to have Forth begin its bootstrap process.
Note that it has to build more than half of itself from source. It takes a
while (TODO: indicate how many minutes).
while about 30 seconds to complete.

Once bootstrapping is done, you'll get a and you should see the Collapse OS
prompt. That's a full Forth interpreter. You can have fun right now.

However, that multi-minutes boot is kinda annoying. Moreover, that bootstrap
code being in source form takes precious space from our 8K ROM. We already have
our compiled dictionary in memory. All we need to have a instant-booting Forth
is to combine our stage1 with our compiled dict in memory, after some
relinking.
However, that long boot time is kinda annoying. Moreover, that bootstrap code
being in source form takes precious space from our 8K ROM. We already have our
compiled dictionary in memory. All we need to have a instant-booting Forth is
to combine our stage1 with our compiled dict in memory, after some relinking.

TODO: write this.
TODO: write this, do this.

[rc2014]: https://rc2014.co.uk
[romwrite]: https://github.com/hsoft/romwrite


+ 1
- 1
recipes/rc2014/run.fs View File

@@ -1,7 +1,7 @@
: INIT
ACIA$
(c<$)
." Collapse OS" LF
." Collapse OS" CR LF
( 0c == CINPTR )
['] (c<) 0x0c RAM+ !
;


Loading…
Cancel
Save