From 76037ca1e7bf2ca406e850ee88df34f1b7256dbb Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 13 May 2020 14:19:54 -0400 Subject: [PATCH] Simplify boot process That INIT thing is unnecessary. --- blk/089 | 14 +++++++------- blk/090 | 27 +++++++++++++-------------- blk/091 | 16 ---------------- blk/411 | 3 +-- blk/430 | 2 +- emul/forth.bin | Bin 5884 -> 5858 bytes emul/stage1.fs | 4 ++-- 7 files changed, 24 insertions(+), 42 deletions(-) delete mode 100644 blk/091 diff --git a/blk/089 b/blk/089 index 0aac0f4..518d49c 100644 --- a/blk/089 +++ b/blk/089 @@ -1,16 +1,16 @@ 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. -1. Set SP to 0x10000-6 +1. Set SP to PS_ADDR and IX to RS_ADDR 2. Sets HERE to RAMEND (RAMSTART+0x80). 3. Sets CURRENT to value of LATEST field in stable ABI. 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). -2. Initialize all overrides to 0. -3. Write LATEST in BOOT C< PTR ( see below ) -4. Find "INIT". If found, execute. Otherwise, "INTERPRET"(cont) +1. Initialize all overrides to 0. +2. Write LATEST in BOOT C< PTR ( see below ) +3. Set "C<*", the word that C< calls to (boot<). (cont.) diff --git a/blk/090 b/blk/090 index af74409..a6ca6df 100644 --- a/blk/090 +++ b/blk/090 @@ -1,16 +1,15 @@ -On a bare system (only boot+icore), this sequence will result -in (c<) reading characters from memory starting from CURRENT -(this is why we put CURRENT in BOOT C< PTR, it tracks current -pos ). +4. Call INTERPRET -This means that you can put initialization code in source form -right into your binary, right after your last compiled dict -entry and it's going to be executed as such until you set a new -(c<). +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. -Note that there is no EMIT in a bare system. You have to take -care of supplying one before your load core.fs and its higher -levels. - - - (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. diff --git a/blk/091 b/blk/091 deleted file mode 100644 index 531e4fb..0000000 --- a/blk/091 +++ /dev/null @@ -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. - - - - - - - - - diff --git a/blk/411 b/blk/411 index 22a0271..881afcc 100644 --- a/blk/411 +++ b/blk/411 @@ -9,7 +9,6 @@ ['] (boot<) 0x0c RAM+ ! ( boot< always has a char waiting. 06 == C - 2+ ALLOT (infl) - LIT< RDLN< (find) DROP 0x0c RAM+ ! + ['] RDLN< 0x0c RAM+ ! 1 0x06 RAM+ ! ( 06 == C#4G>`;cwGU4HaV~p`GN`+h*TUPmh0g?uw&dF zQ49d0OAe{2BGN7!P=GWhG{8%)phck7w?g`q1!0Qw-p2 z9jJncWp$Ubs8&_MPx1A**3=ZIOK^WLfX<2GlLKR@af?PV!i&^Vk(aqlR>(E@M`fRD zhsQqCY)EA+SH1|Y84EbK>4Hau1J>ls#B?m^ly+4k;$>|?;;lve?YWqa_+@QbTGe>3 z2-v`_-wF5Hr8n6#LBp)U+gP*X(=%scbx`TJUw7R7STaB4Fid8n!NaxuR$Qyw_CGK= zPq&QeHjuE$z78H*ysf<$1RR(rds}o><7sRdN~ANdK8NGLo!2CS7Y%?DB6IQ|f-b&7 zgbF_Ad}iGs^C$-KK^}3y>&RzHk8qf8YbM+b8c4&PH^|el2(%n+#lCQ%et7KMd6!PH z(NKMI8+SwlUfz3B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&3lMI ztApwDnf(VU`$m1oa>-}HKrS53x>8x1 z2`pBw21*r#LWy?xyM;0x_rHX{H~j6d+*ZOc>hHpfEDSgOefZWqA(&i#XBoWC5DZkx U<*6&nvw>Wmb70s0@~ diff --git a/emul/stage1.fs b/emul/stage1.fs index 73d3f51..484c541 100644 --- a/emul/stage1.fs +++ b/emul/stage1.fs @@ -20,9 +20,9 @@ RDLN$ LIT< _sys [entry] ." Collapse OS" NL - INTERPRET ; (entry) _ -H@ 256 /MOD 2 PC! 2 PC! H@ 0x08 BIN+ ! ( update LATEST ) + ," INIT " +H@ 256 /MOD 2 PC! 2 PC!