Jupiter Ace Archive Message Board
« In Jupiter Forth, how do I... »

Welcome Guest. Please Login or Register.
Feb 2, 2012, 2:54am




Jupiter Ace Archive Message Board :: Programming in Forth :: Jupiter Ace Forth Programming :: In Jupiter Forth, how do I...
   [Search This Thread][Reply] [Share Topic] [Print]
 AuthorTopic: In Jupiter Forth, how do I... (Read 857 times)
jace
Ace Forth Novice
**
member is offline





Joined: Mar 2007
Gender: Male
Posts: 69
Location: Seattle WA, USA
 In Jupiter Forth, how do I...
« Thread Started on Apr 23, 2007, 1:59pm »
[Quote]

Thought I would start a thread here.

(I shouldn't have put my REDEFINE question in the programing tips thread. It would be nice if an administrator moved those message, but it's not worth too much effort.)
Link to Post - Back to Top  IP: Logged

FORTH LOVE IF HONK THEN
jace
Ace Forth Novice
**
member is offline





Joined: Mar 2007
Gender: Male
Posts: 69
Location: Seattle WA, USA
 Re: In Jupiter Forth, how do I...
« Reply #1 on Apr 23, 2007, 2:02pm »
[Quote]

How do I load a set of word utility words, use them when I am adding new words to my application, and then forget the set of utility words I loaded? Vocabularies haven't worked very well for me.
Link to Post - Back to Top  IP: Logged

FORTH LOVE IF HONK THEN
Ace User
Administrator
*****
member is offline




[homepage]

Joined: Aug 2006
Posts: 346
Location: Jupiter Ace HQ [ UK ]
 Re: In Jupiter Forth, how do I...
« Reply #2 on Apr 23, 2007, 6:05pm »
[Quote]

I'm not sure want you want to do? let me just think about this...

You have your application, but have some other words in a second dictionary you would like to use with your application. You would only like to use one or two words from your second dictionary but have to load from tape the whole second dictionary and would like to forget some of the words from the second dictionary.

Thats fine and you can do that because the second dictionary is loaded after your first app.


But.. if you load your second dictionary first, then your app and try and forget words in the second dictionary you will loose your app words. What you need is a way to save single Forth words to tape from your second dictionary so you can load them into your app for use.

you can do this with the SAVE and LOAD single word routines from Forth User Vol No 2/3 page 51. Its worth a look!


« Last Edit: Apr 23, 2007, 6:05pm by Ace User »Link to Post - Back to Top  IP: Logged

May the Forth be with you
dulac
Ace Forth User
***
member is offline

[avatar]

EverWalking

[msn]
[homepage]

Joined: Dec 2006
Gender: Male
Posts: 246
Location: Portugal
 Re: In Jupiter Forth, how do I...
« Reply #3 on Apr 23, 2007, 6:56pm »
[Quote]

The Vocabulary control is adequate to the ACE and its memory available...
... But with the external disk it becomes inefficient in comparison to the traditional method of loading screens.

That's why a new Editor is so important.
In the traditional method, when a page is loaded it is interpreted (and compiled if they are definitions) ...

This means that a "load N" at the bottom line allows a link between pages and only the needed pages are loaded. This also means that that complete and easy control is achieved by editing the screens.

Additional info:
This can be used in diskettes, disks, files... as long as each sector is a screen.
It's Universal. Every forth editor works with 512/1024 bytes screens. However some can edit more than that... just by appending LOAD <next> after finding a new free sector.

Why 512Bytes :
An whole screen never uses more than 512 bytes (nobody writes 32 chars per line - specially in Forth) so a sector is MORE than enough: More screens needed... more screens used. Minimum losses. Full control.
« Last Edit: Apr 24, 2007, 1:07am by dulac »Link to Post - Back to Top  IP: Logged

REMINDER : Nicotine is not the problem. Smoking is.
Today, "regular" cigarettes are the previous "light"; and so on...
To look the same, today's composition is Full content instead of Smoked Fraction.
LESS nicotine => Smoke MORE to get the SAME amount of nicotine.
jace
Ace Forth Novice
**
member is offline





Joined: Mar 2007
Gender: Male
Posts: 69
Location: Seattle WA, USA
 Re: In Jupiter Forth, how do I...
« Reply #4 on May 8, 2007, 3:19am »
[Quote]

How do I allocate buffers that remain aligned on a 1K boundary? My only though is to fiddle with RAMTOP but that requires QUIT. This would prevent other ED words from calling the allocator and force the user to call an init function by hand.

I am leery of CMOVEing the return stack as people may have pointers into it. (I would also have to update SP.)

I can write the ED code and account for moving non-aligned buffers but it adds a bit of logic.
Link to Post - Back to Top  IP: Logged

FORTH LOVE IF HONK THEN
jace
Ace Forth Novice
**
member is offline





Joined: Mar 2007
Gender: Male
Posts: 69
Location: Seattle WA, USA
 Re: In Jupiter Forth, how do I...
« Reply #5 on May 14, 2007, 12:49am »
[Quote]

In Jupiter forth, how do I remove a bunch of words in the middle of the dictionary? How do I remove a vocabulary and all it's words?

It took me weeks to figure this out. First be sure all the words you want to remove fall one after another in memory. It is OK if there are some public (i.e. visible in FORTH) words as well as words hidden in vocabularies. For example my editor vocabulary exposes the public symbol ED. There are some restrictions if you have multiple vocabularies. It should be safe to remove all the words of vocabularies along with words from the parent vocabulary (FORTH is the root of the parent-child vocabulary tree.) Other scenarios probably won't work.

