Attached is a patch for the Befunge interpreter:
 - support of the chr instruction instead of Clinton's hack
 - a Changes file

Oh, btw, I'm now using cvs diff in order to create my patches (thanks Leon) - 
it rocks! I hope they are still valid patches.

Jérôme
-- 
[EMAIL PROTECTED]
Index: parrot/languages/Befunge-93/README
===================================================================
RCS file: /cvs/public/parrot/languages/Befunge-93/README,v
retrieving revision 1.2
diff -u -d -r1.2 README
--- parrot/languages/Befunge-93/README	19 Aug 2002 23:05:11 -0000	1.2
+++ parrot/languages/Befunge-93/README	9 Sep 2002 19:39:40 -0000
@@ -1,15 +1,14 @@
 DESCRIPTION
 -----------
-This is a Befunge interpreter written in Parrot assembler, version 0.01
+This is a Befunge interpreter written in Parrot assembler, version 0.03
 
 This interpreter should be Befunge-93 compliant. This means the
 playfield is limited to 80x25 and can hold *only bytes*. This means
 that you can't fetch/store numbers greater than 255 or less than 0 in
-the torus.
+the torus (even if I do not check for over/underflow - for now).
 
 You should compile the files with:
 
-     $ make build
      $ make test
 
 Then you can run your Befunge program with: 
@@ -31,7 +30,8 @@
                         instructions
         Makefile        a tiny, little Makefile to help (me) during
                         developement
-        test.bef        a befunge script that test almost all the instructions
+        test.bef        a befunge script that test almost all the
+                        instructions (and is even self-modifying!)
 
 
 BUGS
@@ -43,7 +43,7 @@
 TODO
 ----
 * more error checking
-* better rand()/chr() methods
+* better rand() methods
 * more tests (with Perl and Test::Harness)
 * debugging options
 * use an array of arrays instead of an array of strings
@@ -72,6 +72,7 @@
 ---------
 This program is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.
+
 
 SEE ALSO
 --------
Index: parrot/languages/Befunge-93/befunge.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/Befunge-93/befunge.pasm,v
retrieving revision 1.1
diff -u -d -r1.1 befunge.pasm
--- parrot/languages/Befunge-93/befunge.pasm	17 Aug 2002 00:18:34 -0000	1.1
+++ parrot/languages/Befunge-93/befunge.pasm	9 Sep 2002 19:39:40 -0000
@@ -34,7 +34,6 @@
         set S0, " "             # current instruction
         set S1, P1[0]           # current line
         set S2, ""              # user input
-	set S3, "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"
         
 TICK:
         substr S0, S1, I0, 1
Index: parrot/languages/Befunge-93/befunge.pbc
===================================================================
RCS file: /cvs/public/parrot/languages/Befunge-93/befunge.pbc,v
retrieving revision 1.2
diff -u -d -r1.2 befunge.pbc
Binary files /tmp/cvsbwrXEK and befunge.pbc differ
Index: parrot/languages/Befunge-93/io.pasm
===================================================================
RCS file: /cvs/public/parrot/languages/Befunge-93/io.pasm,v
retrieving revision 1.1
diff -u -d -r1.1 io.pasm
--- parrot/languages/Befunge-93/io.pasm	17 Aug 2002 00:18:34 -0000	1.1
+++ parrot/languages/Befunge-93/io.pasm	9 Sep 2002 19:39:41 -0000
@@ -1,19 +1,3 @@
-# Implement the chr() function.
-# Generic method. 
-# Parrot stack: 
-#   before:     ... i
-#   after:      ... c
-# c = chr(i)        
-IO_CHR:
-        pushi
-        pushs
-        restore I10
-        substr S10, S3, I10, 1
-        save S10
-        pops
-        popi
-        ret
-       
 # String mode.
 # Befunge stack:        
 #   before:     ...
@@ -106,11 +90,13 @@
 #   after:      ...
 # writechar( chr(i) )
 IO_OUTPUT_CHAR:
+        pushi
         pushs
         bsr POP
-        bsr IO_CHR
-        restore S10
+        restore I10
+        chr S10, I10
         print S10
+        popi
         pops
         branch MOVE_PC
                              
@@ -148,8 +134,8 @@
         bsr POP
         restore I10             # offset
         bsr POP
-        bsr IO_CHR
-        restore S11             # char to store
+        restore I20
+        chr S11, I20            # char to store
 	length I12, S10
 	set S13, ""             # First part
 	set S12, ""             # Second part

Reply via email to