Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #39515

Re: FORGET for CamelForth (Z80)?

From "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de>
Newsgroups comp.lang.forth
Subject Re: FORGET for CamelForth (Z80)?
Date 2015-06-02 10:36 +0000
Message-ID <ct5f9fFn7i0U1@mid.individual.net> (permalink)
References <ct38jvF6436U1@mid.individual.net> <556ca7b6$0$23290$e4fe514c@dreader34.news.xs4all.nl> <bv73617h0gvz.y00tgkoxvnhu$.dlg@40tude.net>

Show all headers | View raw


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.

Back to comp.lang.forth | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

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

csiph-web