Skip to main content
shopping_basket Basket 0
Login

FORTHdsPIC gets Embedded and Walks Alone

Bill Marshall
2
Engineer, PhD, lecturer, freelance technical writer, blogger & tweeter interested in robots, AI, planetary explorers and all things electronic. STEM ambassador. Designed, built and programmed my first microcomputer in 1976. Still learning, still building, still coding today.

Comments

June 23, 2014 12:50

"An achievement certainly, but frankly I'd by far rather program in PIC Assembler code than Forth! About time someone finally drove a stake into the heart of that truly awful language! Sorry to sound bitter, but Forth very nearly drove me to a nervous breakdown in the mid 80's!"

Forth always did prevoke extreme reactions! :-) I find that the biggest problem is structuring the source code so that it can be understood by others or even by myself months later. The programmer must keep a mental image of the parameter stack as they work through it and this can be difficult if "colon" defintions of new words are long and rambling with few comments. It also helps to minimize the use of stack-manipulation words such as SWAP, ROT and PICK by arranging the code so that parameters are pushed on the stack in the right order to be popped off, with clever use of Duplicate (DUP) to make a copy of an item to be used again later on in the same definition. Personally I find the 'optimization' process of re-arranging things to make SWAPs and ROTs redundant quite satisfying, as is examining the FORTHdsPIC code itself seeking ways to improve the assembler code. The best bit is defining a new word in Forth, realising it would be useful as a 'core' definition and then re-writing it in assembler for maximum speed. I recently did this for the code that fetches the address in RAM of a particular item in an array. I know I need to get out more and locate a life!

0 Votes

June 23, 2014 10:42

An achievement certainly, but frankly I'd by far rather program in PIC Assembler code than Forth! About time someone finally drove a stake into the heart of that truly awful language! Sorry to sound bitter, but Forth very nearly drove me to a nervous breakdown in the mid 80's!

0 Votes

Related Content

DesignSpark Electrical Logolinkedin