Helo Jonathan,

sdas and sdld are actually a fork of Alan Baldwin's ASXXXX assembler (see http://shop-pdp.net/ashtml/asxxxx.htm) with some sdcc related modifications. Only the targets supported by sdcc are included in sdas/sdld but the documentation includes all ASXXXX targets, as you already noticed, All sdcc targets except pics generate assembly code primarily (or exclusively) for sdas / sdld. So the natural choice for sdcc 6502 target wold be the ASXXXX assembler, which already include support for 6502.

About the zero page problem: you can take a look to ASXXXX and see how it works. I suppose that it assumes that the location can be anywhere in the address space, so it always uses non-zeropage instruction.

There is an other component needed when implementing a new sdcc target: the simulator. It is indispensable for testing the generated code and for running regression tests. You can use any open source simulator you can find, but the natural choice is ucsim, used by all sdcc targets expect pics. Unfortunately uscim doesn't support 6502 yet, so this part should be implemented too,

I hope I gave you at least some answers. Probably other sdcc developers will also give some in depth advices, specially those who lately introduced new targets.

Borut

On 15. 03. 2013 23:27, Masur Jonathan wrote:
Hello everyone,

Without much surprise, I am unable to do contribute to SDCC during my 
free time.

My plan is now to attempt to get, with my master project next year 
(2014), a project where I'll do a 6502 and 65C816 port of SDCC, along 
with some hardware simulation of both processors in order to run program 
compiled by them. Hopefully there will be some professor that will 
accept such a project. (as they are typically more into research for 
next generation CPUs than old '80s CPUs...)

For now I'm just taking more advanced CS courses in order to be ready 
for the task, and I'll have to try to study SDCC as much as possible 
before next year.

What is strange is that I see an "AS6500" port in the documentation, but 
nowhere else. This is really strange, as I don't see where this comes from.
There is already dozen of free-ware 6502 and 65C816 assemblers available 
around, but for the sake of consistency, I think it'd be nice to port 
SDAS and SDLD for the 6502 and 65C816, and this should be rather 
straightforward.
(I already wrote some kind of tiny assembler in java once (for a 
completely unrelated project) and it is only about 800 lines, and just 
took me a couple of days to write, all from scratch)

But if someone already did the porting I don't want to re-invent the wheel.

A problem I see for the linker is that it's not possible to know code 
size in advance, unless you know which variables are zero-page in 
advance. Many assemblers resolves this in a dirty way, but the official 
6502 standard mentions clearly that the following syntax :

lda myvariable

could be both a zero-page and non-zeropage instruction. If the assembly 
files are compiled separately and that myvariable is an extern variable, 
it's impossible to know if it's zero-page and that will be a problem for 
the linker.

Sorry for the long post, and thanks in advance for advice,
Jonathan Masur