1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-26 13:18:06 +11:00

Compare commits

..

No commits in common. "7390cb18ed913edb4b76a6c513aef579dcf19266" and "e5f22c7d910c876c69a6f078b0bf32f61469986c" have entirely different histories.

4 changed files with 74 additions and 25 deletions

View File

@ -40,14 +40,12 @@
;
( read one char into input buffer and returns whether we
should continue, that is, whether CR was not met. )
should continue, that is, whether newline 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 )
@ -59,17 +57,17 @@
our string )
IN> @ ! 1 IN> +! ( c )
( if newline, replace with zero to indicate EOL )
DUP 0xd = IF DROP 0 THEN
DUP 0xa = 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 '>' EMIT SPC THEN
FLAGS @ 0x1 AND NOT IF LF '>' EMIT SPC THEN
(infl)
BEGIN (rdlnc) NOT UNTIL
LF IN( @ IN> !
IN( @ IN> !
;
( And finally, implement a replacement for the (c<) routine )

View File

@ -39,11 +39,11 @@ device I use in this recipe.
### Gathering parts
* A "classic" RC2014 with Serial I/O
* [Forth's stage 2 binary][stage2]
* [romwrite][romwrite] and its specified dependencies
* [GNU screen][screen]
* A FTDI-to-TTL cable to connect to the Serial I/O module
* A FTDI-to-TTL cable to connect to the Serial I/O module of the RC2014
* (Optional) RC2014's Digital I/O module
### Configure your build
@ -85,13 +85,6 @@ In my case (arduino uno), it's `/dev/ttyACM0`. Then:
See romwrite's README for details about these commands.
Note that this method is slow and clunky, but before long, you won't be using
it anymore. Writing to an EEPROM is much easier and faster from a RC2014
running Collapse OS, so once you have that first Collapse OS ROM, you'll be
much better equipped for further toying around (unless, of course, you already
had tools to write to EEPROM. In which case, you'll be ignoring this section
altogether).
### Running
Put the AT28 in the ROM module, don't forget to set the A14 jumper high, then
@ -101,18 +94,19 @@ identify the tty bound to it (in my case, `/dev/ttyUSB0`). Then:
screen /dev/ttyUSB0 115200
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 about
30 seconds to complete.
Note that it has to build more than half of itself from source. It takes a
while (TODO: indicate how many minutes).
Once bootstrapping is done you should see the Collapse OS prompt. That's a full
Forth interpreter. You can have fun right now.
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 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.
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.
TODO: write this, do this.
TODO: write this.
[rc2014]: https://rc2014.co.uk
[romwrite]: https://github.com/hsoft/romwrite

57
recipes/rc2014/glue.asm Normal file
View File

@ -0,0 +1,57 @@
.equ RAMSTART 0x8000
.equ RAMEND 0xffff
.equ ACIA_CTL 0x80 ; Control and status. RS off.
.equ ACIA_IO 0x81 ; Transmit. RS on.
.equ DIGIT_IO 0x00 ; digital I/O's port
jp init
; interrupt hook
.fill 0x38-$
jp aciaInt
.inc "err.h"
.inc "ascii.h"
.inc "core.asm"
.inc "str.asm"
.equ ACIA_RAMSTART RAMSTART
.inc "acia.asm"
.equ STDIO_RAMSTART ACIA_RAMEND
.equ STDIO_GETC aciaGetC
.equ STDIO_PUTC aciaPutC
.inc "stdio.asm"
; *** BASIC ***
; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE STDIO_BUFSIZE
.equ SCRATCHPAD STDIO_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"
.inc "lib/parse.asm"
.inc "lib/fmt.asm"
.equ EXPR_PARSE parseLiteralOrVar
.inc "lib/expr.asm"
.inc "basic/util.asm"
.inc "basic/parse.asm"
.inc "basic/tok.asm"
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
.inc "basic/var.asm"
.equ BUF_RAMSTART VAR_RAMEND
.inc "basic/buf.asm"
.equ BAS_RAMSTART BUF_RAMEND
.inc "basic/main.asm"
init:
di
; setup stack
ld sp, RAMEND
im 1
call aciaInit
ei
call basInit
jp basStart

View File

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