rc2014: Forth Collapse OS, fully operational!
This commit is contained in:
parent
e5f22c7d91
commit
58e88119ec
@ -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 )
|
||||
|
@ -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,7 +1,7 @@
|
||||
: INIT
|
||||
ACIA$
|
||||
(c<$)
|
||||
." Collapse OS" LF
|
||||
." Collapse OS" CR LF
|
||||
( 0c == CINPTR )
|
||||
['] (c<) 0x0c RAM+ !
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user