From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.8 required=3.0 tests=BAYES_00,PLING_QUERY autolearn=no autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!news.szaf.org!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Adapting an Ada compiler to generate 8051 code (Again?! ;-) Date: Wed, 31 Mar 2021 11:23:25 +0300 Organization: Tidorum Ltd Message-ID: References: <41bc7a62-9c70-466d-b316-5fc74a3ee845n@googlegroups.com> <87im58a1up.fsf@nightsong.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net syWYWcnHEEHSQBNwHdRtCwkZSSagJzgqPv4lusy3ggHw1uo0K0 Cancel-Lock: sha1:bgLqahLZVmFGFerxGEf8jlvHTvc= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61697 List-Id: On 2021-03-31 0:28, Luke A. Guest wrote: > On 30/03/2021 20:16, Paul Rubin wrote: > >> Besides the approaches other people have mentioned, I don't know if >> there are any really large obstacles to targeting GCC to the 8051, or to > > The biggest obstacles will be the severe lack of registers. But it's > possible, lm78 for example. The 8051 is not very register-poor: it has a main accumulator and a secondary accumulator and four sets of eight general-purpose registers. The 32 general-purpose registers occupy the first 32 bytes of the internal data memory. A compiler could also use all of the directly addressable 128 bytes of internal data memory as registers, although the instructions that can use those "registers" are a little longer and a little slower. If there is a problem for gcc, it may be that all those registers are only 8 bits wide, and cannot be used to address external data memory (although some of them can be used as 8-bit offsets in paged memory accesses). Only the Data Pointer Register (or registers, in newer variants) is wider and can be used to address external data memory.