Wheeler Jump
# Wheeler Jump

The Wheeler Jump is a type of subroutine call methodology that was used on some early computers that lacked hardware support for saving the return address. The concept was developed by David Wheeler while working on the pioneering EDSAC machine in the 1950s. EDSAC had not been built with subroutines in mind, and lacked a suitable processor register or a hardware stack that might allow the return address to be easily stored.

Wheeler's solution was a particular way to write the subroutine code. To implement it, the last line of the subroutine was a "jump to this address" instruction, which would normally be followed by a memory location. In a Wheeler subroutine, this address was normally set to a dummy number, say 0.

To call the routine, the address of the caller would be placed in the accumulator and then the code would jump to the starting point of the routine. The first instructions in the routine would calculate the return address based on the value in the accumulator, typically the next memory location so an increment will suffice, and then write the result to the dummy address previously set aside. When the routine runs its course it naturally reaches the end of the routine which now says "jump to the return address".

As writing to memory is a slow process compared to register access, this methodology is not particularly fast. It also is not capable of expressing recursion. The addition of new registers for this sort of duty was a key design goal of EDSAC 2.

## Example

This example demonstrates the technique using a pseudo-assembler language for a simple byte-oriented accumulator-based machine with a single register, A:

When this code completes, the JUMP instruction in address 90 will naturally return to location 13, the next instruction after the subroutine.

