From 4c1cacd8d04d638b8480831724c88d216df2f544 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 24 May 2020 10:22:56 -0400 Subject: [PATCH] Remove Linker Now that the boot binary is fully cross-compiled, there's no use for the linker anymore. Theoretically, it could still be useful, but I can't think of a real use case. Let's take it out of the picture. If it's ever needed again, I'll know where to find it. --- blk/001 | 2 +- blk/120 | 16 ---------------- blk/121 | 8 -------- blk/122 | 1 - blk/123 | 15 --------------- blk/124 | 11 ----------- blk/125 | 16 ---------------- blk/126 | 15 --------------- blk/127 | 16 ---------------- blk/128 | 16 ---------------- blk/129 | 16 ---------------- blk/130 | 16 ---------------- 12 files changed, 1 insertion(+), 147 deletions(-) delete mode 100644 blk/120 delete mode 100644 blk/121 delete mode 100644 blk/122 delete mode 100644 blk/123 delete mode 100644 blk/124 delete mode 100644 blk/125 delete mode 100644 blk/126 delete mode 100644 blk/127 delete mode 100644 blk/128 delete mode 100644 blk/129 delete mode 100644 blk/130 diff --git a/blk/001 b/blk/001 index 91bec59..1f12acb 100644 --- a/blk/001 +++ b/blk/001 @@ -2,7 +2,7 @@ MASTER INDEX 3 Usage 30 Dictionary 70 Implementation notes 100 Block editor -120 Linker 150 Extra words +150 Extra words 200 Z80 assembler 260 Cross compilation 280 Z80 boot code 350 Core words 410 PS/2 keyboard subsystem 420 Bootstrap guide diff --git a/blk/120 b/blk/120 deleted file mode 100644 index a58afe2..0000000 --- a/blk/120 +++ /dev/null @@ -1,16 +0,0 @@ -Linker - -Relink a dictionary by applying offsets to all word references -in words of the "compiled" type. - -A typical usage of this unit would be to, right after a -bootstrap-from-icore-from-source operation, identify the root -word of the source part, probably "H@", and run " ' thatword -RLDICT ". Then, take the resulting relinked binary, concatenate -it to the boot binary, and write to boot media. - -LIMITATIONS - -This unit can't automatically detect all offsets needing -relinking. This is a list of situations that aren't handled: - (cont.) diff --git a/blk/121 b/blk/121 deleted file mode 100644 index 7d63ca2..0000000 --- a/blk/121 +++ /dev/null @@ -1,8 +0,0 @@ -Cells: It's not possible to know for sure whether a cellWord -contains an address or a number. They are therefore not -automatically relinked. You have to manually relink each of -them with RLCELL. In the case of a DOES> word, PFA+2, which -is always an offset, is automatically relinked, but not -PFA+0. - -Load with "122 LOAD" diff --git a/blk/122 b/blk/122 deleted file mode 100644 index dfa31f7..0000000 --- a/blk/122 +++ /dev/null @@ -1 +0,0 @@ -1 9 LOADR+ diff --git a/blk/123 b/blk/123 deleted file mode 100644 index 87f1519..0000000 --- a/blk/123 +++ /dev/null @@ -1,15 +0,0 @@ -( Skip atom, considering special atom types. ) -: ASKIP ( a -- a+n ) - DUP @ ( a n ) - ( ?br or br or NUMBER ) - DUP 0x67 = OVER 0x53 = OR OVER 0x20 = OR OVER 0x24 = OR - IF DROP 4 + EXIT THEN - ( regular word ) - 0x22 = NOT IF 2+ EXIT THEN - ( it's a lit, skip to null char ) - ( a ) - 1+ ( we skip by 2, but the loop below is pre-inc... ) - BEGIN 1+ DUP C@ NOT UNTIL - ( skip null char ) - 1+ -; diff --git a/blk/124 b/blk/124 deleted file mode 100644 index 1e7b618..0000000 --- a/blk/124 +++ /dev/null @@ -1,11 +0,0 @@ -( RLATOM pre-comment - - Relink atom at a, applying offset o with limit ol. - Returns a, appropriately skipped. - - 0x24 = IF: 0x24 is an addrWord, which should be offsetted in - the same way that a regular word would. To achieve this, we - skip ASKIP and instead of skipping 4 bytes like a numberWord, - we skip only 2, which means that our number will be treated - like a regular wordref. ) - diff --git a/blk/125 b/blk/125 deleted file mode 100644 index 645b2b9..0000000 --- a/blk/125 +++ /dev/null @@ -1,16 +0,0 @@ -: RLATOM ( a o ol -- a+n ) - ROT ( o ol a ) - DUP @ ( o ol a n ) - DUP 0x24 = IF - DROP 2+ ( o ol a+2 ) - ROT ROT 2DROP ( a ) EXIT - THEN - ROT ( o a n ol ) - < IF ( under limit, do nothing ) - NIP ( a ) - ELSE ( o a ) - TUCK @ ( a o n ) - -^ ( a n-o ) - OVER ! ( a ) - THEN - ASKIP ; diff --git a/blk/126 b/blk/126 deleted file mode 100644 index 2bce355..0000000 --- a/blk/126 +++ /dev/null @@ -1,15 +0,0 @@ -( RLWORD pre-comment - - Relink a word with specified offset. If it's not of the type - "compiled word", ignore. If it is, advance in word until a2 - is met, and for each word that is above ol, reduce that - reference by o. - Arguments: a1: wordref a2: word end addr o: offset to apply - ol: offset limit. don't apply on refs under it. - - The 0x0e and 0x2b check at the beginning is to ensure we have - either a compiledWord or a doesWord. If we don't, we do - nothing. The further 0x2b check is because if we have a - doesWord, we start 2 bytes later. -) - diff --git a/blk/127 b/blk/127 deleted file mode 100644 index 4d4166c..0000000 --- a/blk/127 +++ /dev/null @@ -1,16 +0,0 @@ -: RLWORD ( ol o a1 a2 -- ) - SWAP DUP C@ ( ol o a2 a1 n ) - DUP 0x0e = OVER 0x2b = OR NOT IF - ( unwind all args ) 2DROP 2DROP EXIT THEN - 0x2b = IF 2+ THEN ( ol o a2 a1 ) - 1+ ( ol o a2 a1+1 ) - BEGIN ( ol o a2 a1 ) - 2OVER SWAP ( ol o a2 a1 o ol ) - RLATOM ( ol o a2 a+n ) - 2DUP < IF ABORT THEN ( Something is very wrong ) - 2DUP = ( ol o a2 a+n f ) - IF ( unwind ) - 2DROP 2DROP EXIT - THEN - AGAIN -; diff --git a/blk/128 b/blk/128 deleted file mode 100644 index bb1fb90..0000000 --- a/blk/128 +++ /dev/null @@ -1,16 +0,0 @@ -( RLDICT pre-comment: Copy dict from target wordref, including -header, up to HERE. We're going relocate those words by -specified offset. To do this, we're copying this whole memory -area in HERE and then iterate through that copied area and call -RLWORD on each word. That results in a dict that can be -concatenated to target's prev entry in a more compact way. - - This copy of data doesn't allocate anything, so H@ doesn't -move. Moreover, we reserve 4 bytes at H@ to write our target -and offset because otherwise, things get too complicated with -the PSP. - - The output of this word is 3 numbers: top copied address, top -copied CURRENT, and then the beginning of the copied dict at -the end to indicate that we're finished processing. - cont. ) diff --git a/blk/129 b/blk/129 deleted file mode 100644 index 8ab643b..0000000 --- a/blk/129 +++ /dev/null @@ -1,16 +0,0 @@ -( Note that the last word is always skipped because it's not -possible to reliably detect its end. If you need that last -word, define a dummy word before calling RLDICT. - -We first start by copying the affected area to H@+4. This is -where the relinking will take place. - -Then we iterate the new dict from the top, keeping track of -wr, the current wordref and we, wr's end offset. - -Initially, we get our wr and we, withH@ and CURRENT, which we -offset by u+4. +4 before, remember, we're using 4 bytes -as variable space. - -At each iteration, we becomes wr-header and wr is fetched from -PREV field. ) diff --git a/blk/130 b/blk/130 deleted file mode 100644 index d655904..0000000 --- a/blk/130 +++ /dev/null @@ -1,16 +0,0 @@ -: RLDICT ( target offset -- ) - H@ 2+ ! H@ ! ( H@+2 == offset, H@ == target ) - H@ @ WORD( DUP H@ -^ ( src u ) - DUP ROT SWAP H@ 4 + ( u src u dst ) - SWAP MOVE ( u ) - 4 + DUP CURRENT @ WORD( + ( u we ) - DUP .X NL - SWAP CURRENT @ PREV + DUP .X NL ( we wr ) - BEGIN ( we wr ) - DUP ROT ( wr wr we ) - H@ @ H@ 2+ @ ( wr wr we ol o ) - 2SWAP RLWORD ( wr ) - DUP PREV SWAP ( wr oldwr ) - WORD( SWAP ( we wr ) - DUP 4 - H@ <= ( are we finished? ) - UNTIL H@ 4 + .X NL ;