On 03.09.2012 06:24, Masur Jonathan wrote:
> Hello,
> 
> I am an active developer on the Nintendo Entertainment System platform, 
> and currently I write all my programs in assembly language. Because this 
> is long and ask for more work than writing programs in C, I am looking 
> forward for a C compiler which can output optimized 6502 machine code.
> 
> CC65 already exists, however it outputs unoptimised code which is too 
> slow and too big compared to what it could be. On a system with very 
> little ROM and RAM and with a slow CPU, this is not always acceptable.
> Therefore I wanted to explore the possibility to add support for the 
> 6502 to SDCC.
> 
> I don't know exactly where to start. I am unfortunately not experienced 
> in writing compilers, however I am experienced with 6502 assembly and I 
> am also experienced with the C language.

I suggest you have a look at the sdcc source code, in particular
exisiting ports. I would recommend the hc08 port, since that seems to be
an architecture that is mroe similar to the 6502 than others supported
by sdcc.

A port consists of a few main components and some glue code.

1) Assembler
2) Linker
3) Simulator
5) Code generator
6) Peephole optimizer.

For 1 and 2 there probably are exisiting ones that can be used. 3 is
probably best to write based on ucsim, as most sdcc simulators are. 5 is
most of the work. 6 should be postponed until after the port passes
regression tests.
You also need to think about how to do things. The 6502 unfortunately
seems to be a very limited architecture (awkward stack access, small stack).

Philipp

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to