In this cook-book the first word retained is KEPT and the first word removed is LOST. LOST must be earlier in the dictionary than KEPT. WARNING: when you remove a range of words from the dictionary, any code which calls one of the removed words will behave in surprising ways.


FORTH DEFINITIONS DECIMAL 16 BASE C!

( Make the first word to be)
( removed be a variable)

0 VARIABLE TEMP
FIND TEMP @ FIND LOST !
FORGET TEMP

( Link the first word to be retained)
( to the first killed)

FIND LOST 1- FIND KEPT 3 - !

( Increase size of the LOST variable)
( to include all of the storage between)
( KEPT and LOST)

( The first byte of KEPT's name)

FIND KEPT DUP 1- c@ 3F AND - 5 -

( LOST's word length field )

FIND LOST 5 -

( Bytes between LOST's word length)
( field and KEPT's name)

-

( EDIT: opps, off by one.)
( byte before KEPT's name)

1-

( increase the size of LOST)

FIND LOST 5 - !

( remove words between KEPT)
( and LOST)

REDEFINE LOST


If there weren't a bug in LOAD you would also have to unlink from the vocabulary chain any vocabularies that will be removed. It is much easier to just SAVE and then LOAD the word set since that will not put the vocabulary in the vocabulary chain.

« Last Edit: May 14, 2007, 2:22pm by jace »Link to Post - Back to Top  IP: Logged

FORTH LOVE IF HONK THEN
Ace User
Administrator
*****
member is offline




[homepage]

Joined: Aug 2006
Posts: 346
Location: Jupiter Ace HQ [ UK ]
 Re: In Jupiter Forth, how do I...
« Reply #6 on May 14, 2007, 8:36am »
[Quote]

bug in LOAD..?

Link to Post - Back to Top  IP: Logged

May the Forth be with you
jace
Ace Forth Novice
**
member is offline





Joined: Mar 2007
Gender: Male
Posts: 69
Location: Seattle WA, USA
 Re: In Jupiter Forth, how do I...
« Reply #7 on May 14, 2007, 2:26pm »
[Quote]

Yes, there is a bug in LOAD. When it loads vocabularies it doesn't update the vocabulary linked list. So if you reset a Jupiter, load a tape with a vocabulary and look at the last vocabulary in the linked list (3c35 @) it point's at FORTH's vocabulary link field, not at the loaded vocabulary's vocabulary link field.

See page 131 of the retail manual.
Link to Post - Back to Top  IP: Logged

FORTH LOVE IF HONK THEN
retronym
Ace Forth Rookie
*
member is offline





Joined: Jun 2007
Gender: Male
Posts: 15
Location: Osnabrueck, Germany
 Re: In Jupiter Forth, how do I...
« Reply #8 on Jun 10, 2007, 5:05pm »
[Quote]

Q: How do I use COMPILER RUNS> with vary bytes in the operand field.
A simple example would be nice (e.g. ." ).

A: Something like this?

: count dup 1+ swap c@ ;

-1 compiler s"
34 word count ( adr n )
dup 1+ , ( store size of operand field )
dup c, ( store length of string )
0 do
dup i + c@ c, ( store chars )
loop
drop
runs>
2+ ( address of length of string )
;

." should be (not tested):

-1 compiler ."
...
runs>
2+ count type

;
« Last Edit: Jun 11, 2007, 9:07am by retronym »Link to Post - Back to Top  IP: Logged
Ace User
Administrator
*****
member is offline




[homepage]

Joined: Aug 2006
Posts: 346
Location: Jupiter Ace HQ [ UK ]
 Re: In Jupiter Forth, how do I...
« Reply #9 on Jun 14, 2007, 12:39pm »
[Quote]

@ retronym , can you give us another example of what the task is you wish to carry out in AceForth? We are not sure what you mean or what the task is you wish to do ;-)
Link to Post - Back to Top  IP: Logged

May the Forth be with you
retronym
Ace Forth Rookie
*
member is offline





Joined: Jun 2007
Gender: Male
Posts: 15
Location: Osnabrueck, Germany
 Re: In Jupiter Forth, how do I...
« Reply #10 on Jun 14, 2007, 8:17pm »
[Quote]

Nothing spectacular: With s" you can store Strings inside a word.

: hw s" hello, world" ;

: greet hw count type ;

greet -> hello, world

Or creating a List of Strings:

0 VARIABLE vChain

: []: CREATE HERE 0 , vChain ! ;

: [], ( a -- )
HERE vChain @ !
HERE vChain !
0 , , ;

: example []: s" abc" [], s" 123" [], STRING s" hello, world" [], ;


The task for me was mainly to learn using COMPILER RUNS> with vary bytes. The User Manual mentions it but gives no example.
Link to Post - Back to Top  IP: Logged
Ace User
Administrator
*****
member is offline




[homepage]

Joined: Aug 2006
Posts: 346
Location: Jupiter Ace HQ [ UK ]
 Re: In Jupiter Forth, how do I...
« Reply #11 on Jun 15, 2007, 7:23am »
[Quote]


Quote:
The User Manual mentions it but gives no example.


hmmm I see what you mean..
Link to Post - Back to Top  IP: Logged

May the Forth be with you
   [Search This Thread][Reply] [Share Topic] [Print]

Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!
Terms of Service | Privacy Policy | Report Abuse | Mobile