View unanswered posts | View active topics It is currently Sat Jun 06, 2020 1:03 am

Reply to topic  [ 2 posts ] 
 ITC Header question / string question 
Author Message

Joined: Tue Dec 31, 2013 2:01 am
Posts: 109
Location: Sacramento, CA, United States
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.

Wed Apr 02, 2014 1:54 am

Joined: Tue Dec 11, 2012 8:03 am
Posts: 280
Location: California
For anyone's benefit: There is discussion on this in the parallel topic at .

_________________ lots of 6502 resources

Wed Apr 02, 2014 5:25 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software