On Sat, May 6, 2017 at 8:09 AM Corey Lindsly <corey(a)lod.com> wrote:
There was a branch/loop
that jumped to the middle of a multi-byte machine instruction, so that
branch had to be disassembled and stepped separately until it "synced" up
with the other branch again. Maybe this is standard practice in
programming (I don't know) but at the time I thought, what kind of evil
genius devised this to save a few bytes of memory?
This was extremely common back then. I had a friend who worked on a gas
chromatograph project, names redacted here. It had a very advanced idea, a
thermal printer. It would print a banner when it started. Getting that
print to work, in the ROM they had, was a nightmare that involved all these
tricks.
When the "A" version came out, they asked my friend to have it print the A
after the product number. His response: "NO". There was no way he could
ever pick apart the crazy code that had printed out the startup banner so
he could add an "A". The startup banner remained the same.
Executing code as data in the early startup was also common in those days,
and modifying that data and then rerunning it happened all the time.
This is why the things like the Therac 25 happened ...
https://en.wikipedia.org/wiki/Therac-25
Note the reference to "Cargo coding", reusing code you don't understand.
In
modern terms we call this software reuse and it's taught at all the best
uni's. Google a package, pull it down, compile it in, done.
Lest you think things are better now, Linux uses self modifying code to
optimize certain critical operations, and at one talk I heard the speaker
say that he'd like to put more self modifying code into Linux, "because
it's fun". Oh boy.
ron