; Example program for procedure call with 2 local variables ; ; Peter Strazdins, April 2008 ; #include external WriteInt; ; int main () { n: block 1 ; int n; main: ; load #42 ; n = 42; store n ; ; WriteInt(n, 6); /*=printf("%6d", n);*/ load n ; /* Push(n) */ /* AC=Mem[n] */ incsp #1 ; /* SP=SP+1 */ store !0 ; /* Mem[SP]=AC */ load #6 ; /* Push(#6) */ /* AC=6 */ incsp #1 ; /* SP=SP+1 */ store !0 ; /* Mem[SP]=AC */ call WriteInt; /* SP=SP+1; Mem[SP]=PC; ; PC=WriteInt */ incsp #-2 ; /* Pop(2) */ /* SP=SP-2 */ ; load #'\n' ; putchar('\n'); trap #3 ; trap #1 ; return 0; end main ; }