From ca606850677a170ceed567137370c3b575184b54 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 15 May 2020 11:34:35 -0400 Subject: [PATCH] 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. --- blk/090 | 23 +++++++++-------------- blk/405 | 1 + blk/417 | 4 ++-- blk/421 | 1 - blk/432 | 2 +- blk/436 | 4 +++- blk/618 | 2 +- emul/forth.bin | Bin 5917 -> 5879 bytes emul/xcomp.fs | 10 +++------- recipes/ti84/xcomp.fs | 2 +- recipes/trs80/xcomp.fs | 2 +- 11 files changed, 22 insertions(+), 29 deletions(-) diff --git a/blk/090 b/blk/090 index a6ca6df..156d5a5 100644 --- a/blk/090 +++ b/blk/090 @@ -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. diff --git a/blk/405 b/blk/405 index 33eb3ba..8977d54 100644 --- a/blk/405 +++ b/blk/405 @@ -1,5 +1,6 @@ : WS? 33 < ; : EOT? 4 = ; ( 4 == ASCII EOT, CTRL+D ) +: EOT, 4 C, ; : TOWORD 0 ( dummy ) BEGIN diff --git a/blk/417 b/blk/417 index 931cc51..11037da 100644 --- a/blk/417 +++ b/blk/417 @@ -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> ! ; diff --git a/blk/421 b/blk/421 index 3c7e85b..4ac1c29 100644 --- a/blk/421 +++ b/blk/421 @@ -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 ; diff --git a/blk/432 b/blk/432 index 079e6de..f3883ca 100644 --- a/blk/432 +++ b/blk/432 @@ -2,7 +2,7 @@ BEGIN WORD DUP C@ EOT? IF DROP EXIT THEN (find) NOT IF (parse) ELSE EXECUTE THEN - CsdJ2Si81+5FS+bP|3v4%E~+EnOHJEhwW-OcW{S{fwVDjPy= z(Si*z4b`AV$v(h++6Q=1NNoIxeb~rL6KH(!C&~-KCx1v|Br!&bsU{@Wb7s-Rhxs}G z-#Op8_j2c-Px#kW-+ICaaPt%Ynx8w_;+_C7ZUTc*zxd4G<@-VW<$uLDA?B4mGAN7U zic(2EP;3~;JL#emfJVNen4qG&4HM~nCT+V;2%7k?YJvnkVnU5KgYs^J4ING3<8O)c z>ddxPG|I3lepN53msBRrHP1FI$qkipQVIzShd7bs(+w+UHqhC*;A}8?K@YU@$47uZl;T_PxM^IhH zF0TbV_kIK2Zv>b`A#!6G8X+v%KyqYB-tOh7=Z)>g=o%Xln*rB%L=5mJ@x8$J`gC!X z?{=%a02^EAT4)0a=hy^QZi73ddXnNv1NpiXcqq9;G;`4Iqh}#Epn!~lCRD|CZI`NR zHYCm*pIuDG#Do@?*LYOCstvYPv=v4(?~EJpI{#R+V2yX9oV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*Y{PBpEGBV5zpES21{~A)YyAPQ>y&~8 zm0qXVy#p7E9DVN2*$*vu6!=J}g)g&h?LvgYPtg(VagX4%Ue}Ydsb0{Na9(^J>coQ5 z;@42e&`ms@pxfqq@@;lEL~ZYZd-6WHKM=(bBt@~I*Ab(T|Arb^XH*(dDI^WyHypwo ze2YUb6l->+T(N71!N>75PlS^p23f5N-=o$%HZd{Xo!T!hhdVu{xE1c`xEY|!O}i;3 zVJS=vqno|P4BTD%H!4DrF3(MIAhH8F!;z==rGq=Q@4|EN2wgg*Y;UD&JGP7tlG1$g zJ08J+Z;qTAPi;f(sJIdt>G%w>-qH~6brP<_Uf&YFQBJ8;*5DmP<_HnxXkvEFcYsmj zEyx6MDe3Xz_;}D0)qohz@s9H3z!;L~%x-vlqE+~bdXV4k257he+y_pzpw?#>qZo!s zOUk+umuQ-{Q?+$BbQNt|mZTqO87wJ}aVaeOV4;|Rckw~PBRrTb6crSbxM-ArQl{G+ zEY=E6#D!Z?Tkud2-p0xg#A2Ab0SRQ}#c(XSbzU8aB~c>oP_8skE;#mZ4BqGS;-lF1 zSyJOY;!~U(tW@k`&FC@u?22u~jf_z!7HS4Pvc^#7uwmz`JtXx!gUSscPC%RhTGyoE w6l&eZ(W&!O#?XoJ>B;lMEhINFHa2o*>O`q(m}e$WjZdeHqGP;b6c|PL56l{4c>n+a diff --git a/emul/xcomp.fs b/emul/xcomp.fs index 4551be1..82ead99 100644 --- a/emul/xcomp.fs +++ b/emul/xcomp.fs @@ -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! diff --git a/recipes/ti84/xcomp.fs b/recipes/ti84/xcomp.fs index a550a36..8313ea2 100644 --- a/recipes/ti84/xcomp.fs +++ b/recipes/ti84/xcomp.fs @@ -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! diff --git a/recipes/trs80/xcomp.fs b/recipes/trs80/xcomp.fs index 53becd9..e69a94a 100644 --- a/recipes/trs80/xcomp.fs +++ b/recipes/trs80/xcomp.fs @@ -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!