New here, but not to Forth or the 6502s

Topics relating to various Forth models on the 6502, 65816, and related microprocessors and microcontrollers.
IamRob
Posts: 357
Joined: 26 Apr 2020

Re: New here, but not to Forth or the 6502s

Post by IamRob »

I still see one problem with creating a table then FORGETting it, is the address for that table is still stored somewhere. So if the word that uses the table for a look-up, and the table is no longer there as it got written over by a new word, it will get incorrect data.

I prefer to use the top of available memory for the dictionary and build tables down. The table never needs to be forgotten. And any word that uses the address for the table is still in effect.

I also use this method for temporary strings as well.
User avatar
Dr Jefyll
Posts: 3526
Joined: 11 Dec 2009
Location: Ontario, Canada
Contact:

Re: New here, but not to Forth or the 6502s

Post by Dr Jefyll »

I don't think it's the table that's being forgotten -- it's the word that initializes the table.

Caveat: have not yet had my second cup of coffee this morning :)

-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
JimBoyd
Posts: 931
Joined: 05 May 2017

Re: New here, but not to Forth or the 6502s

Post by JimBoyd »

Correct. Only the word that initializes the table is forgotten. The table, SOMETABLE , is still in the dictionary. Once FILL.TABLE has initialized the table, it is no longer needed.
More words could be defined for a more complex initialization and then forgotten once the table is initialized.
IamRob
Posts: 357
Joined: 26 Apr 2020

Re: New here, but not to Forth or the 6502s

Post by IamRob »

Right!

I misread what was happening.

What you are doing, I do this all the time in assembly. Instead of saving, for example, all the addresses for each screen line of the graphics screen, I use a short routine to create the table and save the addresses.

I keep forgetting one of the perks of Forth is to FORGET the routine once it has done its job and free up that tiny space the routine is taking up.
Post Reply