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

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

From:
jquelin
Date:
January 7, 2009 10:16
Subject:
[svn:parrot] r35158 - trunk/languages/befunge
Message ID:
20090107181557.C186BCB9F9@x12.develooper.com
Author: jquelin
Date: Wed Jan  7 10:15:57 2009
New Revision: 35158

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

Log:
instruction ^ implemented


Modified: trunk/languages/befunge/befunge.pir
==============================================================================
--- trunk/languages/befunge/befunge.pir	(original)
+++ trunk/languages/befunge/befunge.pir	Wed Jan  7 10:15:57 2009
@@ -76,6 +76,7 @@
     
     # direction changing
     if char == '>' goto FLOW_GO_EAST
+    if char == '^' goto FLOW_GO_NORTH
     if char == 'v' goto FLOW_GO_SOUTH
     if char == '<' goto FLOW_GO_WEST
     
@@ -135,12 +136,15 @@
   FLOW_GO_EAST:
     flow__go_east()
     goto MOVE_PC
-  FLOW_GO_WEST:
-    flow__go_west()
+  FLOW_GO_NORTH:
+    flow__go_north()
     goto MOVE_PC
   FLOW_GO_SOUTH:
     flow__go_south()
     goto MOVE_PC
+  FLOW_GO_WEST:
+    flow__go_west()
+    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:15:57 2009
@@ -11,6 +11,16 @@
 .end
 
 #
+# go north.
+# befunge stack unchanged.
+# delta <- (1,0)
+.sub "flow__go_north"
+    $P0 = get_global "status"
+    $P0["dir"] = 0
+    set_global "status", $P0
+.end
+
+#
 # go south.
 # befunge stack unchanged.
 # delta <- (-1,0)
@@ -35,14 +45,6 @@
 
 =pod
 
-# Go north.
-# Befunge stack unchanged.
-# delta <- (0,-1)
-FLOW_GO_NORTH:
-    set I2, 0
-    branch MOVE_PC
-
-
 FLOW_GO_AWAY:
     save 4
     bsr MATHS_RAND



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