From: Michael J. Mahon on
John Selck wrote:
> Am 18.05.2006, 16:14 Uhr, schrieb Paul Schlyter <pausch(a)saaf.se>:
>
>> Could you point at one single case where use of undocumented opcodes did
>> significantly speed up an application on the 6502 platform?
>
>
> Bresenham interpolation.
>
> Without illegal opcodes:
>
> STA $12
> TXA
> STA $FE00,Y
> TAX
> LDA $12
> SBC $10
> BCS .skip
> ADC $11
> INX
> ..skip
>
> With illegal opcodes:
>
> SHX $FE00,Y
> SBC $10
> BCS .skip
> ADC $11
> INX
> ..skip
>
> Best case: 21 vs 11 clock cycles (almost 2x speed with illegal)
> Worst case: 25 vs 15 clock cycles (still 1.67x speed)

I note that the TAX in the first case is unnecessary, trimming the
best case advantage to 19 vs 11 cycles (1.7x) and the worst case
advantage to 23 vs 15 cycles (1.5x).

-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."
From: John B. Matthews on
222222In article <e598gn$134q$1(a)merope.saaf.se>,
pausch(a)saaf.se (Paul Schlyter) wrote:

> In article
> <nospam-467DFC.23375126052006(a)network-065-024-007-027.columbus.rr.com>,
>
> > In article <e56rj1$7lo$1(a)merope.saaf.se>,
> > pausch(a)saaf.se (Paul Schlyter) wrote:
> >
> >> In article <1148544621.115246.248890(a)y43g2000cwc.googlegroups.com>,
> >> mdj <mdj.mdj(a)gmail.com> wrote:
> > [...]
> >>> The key concepts that are missing here are pointers, and more
> >>> specifically,
> >>> the ability to perform arbitrary arithmetic on pointer types.
> >>
> >> FORTRAN, Pascal and Ada lacks this too.
> > [...]
> >
> > This is certainly false for Ada:
> >
> > http://www.adapower.com/rm95.php
> >
> > In particular, the standard package Interfaces.C.Pointers overloads the
> > "+" and "-" operators for just this purpose.
> >
> > http://www.adapower.com/rm95/RM-B-3-2.html
>
> OK, Ada has pointer arithmetic - but is it arbitrary?

Well, it's arbitrary up to the limit of erroneous: you can't access
memory that's forbidden by the OS:-)

> Doesn't Ada impose strict range checking for all its data structures,
> throwing exceptions as soon as an attempt of out-of-range access is
> performed?

Certainly, constraint, overflow and elaboration checks can be turned on
and off selectively as requirements dictate.

> I though the fundamental idea behind Ada was to provide
> provably secure software, and then one cannot take pointer arithmetic
> as lightly as C and C++ both do.

Indeed, the capability is provided more to interface with existing code
than to represent exemplary style. In the normal course of programming,
one uses the operations and attributes of the referenced type (e.g.
array and records) rather than pointer arithmetic. In fact, Ada does
away with the syntactic distinction between the pointer and the thing
pointed to (e.g. p and p^, in Pascal). Java takes this even further,
allowing no access whatever to the underlying object reference as a
pointer.

> > It is arguably false for many widely used flavors of Pascal including
> > Object Pascal and Turbo Pascal.
> >
> > Even Fortran has a non-standard extension for this:
> >
> > http://gcc.gnu.org/onlinedocs/gfortran/Cray-pointers.html
>
> If we are going to include non-standard extensions of languages too,
> then the Java camp should also include both J++ and C# .....

Touch?! :-)

--
John Matthews
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/
From: Paul Schlyter on
In article <Ms2dnbdHwN56NeXZnZ2dneKdnZydnZ2d(a)comcast.com>,
Michael J. Mahon <mjmahon(a)aol.com> wrote:

> It seems appropriate to point out that, given Turing equivalence of
> all computers (with enough storage and time), "portability" is always
> assured in principle, though it may require widely varying degrees of
> effort.
>
> Practically, "portable" means "easily ported" and "non-portable" means
> "difficult to port".

In particular, "portable" doesn't require zero effort. A program can
be portable even though it requires recompilation on the new platform,
and perhans also a few configuration settings.

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

Parallell Apple II's - interesting - but don't you thin one would
get more performance from a modern computer than from a few Apple II's
working in parallell? :-)

--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stockholm dot bostream dot se
WWW: http://stjarnhimlen.se/
From: Paul Schlyter on
In article <nospam-7B7751.02054028052006(a)network-065-024-007-028.columbus.rr.com>,

