Hello,

On 06/10/2013 10:01 AM, Wojciech Zabołotny wrote:
> Hi,
> 
> If I want to extend the standard dictionary with some words defined by me, is 
> it possible to compile them on PC so, that when ATmega is programmed, my 
> words are already available?
> I simply want to avoid relatively lengthy process of adding the new 
> definitions after programming (and minimize the EEPROM usage, as it is 
> rewritten, whenever new word is defined ;-) )
> I know, that I can do it defining the new words in assembler, but the syntax 
> is not very easy to read and write...
> is there any better solution?
> 

There is a little gforth tool at
http://www.forth-ev.de/repos/g4/

if you feed amforth source code to it, it will
produce the equivalent .asm code in the same
style as most of the words/*.asm file look.

"value" is not supported at the moment, maybe more.
But it should be possible to fix g4.fs accordingly.


Another option to "reprogram the controller to a known state" is
this:
. put amforth onto the controller
. add whatever words you want
. read the flash/eeprom state back to your PC
use these files to reprogramm. See makefile for appropriate
targets.


Cheers,
Erich


ew@metis:~/Forth 2 > gforth g4.fs

; g4 macro definitions: <0>
; g4 version #31
; some alias <0>
; label ; headers <0>
; compiling words <0>
user:<4> 0 -149508408 -149508392 0
user:<4> 0 -149508408 -149508392 0
; some state smart words
; g4 macro compiler
; control structures <0>
; exceptions utils <0>
; Simple words <0>
; _: to           _cr _."     .dw XT_TO "              _; does not
work this way
; added more words
; finis
; Items on stack: <0> mk 10. 6.2013 11:44:25

Gforth 0.6.2-20060527, Copyright (C) 1995-2006 Free Software
Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
variable N
; defining a variable:
VE_N:
    .dw $FF01
    .db "N",0
    .dw VE_HEAD
    .set VE_HEAD = VE_N
XT_N:
    .dw PFA_DOVARIABLE
PFA_N:
    .dw heap
    .set heap = heap + CELLSIZE
 ok
: N+ ( -- ) 1 N +!
VE_N+:
    .dw $FF02
    .db "N+"
    .dw VE_HEAD
    .set VE_HEAD = VE_N+
XT_N+:
    .dw DO_COLON
PFA_N+:        ; ( -- )
    .dw XT_DOLITERAL
    .dw $1
    .dw XT_N
    .dw XT_PLUSSTORE
_] bye


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to