<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://bitchin100.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Gluing_Strings_in_Place</id>
	<title>Gluing Strings in Place - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://bitchin100.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Gluing_Strings_in_Place"/>
	<link rel="alternate" type="text/html" href="https://bitchin100.com/wiki/index.php?title=Gluing_Strings_in_Place&amp;action=history"/>
	<updated>2026-04-29T23:42:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://bitchin100.com/wiki/index.php?title=Gluing_Strings_in_Place&amp;diff=922&amp;oldid=prev</id>
		<title>Jhoger at 06:55, 31 January 2009</title>
		<link rel="alternate" type="text/html" href="https://bitchin100.com/wiki/index.php?title=Gluing_Strings_in_Place&amp;diff=922&amp;oldid=prev"/>
		<updated>2009-01-31T06:55:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:55, 30 January 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l62&quot;&gt;Line 62:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 62:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* What else, besides garbage collection, messes with string content pointers?&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* What else, besides garbage collection, messes with string content pointers?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* What else have I neglected to consider?&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* What else have I neglected to consider?&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Model T Developer Reference]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jhoger</name></author>
	</entry>
	<entry>
		<id>https://bitchin100.com/wiki/index.php?title=Gluing_Strings_in_Place&amp;diff=749&amp;oldid=prev</id>
		<title>Jhoger at 07:26, 27 December 2008</title>
		<link rel="alternate" type="text/html" href="https://bitchin100.com/wiki/index.php?title=Gluing_Strings_in_Place&amp;diff=749&amp;oldid=prev"/>
		<updated>2008-12-27T07:26:15Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 00:26, 27 December 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l53&quot;&gt;Line 53:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 53:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;to be called at its VARPTR address pointers:&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;to be called at its VARPTR address pointers:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* You can force garbage collection immediately before computing the CALL address and then, as far as I can tell, be confident of hitting the right spot (though recognizing that this absolute address may have changed since the first time you created your string.)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* You can force garbage collection immediately before computing the CALL address and then, as far as I can tell, be confident of hitting the right spot (though recognizing that this absolute address may have changed since the first time you created your string.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* You can create a string for m/l instructions at the very start of your program.  As long as you do nothing to change the length of this string, its content location should not be affected by garbage&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* You can create a string for m/l instructions at the very start of your program.  As long as you do nothing to change the length of this string, its content location should not be affected by garbage collection.  [Note, in the above program, that the location of A$ did not change.]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;collection.  [Note, in the above program, that the location of A$ did not change.]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* With the preceding in mind, it would appear possible to define not just one, but several, strings-full of m/l instructions at the start of a program.  The strings&amp;#039; contents would be written contiguously at the top range of string storage space, apparently immune to garbage collection, and could thus hold an m/l program of more than 255 bytes.  [Note that careful construction of these strings would be needed -- since the first 255 bytes of your program would go into the &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&amp;#039;&lt;/ins&gt;last&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#039;&amp;#039;&amp;#039; &lt;/ins&gt;string written ... while the program&amp;#039;s final (length mod 255) bytes would go into the first string.]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* With the preceding in mind, it would appear possible to define not just one, but several, strings-full of m/l instructions at the start of a program.  The strings&amp;#039; contents would be written&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;contiguously at the top range of string storage space, apparently immune to garbage collection, and could thus hold an m/l program of more than 255 bytes.  [Note that careful construction of these strings would be needed -- since the first 255 bytes of your program would go into the &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=&lt;/del&gt;last&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;= &lt;/del&gt;string written ... while the program&amp;#039;s final (length mod 255) bytes would go into the first string.]&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Some un-answered questions that may trash all of the conclusions&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Some un-answered questions that may trash all of the conclusions&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jhoger</name></author>
	</entry>
	<entry>
		<id>https://bitchin100.com/wiki/index.php?title=Gluing_Strings_in_Place&amp;diff=748&amp;oldid=prev</id>
		<title>Jhoger: New page: Wilson Van Alst:  Here is a short program that illustrates the effects of garbage collection, and how it can trap the unwary:  &lt;pre&gt; 10 clear 800 20 a$ = string$(255,&quot;a&quot;) 30 b$ = string$(2...</title>
		<link rel="alternate" type="text/html" href="https://bitchin100.com/wiki/index.php?title=Gluing_Strings_in_Place&amp;diff=748&amp;oldid=prev"/>
		<updated>2008-12-27T07:22:18Z</updated>

		<summary type="html">&lt;p&gt;New page: Wilson Van Alst:  Here is a short program that illustrates the effects of garbage collection, and how it can trap the unwary:  &amp;lt;pre&amp;gt; 10 clear 800 20 a$ = string$(255,&amp;quot;a&amp;quot;) 30 b$ = string$(2...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Wilson Van Alst:&lt;br /&gt;
&lt;br /&gt;
Here is a short program that illustrates the effects of garbage&lt;br /&gt;
collection, and how it can trap the unwary:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
10 clear 800&lt;br /&gt;
20 a$ = string$(255,&amp;quot;a&amp;quot;)&lt;br /&gt;
30 b$ = string$(255,&amp;quot;b&amp;quot;)&lt;br /&gt;
40 c$ = string$(255,&amp;quot;c&amp;quot;)&lt;br /&gt;
50 gosub 100&lt;br /&gt;
60 b$ = mid$(b$,10,10)&lt;br /&gt;
70 gosub 100&lt;br /&gt;
80 gosub 100&lt;br /&gt;
90 end&lt;br /&gt;
100 print &amp;quot;a$,b$,c$ content ^:&amp;quot;;&lt;br /&gt;
110 v = varptr(a$) : gosub 200 : print v;&lt;br /&gt;
120 v = varptr(b$) : gosub 200 : print v;&lt;br /&gt;
130 v = varptr(c$) : gosub 200 : print v&lt;br /&gt;
140 print fre(&amp;quot;&amp;quot;);&amp;quot;free string bytes&amp;quot;&lt;br /&gt;
150 return&lt;br /&gt;
200 v = peek(v+1) + 256*peek(v+2) : return&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running the program will show:&lt;br /&gt;
* Original locations for each of the 255 byte strings&lt;br /&gt;
* Addresses after b$ is shortened per Line 60&lt;br /&gt;
* Addresses after &amp;#039;garbage collection.&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;But, wait,&amp;quot; says the unwary voice.  &amp;quot;I see the change made in Line&lt;br /&gt;
60, and that affected the content location for b$.  But nothing&lt;br /&gt;
changed between Lines 70 and 80.  Why do we see changes in both b$ and&lt;br /&gt;
c$ content addresses?&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The key is in Line 140, where the program uses fre(&amp;quot;&amp;quot;).  This, from&lt;br /&gt;
what I can determine, &amp;#039;forces&amp;#039; garbage collection -- at least within&lt;br /&gt;
the space CLEARed for string variables.  So the locations reported in&lt;br /&gt;
Lines 120 and 130 actually changed immediatly when Line 140 ran.&lt;br /&gt;
&lt;br /&gt;
If you want to test this, add Line 105 to the subroutine:&lt;br /&gt;
&lt;br /&gt;
 105 s = fre(&amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
... and now you will &amp;#039;force&amp;#039; garbage collection before computing the&lt;br /&gt;
string content addresses.&lt;br /&gt;
&lt;br /&gt;
Alternatively, don&amp;#039;t use Line 105 and also get rid of Line 140.&lt;br /&gt;
Without the fre(&amp;quot;&amp;quot;) command, no garbage collection is performed, and&lt;br /&gt;
the contents of b$ and c$ stay where they were.&lt;br /&gt;
&lt;br /&gt;
Lessons for those who might want to put machine language in a string&lt;br /&gt;
to be called at its VARPTR address pointers:&lt;br /&gt;
* You can force garbage collection immediately before computing the CALL address and then, as far as I can tell, be confident of hitting the right spot (though recognizing that this absolute address may have changed since the first time you created your string.)&lt;br /&gt;
* You can create a string for m/l instructions at the very start of your program.  As long as you do nothing to change the length of this string, its content location should not be affected by garbage&lt;br /&gt;
collection.  [Note, in the above program, that the location of A$ did not change.]&lt;br /&gt;
* With the preceding in mind, it would appear possible to define not just one, but several, strings-full of m/l instructions at the start of a program.  The strings&amp;#039; contents would be written&lt;br /&gt;
contiguously at the top range of string storage space, apparently immune to garbage collection, and could thus hold an m/l program of more than 255 bytes.  [Note that careful construction of these strings would be needed -- since the first 255 bytes of your program would go into the =last= string written ... while the program&amp;#039;s final (length mod 255) bytes would go into the first string.]&lt;br /&gt;
&lt;br /&gt;
Some un-answered questions that may trash all of the conclusions&lt;br /&gt;
above:&lt;br /&gt;
&lt;br /&gt;
* What else, besides fre(&amp;quot;&amp;quot;), forces garbage collection?&lt;br /&gt;
* What else, besides garbage collection, messes with string content pointers?&lt;br /&gt;
* What else have I neglected to consider?&lt;/div&gt;</summary>
		<author><name>Jhoger</name></author>
	</entry>
</feed>