mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-02 10:20:55 +11:00
Compare commits
2 Commits
e5f22c7d91
...
7390cb18ed
Author | SHA1 | Date | |
---|---|---|---|
|
7390cb18ed | ||
|
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 )
|
||||
|
@ -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 of the RC2014
|
||||
* (Optional) RC2014's Digital I/O module
|
||||
* A FTDI-to-TTL cable to connect to the Serial I/O module
|
||||
|
||||
### Configure your build
|
||||
|
||||
@ -85,6 +85,13 @@ 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
|
||||
@ -94,19 +101,18 @@ 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 a
|
||||
while (TODO: indicate how many minutes).
|
||||
Note that it has to build more than half of itself from source. It takes 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.
|
||||
Once bootstrapping is done 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,57 +0,0 @@
|
||||
.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
|
||||
|
||||
|
@ -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