Interpret Befunge-93 The program will be provided as the first argument, stdin should be used for all
read requests by the program and stdout for all write requests.  It can be
assumed that the program is less than 80 characters wide and less than 25 lines
high.


~ should push -1 if there is nothing to read.
Any pop off the bottom of the list should simply return 0, including for any calculations.
For p and g, x and y are 0 based indices.
Input should be fully buffered, i.e. &amp; and ~ block the program until EOF is encountered on stdin then any remaining input is kept to serve future requests.


The following commands must be available:


  
  0-9
  &nbsp;&nbsp;&nbsp;&nbsp;Push this number on the stack
  +
  &nbsp;&nbsp;&nbsp;&nbsp;Addition: Pop a then b, push a+b
  -
  &nbsp;&nbsp;&nbsp;&nbsp;Subtraction: Pop a then b, push b-a
  *
  &nbsp;&nbsp;&nbsp;&nbsp;Multiplication: Pop a then b, push a*b
  /
  &nbsp;&nbsp;&nbsp;&nbsp;Integer division: Pop a then b, push b/a, rounded down. If a is 0, result is undefined
  %
  &nbsp;&nbsp;&nbsp;&nbsp;Modulo: Pop a then b, push the remainder of the integer division of b/a. If a is 0, result is undefined
  !
  &nbsp;&nbsp;&nbsp;&nbsp;Logical NOT: Pop a value. If the value is 0, push 1; otherwise, push 0.
  `
  &nbsp;&nbsp;&nbsp;&nbsp;Greater than: Pop a then b, push 1 if b>a, otherwise 0.
  &gt;
  &nbsp;&nbsp;&nbsp;&nbsp;Start moving right
  &lt;
  &nbsp;&nbsp;&nbsp;&nbsp;Start moving left
  ^
  &nbsp;&nbsp;&nbsp;&nbsp;Start moving up
  v
  &nbsp;&nbsp;&nbsp;&nbsp;Start moving down
  ?
  &nbsp;&nbsp;&nbsp;&nbsp;Start moving in a random cardinal direction
  _
  &nbsp;&nbsp;&nbsp;&nbsp;Pop a value; move right if value=0, left otherwise
  |
  &nbsp;&nbsp;&nbsp;&nbsp;Pop a value; move down if value=0, up otherwise
  "
  &nbsp;&nbsp;&nbsp;&nbsp;Start string mode: push each character's ASCII value all the way up to the next "
  :
  &nbsp;&nbsp;&nbsp;&nbsp;Duplicate value on top of the stack
  \
  &nbsp;&nbsp;&nbsp;&nbsp;Swap two values on top of the stack
  $
  &nbsp;&nbsp;&nbsp;&nbsp;Pop value from the stack
  .
  &nbsp;&nbsp;&nbsp;&nbsp;Pop value and output as an integer
  ,
  &nbsp;&nbsp;&nbsp;&nbsp;Pop value and output as ASCII character
  #
  &nbsp;&nbsp;&nbsp;&nbsp;Trampoline: Skip next cell
  p
  &nbsp;&nbsp;&nbsp;&nbsp;A "put" call (a way to store a value for later use). Pop y then x then v, change the character at the position (x,y) in the program to the character with ASCII value v
  g
  &nbsp;&nbsp;&nbsp;&nbsp;A "get" call (a way to retrieve data in storage). Pop y then x, push ASCII value of the character at that position in the program
  &
  &nbsp;&nbsp;&nbsp;&nbsp;Input an integer (may be multiple characters and may be negative) and push it
  ~
  &nbsp;&nbsp;&nbsp;&nbsp;Input a single character from stdin and push its ASCII value
  @
  &nbsp;&nbsp;&nbsp;&nbsp;End program
  


This is a code golf, shortest answer wins.  If there is a tie then the first answer wins.

You may use any language feature not specifically designed for Befunge to implement this, if you want to try and translate Befunge to native code and eval it good luck.

For test cases look at my recent answers.  The reference interpreter I have been using is http://www.quirkster.com/js/befunge.html.

One quick test case of some features from "egnufeB"&gt;:#,_@

1-0g:"Z"-#v_$91+"sparw tup/teG"&gt;:#,_$               v                          Z
          &gt;:" "-#v_$91+"ecaps snruter teg BOO"&gt;:#,_$v
v                &gt;0" snruter teg BOO"&gt;:#,_$.91+,    &gt;
&gt;8:+:*11p11g#v_91+"tib 8 dengis"01-11p11g!#v_"nu"&gt;" era slleC"&gt;:#,_v
vv           &gt;91+"tib 8&gt;"                  &gt;     ^                 &gt;91+"krow " #
 &gt;        &gt;"spmuj egdE"&gt;:#,_   91+"krow "04-3%1+#v_        &gt;"sredniamer evitag"v
&gt;"ton od "^                                      &gt;"ton od "^
"eN"&gt;:#,_  91+"skrow edomgnirts ni @"&gt;:#,_@                                    &gt;
Befunge-93 - 404 371 361 352 339 337 323 bytes
&lt;xyXYvp01&lt;&gt;110vv5_v#`0+1:_v#+!-&quot;g&quot;\&lt;v&quot;&lt;&quot;:::&lt;&gt;1v#p03-1_&gt;! g20gp00g1+0v25p
v2g02 &lt; p0 20p&lt;+vp020p01-10$_:&quot;p&quot;-!^&gt;&gt;-!\ v^ &lt;&gt;0p20pv|!*-&quot;;&quot;\+1::~p0&lt;
v2-10&lt;^v# ^#&lt;  &lt;&lt;$&lt;       &lt; ^+!-&quot;_&quot;\+!-&quot;?&quot;&lt;&gt;#^_10v4p&lt;:^00 _$20g1+20p^
v21p010&gt;#&lt;40g20v&gt;\%:40p5+g:92p:75*1--00g!\#^_\$0 v   &gt;91+-^
&lt;3+g01g 03p04+g&lt;^++g04g02:*54p03:%\++g03g01:&quot;P&quot;p0&lt;

Try It Online!
Input program must have at most 20 lines. Input can be provided in same file as Befunge program by placing it after a ; character. Yes, it can interpret itself, but the *54 in the bottom line should be replaced by *53 if you do that. And if you ask that interpreted interpreter to interpret itself, change it to *52 etc. If run in a Befunge-97 interpreter, it will also support the a-f commands (but not ' or any new command that affects control flow or wrapping behavior).
Note that it basically asks the interpreter it runs in to handle all the stuff relating to I/O and stack, so its specific behavior is largely dependent on that of the interpreter running it. In other words, it is perfectly compliant if run in a compliant interpreter.
It works by reading in the program from input (until EOF or semicolon) directly into the playfield below it, then simulating the movement of a virtual instruction pointer through that program. It copies each command from the program into its own execution area (at position (9,2) on the grid) and runs its own instruction pointer through it after ensuring all of its own data has been removed from the stack (as all of the interpreted program's stack data is maintained at the bottom of the stack). This is the standard methodology for Befunge self-interpretation since the early 00s, but I don't think it has ever been done in such a small program.
A fuller explanation is in the annotations you can see by clicking the link above.