> 222222In article <e598gn$134q$1(a)merope.saaf.se>,
> pausch(a)saaf.se (Paul Schlyter) wrote:
>
>> In article
>> <nospam-467DFC.23375126052006(a)network-065-024-007-027.columbus.rr.com>,
>>
>>> In article <e56rj1$7lo$1(a)merope.saaf.se>,
>>> pausch(a)saaf.se (Paul Schlyter) wrote:
>>>
>>>> In article <1148544621.115246.248890(a)y43g2000cwc.googlegroups.com>,
>>>> mdj <mdj.mdj(a)gmail.com> wrote:
>>> [...]
>>>>> The key concepts that are missing here are pointers, and more
>>>>> specifically,
>>>>> the ability to perform arbitrary arithmetic on pointer types.
>>>>
>>>> FORTRAN, Pascal and Ada lacks this too.
>>> [...]
>>>
>>> This is certainly false for Ada:
>>>
>>> http://www.adapower.com/rm95.php
>>>
>>> In particular, the standard package Interfaces.C.Pointers overloads the
>>> "+" and "-" operators for just this purpose.
>>>
>>> http://www.adapower.com/rm95/RM-B-3-2.html
>>
>> OK, Ada has pointer arithmetic - but is it arbitrary?
>
> Well, it's arbitrary up to the limit of erroneous: you can't access
> memory that's forbidden by the OS:-)

Ouch .... so much for the "security" of Ada......

>> Doesn't Ada impose strict range checking for all its data structures,
>> throwing exceptions as soon as an attempt of out-of-range access is
>> performed?
>
> Certainly, constraint, overflow and elaboration checks can be turned on
> and off selectively as requirements dictate.
>
>> I though the fundamental idea behind Ada was to provide
>> provably secure software, and then one cannot take pointer arithmetic
>> as lightly as C and C++ both do.
>
> Indeed, the capability is provided more to interface with existing code
> than to represent exemplary style. In the normal course of programming,
> one uses the operations and attributes of the referenced type (e.g.
> array and records) rather than pointer arithmetic. In fact, Ada does
> away with the syntactic distinction between the pointer and the thing
> pointed to (e.g. p and p^, in Pascal). Java takes this even further,
> allowing no access whatever to the underlying object reference as a
> pointer.

ANSI C did that too, partially, by doing away with the difference between
functions and function pointers. That's why this C program works:

#include <stdio.h>

int main()
{
(***************************printf)("Hello, world\n");
return 0;
}


>>> It is arguably false for many widely used flavors of Pascal including
>>> Object Pascal and Turbo Pascal.
>>>
>>> Even Fortran has a non-standard extension for this:
>>>
>>> http://gcc.gnu.org/onlinedocs/gfortran/Cray-pointers.html
>>
>> If we are going to include non-standard extensions of languages too,
>> then the Java camp should also include both J++ and C# .....
>
> Touche! :-)

--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stockholm dot bostream dot se
WWW: http://stjarnhimlen.se/
From: John B. Matthews on
In article <e5c1e4$24tu$1(a)merope.saaf.se>,
pausch(a)saaf.se (Paul Schlyter) wrote:

> In article
> <nospam-7B7751.02054028052006(a)network-065-024-007-028.columbus.rr.com>,
>
> > 222222In article <e598gn$134q$1(a)merope.saaf.se>,
> > pausch(a)saaf.se (Paul Schlyter) wrote:
> >
> >> In article
> >> <nospam-467DFC.23375126052006(a)network-065-024-007-027.columbus.rr.com>,
> >>
> >>> In article <e56rj1$7lo$1(a)merope.saaf.se>,
> >>> pausch(a)saaf.se (Paul Schlyter) wrote:
> >>>
> >>>> In article <1148544621.115246.248890(a)y43g2000cwc.googlegroups.com>,
> >>>> mdj <mdj.mdj(a)gmail.com> wrote:
> >>> [...]
> >>>>> The key concepts that are missing here are pointers, and more
> >>>>> specifically,
> >>>>> the ability to perform arbitrary arithmetic on pointer types.
> >>>>
> >>>> FORTRAN, Pascal and Ada lacks this too.
> >>> [...]
> >>>
> >>> This is certainly false for Ada:
> >>>
> >>> http://www.adapower.com/rm95.php
> >>>
> >>> In particular, the standard package Interfaces.C.Pointers overloads the
> >>> "+" and "-" operators for just this purpose.
> >>>
> >>> http://www.adapower.com/rm95/RM-B-3-2.html
> >>
> >> OK, Ada has pointer arithmetic - but is it arbitrary?
> >
> > Well, it's arbitrary up to the limit of erroneous: you can't access
> > memory that's forbidden by the OS:-)
>
> Ouch .... so much for the "security" of Ada......

I don't see how this follows. One of the goals of Ada is to find more
errors at compile-time, leaving fewer for run-time. It is certainly
possible to write an erroneous program in Ada, but one must do so
explicitly. It's much harder to do by accident.

[...]

--
John Matthews
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/