]> khamidou — GitHub mirrors - miniforth.git/commitdiff
jmp now works
authorkhamidou <khamidou@gmail.com>
Tue, 18 Jan 2011 07:46:44 +0000 (08:46 +0100)
committerkhamidou <khamidou@gmail.com>
Tue, 18 Jan 2011 07:46:44 +0000 (08:46 +0100)
tests/t4.as
vm.c

index 2b4665295885ba371772a3ffc1c987d5516af7ad..e07085c75bf2af7eeb0d448a2afa85482aec9059 100644 (file)
@@ -1,4 +1,6 @@
 push 23
+dprint
 jmp t
 push 24
+dprint
 t: dprint
diff --git a/vm.c b/vm.c
index 7115e68e7808f326f45ea5a1180aece2a88c7c11..5fb06f558aa0be0e80fab9c18747e51b454ac014 100644 (file)
--- a/vm.c
+++ b/vm.c
@@ -81,7 +81,7 @@ int run(struct vm *v)
 
                        case JMP:
                                ip++;
-                               ip = v->stack + (*ip);
+                               ip = v->mem + (*ip) - 1; /* because the pointer gets automatically incremented */
                                break;
 
                }