Fix NIP & TUCK

This commit is contained in:
Remko Tronçon 2022-05-14 20:57:47 +02:00
parent 0a7b49d29d
commit 90ccc78ead
2 changed files with 7 additions and 6 deletions

View file

@ -1830,7 +1830,8 @@
(func $TUCK (param $tos i32) (result i32)
(local.get $tos)
(call $SWAP) (call $OVER))
(data (i32.const 0x21858) "\4c\18\02\00" "\03" "NIP" "\a4\00\00\00")
(data (i32.const 0x21858) "\4c\18\02\00" "\23" (; HIDDEN ;) "UND" "\a4\00\00\00")
(data (i32.const 0x2190c) "\fc\18\02\00" "\04" "TUCK\00\00\00" "\a4\00\00\00")
(elem (i32.const 0xa4) $TUCK)
(func $UWIDTH (param $tos i32) (result i32)
@ -2095,8 +2096,8 @@
(global $sourceID (mut i32) (i32.const 0))
;; Dictionary pointers
(global $latest (mut i32) (i32.const 0x218fc))
(global $here (mut i32) (i32.const 0x2190c))
(global $latest (mut i32) (i32.const 0x2190c))
(global $here (mut i32) (i32.const 0x2191c))
(global $nextTableIndex (mut i32) (i32.const 0xab (; = NEXT_TABLE_INDEX ;)))
;; Pictured output pointer

View file

@ -1463,19 +1463,19 @@ function loadTests() {
it("should work", () => {
run(': FOO 0 0 S" 123AB" >NUMBER ;');
run("FOO");
expect(stackValues()).to.eql([123, 0, 137499, 2]);
expect(stackValues()).to.eql([123, 0, 137515, 2]);
});
it("should work with init", () => {
run(': FOO 1 0 S" 1" >NUMBER ;');
run("FOO");
expect(stackValues()).to.eql([11, 0, 137497, 0]);
expect(stackValues()).to.eql([11, 0, 137513, 0]);
});
it("should not parse sign", () => {
run(': FOO 0 0 S" -" >NUMBER ;');
run("FOO");
expect(stackValues()).to.eql([0, 0, 137496, 1]);
expect(stackValues()).to.eql([0, 0, 137512, 1]);
});
});