Ch 08 Quiz A
Stack Tracing Quiz
Code A
Please include LCL
and ARG
in your stack frame.
Move to a new column in your stack tracing whenever you hit
function
, return
, or the stack decreases (add, subtract, etc).
110 function Sys.main 0
120 push constant 13
130 push constant 3
140 call grind 1
150 push constant 0
160 call grind 1
170 add
180 label INFINITE
185 goto INFINITE
190 function grind 1
200 push arg 0
210 push constant 1
220 add
230 pop local 0
240 push local 0
250 push local 0
260 push constant 2
270 gt
280 if-goto GDONE
290 call grind 1
300 label GDONE
310 return