From: utzoo!utcsrgv!newman
Newsgroups: net.micro.atari
Title: 6502 compilers
Article-I.D.: utcsrgv.940
Posted: Fri Jan 28 21:15:04 1983
Received: Fri Jan 28 21:40:25 1983


The topic of why the 6502 can't support a compiler seems to
have come up again. The standard reasons given (no 16-bit
registers, 8-bit sp) don't seem convincing to me. The 6502
intentionally traded off on-chip registers for addressing
modes. The Z80 has more registers, but the 6502 has many
more addressing modes; the 6809 has both (oversimplified).
The reason the 6502 has no 16-bit registers is that you
are supposed to use the indexed indirect and indirect
indexed modes to use page zero as a large register bank,
essentially giving you 128 16-bit pointer registers. If
you look at the instruction timings, you can access an
absolute memory location through a two-byte zero-page
pointer (register) with a one-byte offset in as few as
5 cycles. Another benefit of few registers is fast state
saving (interrupt handling has little overhead). The
shortcoming of the dumb 8-bit stack pointer would 
seem to be naturally implemented in software, with a
bit of a loss in speed. Also a useful capability I believe
not provided in the Z80 is the 6502's memory-to-memory
instructions; you can incr/decr, shift or rotate absolute
locations without using the limited registers.

As proof that the 6502 CAN support a compiler, the company
below claims to have a native 6502 C compiler available
(I posted this to the net some time ago - I don't know
any inside details on the compiler, so don't ask me. Also
I am realistic enough to realize that any time-critical
operation on 8-bit processors at low clock rates is best
done in assembler, so I haven't looked into the product).

Optimized Systems Software, Inc.,
10379 Lansdale Ave.,
Cupertino, CA 95014
(408) 446-3099

C/65 - "The first native mode C compiler ever produced
        for Atari and Apple computers."

(This company was the one that developed Atari Basic,
Atari Assembler/Editor, the first Atari DOS, and the
first Apple DOS).

Ken Newman
Univ. of Toronto