The Wheeler Jump.
Heater.
Posts: 21,230
in Propeller 1
Professor Brailsford, one of the original ARM processor architects, tells the history of how computers did subroutine calls before we had link registers or stacks and CALL, RTS, PUSH and POP instructions.
It was done with self-modifying code. Does that sound familiar?
Which he explains is "really bad". Little does he know...
It was done with self-modifying code. Does that sound familiar?
Which he explains is "really bad". Little does he know...
Comments
It puts the return address into the JMP at the end of the subroutine. In that respect it does what the Wheeler Jump does automatically. Rather than having to code it yourself.
That's a bit different from the idea of a LINK register and very different from the modern day idea of automatically pushing return addresses to a stack.
The Propeller confuses the discussion because it executes code from it's registers. I've never worked with any other processor that does that. Is there another example of such a thing out there ?
But as Mel said "What use is a program that cannot modify its own code?"
See "The Story of Mel". Discussed on this forum and all over the net.
The only other machine I know that could execute code from it's registers was the TI TMS9900.
Basically because it did not have any registers internally. Ony a program counter, status register, and workspace pointer.
The last of which pointed to a location in external RAM where it regarded 16 words as being it's general purpose registers.
So basically you could execute code from, and/or modify, external RAM space, that was also considered to be registers.
Chaos !
There were three special locations in each cores own (partition) memory that could perform indexing within an instruction.
Instructions were very much like the propeller - dual operand but reversed. It simulated multi-core by hardware time slicing, where each core had its' own memory (partition) and also shared (common) memory space. Code could run from both.
Hmm... an "execute instruction" instruction. That is kind of meta. Weird.
Could the "execute instruction" instruction execute the "execute instruction" instruction ?
(But I'm tempted to change my emulator to allow it.. just to see what's possible)
Heater,
The System/360 (and 370, etc.) had an EX instruction):
https://en.wikibooks.org/wiki/360_Assembly/360_Instructions/EX
And trying to execute an Execute instruction caused an Execute instruction.
BTW, the IBM 1130/1800 also used self-modifying code.
Walter
"DC" stands for "define constant," and the "*-*" is just the location pointer minus the location pointer, IOW zero. It's just a visual indication that something will be written there, similar to (and the inspiration for) PASM's use of "0-0" . The "return" instruction is just an indirect branch through the address placed in SUBR.
Another convention used by the 1130 was to place parameter addresses in DCs immediately following the CALL, viz:
SUBR would access the parameters via the DC above its entry point and adjust the return address accordingly. This same technique could be employed in PASM!
The 1130 also used a LIBF call to access frequently-called subroutines through a local transfer table. This enabled indexed BSIs that required only one word of storage, compared to the two required by a CALL.
-Phil
As did I.
In fact, the reason I started working with the Propeller was to create an 1130 emulator.
It's easy (and already exists) to do it on a PC with gigs of ram and disk space.
It's much more challenging to emulate a 16K (8K words) machine in 32K of ram.
I thought it would take 6 months. It was more like 6 years before I really got it working as it should. The rule about rounding up to the next unit when estimating certainly applied here.
Walter
Thanks all.
I'm kind of intrigued by Phils suggestion of IBM 1130 style parameter passing in PASM.
Has anyone ever done such a thing in PASM? Is there an advantage to doing that in some cases?
I have to think that though a bit...
This reminds me of an old article in "Datamation" (IRC after 40 years) with a list of crazy CPU instructions like: execute invalid operation, execute ignorant operator
1) The register contains another EXR instruction, with bits 3-5 of that one also pointing to a register
2) If that register is the same as for the original EXR instruction you would just have an infinite loop
3) If that register is different from the one in the original, the original could just have pointed to the 'final' register in the first place. There's nothing at all to gain in doing this via a second (or third) EXR.
So instead the architecture traps an attempt to execute an EXR via an an EXR, as it's pointless to do so anyway.
This is very different from the infinite indirection addressing scheme of the PDP-10 that David described, which is actually useful for some stuff.
Now if only they had added some other operations, ADD, SUB, etc that executed from registers then they would have had a Propeller architecture!
Branch and Catch Fire
Cannot recall which computer this was attributed to... so long ago now
Not sure which one it was either but I think it might also be the one that used special write-only memory.
https://en.wikipedia.org/wiki/Halt_and_Catch_Fire
School boy snickers...
The aforementioned ND line of computers had one, 'Set EXtended address mode', and its partner was REX, 'Reset EXtended address mode'
That is "SEX" as in "Sign Extend".
There is nothing like modern day assembler instructions though. How about this from ARM?
LDMIAEQ SP!, {R4-R7, PC}
Or this from Intel?
VZEROUPPERS
Obvious ha?