larsbrinkhoff / xForth

Experimental Forth cross compiler for tiny devices
GNU General Public License v3.0
61 stars 14 forks source link

STM8 #5

Closed larsbrinkhoff closed 7 years ago

larsbrinkhoff commented 7 years ago

Work in progress.

larsbrinkhoff commented 7 years ago

@TG9541 I was considering to use X or Y as a TOS register, but I see your stm8ef doesn't. Did you decide against that?

TG9541 commented 7 years ago

Dr. C.H. Ting decided not to do that - I was a total Forth beginner when I started working on the code. There are indications that the basis for STM8EF was WHYP for the HC11 which has a similar register set. However, I took some effort to use Y or A as TOS for mixing Forth code with assembly. You'll find that STM8 16 bit operations and addressing modes leave a lot to wish for. In order to take advantage of these it'a sometimes necessary to make values do a little dance between X, Y, and temporary storage. STM8EF is, however, heavily size optimized, and fully reentrant (unlike the original code). Speed optimized code would require different coding techniques .

EDIT: 6812ef is the eForth Dr.Ting used as a starting point for the original STM8EF.

larsbrinkhoff commented 7 years ago

I'll add your uCsim link here for reference:
https://github.com/TG9541/stm8ef/wiki/STM8S-Programming#sdcc-the-simulator-ucsim

larsbrinkhoff commented 7 years ago

You'll find that STM8 16 bit operations and addressing modes leave a lot to wish for.

Yes, I see that now. It seems that any optimization I attempt is just out of reach due to missing adressing modes, registers, or instructions.

larsbrinkhoff commented 7 years ago

The STM8 port now successfully passes the test in uCsim.