PDA

View Full Version : Undocumented(?) FLERASE word


mmbutler
04-21-06, 11:23 PM
As I mentioned in my earlier thread, I'm using the NMIN-12A256B. I don't have the board at hand right now, but I believe it's running Max-FORTH v5.1.

The last time I checked, New Micros had an online document that was supposed to list all the words in v5.0, and described their function. Several flash-related words are mentioned, but I'm not finding FLERASE in my (several) plain text copies of that document. I used to have a URL for an HTML version of this doc that NMI had posted, but I can't locate it now. Note that v5.1 might be, stricly speaking, not documented at this level, depending on what has changed from v5.0. I can't tell.

The only mention of FLERASE I've seen is in the very last paragraph of the NMIN-12A256B PDF file (bottom of page 17). It's mentioned there in passing -- no details.

I've used NMI's website search for any mention of FLERASE in the forums. I only find one ARM-related post that doesn't mean much to me.

So, some questions:

1) On the NMIN-12A256B running the most recent version of Max-FORTH, what does FLERASE do? Does it erase part, or all, of the flash page pointed to by PPAGE (the register at HEX 00C0)?

2) If so, does it erase that flash page in increments of 512-byte flash memory boundaries? If not, is there a word you folks have written that does that? I would assume so, since FL!, FLC! and FLWORD would probably not work properly if you didn't have such code.

3) How is FLERASE called, and what, if anything, does it return?

4) Does FLERASE ever return any exceptions? If so, what?

Thanks.

mmbutler
04-22-06, 07:14 PM
OK, I looked everywhere I could think of, and finally found one place where FLERASE appears in some sort of useful context: at the top of the New Micros-supplied utility file SCRUB.F.

Am I wrong to think the FLERASE word ought to be included in a New Micros-published glossary? ( 1/2 :) )

If SCRUB.F works as it probably should, it appears that the normal stack effect diagram for FLERASE is ( addr --).

It also appears that as long as addr is a 2-byte-aligned value in the range of the address space for the "windowed" Flash, one call to FLERASE will erase the entire 512-byte Flash "sector" in which addr lies.

And (since this is controlled by standard Moto/Freesclae hardware), the byte contents of address 0030 will control what page of the actual Flash memory space is windowed.

I don't know if FLERASE throws any exceptions. Someday I might try to find out. Not meaning to be snarky here, but I don't want to risk harming the board for the sake of exploring this question without documentation.

On to other questions...