ITC Header question / string question
Page 1 of 1

Author:  barrym95838 [ Wed Apr 02, 2014 1:54 am ]
Post subject:  ITC Header question / string question

Hello, Forthers

I am trying to learn Forth by following the eccentric path of hand-translating an ITC Forth to my new processor design. I have learned tons of fascinating details, but I had a question regarding the Header structure.

If I'm not mistaken, it is customary to have it formed as a macro which includes previous link, attribute flags, name length, name, CFA, in that order, followed immediately by the code field, if applicable. The immediate flag (and one or two other attribute bits) can be squeezed into the upper bits of the name length, making it 'non-standard' in the sense of a standard string. That's where my question comes in. Is there such a thing as a 'standard' format for strings in Forth?

The reason that I'm asking is that my 65m32 doesn't address bytes, only 32-bit words, and I don't want to waste 75% of my available bits on strings by following a byte-oriented format. I would like to use a packed ascii format that holds up to four 7-bit chars per word, sets bit 31 if there are any more chars following, and signals the last word of the packed string by clearing bit 31 for just that last word. I am writing (FIND) right now, and although I realize that I don't have to follow any standard for my own amusement, if would be nice to be able to offer a finished product that doesn't irritate and confuse potential users.

Does anyone have an opinion on this method of encoding strings, and is there any 'prior art' along these lines with which you are familiar? If I use this method for finding names, should I just leave it at that, or should I write some other words to deal with packed strings, or should I modify the existing string words to accept packed formats as well as the 'standard' one-char-per-word. I know that I could just ignore NULs and treat unpacked, loosely packed and tightly packed with the same routine, but that doesn't address the length-byte issue.

Thanks in advance for any comments, suggestions or criticisms.


P.S. It occurs to me that some of you (Garth) like to use 8-bit ascii a bit, and that would make my scheme almost useless, so maybe I should consider keeping the leading length word, but still allow up to four chars in each following word.

Author:  Garth [ Wed Apr 02, 2014 5:25 am ]
Post subject:  Re: ITC Header question / string question

For anyone's benefit: There is discussion on this in the parallel topic at .

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group