Merge pull request #18 from catseye/docs-updates
Corrections and updates to documentation
Chris Pressey authored 3 years ago
GitHub committed 3 years ago
9 | 9 | Chris Pressey, Cat's Eye Technologies |
10 | 10 | *Original document September, 1993* |
11 | 11 | *Updated December, 1996* |
12 | *Updated Yet Again September, 2004* | |
13 | *Converted from HTML to Markdown August 2012* | |
12 | *Updated Yet Again September, 2004* | |
13 | *Converted from HTML to Markdown August 2012* | |
14 | *Updated for Silver Jubilee, 2018* | |
14 | 15 | |
15 | 16 | ### The Basics of Befunge-93 ### |
16 | 17 | |
17 | 18 | Most likely the most unique element of Befunge-93 programming is the |
18 | 19 | Program Counter (PC.) In almost all computer programming languages, the |
19 | 20 | program counter is continually moving forward through the program, |
20 | occassionally jumping to another spot in the code (but continuing | |
21 | occasionally jumping to another spot in the code (but continuing | |
21 | 22 | forward thereafter, nonetheless.) |
22 | 23 | |
23 | 24 | The PC in Befunge-93, however, is subject to different rules. It may go |
73 | 74 | the upper-left of the torus and is initially oriented to execute |
74 | 75 | rightward. |
75 | 76 | |
76 | NB. If the stack is be empty when you pop something off, be warned that | |
77 | NB. If the stack is empty when you pop something off, be warned that | |
77 | 78 | this will *not* generate an underflow! It will simply push a 0 value |
78 | 79 | onto the stack. Hope you can live with it! |
79 | 80 | |
210 | 211 | |
211 | 212 | The last two commands that need to be explained are the ones that allow |
212 | 213 | you to examine and change the contents of the torus where the program is |
213 | stored. This 'playfield' can be used for auxilliary storage when the | |
214 | stored. This 'playfield' can be used for auxiliary storage when the | |
214 | 215 | stack alone will not suffice, but keep in mind that it also contains the |
215 | 216 | running program. |
216 | 217 | |
251 | 252 | : (dup) <value> <value> <value> |
252 | 253 | \ (swap) <value1> <value2> <value2> <value1> |
253 | 254 | $ (pop) <value> pops <value> but does nothing |
254 | . (pop) <value> outputs <value> as integer | |
255 | , (pop) <value> outputs <value> as ASCII | |
255 | . (output int) <value> outputs <value> as integer | |
256 | , (output char) <value> outputs <value> as ASCII | |
256 | 257 | # (bridge) 'jumps' PC one farther; skips |
257 | 258 | over next command |
258 | 259 | g (get) <x> <y> <value at (x,y)> |
259 | 260 | p (put) <value> <x> <y> puts <value> at (x,y) |
260 | & (input value) <value user entered> | |
261 | & (input int) <value user entered> | |
261 | 262 | ~ (input character) <character user entered> |
262 | 263 | @ (end) ends program |
263 | 264 |