Re: Newbie in Forth needs help...
- From: "Maki" <XYZveselic@xxxxxxxx>
- Date: Fri, 3 Mar 2006 16:46:52 +0100
"Stephen Pelc" <stephenXXX@xxxxxxxxxxxx> wrote in message
news:44084748.778879812@xxxxxxxxxxxxxxxxxxx
On Fri, 3 Mar 2006 13:07:41 +0100, "Maki" <XYZveselic@xxxxxxxx> wrote:main
vocabulary target \ Create vocabulary
forth definitions \ All the word for a cross assembly goes to
dict.
...
words for cross assembly ( if, then, while, )
...
target definitions \ Now begin assembly and gradually build an
image
.... \ assembly
L: test \ But how to prevent to create constant in
current dictionary which is target?
You have two choices:
Choice 1
========
only forth definitions
vocabulary *target
also *target definitions \ will search *TARGET before FORTH
l: test \ searches FORTH to find L:
\ TEST is in *TARGET
Choice 2
========
: L: \ -- ; L: <name>
also *target definitions
here(t) constant
previous definitions
;
This creates TEST in *TARGET regardless of the defined search
order. If you use an ANS Forth host, you will have more control
than using a Forth-83 host.
If you want to generate a Forth cross compiler as well, read
Brad Rodriguez series of articles on "Moving Forth". If you
are doing this for work rather than entertainment, buy a
commercial compiler with source code from MPE or Forth Inc.
We've been doing this stuff for a long time, the chassis is
rock solid, and you'll get all the tools you need. Forth
cross compilers are conceptually easy, but are very difficult
to implement well - the devil's in the detail and there's
a lot of detail. Yes, I'm biased. We sell cross-compilers
but even at very low wage rates, the cost of a commercial
compiler is very low compared to that of the time it will
take to write a good tool from scratch.
Stephen
--
Stephen Pelc, stephenXXX@xxxxxxxxxxxx
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads
Ok I'm not sure I understand yet...
vocabulary *target
only forth definitions \ Compiling to Forth dictionary
.... \ words for assembly
: L:
also *target definitions \ include *target dictionary first in search
order
here \ dictionary pointer of *target
previous definitions \ return previous search order
constant \ build constant in forth dictionary
;
also *target definitions \
\ Later in the code if I use L:
L: test \ will compile constant in forth dictionary
\ with value of here from *target dictionary
test call, \ returns address of test to assemble call,
As I understoded the constant is compiled in the dictionary where L: is
found? That's why I have to switch back to *target to be able do take "here"
of *target in order to assign that value to a constant which is then after
restoring search order compiled in the forth dict.
I'm a student and can't afford to buy any commercial tools :( so I have to
make them myself :o))
I have built a simple 16-bit Forth processor in FPGA.. But I'm sick and
tired of coding hex values so I decided to build an assembler. With
assembler
at hand I can make bootloader and after that ( which is far away... ) I'm
planning to port eForth for my processor so I can enjoy in a powerful
programming environment !
Thanks,
Best regards,
M.Veselic
.
- Follow-Ups:
- Re: Newbie in Forth needs help...
- From: Maki
- Re: Newbie in Forth needs help...
- References:
- Newbie in Forth needs help...
- From: Maki
- Re: Newbie in Forth needs help...
- From: Stephen Pelc
- Re: Newbie in Forth needs help...
- From: Maki
- Re: Newbie in Forth needs help...
- From: Stephen Pelc
- Newbie in Forth needs help...
- Prev by Date: Re: Newbie in Forth needs help...
- Next by Date: Re: it's a joke ?
- Previous by thread: Re: Newbie in Forth needs help...
- Next by thread: Re: Newbie in Forth needs help...
- Index(es):
Relevant Pages
|
Loading