From: "ben franchuk"
<bfranchuk(a)jetnet.ab.ca>
Tony Duell wrote:
C requires a stack pointer and a index register.Offhand
I don't think
your hardware supports that.
Certain HP2xxx do have index registers (the ones with the EIG instructions
IIRC), but guess how FORTRAN compilers handle indexed array accesses
Err, self-modifying code? That was the traditional way to do this sort of
thing.
I think the PC is noted more more self-modifying code than the old
machines. The only real self modifying code (on your typical early
machine) is the fact the return address is placed in the first word
of subroutine code.
> -tony
>
Hi
I don't call this self modifying. Where you have a port
command like the 8080 and you overwrite the port address
before executing, now that is self modifying. Something
like over writing an add instruction with a subtract
would qualify as self modifying. Placing the address at
the beginning is no different than pushing
the address onto a stack, other than that it isn't reentrant
( with out extra code and then not for interrupts ). The
first address isn't code, it is a variable space. The executed
code never changes.
My Nicolet uses the entry address saving method.
In any case, I never understood the stigma of using self
modifying code. It does require careful documentation if
it is expected to be maintained. There is no reason why
it can't be as robust as any other code if done properly.
I suspect it was used as a sales talk when someone was
trying to pitch their version of code to be better than
someone else's. Such things as overlays would qualify as
more risky uses of self modifying code but that is done
without mention.
Dwight