Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #39501 > unrolled thread
| Started by | "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> |
|---|---|
| First post | 2015-06-01 14:30 +0000 |
| Last post | 2015-06-02 10:36 +0000 |
| Articles | 9 — 6 participants |
Back to article view | Back to comp.lang.forth
FORGET for CamelForth (Z80)? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2015-06-01 14:30 +0000
Re: FORGET for CamelForth (Z80)? Bob <bob@none.com> - 2015-06-01 13:12 -0400
Re: FORGET for CamelForth (Z80)? "Elizabeth D. Rather" <erather@forth.com> - 2015-06-01 13:21 -1000
Re: FORGET for CamelForth (Z80)? "HAA" <someone@microsoft.com> - 2015-06-03 13:20 +1000
Re: FORGET for CamelForth (Z80)? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-06-01 18:43 +0000
Re: FORGET for CamelForth (Z80)? Coos Haak <chforth@hccnet.nl> - 2015-06-01 22:10 +0200
Re: FORGET for CamelForth (Z80)? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2015-06-01 20:43 +0000
Re: FORGET for CamelForth (Z80)? Coos Haak <chforth@hccnet.nl> - 2015-06-01 23:50 +0200
Re: FORGET for CamelForth (Z80)? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2015-06-02 10:36 +0000
| From | "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> |
|---|---|
| Date | 2015-06-01 14:30 +0000 |
| Subject | FORGET for CamelForth (Z80)? |
| Message-ID | <ct38jvF6436U1@mid.individual.net> |
Hello folks, for some old Z80 SBC I managed to adopt camel forth 1.2 for standalone use. Unfortunately camel forth has not FORGET in its dictionary. I'd like to implement it for I find it useful in the develop phase but I have not enought knowledge to do it by myself. If anyone already has a definition for FORGET I would highly appreciate if he could post it. Thanks a lot in advance. -- Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de HTML mails will be forwarded to /dev/null.
[toc] | [next] | [standalone]
| From | Bob <bob@none.com> |
|---|---|
| Date | 2015-06-01 13:12 -0400 |
| Message-ID | <sq0bx.30459$Ik1.8952@fx12.iad> |
| In reply to | #39501 |
On 06/01/2015 10:30 AM, Peter Heitzer wrote:
> Hello folks,
> for some old Z80 SBC I managed to adopt camel forth 1.2 for standalone
> use. Unfortunately camel forth has not FORGET in its dictionary.
> I'd like to implement it for I find it useful in the develop phase
> but I have not enought knowledge to do it by myself. If anyone already
> has a definition for FORGET I would highly appreciate if he could
> post it.
> Thanks a lot in advance.
>
>
FORGET needs to find the newest definition to keep then set
the dictionary search pointer and the pointer to the end of
used memory.
: FORGET [COMPILE] ' ( LOOKUP NAME FROM INPUT STREAM )
DUP NFA DP ! ( DP IS USED BY HERE, THIS FREES UP MEMORY )
LFA @ CURRENT @ ! ; ( LINK TO PRIOR WORD, SET CURRENT )
( VOCABULARY TO START SEARCH THERE )
This is what I used on a Z80 long ago. Today it is politically
incorrect because it depends on knowing what is in the dictionary
and then touching that. NFA takes what tick gives and adjusts to
the name field address. LFA takes what tick gives and adjusts to
the link field address. DP is end of dictionary pointer.
Warning, don't forget stuff that will cause a problem. If you
create another vocabulary and delete some of its words then the
unforgotten vocabulary head points to deleted stuff that will
soon be written over. If you forget an entire vocabulary that
may be OK. If you have a vectoring word that has been pointed
to forgotten code it will soon fail. Failures will happen at
some time in the future, far from the cause, generating
confusion.
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2015-06-01 13:21 -1000 |
| Message-ID | <Y4-dnXR1-MWfdPHInZ2dnUU7-UGdnZ2d@supernews.com> |
| In reply to | #39506 |
On 6/1/15 7:12 AM, Bob wrote: > On 06/01/2015 10:30 AM, Peter Heitzer wrote: >> Hello folks, >> for some old Z80 SBC I managed to adopt camel forth 1.2 for standalone >> use. Unfortunately camel forth has not FORGET in its dictionary. >> I'd like to implement it for I find it useful in the develop phase >> but I have not enought knowledge to do it by myself. If anyone already >> has a definition for FORGET I would highly appreciate if he could >> post it. >> Thanks a lot in advance. >> >> > FORGET needs to find the newest definition to keep then set > the dictionary search pointer and the pointer to the end of > used memory. > > : FORGET [COMPILE] ' ( LOOKUP NAME FROM INPUT STREAM ) > DUP NFA DP ! ( DP IS USED BY HERE, THIS FREES UP MEMORY ) > LFA @ CURRENT @ ! ; ( LINK TO PRIOR WORD, SET CURRENT ) > ( VOCABULARY TO START SEARCH THERE ) > > This is what I used on a Z80 long ago. Today it is politically > incorrect because it depends on knowing what is in the dictionary > and then touching that. NFA takes what tick gives and adjusts to > the name field address. LFA takes what tick gives and adjusts to > the link field address. DP is end of dictionary pointer. I don't see anything "politically incorrect" about having to use implementation knowledge to implement FORGET. This is why it was included in ANS Forth (though marked "Obsolescent"). We standardize words that are useful but would be hard to implement without implementation details. > Warning, don't forget stuff that will cause a problem. If you > create another vocabulary and delete some of its words then the > unforgotten vocabulary head points to deleted stuff that will > soon be written over. If you forget an entire vocabulary that > may be OK. If you have a vectoring word that has been pointed > to forgotten code it will soon fail. Failures will happen at > some time in the future, far from the cause, generating > confusion. This is an important warning! Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | "HAA" <someone@microsoft.com> |
|---|---|
| Date | 2015-06-03 13:20 +1000 |
| Message-ID | <mklroa$kcl$1@speranza.aioe.org> |
| In reply to | #39506 |
Bob wrote: > ... > Warning, don't forget stuff that will cause a problem. If you > create another vocabulary and delete some of its words then the > unforgotten vocabulary head points to deleted stuff that will > soon be written over. Yes. This occurs in Fig-Forth. A fix was published in FD which involved traversing all vocabs. Simple systems like CamelForth & Eforth usually don't need vocabs - unless perhaps you want a resident assembler and names clash. > If you have a vectoring word that has been pointed > to forgotten code it will soon fail. Failures will happen at > some time in the future, far from the cause, generating > confusion. It's why ANS introduced MARKER. FORGET can be likened to a sling-shot whereas MARKER is a cannon.
[toc] | [prev] | [next] | [standalone]
| From | albert@spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2015-06-01 18:43 +0000 |
| Message-ID | <556ca7b6$0$23290$e4fe514c@dreader34.news.xs4all.nl> |
| In reply to | #39501 |
In article <ct38jvF6436U1@mid.individual.net>,
Peter Heitzer <peter.heitzer@rz.uni-regensburg.de> wrote:
>Hello folks,
>for some old Z80 SBC I managed to adopt camel forth 1.2 for standalone
>use. Unfortunately camel forth has not FORGET in its dictionary.
>I'd like to implement it for I find it useful in the develop phase
>but I have not enought knowledge to do it by myself. If anyone already
>has a definition for FORGET I would highly appreciate if he could
>post it.
>Thanks a lot in advance.
I have the source of 6809 camelforth here.
1. LATEST is a user variable. There is just one list, no
vocabularies.
This means that getting something appropriate into LATEST,
cuts the dictionary short.
2. From the code of FIND I see that this must be a NFA address.
The code field address (xt) sits after the name.
So to forget from the word APE you could try:
if NOTE is the word defined after APE
' NOTE
' APE 3 ( length of name) - 1- LATEST !
DP !
You can try storing in LATEST first, then try WORDS.
If that doesn't crash you're halfway through.
Disclaimer :
This may or may not be similar to the Z80 code.
Just experiment a bit, you'll figure it out.
>
>
>--
>Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de
Groetjes Albert
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | Coos Haak <chforth@hccnet.nl> |
|---|---|
| Date | 2015-06-01 22:10 +0200 |
| Message-ID | <bv73617h0gvz.y00tgkoxvnhu$.dlg@40tude.net> |
| In reply to | #39507 |
Op 01 Jun 2015 18:43:02 GMT schreef Albert van der Horst:
> In article <ct38jvF6436U1@mid.individual.net>,
> Peter Heitzer <peter.heitzer@rz.uni-regensburg.de> wrote:
>>Hello folks,
>>for some old Z80 SBC I managed to adopt camel forth 1.2 for standalone
>>use. Unfortunately camel forth has not FORGET in its dictionary.
>>I'd like to implement it for I find it useful in the develop phase
>>but I have not enought knowledge to do it by myself. If anyone already
>>has a definition for FORGET I would highly appreciate if he could
>>post it.
>>Thanks a lot in advance.
>
> I have the source of 6809 camelforth here.
>
> 1. LATEST is a user variable. There is just one list, no
> vocabularies.
> This means that getting something appropriate into LATEST,
> cuts the dictionary short.
>
> 2. From the code of FIND I see that this must be a NFA address.
>
> The code field address (xt) sits after the name.
>
> So to forget from the word APE you could try:
> if NOTE is the word defined after APE
> ' NOTE
> ' APE 3 ( length of name) - 1- LATEST !
> DP !
>
> You can try storing in LATEST first, then try WORDS.
> If that doesn't crash you're halfway through.
>
> Disclaimer :
> This may or may not be similar to the Z80 code.
>
> Just experiment a bit, you'll figure it out.
>
>>
>>
>>--
>>Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de
>
> Groetjes Albert
This works on CamelForth 1802.
: >NAME ( xt -- nfa )
DUP >R
BEGIN DUP COUNT + R@ <> \ Walk back to the count byte
WHILE 1-
REPEAT
R> DROP ;
: FORGET ( "name" -- )
' >NAME 3 - \ this becomes the dictionary pointer
DUP DP !
@ LATEST ! ; \ and contained the link to the previous word
--
Coos
CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html
[toc] | [prev] | [next] | [standalone]
| From | albert@spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2015-06-01 20:43 +0000 |
| Message-ID | <556cc3dc$0$21243$e4fe514c@dreader37.news.xs4all.nl> |
| In reply to | #39508 |
In article <bv73617h0gvz.y00tgkoxvnhu$.dlg@40tude.net>, Coos Haak <chforth@hccnet.nl> wrote: >Op 01 Jun 2015 18:43:02 GMT schreef Albert van der Horst: > >> In article <ct38jvF6436U1@mid.individual.net>, >> Peter Heitzer <peter.heitzer@rz.uni-regensburg.de> wrote: >>>Hello folks, >>>for some old Z80 SBC I managed to adopt camel forth 1.2 for standalone >>>use. Unfortunately camel forth has not FORGET in its dictionary. >>>I'd like to implement it for I find it useful in the develop phase >>>but I have not enought knowledge to do it by myself. If anyone already >>>has a definition for FORGET I would highly appreciate if he could >>>post it. >>>Thanks a lot in advance. >> >> I have the source of 6809 camelforth here. >> >> 1. LATEST is a user variable. There is just one list, no >> vocabularies. >> This means that getting something appropriate into LATEST, >> cuts the dictionary short. >> >> 2. From the code of FIND I see that this must be a NFA address. >> >> The code field address (xt) sits after the name. >> >> So to forget from the word APE you could try: >> if NOTE is the word defined after APE >> ' NOTE >> ' APE 3 ( length of name) - 1- LATEST ! >> DP ! >> >> You can try storing in LATEST first, then try WORDS. >> If that doesn't crash you're halfway through. >> >> Disclaimer : >> This may or may not be similar to the Z80 code. >> >> Just experiment a bit, you'll figure it out. >> >>> >>> >>>-- >>>Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de >> >> Groetjes Albert > >This works on CamelForth 1802. > >: >NAME ( xt -- nfa ) > DUP >R > BEGIN DUP COUNT + R@ <> \ Walk back to the count byte > WHILE 1- > REPEAT > R> DROP ; There may information in the sign bit, so `` COUNT 7F AND '' may be needed. > >: FORGET ( "name" -- ) > ' >NAME 3 - \ this becomes the dictionary pointer > DUP DP ! > @ LATEST ! ; \ and contained the link to the previous word And don't forget, DUMP is your friend! > >-- >Coos Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | Coos Haak <chforth@hccnet.nl> |
|---|---|
| Date | 2015-06-01 23:50 +0200 |
| Message-ID | <q3dfluicqq92.1qdyif2i6ogr3$.dlg@40tude.net> |
| In reply to | #39509 |
Op 01 Jun 2015 20:43:08 GMT schreef Albert van der Horst:
> In article <bv73617h0gvz.y00tgkoxvnhu$.dlg@40tude.net>,
> Coos Haak <chforth@hccnet.nl> wrote:
>>Op 01 Jun 2015 18:43:02 GMT schreef Albert van der Horst:
>>
>>> In article <ct38jvF6436U1@mid.individual.net>,
>>> Peter Heitzer <peter.heitzer@rz.uni-regensburg.de> wrote:
>>>>Hello folks,
>>>>for some old Z80 SBC I managed to adopt camel forth 1.2 for standalone
>>>>use. Unfortunately camel forth has not FORGET in its dictionary.
>>>>I'd like to implement it for I find it useful in the develop phase
>>>>but I have not enought knowledge to do it by myself. If anyone already
>>>>has a definition for FORGET I would highly appreciate if he could
>>>>post it.
>>>>Thanks a lot in advance.
>>>
>>> I have the source of 6809 camelforth here.
>>>
>>> 1. LATEST is a user variable. There is just one list, no
>>> vocabularies.
>>> This means that getting something appropriate into LATEST,
>>> cuts the dictionary short.
>>>
>>> 2. From the code of FIND I see that this must be a NFA address.
>>>
>>> The code field address (xt) sits after the name.
>>>
>>> So to forget from the word APE you could try:
>>> if NOTE is the word defined after APE
>>> ' NOTE
>>> ' APE 3 ( length of name) - 1- LATEST !
>>> DP !
>>>
>>> You can try storing in LATEST first, then try WORDS.
>>> If that doesn't crash you're halfway through.
>>>
>>> Disclaimer :
>>> This may or may not be similar to the Z80 code.
>>>
>>> Just experiment a bit, you'll figure it out.
>>>
>>>>
>>>>
>>>>--
>>>>Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de
>>>
>>> Groetjes Albert
>>
>>This works on CamelForth 1802.
>>
>>: >NAME ( xt -- nfa )
>> DUP >R
>> BEGIN DUP COUNT + R@ <> \ Walk back to the count byte
>> WHILE 1-
>> REPEAT
>> R> DROP ;
>
> There may information in the sign bit, so `` COUNT 7F AND '' may be needed.
>>
>>: FORGET ( "name" -- )
>> ' >NAME 3 - \ this becomes the dictionary pointer
>> DUP DP !
>> @ LATEST ! ; \ and contained the link to the previous word
>
> And don't forget, DUMP is your friend!
>
>>
>>--
>>Coos
>
>
> Groetjes Albert
Don't worry, IMMEDIATE sets the byte just before the name:
: IMMEDIATE 1 LATEST @ 1- C! ;
There is no TRAVERSE like as in Figforth.
Something similar
: MARKER ( "name" -- ) CREATE LATEST @ 3 - ,
DOES> @ DUP DP ! @ LATEST ! ;
This runs on the 1802sim simulater on Cygwin and Rasberry Pi.
Forgeting an essential word like QUIT is trapped by the simulator.
A working system remains.
I don't expect that to be the case on ans SBC tough.
--
Coos
CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html
[toc] | [prev] | [next] | [standalone]
| From | "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> |
|---|---|
| Date | 2015-06-02 10:36 +0000 |
| Message-ID | <ct5f9fFn7i0U1@mid.individual.net> |
| In reply to | #39508 |
Coos Haak <chforth@hccnet.nl> wrote: >This works on CamelForth 1802. >: >NAME ( xt -- nfa ) > DUP >R > BEGIN DUP COUNT + R@ <> \ Walk back to the count byte > WHILE 1- > REPEAT > R> DROP ; >: FORGET ( "name" -- ) > ' >NAME 3 - \ this becomes the dictionary pointer > DUP DP ! > @ LATEST ! ; \ and contained the link to the previous word This also works for the Z80 version, thanks. If anyone wants to have FORGET already in PROM here is the source for ZMASM ;Z >NAME ( xt -- nfa) ; DUP >R ; BEGIN DUP COUNT + R@ <> \ Walk back to the count byte ; WHILE 1- ; REPEAT ; R> DROP ; head TONAME,5,">NAME",docolon DW DUP,TOR $$ DW DUP,COUNT,PLUS,RFETCH,NOTEQUAL,QBRANCH,$F DW ONEMINUS,BRANCH,$B $$ DW RFROM,DROP,EXIT ;Z FORGET ( "name" -- ) ; ' >NAME 3 - \ this becomes the dictionary pointer ; DUP DP ! ; @ LATEST ! ; \ and contained the link to the previous word head FORGET,6,"FORGET",docolon DW TICK,TONAME,LIT,3,MINUS,DUP,DP,STORE,FETCH,LATEST,STORE,EXIT For a more fool prof version one has to check if the word to forget is in RAM. Doing a FORGET for words in ROM makes the system kinda upset. -- Dipl.-Inform(FH) Peter Heitzer, peter.heitzer@rz.uni-regensburg.de HTML mails will be forwarded to /dev/null.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.forth
csiph-web