1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-20 14:38:05 +11:00

Streamline initialization process

Instead of letting each configuration taking care of RDLN$ and
"CollapseOS" prompt, move this to BOOT to simplify xcomp units.

Initialization source code is now only for driver initialization.
This commit is contained in:
Virgil Dupras 2020-05-15 11:34:35 -04:00
parent 0163af470a
commit ca60685067
11 changed files with 22 additions and 29 deletions

23
blk/090
View File

@ -1,15 +1,10 @@
4. Call INTERPRET
4. Call INTERPRET which interprets boot source code until
ASCII EOT (4) is met. This usually init drivers.
5. Initialize rdln buffer, _sys entry (for EMPTY), prints
"CollapseOS" and then calls (main).
6. (main) interprets from rdln input (usually from KEY) until
EOT is met, then calls BYE.
In other words, BOOT interprets bytes directly following
CURRENT as Forth source code. This code will typically
initialize all subsystems and then call RDLN$. As soon as
this is called, INTERPRET will begin reading from RDLN< which
reads from KEY.
In the "/emul" binaries, "HERE" is readjusted to "CURRENT @" so
that we don't have to relocate compiled dicts. Note that in
this context, the initialization code is fighting for space
with HERE: New entries to the dict will overwrite that code!
Also, because we're barebone, we can't have comments. This can
lead to peculiar code in this area where we try to "waste"
space in initialization code.
In RAM-only environment, we will typically have a
"CURRENT @ HERE !" line during init to have HERE begin at the
end of the binary instead of RAMEND.

View File

@ -1,5 +1,6 @@
: WS? 33 < ;
: EOT? 4 = ; ( 4 == ASCII EOT, CTRL+D )
: EOT, 4 C, ;
: TOWORD
0 ( dummy ) BEGIN

View File

@ -2,8 +2,8 @@
H@ 0x3c ( BLK(* ) RAM+ !
1024 ALLOT
( LOAD detects end of block with ASCII EOT. This is why
we write it there. EOT == 0x04 )
4 C,
we write it there. )
EOT,
0 BLKDTY !
-1 BLK> !
;

View File

@ -11,6 +11,5 @@
: BS 8 EMIT ; : LF 10 EMIT ; : CR 13 EMIT ;
: CRLF CR LF ; : SPC 32 EMIT ;
: NL 0x0a RAM+ @ ( NLPTR ) DUP IF EXECUTE ELSE DROP CRLF THEN ;
: (ok) SPC LIT" ok" (print) NL ;
: (uflw) LIT" stack underflow" ERR ;
: (wnf) (print) SPC LIT" word not found" ERR ;

View File

@ -2,7 +2,7 @@
BEGIN
WORD DUP C@ EOT? IF DROP EXIT THEN
(find) NOT IF (parse) ELSE EXECUTE THEN
C<? NOT IF (ok) THEN
C<? NOT IF SPC LIT< ok (print) NL THEN
AGAIN ;
( Read from BOOT C< PTR and inc it. )
: (boot<)

View File

@ -9,4 +9,6 @@
( 0c == C<* )
['] (boot<) 0x0c RAM+ !
( boot< always has a char waiting. 06 == C<?* )
1 0x06 RAM+ ! (main) ;
1 0x06 RAM+ ! INTERPRET
RDLN$ LIT< _sys [entry]
LIT< CollapseOS (print) NL (main) ;

View File

@ -12,4 +12,4 @@ RAMSTART 0x70 + CONSTANT ACIA_MEM
(entry) _
( Update LATEST )
PC ORG @ 8 + !
," : _ ACIA$ RDLN$ (ok) ; _ "
," ACIA$ " EOT,

Binary file not shown.

View File

@ -28,13 +28,9 @@
( Update LATEST )
PC ORG @ 8 + !
," CURRENT @ HERE ! "
," : INIT "
," BLK$ "
," ['] EFS@ BLK@* ! "
," ['] EFS! BLK!* ! "
," RDLN$ "
," LIT< _sys [entry] "
," LIT< CollapseOS (print) NL "
," ; INIT "
," ' EFS@ BLK@* ! "
," ' EFS! BLK!* ! "
EOT,
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!

View File

@ -68,6 +68,6 @@ CREATE ~FNT CPFNT3x5
(entry) _
( Update LATEST )
PC ORG @ 8 + !
," : _ LCD$ KBD$ (ok) RDLN$ ; _ "
," LCD$ KBD$ " EOT,
ORG @ 0x100 - 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!

View File

@ -15,6 +15,6 @@ RS_ADDR 0x80 - CONSTANT RAMSTART
PC ORG @ 8 + !
," CURRENT @ HERE ! "
( 0x0a == NLPTR. TRS-80 wants CR-only newlines )
," : _ ['] CR 0x0a RAM+ ! BLK$ FD$ (ok) RDLN$ ; _ "
," ' CR 0x0a RAM+ ! BLK$ FD$ " EOT,
ORG @ 256 /MOD 2 PC! 2 PC!
H@ 256 /MOD 2 PC! 2 PC!