Improvements and Maintenance
New features
ADC support for STM8L devices
In #227 and #229 @Eelkhoorn provided ADC!
and ADC@
for STM8L devices (e.g. STM8L051)
New bit addressing words
The following new words make efficiernt bit manipulation/testing easier, assembly programming often unnecessary:
[ address bit# ]B?
read bit from memory to flag on stack (contributed by Manfred Mahlow)[ address bit# ]BC
copy C flag to memory bit[ address bit# ]CB
copy bit from memory address to C flag
The bit-banging DS1302 RTC code in stm8ef/XH-M194/board.fs is an example for mixing machine code with Forth for fast and compact code.
New assembly interface words
Since STM8 eForth compiles to machine code, injecting assembly instructions into Forth code is very easy. Since many Forth words keep the value of the last Top of the Stack (TOS) in either the STM8 register Y (16 bit) or A (8 bit) accessing these registers in assembly is often a shortcut to interfacing Forth from assembly.
The following interface words can be added with #require
:
word | action |
---|---|
>A |
pull 8bit value from stack to register A |
A@ |
read word from zero-page RAM address in A and push to stack |
A> |
push 8bit value in register A to stack |
>Y |
pull 16bit value from stack to register Y |
Y@ |
read word from address in Y and push to stack |
Y> |
push 16bit value in register Y to stack |
More kernel constants exposed
Issue #243 improved the export of target dependent kernel constants, and introduced some new ones that are all available in the target
folder:
$0064 CONSTANT BASE \ "BASE" radix base for numeric I/O
$0040 CONSTANT BGADDR \ address of background routine (0: off)
$0350 CONSTANT BSPP \ "BSPP" Background data stack, growing down
$007E CONSTANT BUFFER \ "BUFFER" address, defaults to TIBB
$0076 CONSTANT CONTEXT \ "CONTEXT" start vocabulary search
$006A CONSTANT CP \ "CP" point to top of dictionary
$0070 CONSTANT CTOP \ "CTOP" point to the start of RAM dictionary
$0060 CONSTANT 'EMIT \ "'EMIT" execution vector of EMIT
$0078 CONSTANT 'EVAL \ "'EVAL" execution vector of EVAL
$0044 CONSTANT HLD \ "HLD" hold a pointer of output string
$0066 CONSTANT 'IDLE \ "'IDLE" idle routine in KEY (default: RET)
$007C CONSTANT >IN \ ">IN" hold parsing pointer
$0330 CONSTANT ISPP \ "ISPP" Interrupt data stack, growing down
$0062 CONSTANT '?KEY \ "'?KEY" execution vector of QKEY
$006C CONSTANT LAST \ "LAST" currently last name in dictionary
$3E80 CONSTANT OSCFREQ \ "OSCFREQ" oscillator frequency in kHz
$0068 CONSTANT 'PROMPT \ "'PROMPT" point to prompt word (default .OK)
$03FF CONSTANT RPP \ "RPP" return stack, growing down
$0320 CONSTANT SPP \ "SPP" data stack, growing down (with SPP-1 first)
$0350 CONSTANT TIB \ "TIB" Term. Input Buf. TIBLENGTH between SPPLOC and RPP
$007A CONSTANT #TIB \ "#TIB" count in terminal input buffer
$0042 CONSTANT TICKCNT \ 16 bit ticker (counts up)
$0060 CONSTANT UPP \ "UPP" offset user area
$0072 CONSTANT VAR \ "VAR" point to next free USR RAM location
$0046 CONSTANT YTEMP \ extra working register for core words
Hints:
- these internal variables and constants can be accessed with
#require
when using e4thcom or codeload.py - variable addresses in the range 0x0040 .. 0x005F, stack location etc. depend on the target
- variable addresses in the range 0x0060 .. 0x007F are target independent and change rarely
Tool improvements and bug-fixes
Continuous integration environment updated
The Docker driven CI environment now uses SDCC 3.8.6 including an improved version of uCsim (see #235 ).
Alias export improvements
- #237 improved
genalias.awk
: there won't be aliases for headers that contain aNOALIAS
tag (exposing code likedodoes
only clutters thetarget/
folder).
More make
targets
make
can now fetch the STM8 target device name from <BOARD>/target.inc
. New device dependent targets are defaults
, readflash
, readeeprom
, and readopt
.
Please note that the for some devices (e.g. STM8S207, STM8L) the opt defaults file in the /tools
folder is still missing.
AWK issues fixed
- @zcsahok provided a fix (43dcd7f) for binary
and()
in recent versions ofgawk
- #197 fixes use POSIX awk, don't rely on linux script processor path
Changes to simload.sh
-
Merge pull request #252 from bademux/tool_dump2ihx_script (this replaces the AWK script with a much nicer python script)
-
fixes #235 sstm8 dump format update: simload.sh fix for DOCKER-SDCC:V3.8.4 (2nd take)
Documentation improvements
VOC
Examples added
With #130 Manfred Mahlow's VOC
example for I2C was added. VOC
and word list extensions were added in #241, and they have finally found their way into the Wiki.
More example code
Besides lots of Wiki edits and new pages, #233 brings some docs improvements in the source repository (e.g.
info for the STM8S001J3, example code in lib/
words improved).