embedded systems developers tools, cross compilers
  Home  |   SwiftX Archive  |   SwiftForth Archive  |

Re: Memory Section Types and Defining Words

From: Elizabeth D. Rather <erather_at_forth.com>
Date: Tue, 21 Jan 2003 15:39:20 -0800

How to reply: Use your email client's "Reply All" function to reply to the
entire list (preferred). Use "Reply" for a private reply to the sender.
--------------------------------------------------------------------------

At 02:42 PM 1/21/03 -0700, Thomas Talkington wrote:

>Hello all,
>
>I am a little confused about the use of current memory sections and defining
>words and thought I would throw it out for discussion.
>
>The SwiftX manual states that IDATA is the normal default section type.
>With IDATA selected, any defining words that you create (along with some
>bundled ones) put the body of the definitions in IDATA. For instance
>TERMINAL and BACKGROUND put the body in IDATA, so the pointers to STATUS and
>SO are wasting 4 bytes of RAM. It seems odd to declare CDATA every time you
>use TERMINAL or BACKGROUND.

It's convenient as is... Are you really that short on RAM?

>As an example if you define CONSTANT as
>
>: CONSTANT CREATE , DOES> @ ;
>
>and then use it with IDATA as the current section it makes a CONSTANT in
>RAM!?

Yes (although the system CONSTANT actually generates an in-line literal
on most targets).

>VARIABLE, CVARIABLE and BUFFER: always place the body in UDATA but I can't
>find any source to study so I am not sure how it is done. I have created
>defining words which change the current memory sections but it sure gets
>messy and I am not sure how to restore them to what was previously set.

They're available in SwiftX Pro. Actually, VARIABLE and CVARIABLE are
switch-selectable: you could say IDATA VARIABLES or UDATA VARIABLES
to control where they go. UDATA is the default.

The whole point of specifying a "default" is to simplify restoring from a
non-default condition, just say IDATA (unless you want to change the
default). SAVE-SECTIONS and RESTORE-SECTIONS are available,
they save & restore the whole secton context.

>Don't know if any of you have looked at J.V. Noble's Finite State Machine
>http://www.jfar.org/article001.html but here is how I had to implement it in
>Swift X. Is this the proper way?

I haven't tried it, but I don't think it's necessary to use CDATA at all,
and it does complicate the definitions. xt's as data can certainly go
in IDATA, and it's possible to change your table then.

Cheers,
Elizabeth

>INTERPRETER
>
>: FSM: ( width, initial state --- )
> CDATA CREATE
> IDATA HERE SWAP , ,C ,C ;
>
>: || ' ,C ' ,C ; \ add to xt's to data field
>
>: ;FSM DOES> ( col# adr -- )
> DUP >R 2@ C@ * + ( -- col#+width*state )
> 2* 2 + CELLS ( -- relative offset )
> R@ + ( -- adr[action] )
> DUP >R ( -- adr[action] )
> @EXECUTE ( ? )
> R> CELL+ ( -- ? offset-to-update)
> @EXECUTE ( -- ? state')
> R> @ C! ; ( ? ) \ update state
>
>TARGET
>
>
>so...
>
>What is everyone else doing in these situations?
>
>
>Thomas Talkington
>Travel Asset Group Ltd
>480-491-2096 (office)
>480-236-2992 (cell)
>
>----------------------------------------------------------------------
>swiftx_at_forth.com The SwiftX programming discussion email list
>To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
>For help with listar commands, send subject "help" to listar_at_forth.com
>Archives are located at http://www.forth.com/swiftx -- check them out!
>----------------------------------------------------------------------
>THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.

==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310-491-3356
5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454
Hawthorne, CA 90250
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Tue Jan 21 2003 - 15:35:21 PST

This archive was generated by hypermail 2.2.0 : Mon Dec 01 2008 - 03:04:47 PST