Begin massaging Markdown version of specification.
catseye
12 years ago
8 | 8 | |
9 | 9 | ### Table of Contents |
10 | 10 | |
11 | - #### [Introduction](#Introduction) | |
11 | - [Introduction](#Introduction) | |
12 | 12 | |
13 | 13 | - [What is a Funge?](#Whatis) |
14 | 14 | - [About this Document](#About) |
15 | 15 | |
16 | - #### [The Funge Virtual Machine](#Machine) | |
16 | - [The Funge Virtual Machine](#Machine) | |
17 | 17 | |
18 | 18 | - [Code and Data](#Code_Data) |
19 | 19 | - [Funge-Space](#Space) |
20 | 20 | - [Stack Stack](#Stack_Stack) |
21 | 21 | - [Funge Source File Format](#Format) |
22 | 22 | |
23 | - #### [Code: Program Flow](#Code) | |
23 | - [Code: Program Flow](#Code) | |
24 | 24 | |
25 | 25 | - [Instruction Pointer](#IP) |
26 | 26 | - [Instructions](#Instructions) |
29 | 29 | - [Flow Control](#Flow) |
30 | 30 | - [Decision Making](#Decision) |
31 | 31 | |
32 | - #### [Data: Cell Crunching](#Data) | |
32 | - [Data: Cell Crunching](#Data) | |
33 | 33 | |
34 | 34 | - [Integers](#Integers) |
35 | 35 | - [Strings](#Strings) |
36 | 36 | - [Stack Manipulation](#Stack_Manipulation) |
37 | 37 | - [Stack Stack Manipulation](#Stack_Stack_Manipulation) |
38 | 38 | |
39 | - #### [Media: Communications and Storage](#Media) | |
39 | - [Media: Communications and Storage](#Media) | |
40 | 40 | |
41 | 41 | - [Funge-Space Storage](#Storage) |
42 | 42 | - [Standard Input/Output](#Stdio) |
44 | 44 | - [System Execution](#System) |
45 | 45 | - [System Information Retrieval](#Sysinfo) |
46 | 46 | |
47 | - #### [Scale: Extension and Customization](#Scale) | |
47 | - [Scale: Extension and Customization](#Scale) | |
48 | 48 | |
49 | 49 | - [Handprints](#Handprints) |
50 | 50 | - [Fingerprints](#Fingerprints) |
51 | 51 | - [Funge Central Registry](#Registry) |
52 | 52 | |
53 | - #### [Appendix](#Appendix) | |
53 | - [Appendix](#Appendix) | |
54 | 54 | |
55 | 55 | - [Instruction Quick Reference](#Quickref) |
56 | 56 | - [Concurrent Funge-98](#Concurrent) |
373 | 373 | To remember which is which, visualize yourself on the seat of a bicycle, |
374 | 374 | looking down at the handlebars: |
375 | 375 | |
376 | ------------- -------------- -------------- | |
377 | `+-| +-` `+-+| |` `-+ |-+` | |
378 | `[` ` ` `]` | |
379 | `Turn Left` `Go Forward` `Turn Right` | |
380 | ------------- -------------- -------------- | |
376 | +- +-+ -+ | |
377 | | | | | | |
378 | +- -+ | |
379 | ||
380 | [ ] | |
381 | ||
382 | Turn Go Turn | |
383 | Left Forward Right | |
381 | 384 | |
382 | 385 | The `r` "Reverse" instruction multiplies the IP's delta by -1. In two |
383 | 386 | dimensions, this is the equivalent of reflecting the delta of the IP |
610 | 613 | spaces and/or wrap while in stringmode will have to be changed to work |
611 | 614 | the same under Funge-98. |
612 | 615 | |
613 | Befunge-93 Befunge-98 | |
614 | ||
616 | Befunge-93 Befunge-98 | |
617 | ||
615 | 618 | "hello world" "hello world" |
616 | 619 | "hello world" "hello "::"world" |
617 | 620 | |
621 | 624 | skipping over the character (in no ticks). For example, the following |
622 | 625 | two snippets perform the same function, printing a Q: |
623 | 626 | |
624 | `"Q",` | |
625 | ||
626 | `'Q,` | |
627 | "Q", | |
628 | ||
629 | 'Q, | |
627 | 630 | |
628 | 631 | `s` "Store Character" is the mirror image of the `'` instruction: this |
629 | 632 | instead pops a value off the stack and writes it into (position + |
1079 | 1082 | |
1080 | 1083 | ### Funge Central Registry |
1081 | 1084 | |
1085 | _Nota bene: information in this section is obsolete_ | |
1086 | ||
1082 | 1087 | The Funge Central Registry is an online database located at |
1083 | 1088 | `http://www.catseye.mb.ca/esoteric/befunge/`. Before developing and |
1084 | 1089 | releasing your own Funge-98 implementation or extension, please register |
1112 | 1117 | - `f` Filesystem Funge. Check `y` to see if these instructions are |
1113 | 1118 | implemented. |
1114 | 1119 | |
1115 | Decimal | |
1116 | ||
1117 | ASCII | |
1118 | ||
1119 | Instruction | |
1120 | ||
1121 | Stack Before | |
1122 | ||
1123 | Stack After | |
1124 | ||
1125 | Other Effects | |
1126 | ||
1127 | *(bottom ... top)* | |
1128 | ||
1129 | 32 | |
1130 | ||
1131 | space | |
1132 | ||
1133 | Space | |
1134 | ||
1135 | ||
1136 | ||
1137 | ||
1138 | ||
1139 | not normally executed | |
1140 | ||
1141 | 33 | |
1142 | ||
1143 | `!` | |
1144 | ||
1145 | Logical Not | |
1146 | ||
1147 | b | |
1148 | ||
1149 | NOT b | |
1150 | ||
1151 | ||
1152 | ||
1153 | 34 | |
1154 | ||
1155 | `"` | |
1156 | ||
1157 | Toggle Stringmode | |
1158 | ||
1159 | ||
1160 | ||
1161 | ||
1162 | ||
1163 | stringmode \<- NOT stringmode | |
1164 | ||
1165 | 35 | |
1166 | ||
1167 | `#` | |
1168 | ||
1169 | Trampoline | |
1170 | ||
1171 | ||
1172 | ||
1173 | ||
1174 | ||
1175 | pos \<- pos + delta | |
1176 | ||
1177 | 36 | |
1178 | ||
1179 | `$` | |
1180 | ||
1181 | Pop | |
1182 | ||
1183 | n | |
1184 | ||
1185 | ||
1186 | ||
1187 | ||
1188 | ||
1189 | 37 | |
1190 | ||
1191 | `%` | |
1192 | ||
1193 | Remainder | |
1194 | ||
1195 | a b | |
1196 | ||
1197 | a REM b | |
1198 | ||
1199 | ||
1120 | "Before" column is the state of the TOSS before the instruction is | |
1121 | executed. "After" column is the state of the TOSS after the instruction | |
1122 | is executed. Both are notated from bottom (on the left) to top (on the | |
1123 | right). | |
1124 | ||
1125 | ASCII Instruction Before After Other Effects | |
1126 | ----- ----------- ------ ----- ------------- | |
1127 | space Space not normally executed | |
1128 | ! Logical Not b NOT b | |
1129 | " Toggle Stringmode stringmode <- NOT stringmode | |
1130 | # Trampoline pos <- pos + delta | |
1131 | $ Pop n | |
1132 | % Remainder a b a REM b | |
1133 | ||
1134 | * * * * * | |
1200 | 1135 | |
1201 | 1136 | 38 |
1202 | 1137 |