Am 08.12.25 um 18:42 schrieb [email protected]:
Having had a quick look at the architecture, I think SDCC is a good
choice for a compiler targeting it. The instruction set, and adressing
modes look ok, the 16-bit stack pointer and index register will be quite
helpful. It is kind of a typical architecture for an SDCC target - not a
great target for C, but not too bad either.
It's an extremely nice machine for most C code generation as far as 8bit
processors go. It's probably better than pretty much anything except 6809
- certain beats the Z80 flat.
Sorry, the 6801 is okay. But far from "extremely nice […] for C" or
"better than pretty much anything". IMO, the STM8 is far better, and
some of the Z80-derivatives with efficient stackpointer-relative
addressing are also quite good, the HCS08 isn't that bad either (though
its sp-relative adressing mode is less efficeint than zero-page
addressing, which makes it worse than STM8 or those Z80-derivatives
mentioned before).
You do need to do good register tracking on the X register and also
know how to dynamically calculate offsets from the current X register
versus S at any point to make it work well. So for example you end up
doing stuff like
TSX
LDB #8
ABX
PSHX ; push &x
LDD 4,X ; tracking live X so we don't keep reloading with TSX
The main difficulty will likely be the lack of an efficient
stackpointer-relative addressing mode, so stack accesses would have to
use the index register - and there is only one index register, which
also needs to be used for pointer accesses. Thus, you'll probably want
local variables to not be on the stack by default (like for mos6502,
pdk, mcs51, hc08).
Having written two 6801/3 compilers that isn't the case at all. You want
everything on the stack most of the time because indexed is faster and
more compact than extended. […]
Thanks. That experience is certainly helpful for me to get a better idea
of the MC6801.
68HC11 adds Y but it's prefixed and slower so harder to use effectively.
It's really important for stuff like asm memcpy() functions but in C I
ended up using it as the upper half of the 32bit working value mostly as
you can then ADDD n+2,X XGDY ADCB n+1,X ADCA n,X XGDY and so on.
Well, that looks somewaht similar to X and Y on STM8, which I am used to.
HC08 is a totally different beastie and involves some fun managing
whether your working 16bit value upper is in X or H according to what you
are doing.
Yes. And we already have a port for that one.
Philipp
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user