git @ Cat's Eye Technologies Befunge-93 / 1e88a46
Merge pull request #18 from catseye/docs-updates Corrections and updates to documentation Chris Pressey authored 3 years ago GitHub committed 3 years ago
1 changed file(s) with 9 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
99 Chris Pressey, Cat's Eye Technologies
1010 *Original document September, 1993*
1111 *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*
1415
1516 ### The Basics of Befunge-93 ###
1617
1718 Most likely the most unique element of Befunge-93 programming is the
1819 Program Counter (PC.) In almost all computer programming languages, the
1920 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
2122 forward thereafter, nonetheless.)
2223
2324 The PC in Befunge-93, however, is subject to different rules. It may go
7374 the upper-left of the torus and is initially oriented to execute
7475 rightward.
7576
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
7778 this will *not* generate an underflow! It will simply push a 0 value
7879 onto the stack. Hope you can live with it!
7980
210211
211212 The last two commands that need to be explained are the ones that allow
212213 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
214215 stack alone will not suffice, but keep in mind that it also contains the
215216 running program.
216217
251252 : (dup) <value> <value> <value>
252253 \ (swap) <value1> <value2> <value2> <value1>
253254 $ (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
256257 # (bridge) 'jumps' PC one farther; skips
257258 over next command
258259 g (get) <x> <y> <value at (x,y)>
259260 p (put) <value> <x> <y> puts <value> at (x,y)
260 & (input value) <value user entered>
261 & (input int) <value user entered>
261262 ~ (input character) <character user entered>
262263 @ (end) ends program
263264