Author: jquelin
Date: Fri Jan  9 01:55:38 2009
New Revision: 35261

Modified:
   trunk/languages/befunge/befunge.pir
   trunk/languages/befunge/flow.pir

Log:
instruction # implemented (trampoline)


Modified: trunk/languages/befunge/befunge.pir
==============================================================================
--- trunk/languages/befunge/befunge.pir (original)
+++ trunk/languages/befunge/befunge.pir Fri Jan  9 01:55:38 2009
@@ -91,6 +91,7 @@
     # flow control
     if char == '_' goto FLOW_IF_HORIZONTAL
     if char == '|' goto FLOW_IF_VERTICAL
+    if char == '#' goto FLOW_BRIDGE
     
     # math functions
     if char == '-' goto MATHS_SUB
@@ -117,7 +118,7 @@
         eq S0, "`", FLOW_COMPARE
         #eq S0, "_", FLOW_EW_IF
         #eq S0, "|", FLOW_NS_IF
-        eq S0, "#", FLOW_BRIDGE
+        #eq S0, "#", FLOW_BRIDGE
         eq S0, "@", FLOW_END
 
         # Math functions.
@@ -144,6 +145,9 @@
 =cut
 
     # flow instructions
+  FLOW_BRIDGE:
+    flow__trampoline(1)
+    goto MOVE_PC
   FLOW_GO_EAST:
     flow__go_east()
     goto MOVE_PC
@@ -166,7 +170,7 @@
     flow__toggle_string_mode()
     goto MOVE_PC
   FLOW_TRAMPOLINE:
-    flow__trampoline()
+    flow__trampoline(0)
     goto MOVE_PC
 
     # io instructions

Modified: trunk/languages/befunge/flow.pir
==============================================================================
--- trunk/languages/befunge/flow.pir    (original)
+++ trunk/languages/befunge/flow.pir    Fri Jan  9 01:55:38 2009
@@ -105,12 +105,15 @@
 
 
 #
-# remove trampoline flag.
+# flow__trampoline(bool)
+#
+# set/remove trampoline flag.
 # befunge stack unchanged.
 #
 .sub "flow__trampoline"
+    .param int val
     $P0 = get_global "status"
-    $P0["flag"] = 0
+    $P0["flag"] = val
     set_global "status", $P0
 .end
 
@@ -149,12 +152,6 @@
     branch MOVE_PC
 
 
-# Trampoline.
-# Befunge stack unchanged.
-# Skip next instruction (pos < pos + delta)
-FLOW_BRIDGE:
-    set I4, 2
-    branch MOVE_PC
 
 # Stop.
 # Befunge stack unchanged.

Reply via email to