Skip to content

Releases: TG9541/stm8ef

v2.2.3: I/O code in board folders, improved vocabulary options, fix off-by-on…

27 Dec 21:41
Compare
Choose a tag to compare

Most of the changes in v2.2.3 are non-functional, but some is nevertheless important:

  • I/O code in board folders:
    This change concentrates most of the board dependent code, i.e. initialization, interrupts, RX!, ?TX and OUT!, into the configuration folders. There is some risk of some future code repetition for very similar boards but this can be addressed as it arises. Future work will add more abstraction code (like BKEYCHAR for keyboard translation).
  • improved vocabulary options
    The vocabulary options were reviewed and aligned with certain use cases: "Forth as a Scripting Language", "Self-hosted µC Development", and "Forth Interpreter Lab". Most users won't have the third use case, but if they need it the words the interpreter consists of can be linked.
  • fix off-by-one in DEPTH and rp!:
    In both DEPTH and rp! were bugs that canceled each other out, but that left the number 0x3FF (1023) on the floor of the stack. This became visible when rp! was re-implemented in in-line assembly to save space.
  • binary size reduction:
    Due to re-write of many routines in assembly, frequent use of short addressing modes, more factoring, and several optimized eForth core words the size of CORE including "Compile to Flash memory" is now below 4KiB (3800 bytes without this option). Further improvements would require abandoning STC in favor of DTC or even ITC.
  • Retab:
    Unfortunately different authors left a mix of different tab witdh in the code. There is a retab-only commit to facilitate comparing code changes.

Vectored I/O, Number modifiers (%, &), Y=TOS, smaller binary size

20 Dec 21:26
Compare
Choose a tag to compare

New Features

The release 2.2.2 brings some important changes:

Vectored I/O

New are the words 'EMIT '?KEY that provide vectors for the words ?KEY and the and EMIT, e.g. for background task, but also for text output through the Forth console.

Here is an example for a custom EMIT word:

stm8eForth v2.2
: funEMIT ( c -- ) DUP 64 72 WITHIN -32 * + TX! ;  ( change A..G to lowercase ) ok
' funEMIT 'EMIT ! ok 
words
 funeMIT ReSeT RaM NVM adc` adc! OUT! LOcK ULOcK 2c` 2c! bSR WORdS .S dUMP VaRIabLe dOeS> cReaTe IMMedIaTe : 
caLL, ] ; ." abORT" afT RePeaT WHILe eLSe THeN If agaIN UNTIL begIN +LOOP LOOP dO NeXT fOR LITeRaL c, , aLLOT 
' [ \ ( .( ? . U. TYPe U.R .R cR SPaceS SPace NUf? KeY decIMaL HeX eRaSe fILL cMOVe HeRe 2` 2! +! PIcK 0= abS
 NegaTe NOT 2/ 1- 1+ 2* 2- 2+ */ */MOd M* * UM* / MOd /MOd M/MOd UM/MOd WITHIN MIN MaX < U< = dNegaTe 2dUP RO
T ?dUP fILe HaNd bg TIM -1 1 0 bL OUT '?KeY 'eMIT baSe UM+ - 0< OR aNd XOR + OVeR SWaP dUP >R R` 2dROP dROP I
 R> c! c` ! ` eXecUTe LeaVe TX! eMIT ?RX ?KeY hi 'bOOT cOLd ok

The word '?KEY works similar for ?KEY. Using these words it's even possible to redirect the console to any "device driver"!

Improved NUMBER string conversion

New modifiers that work like $:

  • % for base 2 and
  • & for base 10.

The number strings %-111 and -%111 both result in -7.

Here is an example for valid number strings:

DECIMAL ok
$10 $-10 -$20 20 -20 %1111 -%1111 .S
 16 -16 -32 20 -20 15 -15 <sp  ok
HEX &16 . 10 ok

Significant binary size reduction and coding improvements

  • Code size Refactoring of most core words to Y=TOS, which means that assembly and STC code can be mixed more easily
  • Rewrite of many routines in assembly, new coding method for ( n -- n ) primitives with DOXCODE
  • CORE binary size is below 4 KiB
  • MINDEV binary size is below 5 KiB
  • the size of a binary with a fully linked vocabulary is below 5.5 KiB

2.2.2 dev. snapshot: EMIT vector, more general Y=TOS

18 Dec 18:56
Compare
Choose a tag to compare

The 2.2.2 snapshot provides some important changes:

  • vector for an EMIT word, e.g. for background task, but also for text output via a general Forth word
  • Refactoring of most core words to Y=TOS, which means that assembly and STC code can be mixed more easily
  • Improved NUMBER string conversion: new modifiers % for base 2 and & for base 10. The number strings %-111 and -%111 both result in -7.

Here is an example for valid number strings:

DECIMAL
$10 $-10 -$20 20 -20 %1111 -%1111 .S
 16 -16 -32 20 -20 15 -15 <sp  ok
HEX &16 . 10 ok

Since NUMBER was re-implemented in a mix of STC and assembly the binary size of this snapshot is significantly smaller even if there are more features.

v2.2.1: DO .. LOOP extension

11 Dec 11:06
Compare
Choose a tag to compare

STM8EF v2.2.1 adds DO ( n n --), LEAVE ( -- ), LOOP ( -- ), and +LOOP ( +n -- )
The new words should work like specified in ANS Forth.

Example:
: test DO R@ DUP . 3 = IF LEAVE THEN 2 +LOOP ; ok
10 -9 test -9 -7 -5 -3 -1 1 3 ok
10 2 test 2 4 6 8 ok

2.2.1 development snapshot

07 Dec 20:11
Compare
Choose a tag to compare
Pre-release

Latest development snapshot. Initial tests with Y=TOS and CPU flags

v2.2.0

07 Dec 20:03
Compare
Choose a tag to compare
  • rather aggressive code size reduction (less than 5000 bytes for a full development version),
  • improved vocabulary options,
  • case-insensitive vocabulary,
  • and native BRANCH and EXIT.