CS 207: Computer Organization and Architecture

Function-calling and recursion on the PDP-8/E

Write a function for the PDP8 that uses recursion to compute the Nth triangular number. Your main program will get N from the switch register and call a recursive function with N as its parameter. The recursive function, upon return to the main program, will have left the Nth triangular number T(N) = 1 + 2 + ... + N in the AC.

This program will require you to implement a rudimentary function-calling mechanism using a stack. I'll give you some suggestions and constraints, so don't start working on this until we talk about it in class.