Le 05.09.2012 09:32, Sebastien Lorquet a écrit :
> It depends on the port.
> For your port, you can have both (as for mcs51): functions flagged with
> __reentrant will use the stack convention, the others will use the overlay
Yes, this sounds like the way to go. By default, the function are not
re-entrant and are optimized, but if it's required that they are
re-entrant the user is free to do it.
> To write a new port, I don't think you need an official guide, just look at how
> an existing port is called from the main code and integrated, and start a new
> one in a new subfolder :) If I remember correctly, there's a big port_t
> structure that you have to fill with the proper values and function pointers.
Thank you for pointing me to this.
> Isn't the HC08 be similar enough to 6502?
Apparently it is quite similar, but the HC08 has no Y register, but has
a lot of added instructions the 6502 lacks. I'll really look at the HC08
port as a base for my attempt to port for the 6502.
> Also, as a remark, the 6502 has a derivative, the 65C02; of which
> there also exists variants with "secret" (more or less officially
> supported) instructions.
Exact, the 65C02 has some extra instructions. It is used in the
TurboGraphix-16 / PC-Engine video game console.
There is also the 65C816 which has a 16-bit mode and many extra
instructions, which is used in the Super Nintendo Entertainment System
(SNES) video game console.
It would be great to port SDCC for all variants of the 6502 family,
although I'm not too sure about 65C816 because it's not entirely a 8-bit
CPU, it's more a fake 16-bit CPU. It's data bus is physically 8-bit, but
the registers can be toggled between 8-bit and 16-bit, and the
instructions behave differently depending on the used mode, which can
turn out quite complicated - for example a subroutine call that is
supposed to be done in 16-bit mode can crash the CPU if called in 8-bit
mode and vice-versa. I don't know if this make it "eligible" for a SDCC
At least the 6502 and 65C02 are eligible.
> It might be also interesting to find out whether WDC
> (http://www.westerndesigncenter.com/wdc/ ) would be interested to
> support such a porting in some way...
They already have a C compiler, and like I said, I tried the trial
version and they apparently use an software argument stack with slow
addressing modes like CC65, which I really dislike.
Thanks for the support and regards.