old processor architectures [was Re: The Strange Birth and Long Life of Unix - IEEE Spectrum]
D. Hugh Redelmeier
hugh-pmF8o41NoarQT0dZR+AlfA at public.gmane.org
Thu Dec 8 16:05:34 UTC 2011
| From: Scott Allen <mlxxxp-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
| Indexing was one of the big features that the Z80 added.
Yes, but if you looked at the actual bytes of generated code, it
didn't often make your code much faster or shorter. I had z80s but
didn't find it worthwhile to use any of the added instructions.
Even the block move instructions weren't much faster than a loop: they
refetched the instruction for each byte!
| It also added invalid opcodes :-)
What I meant was: detecting invalid opcodes and trapping. I don't
think that the z80 did that. Assembly programs go off the rails in a
number of ways and having the system detect and stop them is handy.
On /360, ABEND S0C1 (invalid opcode) and S0C4 (storage protection
violation) were common and useful to me as a programmer.
On the /360, arithmetic overflow can cause a trap, but that is
normally disabled. I usually enabled it in my programs because it
detected real bugs. This is an example where the /360 is superior to
the PDP-11, but most architects don't notice: the /360 had two sets of
certain arithmetic instructions: ones where the operand was unsigned
and ones where it was signed two's complement. Although the
calculated result was the same, the concept of overflow was different.
This allowed trap-on-overflow to be reasonable. On the PDP-11, the
CPU doesn't know whether the "c" condition or the "v" condition is an
error because it doesn't know if the operation is signed or unsigned.
In C code, one of the most common run-time errors is dereferencing a
NULL pointer. On the original Mac, it would just silently work,
operating on location 0. On the Atari ST, location 0 references (or
perhaps only stores, I don't remember) would trap. When an ST program
to emulate the Mac was created, I think the majority of the work to
make it practical was to create fixups for all the important Mac
programs that silently dereferenced NULL. I heard that a few Mac
programmers bought an ST + the emulator to catch bugs in their own
programs! Later Macs forbid dereferencing NULL.
--
The Toronto Linux Users Group. Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists
More information about the Legacy
mailing list