mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 16:08:07 +11:00
Simplify boot process
That INIT thing is unnecessary.
This commit is contained in:
parent
bb77cd0759
commit
76037ca1e7
14
blk/089
14
blk/089
@ -1,16 +1,16 @@
|
|||||||
Initialization sequence
|
Initialization sequence
|
||||||
|
|
||||||
On boot, we jump to the "main" routine in boot.fs which does
|
On boot, we jump to the "main" routine in B289 which does
|
||||||
very few things.
|
very few things.
|
||||||
|
|
||||||
1. Set SP to 0x10000-6
|
1. Set SP to PS_ADDR and IX to RS_ADDR
|
||||||
2. Sets HERE to RAMEND (RAMSTART+0x80).
|
2. Sets HERE to RAMEND (RAMSTART+0x80).
|
||||||
3. Sets CURRENT to value of LATEST field in stable ABI.
|
3. Sets CURRENT to value of LATEST field in stable ABI.
|
||||||
4. Look for the word "BOOT" and calls it.
|
4. Look for the word "BOOT" and calls it.
|
||||||
|
|
||||||
In a normal system, BOOT is in icore and does a few things:
|
In a normal system, BOOT is in xcomp core (B411) and does a
|
||||||
|
few things:
|
||||||
|
|
||||||
1. Find "(c<)" a set CINPTR to it (what C< calls).
|
1. Initialize all overrides to 0.
|
||||||
2. Initialize all overrides to 0.
|
2. Write LATEST in BOOT C< PTR ( see below )
|
||||||
3. Write LATEST in BOOT C< PTR ( see below )
|
3. Set "C<*", the word that C< calls to (boot<). (cont.)
|
||||||
4. Find "INIT". If found, execute. Otherwise, "INTERPRET"(cont)
|
|
||||||
|
27
blk/090
27
blk/090
@ -1,16 +1,15 @@
|
|||||||
On a bare system (only boot+icore), this sequence will result
|
4. Call INTERPRET
|
||||||
in (c<) reading characters from memory starting from CURRENT
|
|
||||||
(this is why we put CURRENT in BOOT C< PTR, it tracks current
|
|
||||||
pos ).
|
|
||||||
|
|
||||||
This means that you can put initialization code in source form
|
In other words, BOOT interprets bytes directly following
|
||||||
right into your binary, right after your last compiled dict
|
CURRENT as Forth source code. This code will typically
|
||||||
entry and it's going to be executed as such until you set a new
|
initialize all subsystems and then call RDLN$. As soon as
|
||||||
(c<).
|
this is called, INTERPRET will begin reading from RDLN< which
|
||||||
|
reads from KEY.
|
||||||
|
|
||||||
Note that there is no EMIT in a bare system. You have to take
|
In the "/emul" binaries, "HERE" is readjusted to "CURRENT @" so
|
||||||
care of supplying one before your load core.fs and its higher
|
that we don't have to relocate compiled dicts. Note that in
|
||||||
levels.
|
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
|
||||||
(cont.)
|
lead to peculiar code in this area where we try to "waste"
|
||||||
|
space in initialization code.
|
||||||
|
16
blk/091
16
blk/091
@ -1,16 +0,0 @@
|
|||||||
(cont.) 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.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
3
blk/411
3
blk/411
@ -9,7 +9,6 @@
|
|||||||
['] (boot<) 0x0c RAM+ !
|
['] (boot<) 0x0c RAM+ !
|
||||||
( boot< always has a char waiting. 06 == C<?* )
|
( boot< always has a char waiting. 06 == C<?* )
|
||||||
1 0x06 RAM+ !
|
1 0x06 RAM+ !
|
||||||
LIT< INIT (find)
|
INTERPRET
|
||||||
IF EXECUTE ELSE DROP INTERPRET THEN
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
2
blk/430
2
blk/430
@ -6,7 +6,7 @@
|
|||||||
the last typed 0x0a and one for the following NULL. )
|
the last typed 0x0a and one for the following NULL. )
|
||||||
IN) IN> - 2+ ALLOT
|
IN) IN> - 2+ ALLOT
|
||||||
(infl)
|
(infl)
|
||||||
LIT< RDLN< (find) DROP 0x0c RAM+ !
|
['] RDLN< 0x0c RAM+ !
|
||||||
1 0x06 RAM+ ! ( 06 == C<? )
|
1 0x06 RAM+ ! ( 06 == C<? )
|
||||||
;
|
;
|
||||||
|
|
||||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
@ -20,9 +20,9 @@
|
|||||||
RDLN$
|
RDLN$
|
||||||
LIT< _sys [entry]
|
LIT< _sys [entry]
|
||||||
." Collapse OS" NL
|
." Collapse OS" NL
|
||||||
INTERPRET
|
|
||||||
;
|
;
|
||||||
|
|
||||||
(entry) _
|
(entry) _
|
||||||
H@ 256 /MOD 2 PC! 2 PC!
|
|
||||||
H@ 0x08 BIN+ ! ( update LATEST )
|
H@ 0x08 BIN+ ! ( update LATEST )
|
||||||
|
," INIT "
|
||||||
|
H@ 256 /MOD 2 PC! 2 PC!
|
||||||
|
Loading…
Reference in New Issue
Block a user