develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35157 - trunk/languages/befunge

From:
jquelin
Date:
January 7, 2009 10:14
Subject:
[svn:parrot] r35157 - trunk/languages/befunge
Message ID:
20090107181435.E8A71CB9F9@x12.develooper.com
Author: jquelin
Date: Wed Jan  7 10:14:35 2009
New Revision: 35157

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

Log:
instruction v implemented


Modified: trunk/languages/befunge/befunge.pir
==============================================================================
--- trunk/languages/befunge/befunge.pir	(original)
+++ trunk/languages/befunge/befunge.pir	Wed Jan  7 10:14:35 2009
@@ -76,6 +76,7 @@
     
     # direction changing
     if char == '>' goto FLOW_GO_EAST
+    if char == 'v' goto FLOW_GO_SOUTH
     if char == '<' goto FLOW_GO_WEST
     
     # unknown instruction
@@ -137,6 +138,9 @@
   FLOW_GO_WEST:
     flow__go_west()
     goto MOVE_PC
+  FLOW_GO_SOUTH:
+    flow__go_south()
+    goto MOVE_PC
     
   FLOW_TOGGLE_STRING_MODE:
     flow__toggle_string_mode()

Modified: trunk/languages/befunge/flow.pir
==============================================================================
--- trunk/languages/befunge/flow.pir	(original)
+++ trunk/languages/befunge/flow.pir	Wed Jan  7 10:14:35 2009
@@ -11,6 +11,17 @@
 .end
 
 #
+# go south.
+# befunge stack unchanged.
+# delta <- (-1,0)
+#
+.sub "flow__go_south"
+    $P0 = get_global "status"
+    $P0["dir"] = 2
+    set_global "status", $P0
+.end
+
+#
 # go west.
 # befunge stack unchanged.
 # delta <- (-1,0)
@@ -31,13 +42,6 @@
     set I2, 0
     branch MOVE_PC
 
-# Go south.
-# Befunge stack unchanged.
-# delta <- (0,1)
-FLOW_GO_SOUTH:
-    set I2, 2
-    branch MOVE_PC
-
 
 FLOW_GO_AWAY:
     save 4



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About