fixed missing RETs, added sensible termination case

This commit is contained in:
psf 2022-03-26 00:10:11 -07:00
parent b1a477ea99
commit f2d9b7a092

View file

@ -94,6 +94,7 @@ fn init_dictionary(c: &mut Core) {
for p in PRIMITIVES { for p in PRIMITIVES {
create(c, p.name); create(c, p.name);
comma(c, opcode); comma(c, opcode);
comma(c, 65535); // ret
opcode -= 1; opcode -= 1;
} }
} }
@ -142,8 +143,11 @@ fn step(c: &mut Core) {
} }
fn inner(c: &mut Core) { fn inner(c: &mut Core) {
while c.ip != 2 { loop {
step(c); step(c);
if c.trs == 0 {
break;
}
} }
} }