[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 6502 illegal opcodes questions



mdj wrote:
Michael J. Mahon wrote:

mdj wrote:

Paul Schlyter wrote:



So this bounds checking can not be turned off in Ada, for efficiency ?


It's compiler dependent - but the Ada compilers I've used allow pretty
much all runtime checking to be disabled. This is reasonable - after a
degree of testing I guess... I've personally never written anything in
Ada that ran slowly enough to bother with it.

Turning off error/assertion checking after development and test and
before distributing software for use is like wearing life vests during
training, but taking them off before going to sea (to paraphrase
Dijkstra).


Absolutely... Unless you really need the extra few cycles of speed it's
more sensible to leave it on. Some people though, would prefer that
their customer see an application crash than show a helpful error
message indicating that a programmer attempted to divide something by
zero ;-)

Even in this case, you could just compile it out per module as
required.

I've never understood why after all these years and all the fancy stuff
that's implemented in a CPU why they never grew the fairly obvious
feature of throwing an interrupt on overflow. It would mean such errors
could be trapped with zero overhead in the no error case.

A number of machines implemented "sticky" overflow, in which the
overflow indicator, if set, would stay set until reset.  This allows
a single test at the end of each procedure, for example, but also
loses the precise point of the interrupt.

One problem with your proposal for an overflow interrupt is that in
many quite ordinary computations, an overflow normally occurs.  This
would require either enabling and disabling the interrupt with some
frequency or defining special forms of arithmetic ops that ignore
any interrupt.

-michael

Parallel computing for 8-bit Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."