avatar
Jack Aidley @jackaidley.bsky.social

It's not a general feature of a Wheeler Jump but depending on architecture it could be an efficient way of doing it. The Wheeler Jump repurposes the arithmetic accumulator as the return address, but you can't usually write directly to the accumulator: you have to carry out a sum.

aug 25, 2025, 9:57 am • 1 0

Replies

avatar
Jack Aidley @jackaidley.bsky.social

So on architecture which has a "negate" operator, then the efficient method of storing the address may just be to use that operator on the Program Counter. Without knowing the exact reference you're referring to, I can't say whether that's the correct explanation.

aug 25, 2025, 9:57 am • 1 0 • view
avatar
Ehud @duhe.bsky.social

Thanks! What I’m reading refers to the original implementation (on the EDSAC).

aug 25, 2025, 10:06 am • 0 0 • view
avatar
Ehud @duhe.bsky.social

This is presumably the source (that I’m too lazy to check rn): Wheeler, D.J., "The EDSAC Programming Systems," in IEEE Annals of the History of Computing, vol. 14, no. 4, pp. 34-40, 1992.86

aug 25, 2025, 10:13 am • 0 0 • view
avatar
Jack Aidley @jackaidley.bsky.social

Ah, gotcha. I think your reference has slightly misunderstood, or you've slightly misunderstood it, if you look at the code from that paper you can see that what it's storing into the accumulator isn't the return address but the command 'A m F'. A is 11100 in the character table of the EDSAC2 so...

Program text. The relevant parts of the code are explained in the comment and the first reply.
aug 25, 2025, 10:24 am • 1 0 • view
avatar
Jack Aidley @jackaidley.bsky.social

... this is actually a negative number. The command 'G n F' is a conditional jump that jumps if the accumulator is negative. Once it reaches the subroutine it adds a pre-calculated constant to 'A m F' to convert it into 'E m+2 F' and stores it into the address at the end so that it will now return.

aug 25, 2025, 10:24 am • 1 0 • view
avatar
Ehud @duhe.bsky.social

So the return address is in location 3? The snippet doesn’t show this. But then why put the A in the accumulator to begin with? Now I’m confused…

aug 25, 2025, 10:30 am • 0 0 • view
avatar
Jack Aidley @jackaidley.bsky.social

No, location 3 is used to store the number that needs to be added to 'A m F' to turn it into 'E m+2 F'. The accumulator gets the entire command 'A m F' stored into it, this means when you add the number stored in 3 to the accumulator it can be stored as the return op without further manipulation.

aug 25, 2025, 10:46 am • 1 0 • view
avatar
Jack Aidley @jackaidley.bsky.social

Command codes in EDSAC 2 were stored as a 5 bit command code, a spare bit, a 10 bit address, and a final bit indicating whether the command was 'F' (short) or 'D' (long). So, if you're calling a subroutine at position 10, you'd store the return address with 'A 10 F' which is '11100 0 0000001010 0'

aug 25, 2025, 10:57 am • 1 0 • view
avatar
Jack Aidley @jackaidley.bsky.social

And you need to return from the subroutine function with 'E 12 F' (because you want to skip before the accumulator and the jump instruction you return to the stored value + 2), which is '00011 0 0000001100 0'. Location 3 is used to store the difference between these two values which is always...

aug 25, 2025, 10:57 am • 1 0 • view
avatar
Jack Aidley @jackaidley.bsky.social

... the same 'U 2 F' (00111 0 00000 00010 0). Add this to 'A 10 F' and you get 'E 12 F' -- which, looking at it now, I think only works because of arithmetic overflow.

aug 25, 2025, 10:57 am • 1 0 • view
avatar
Ehud @duhe.bsky.social

Ok, thanks. I think I got it: to get the return location we use the current line which was relocated so has the correct current program counter. The A instruction does this for us, and adds the contents of the current pc location which is the instruction A m. 1/ .

aug 25, 2025, 10:58 am • 1 0 • view
avatar
Ehud @duhe.bsky.social

This is how we capture m, the current pc. In the subroutine we add the difference between A and E instructions (and m to m+2 to go the instruction after the jump) to get a return jump and plug it at the end of the subroutine. This is a constant value. 2/

aug 25, 2025, 10:58 am • 2 0 • view
avatar
Ehud @duhe.bsky.social

Presumably E jumps on positive and G on negative unrelated to this, simply the way conditional branching was implemented way before subroutines were contemplated. 3/3

aug 25, 2025, 10:58 am • 2 0 • view
avatar
Ehud @duhe.bsky.social

It seems that the G instruction jumps to the address in the accumulator only if it is negative. Need to investigate.

aug 25, 2025, 10:17 am • 0 0 • view
avatar
Ehud @duhe.bsky.social

Aha!

EDSAC instruction set showing that I was right about the G instruction.
aug 25, 2025, 10:23 am • 1 0 • view