THE STACK AREA OF MEMORY 7FFF: ??? already in use 7FFE: ??? already in use 7FFD: return address from start to its caller 7FFC: old fp; start's stack frame starts here 7FFB: x (uninitialised) 7FFA: y = 1739 7FF9: z (uninitialised) 7FF8: f's base = 10; F's stack frame starts here 7FF7: f's x = 1736 7FF6: 040B; return address 7FF5: 7FFC; old fp 7FF4: a = 173 7FF3: b = 6 7FF2: base = 10; second stack frame for recursive f 7FF1: x = 173 7FF0: 0424; return address 7FEF: 7FF5; old fp 7FEE: a = 17 7FED: b = 3 7FEC: base = 10; third stack frame for f 7FEB: x = 17 7FEA: 0424; return address FP->7FE9: 7FEF; old fp 7FE8: a = 1 SP->7FE7: b = 7 7FE6: 7FE5: THE STATIC AREA OF MEMORY 0400: start: push fp 0401: load fp, sp 0402: sub sp, 3 0403: load r1, 1739 0404: store r1, [fp-2] // y 0405: push 10 0406: load r1, [fp-2] 0407: sub r1, 3 0408: push r1 0409: call PC+7 // address of f 040A: add sp, 2 // two params were pushed 040B: push '\n' 040C: call (address of outch) 040D: add sp, 1 // one param was pushed 040E: add sp, 3 // remove local vars 040F: pop fp 0410: ret // pop and jump 0412: f: push fp 0413: load fp, sp 0414: sub sp, 2 // two locals 0415: load r1, [fp+2] // x 0416: div r1, [fp+3] // base 0417: store r1, [fp-1] //a 0418: load r1, [fp+2] 0419: mod r1, [fp+2] 041A: store r1, [fp-2] // b 041B: push [fp-2] // say(b) 041C: call (address of say) 041D: add sp, 1 041E: load r1, [fp-1] // if (a > 0) 041F: comp r1, 0 0420: jcond leq, PC+4 // over it 0421: push [fp-1] // a 0422: push [fp+3] // base 0423: call PC-18 // f again 0424: add sp, 2 0425: push [fp-2] // b 0426: call (address of say) 0427: add sp, 1 0428: add sp, 2 // kill two locals 0429: pop fp 042A: ret 042B: 042C: