diff --git a/capsules/v4/sys/dict.f18 b/capsules/v4/sys/dict.f18 index f220b249..515b8eee 100644 --- a/capsules/v4/sys/dict.f18 +++ b/capsules/v4/sys/dict.f18 @@ -89,7 +89,7 @@ set HDR-NFA here ", C, #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here drop a DP b! @b -1 + jump C! FULL: drop ; set HDR-NFA here ", 2, #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here -: 2, ( lo hi -- ) SWAP , , ; \ the low cell first, as v3 +: 2, ( lo hi -- ) , , ; \ the high cell first: FORTH-83's layout (#189, 2026-11-14) set HDR-NFA here ", LATEST #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here : LATEST ( -- xt ) CURRENT a! @ a! @ ; \ the newest entry of the CURRENT vocabulary diff --git a/capsules/v4/sys/words.f18 b/capsules/v4/sys/words.f18 index 1753f238..6d95e83a 100644 --- a/capsules/v4/sys/words.f18 +++ b/capsules/v4/sys/words.f18 @@ -27,9 +27,9 @@ set HDR-NFA here ", INVERT #id, #, 8 #, HDR-NFA #, HDR-LINK set HDR-LINK h \ ---- memory ---- set HDR-NFA here ", 2@ #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here -: 2@ ( addr -- lo hi ) a! @+ @ ; +: 2@ ( addr -- lo hi ) a! @+ @ SWAP ; \ the high cell at addr: FORTH-83 (#189, 2026-11-14) set HDR-NFA here ", 2! #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here -: 2! ( lo hi addr -- ) a! SWAP !+ ! ; +: 2! ( lo hi addr -- ) a! !+ ! ; \ the high cell at addr, the low after: FORTH-83 set HDR-NFA here ", -! #id, #, 0 #, HDR-NFA #, HDR-LINK set HDR-LINK here : -! ( n addr -- ) a! NEGATE @ + ! ; diff --git a/v4/tests/test_host_dict.c b/v4/tests/test_host_dict.c index ed2a6b23..f6b4fc6b 100644 --- a/v4/tests/test_host_dict.c +++ b/v4/tests/test_host_dict.c @@ -233,8 +233,8 @@ int main(void) CHECK(run("C,", 1, 'f', 0) && clean() && run("ALIGN", 0, 0, 0) && clean() && n.mem[DP] == (DICT_W + 6) * 4, "ALIGN rounds up to a cell"); CHECK(run("ALIGN", 0, 0, 0) && clean() && n.mem[DP] == (DICT_W + 6) * 4, "ALIGN when aligned does nothing"); - /* 2, : the low cell first, as v3 (HERE 1 2 2, : the first cell holds 1) */ - CHECK(run("2,", 2, 1, 2) && clean() && n.mem[DICT_W + 6] == 1 && n.mem[DICT_W + 7] == 2 && get("HERE", 0, 0) == DICT_W + 8, "v3: 2, stores the low cell first"); + /* 2, : the high cell first, FORTH-83's layout (#189, Captain Bob 2026-11-14): 1 2 2, -- the first cell holds 2 */ + CHECK(run("2,", 2, 1, 2) && clean() && n.mem[DICT_W + 6] == 2 && n.mem[DICT_W + 7] == 1 && get("HERE", 0, 0) == DICT_W + 8, "2, stores the high cell first, as FORTH-83"); /* ALLOT counts cells */ CHECK(run("ALLOT", 1, 5, 0) && clean() && !err() && get("HERE", 0, 0) == DICT_W + 13, "5 ALLOT reserves five cells"); diff --git a/v4/tests/test_host_quit.c b/v4/tests/test_host_quit.c index 27055438..c82a64f0 100644 --- a/v4/tests/test_host_quit.c +++ b/v4/tests/test_host_quit.c @@ -801,7 +801,7 @@ static const transcript script[] = { { "1 2 3 4 5 6 2ROT . . . . . .\n", "2 1 6 5 4 3 ok\nok> ", 1 }, { ": T 1 2 2>R 2R@ 2R> . . . . ; T\n", "2 1 2 1 ok\nok> ", 1 }, { "TRUE . FALSE . 5 INVERT . NOP\n", "-1 0 -6 ok\nok> ", 1 }, - { "VARIABLE X 0 , 11 22 X 2! X 2@ . . X @ .\n", "22 11 11 ok\nok> ", 1 }, + { "VARIABLE X 0 , 11 22 X 2! X 2@ . . X @ .\n", "22 11 22 ok\nok> ", 1 }, /* the high cell at X: FORTH-83 */ { "VARIABLE Y 10 Y ! 3 Y -! Y @ .\n", "7 ok\nok> ", 1 }, { "0 0<> . 5 0<> . -5 0<> .\n", "0 -1 -1 ok\nok> ", 1 }, { "0 0> . 5 0> . -5 0> .\n", "0 -1 0 ok\nok> ", 1 },