<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.intellivision.us/index.php?action=history&amp;feed=atom&amp;title=Initmem.asm_and_initmem.mac</id>
		<title>Initmem.asm and initmem.mac - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.intellivision.us/index.php?action=history&amp;feed=atom&amp;title=Initmem.asm_and_initmem.mac"/>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;action=history"/>
		<updated>2026-06-29T21:23:33Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=14815&amp;oldid=prev</id>
		<title>Mr z: Protected &quot;Initmem.asm and initmem.mac&quot; ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=14815&amp;oldid=prev"/>
				<updated>2010-12-04T08:37:53Z</updated>
		
		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/index.php/Initmem.asm_and_initmem.mac&quot; title=&quot;Initmem.asm and initmem.mac&quot;&gt;Initmem.asm and initmem.mac&lt;/a&gt;&amp;quot; ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 08:37, 4 December 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2975&amp;oldid=prev</id>
		<title>Mr z: /* Notes */</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2975&amp;oldid=prev"/>
				<updated>2008-09-07T05:28:15Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Notes&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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 style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:28, 7 September 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-l104&quot; &gt;Line 104:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 104:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;All initialized variables must reside in memory between $000 and $3FF.&amp;#160; This covers the [[Scratchpad RAM]], [[System RAM]] (including [[BACKTAB]]), the [[STIC]] registers and both [[PSG]]s.&amp;#160; It does not cover the [[Graphics RAM]], nor does it cover the RAM in the [[Entertainment Computer System|ECS]] unit.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;All initialized variables must reside in memory between $000 and $3FF.&amp;#160; This covers the [[Scratchpad RAM]], [[System RAM]] (including [[BACKTAB]]), the [[STIC]] registers and both [[PSG]]s.&amp;#160; It does not cover the [[Graphics RAM]], nor does it cover the RAM in the [[Entertainment Computer System|ECS]] unit&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, or any additional RAM a game cartridge might provide&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2974&amp;oldid=prev</id>
		<title>Mr z: /* Notes */</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2974&amp;oldid=prev"/>
				<updated>2008-09-07T05:24:56Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Notes&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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 style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:24, 7 September 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-l104&quot; &gt;Line 104:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 104:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;All initialized variables must reside in memory between $&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;0F0 &lt;/del&gt;and $&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;35F&lt;/del&gt;.&amp;#160; This covers the [[Scratchpad RAM]], [[System RAM]] (including [[BACKTAB]]), and both [[PSG]]s.&amp;#160; It does not cover the [[Graphics RAM]], nor does it cover the RAM in the [[Entertainment Computer System|ECS]] unit.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;All initialized variables must reside in memory between $&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;000 &lt;/ins&gt;and $&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;3FF&lt;/ins&gt;.&amp;#160; This covers the [[Scratchpad RAM]], [[System RAM]] (including [[BACKTAB]]), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the [[STIC]] registers &lt;/ins&gt;and both [[PSG]]s.&amp;#160; It does not cover the [[Graphics RAM]], nor does it cover the RAM in the [[Entertainment Computer System|ECS]] unit.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2973&amp;oldid=prev</id>
		<title>Mr z: /* Notes */</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2973&amp;oldid=prev"/>
				<updated>2008-09-07T05:20:07Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Notes&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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 style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:20, 7 September 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-l104&quot; &gt;Line 104:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 104:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;All initialized variables must reside in memory between $0F0 and $35F.&amp;#160; This covers the [[Scratchpad RAM]], [[System RAM]] (including [[BACKTAB]]), both [[PSG]]s.&amp;#160; It does not cover the [[Graphics RAM]], nor does it cover the RAM in the [[Entertainment Computer System|ECS]] unit.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;All initialized variables must reside in memory between $0F0 and $35F.&amp;#160; This covers the [[Scratchpad RAM]], [[System RAM]] (including [[BACKTAB]]), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;both [[PSG]]s.&amp;#160; It does not cover the [[Graphics RAM]], nor does it cover the RAM in the [[Entertainment Computer System|ECS]] unit.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2972&amp;oldid=prev</id>
		<title>Mr z: /* Notes */</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2972&amp;oldid=prev"/>
				<updated>2008-09-07T05:19:50Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Notes&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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 style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:19, 7 September 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-l103&quot; &gt;Line 103:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Include initmem.mac near the top of your program.&amp;#160; Include initmem.asm where convenient.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;All initialized variables must reside in memory between $0F0 and $35F.&amp;#160; This covers the [[Scratchpad RAM]], [[System RAM]] (including [[BACKTAB]]), both [[PSG]]s.&amp;#160; It does not cover the [[Graphics RAM]], nor does it cover the RAM in the [[Entertainment Computer System|ECS]] unit.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2971&amp;oldid=prev</id>
		<title>Mr z: /* Using INITMEM.2 to initialize some game variables */</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2971&amp;oldid=prev"/>
				<updated>2008-09-07T05:08:40Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Using INITMEM.2 to initialize some game variables&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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 style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 05:08, 7 September 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-l89&quot; &gt;Line 89:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 89:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DIFF&amp;#160; &amp;#160; DECLE&amp;#160; EASY, MEDIUM, HARD&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;DIFF&amp;#160; &amp;#160; DECLE&amp;#160; EASY, MEDIUM, HARD&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; ;... and &lt;/del&gt;then elsewhere ...&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;And &lt;/ins&gt;then elsewhere ...&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;pre&amp;gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; ; R1 = 0 for easy, 1 for medium, 2 for hard&amp;#160;  &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; ; R1 = 0 for easy, 1 for medium, 2 for hard&amp;#160;  &amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; ADDI&amp;#160;  #DIFF,&amp;#160; R1&amp;#160; &amp;#160; ; index into table to pick which initializer to use&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; ADDI&amp;#160;  #DIFF,&amp;#160; R1&amp;#160; &amp;#160; ; index into table to pick which initializer to use&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2970&amp;oldid=prev</id>
		<title>Mr z at 05:07, 7 September 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Initmem.asm_and_initmem.mac&amp;diff=2970&amp;oldid=prev"/>
				<updated>2008-09-07T05:07:35Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Programming]] [[Category:Library]]&lt;br /&gt;
&lt;br /&gt;
These are two files that work together to provide a convenient way of initializing several variables at once.  This is useful, for example, when starting a game, or when switching between phases of a game.  &amp;lt;TT&amp;gt;initmem.mac&amp;lt;/TT&amp;gt; provides the macros that do all the work of recording initializers and encoding them.  &amp;lt;TT&amp;gt;initmem.asm&amp;lt;/TT&amp;gt; provides the actual function that unpacks the initialization data when the time comes.&lt;br /&gt;
&lt;br /&gt;
= Functions Provided =&lt;br /&gt;
&lt;br /&gt;
== initmem.mac ==&lt;br /&gt;
&amp;lt;CENTER&amp;gt;&amp;lt;TABLE BORDER&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TH&amp;gt;Macro&amp;lt;/TH&amp;gt;&amp;lt;TH&amp;gt;Action performed&amp;lt;/TH&amp;gt;&amp;lt;TH&amp;gt;Notes&amp;lt;/TH&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;INIT &amp;lt;I&amp;gt;val, addr&amp;lt;/I&amp;gt;&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Output an initializer record to set location &amp;lt;I&amp;gt;addr&amp;lt;/I&amp;gt; to &amp;lt;I&amp;gt;val&amp;lt;/I&amp;gt;&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Both &amp;lt;I&amp;gt;val&amp;lt;/I&amp;gt; and &amp;lt;I&amp;gt;addr&amp;lt;/I&amp;gt; must be computable at assembly time&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;INIT_DONE&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Terminate an initializer list&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Must immediately follow last INIT line in an initializer list.&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;EMIT_CST8&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Output 8-bit constant table&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Must be used once per program, after all initializer lists.&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;EMIT_CST16&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Output 16-bit constant table&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Must be used once per program, after all initializer lists.&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;/TABLE&amp;gt;&amp;lt;/CENTER&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The INIT and INIT_DONE macros allow you to build up an initializer list.  You can put labels ahead of or within an initializer list to indicate alternate starting points within the list.  An initializer list is simply a series of INIT lines followed by a single line with INIT_DONE.&lt;br /&gt;
&lt;br /&gt;
    INIT val, addr&lt;br /&gt;
    INIT val, addr&lt;br /&gt;
    ;...&lt;br /&gt;
    INIT val, addr&lt;br /&gt;
    INIT val, addr&lt;br /&gt;
    INIT_DONE&lt;br /&gt;
&lt;br /&gt;
The EMIT_CST8 and EMIT_CST16 output lookup tables that the INITMEM function uses to decode the initializer lists.  These two macros must each be called precisely once somewhere in your program, &amp;lt;I&amp;gt;after&amp;lt;/I&amp;gt; all initializer lists have been seen by the assembler.  They take no arguments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== initmem.asm ==&lt;br /&gt;
&amp;lt;CENTER&amp;gt;&amp;lt;TABLE BORDER&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TH&amp;gt;Entry point&amp;lt;/TH&amp;gt;&amp;lt;TH&amp;gt;Function provided&amp;lt;/TH&amp;gt;&amp;lt;TH&amp;gt;Notes&amp;lt;/TH&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;INITMEM&amp;lt;/TD&amp;gt;&amp;lt;TD ROWSPAN=3&amp;gt;Initialize a set of variables in memory&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Initializer list immediately follows [[CALL]].&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;INITMEM.1&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Pointer to initializer list immediately follows [[CALL]].&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;INITMEM.2&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Register R4 contains pointer to initializer list.&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;/TABLE&amp;gt;&amp;lt;/CENTER&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See examples and code below for usage.&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== Using INITMEM to initialize some game variables ==&lt;br /&gt;
&lt;br /&gt;
The following example assumes that the game has 5 variables named SCORE, LIVES, XPOS, YPOS and TIME.  These variables may have been declared with the [[dseg.mac|SCRATCH or SYSTEM]] macros, but don't need to have been.&lt;br /&gt;
&lt;br /&gt;
    ; Set things up for the start of the game&lt;br /&gt;
    CALL    INITMEM&lt;br /&gt;
    INIT    0,      SCORE    ; Reset score&lt;br /&gt;
    INIT    4,      LIVES    ; Reset lives&lt;br /&gt;
    INIT    10,     XPOS     ; \_ put player in the middle of the screen&lt;br /&gt;
    INIT    6,      YPOS     ; /&lt;br /&gt;
    INIT    60,     TIME     ; Put 60 seconds remaining on the clock&lt;br /&gt;
    INIT_DONE&lt;br /&gt;
&lt;br /&gt;
== Using INITMEM.1 to initialize some game variables ==&lt;br /&gt;
&lt;br /&gt;
Building off the example above, suppose your game has an initializer list that you might want to use some subset of, or use from multiple places.  Consider the previous example:  It sets up variables for the start of a game.  The last three entries might be useful for re-initializing &amp;lt;I&amp;gt;some&amp;lt;/I&amp;gt; variables if the player loses a life.  You could then write things like so:&lt;br /&gt;
&lt;br /&gt;
    ; Set things up for the start of the game&lt;br /&gt;
    CALL    INITMEM&lt;br /&gt;
    INIT    0,      SCORE    ; Reset score&lt;br /&gt;
    INIT    4,      LIVES    ; Reset lives&lt;br /&gt;
 restart_level:&lt;br /&gt;
    INIT    10,     XPOS     ; \_ put player in the middle of the screen&lt;br /&gt;
    INIT    6,      YPOS     ; /&lt;br /&gt;
    INIT    60,     TIME     ; Put 60 seconds remaining on the clock&lt;br /&gt;
    INIT_DONE&lt;br /&gt;
&lt;br /&gt;
and then elsewhere:&lt;br /&gt;
&lt;br /&gt;
    ; After player died, reinitialize some of the state but not all&lt;br /&gt;
    CALL    INITMEM.1&lt;br /&gt;
    DECLE   restart_level&lt;br /&gt;
&lt;br /&gt;
== Using INITMEM.2 to initialize some game variables ==&lt;br /&gt;
&lt;br /&gt;
Sometimes you want to be able to pick from several different sets of initializers, such as when picking difficulty levels.  One way to do this is to pick from multiple tables and then tell INITMEM which one to use.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EASY    INIT   1,      SPEED&lt;br /&gt;
        INIT   120,    TIME&lt;br /&gt;
        INIT   3,      CREEPS&lt;br /&gt;
        INIT_DONE&lt;br /&gt;
&lt;br /&gt;
MEDIUM  INIT   3,      SPEED&lt;br /&gt;
        INIT   90,     TIME&lt;br /&gt;
        INIT   5,      CREEPS&lt;br /&gt;
        INIT_DONE&lt;br /&gt;
&lt;br /&gt;
HARD    INIT   5,      SPEED&lt;br /&gt;
        INIT   60,     TIME&lt;br /&gt;
        INIT   7,      CREEPS&lt;br /&gt;
        INIT_DONE&lt;br /&gt;
&lt;br /&gt;
DIFF    DECLE  EASY, MEDIUM, HARD&lt;br /&gt;
&lt;br /&gt;
        ;... and then elsewhere ...&lt;br /&gt;
        &lt;br /&gt;
        ; R1 = 0 for easy, 1 for medium, 2 for hard   &lt;br /&gt;
        ADDI   #DIFF,  R1    ; index into table to pick which initializer to use&lt;br /&gt;
        MVI@   R1,     R4    ; read pointer to initializer&lt;br /&gt;
        CALL   INITMEM.2     ; set up the game variables&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Notes =&lt;br /&gt;
&lt;br /&gt;
Be sure to call EMIT_CST8 and EMIT_CST16 precisely once in your program, after all INIT blocks.  Otherwise your program will not assemble correctly.&lt;br /&gt;
&lt;br /&gt;
Include initmem.mac near the top of your program.  Include initmem.asm where convenient.&lt;br /&gt;
&lt;br /&gt;
= Source Code =&lt;br /&gt;
&lt;br /&gt;
== initmem.mac ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;* ======================================================================== *;&lt;br /&gt;
;*     This file is hereby placed into the public domain by its author,     *;&lt;br /&gt;
;*     Joseph Zbiciak.  It may therefore be incorporated into programs      *;&lt;br /&gt;
;*     with any license with no restrictions on the resulting program.      *;&lt;br /&gt;
;* ======================================================================== *;&lt;br /&gt;
                IF (DEFINED _INITMEM_MAC) = 0&lt;br /&gt;
_INITMEM_MAC    EQU     1&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  INITMEM                                                                 ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  These are the macros that work with the INITMEM function.               ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  MACROS:                                                                 ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;      INIT val, addr      Set 'addr' to 'value' as part of init list.     ;;&lt;br /&gt;
;;      INIT_DONE           Terminates an init list                         ;;&lt;br /&gt;
;;      EMIT_CST8           Outputs the accumulated CST8 table.             ;;&lt;br /&gt;
;;      EMIT_CST16          Outputs the accumulated CST16 table.            ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  DETAILS                                                                 ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  Initialize a set of variables to initial values.  Initialization        ;;&lt;br /&gt;
;;  records are 1 word each typically.  All variables are in the range      ;;&lt;br /&gt;
;;  $0F0 - $35F.  So, each record is formatted as follows.                  ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;        15                 10  9                                0         ;;&lt;br /&gt;
;;       +---------------------+-----------------------------------+        ;;&lt;br /&gt;
;;       |       Value         |             Address               |        ;;&lt;br /&gt;
;;       +---------------------+-----------------------------------+        ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  A record of 0 terminates the initializer list.                          ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  The &amp;quot;value&amp;quot; field is actually encoded.  $20 - $3F directly map to       ;;&lt;br /&gt;
;;  the constants $00 - $1F.  $00 - $1E map to constants in a separate      ;;&lt;br /&gt;
;;  constants table.  $1F indicates the constant appears in the following   ;;&lt;br /&gt;
;;  word.  Furthermore, constant table entries $00 - $0F are packed 8-bit   ;;&lt;br /&gt;
;;  contants, whereas $10 - $1E are unpacked 16-bit constants.              ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
&lt;br /&gt;
_init_const     SET 0&lt;br /&gt;
_init_escape    SET 0&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  Helper macros:  (Programs should not call these.)                       ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;      _init_try       See if constant is already allocated in CST tables. ;;&lt;br /&gt;
;;      _init_alloc8    Allocate an 8-bit constant.                         ;;&lt;br /&gt;
;;      _init_alloc16   Allocate a 16-bit constant.                         ;;&lt;br /&gt;
;;      _init_encode_constant   Given a cst, return bits 15:10 of init rec. ;;&lt;br /&gt;
;;      _emit_cst8      Output two entries of CST8 table if defined.        ;;&lt;br /&gt;
;;      _emit_cst16     Output an entry of CST16 table if defined.          ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
MACRO           _init_try(v,c)&lt;br /&gt;
                IF      (%v% = _init_cst_%c%)&lt;br /&gt;
_init_const     SET     ($%c%) SHL 10&lt;br /&gt;
                ENDI&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
MACRO           _init_alloc8(v,c)&lt;br /&gt;
                IF (_init_const = -1) AND (DEFINED _init_cst_%c%) = 0&lt;br /&gt;
_init_cst_%c%   EQU     (%v%)&lt;br /&gt;
_init_const     SET     ($%c%) SHL 10&lt;br /&gt;
                ENDI&lt;br /&gt;
ENDM&lt;br /&gt;
MACRO           _init_alloc16(v,c)&lt;br /&gt;
                IF (_init_const = -1) AND (DEFINED _init_cst_%c%) = 0&lt;br /&gt;
_init_cst_%c%   EQU     (%v%)&lt;br /&gt;
_init_const     SET     ($%c%) SHL 10&lt;br /&gt;
                ENDI&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MACRO           _init_encode_constant(v)&lt;br /&gt;
&lt;br /&gt;
_init_escape    SET     0&lt;br /&gt;
_init_const     SET     -1 &lt;br /&gt;
&lt;br /&gt;
                IF  (%v% &amp;gt;= $00) AND (%v% &amp;lt;= $1F)&lt;br /&gt;
_init_const     SET     (%v% + $20) SHL 10&lt;br /&gt;
                ELSE&lt;br /&gt;
                _init_try(%v%,00)&lt;br /&gt;
                _init_try(%v%,01)&lt;br /&gt;
                _init_try(%v%,02)&lt;br /&gt;
                _init_try(%v%,03)&lt;br /&gt;
                _init_try(%v%,04)&lt;br /&gt;
                _init_try(%v%,05)&lt;br /&gt;
                _init_try(%v%,06)&lt;br /&gt;
                _init_try(%v%,07)&lt;br /&gt;
                _init_try(%v%,08)&lt;br /&gt;
                _init_try(%v%,09)&lt;br /&gt;
                _init_try(%v%,0A)&lt;br /&gt;
                _init_try(%v%,0B)&lt;br /&gt;
                _init_try(%v%,0C)&lt;br /&gt;
                _init_try(%v%,0D)&lt;br /&gt;
                _init_try(%v%,0E)&lt;br /&gt;
                _init_try(%v%,0F)&lt;br /&gt;
                _init_try(%v%,10)&lt;br /&gt;
                _init_try(%v%,11)&lt;br /&gt;
                _init_try(%v%,12)&lt;br /&gt;
                _init_try(%v%,13)&lt;br /&gt;
                _init_try(%v%,14)&lt;br /&gt;
                _init_try(%v%,15)&lt;br /&gt;
                _init_try(%v%,16)&lt;br /&gt;
                _init_try(%v%,17)&lt;br /&gt;
                _init_try(%v%,18)&lt;br /&gt;
                _init_try(%v%,19)&lt;br /&gt;
                _init_try(%v%,1A)&lt;br /&gt;
                _init_try(%v%,1B)&lt;br /&gt;
                _init_try(%v%,1C)&lt;br /&gt;
                _init_try(%v%,1D)&lt;br /&gt;
                _init_try(%v%,1E)&lt;br /&gt;
                ENDI&lt;br /&gt;
&lt;br /&gt;
                IF ((%v% - $20) AND $FF00) = 0&lt;br /&gt;
                _init_alloc8(%v%,00)&lt;br /&gt;
                _init_alloc8(%v%,01)&lt;br /&gt;
                _init_alloc8(%v%,02)&lt;br /&gt;
                _init_alloc8(%v%,03)&lt;br /&gt;
                _init_alloc8(%v%,04)&lt;br /&gt;
                _init_alloc8(%v%,05)&lt;br /&gt;
                _init_alloc8(%v%,06)&lt;br /&gt;
                _init_alloc8(%v%,07)&lt;br /&gt;
                _init_alloc8(%v%,08)&lt;br /&gt;
                _init_alloc8(%v%,09)&lt;br /&gt;
                _init_alloc8(%v%,0A)&lt;br /&gt;
                _init_alloc8(%v%,0B)&lt;br /&gt;
                _init_alloc8(%v%,0C)&lt;br /&gt;
                _init_alloc8(%v%,0D)&lt;br /&gt;
                _init_alloc8(%v%,0E)&lt;br /&gt;
                _init_alloc8(%v%,0F)&lt;br /&gt;
                ELSE&lt;br /&gt;
                _init_alloc16(%v%,10)&lt;br /&gt;
                _init_alloc16(%v%,11)&lt;br /&gt;
                _init_alloc16(%v%,12)&lt;br /&gt;
                _init_alloc16(%v%,13)&lt;br /&gt;
                _init_alloc16(%v%,14)&lt;br /&gt;
                _init_alloc16(%v%,15)&lt;br /&gt;
                _init_alloc16(%v%,16)&lt;br /&gt;
                _init_alloc16(%v%,17)&lt;br /&gt;
                _init_alloc16(%v%,18)&lt;br /&gt;
                _init_alloc16(%v%,19)&lt;br /&gt;
                _init_alloc16(%v%,1A)&lt;br /&gt;
                _init_alloc16(%v%,1B)&lt;br /&gt;
                _init_alloc16(%v%,1C)&lt;br /&gt;
                _init_alloc16(%v%,1D)&lt;br /&gt;
                _init_alloc16(%v%,1E)&lt;br /&gt;
                ENDI&lt;br /&gt;
&lt;br /&gt;
                IF _init_const = -1&lt;br /&gt;
_init_const     EQU     $1F SHL 10&lt;br /&gt;
_init_escape    EQU     1&lt;br /&gt;
                ENDI&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
MACRO           _emit_cst8(a,b)&lt;br /&gt;
                IF      (DEFINED _init_cst_%a%) &amp;lt;&amp;gt; 0&lt;br /&gt;
_init_tmp       SET     (((_init_cst_%a% - $20) AND $FF) SHL 8)&lt;br /&gt;
                ENDI&lt;br /&gt;
                IF      (DEFINED _init_cst_%b%) &amp;lt;&amp;gt; 0&lt;br /&gt;
_init_tmp       SET     _init_tmp OR ((_init_cst_%b% - $20) AND $FF)&lt;br /&gt;
                ENDI&lt;br /&gt;
                IF      (DEFINED _init_cst_%a%) OR (DEFINED _init_cst_%b%)&lt;br /&gt;
                DECLE   _init_tmp&lt;br /&gt;
                ENDI&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
MACRO           _emit_cst16(a)&lt;br /&gt;
                IF  (DEFINED _init_cst_%a%) &amp;lt;&amp;gt; 0&lt;br /&gt;
                DECLE _init_cst_%a%&lt;br /&gt;
                ENDI&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  INIT val, addr -- Output an initialization record                       ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
MACRO           INIT    v, a&lt;br /&gt;
&lt;br /&gt;
                LISTING &amp;quot;code&amp;quot;&lt;br /&gt;
                _init_encode_constant(%v%)&lt;br /&gt;
                IF      _init_escape = 0&lt;br /&gt;
                DECLE   _init_const OR %a%&lt;br /&gt;
                ELSE&lt;br /&gt;
                DECLE   _init_const OR %a%, %v%&lt;br /&gt;
                ENDI&lt;br /&gt;
                LISTING &amp;quot;prev&amp;quot;&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  INIT_DONE   Terminate an initialization list.                           ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
MACRO           INIT_DONE&lt;br /&gt;
                DECLE   0&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  EMIT_CST8   Output the CST8 table.  This call must appear after all     ;;&lt;br /&gt;
;;              INIT lists due to assembler restrictions.                   ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
MACRO           EMIT_CST8&lt;br /&gt;
&lt;br /&gt;
CST8            PROC&lt;br /&gt;
                LISTING &amp;quot;code&amp;quot;&lt;br /&gt;
                IF  (DEFINED _cst8_fix) AND ((CST8 AND $8000) = 0)&lt;br /&gt;
_init_tmp       SET     $&lt;br /&gt;
                ORG     _cst8_fix&lt;br /&gt;
                CLRC                ; patch up INITMEM&lt;br /&gt;
                ORG     _init_tmp&lt;br /&gt;
                ENDI&lt;br /&gt;
&lt;br /&gt;
                _emit_cst8(00, 01)&lt;br /&gt;
                _emit_cst8(02, 03)&lt;br /&gt;
                _emit_cst8(04, 05)&lt;br /&gt;
                _emit_cst8(06, 07)&lt;br /&gt;
                _emit_cst8(08, 09)&lt;br /&gt;
                _emit_cst8(0A, 0B)&lt;br /&gt;
                _emit_cst8(0C, 0D)&lt;br /&gt;
                _emit_cst8(0E, 0F)&lt;br /&gt;
                LISTING &amp;quot;prev&amp;quot;&lt;br /&gt;
                ENDP&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  EMIT_CST16  Output the CST16 table.  This call must appear after all    ;;&lt;br /&gt;
;;              INIT lists due to assembler restrictions.                   ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
MACRO           EMIT_CST16&lt;br /&gt;
&lt;br /&gt;
CST16           PROC&lt;br /&gt;
                LISTING &amp;quot;code&amp;quot;&lt;br /&gt;
                _emit_cst16(10)&lt;br /&gt;
                _emit_cst16(11)&lt;br /&gt;
                _emit_cst16(12)&lt;br /&gt;
                _emit_cst16(13)&lt;br /&gt;
                _emit_cst16(14)&lt;br /&gt;
                _emit_cst16(15)&lt;br /&gt;
                _emit_cst16(16)&lt;br /&gt;
                _emit_cst16(17)&lt;br /&gt;
                _emit_cst16(18)&lt;br /&gt;
                _emit_cst16(19)&lt;br /&gt;
                _emit_cst16(1A)&lt;br /&gt;
                _emit_cst16(1B)&lt;br /&gt;
                _emit_cst16(1C)&lt;br /&gt;
                _emit_cst16(1D)&lt;br /&gt;
                _emit_cst16(1E)&lt;br /&gt;
                LISTING &amp;quot;prev&amp;quot;&lt;br /&gt;
                ENDP&lt;br /&gt;
ENDM&lt;br /&gt;
&lt;br /&gt;
                ENDI&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  End of File:  initmem.mac                                               ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== initmem.asm ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;* ======================================================================== *;&lt;br /&gt;
;*     This file is hereby placed into the public domain by its author,     *;&lt;br /&gt;
;*     Joseph Zbiciak.  It may therefore be incorporated into programs      *;&lt;br /&gt;
;*     with any license with no restrictions on the resulting program.      *;&lt;br /&gt;
;* ======================================================================== *;&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  INITMEM                                                                 ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  Initialize a set of variables to initial values.  Initialization        ;;&lt;br /&gt;
;;  records are 1 word each typically.  All variables are in the range      ;;&lt;br /&gt;
;;  $0F0 - $35F.  So, each record is formatted as follows.                  ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;        15                 10  9                                0         ;;&lt;br /&gt;
;;       +---------------------+-----------------------------------+        ;;&lt;br /&gt;
;;       |       Value         |             Address               |        ;;&lt;br /&gt;
;;       +---------------------+-----------------------------------+        ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  A record of 0 terminates the initializer list.                          ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  The &amp;quot;value&amp;quot; field is actually encoded.  $20 - $3F directly map to       ;;&lt;br /&gt;
;;  the constants $00 - $1F.  $00 - $1E map to constants in a separate      ;;&lt;br /&gt;
;;  constants table.  $1F indicates the constant appears in the following   ;;&lt;br /&gt;
;;  word.  Furthermore, constant table entries $00 - $1F are packed 8-bit   ;;&lt;br /&gt;
;;  contants, whereas $20 - $2E are unpacked 16-bit constants.              ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  INPUTS  (INITMEM.0)                                                     ;;&lt;br /&gt;
;;      R5  Initializer table.  Returns following table.                    ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  INPUTS  (INITMEM.1)                                                     ;;&lt;br /&gt;
;;      R5  Pointer to initializer table.  Returns following pointer.       ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  INPUTS  (INITMEM.2)                                                     ;;&lt;br /&gt;
;;      R5  Return address                                                  ;;&lt;br /&gt;
;;      R4  Initialization table                                            ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
&lt;br /&gt;
INITMEM     PROC&lt;br /&gt;
@@0:        MOVR    R5,     R4          ; Read init table from after CALL&lt;br /&gt;
            CLRR    R5                  ; Flag:  Return to R4.&lt;br /&gt;
            INCR    PC                  ; Skip MVI@&lt;br /&gt;
@@1:        MVI@    R5,     R4          ; Read init table from elsewhere&lt;br /&gt;
@@2:    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
@@next:&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
            ;;  Decode next initializer symbol.  R1 will hold the 10-bit    ;;&lt;br /&gt;
            ;;  variable address and R2 holds the encoded constant value.   ;;&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
            MVI@    R4,     R2          ; Get next record&lt;br /&gt;
            MOVR    R2,     R1          ; Save for factoring addr from cst&lt;br /&gt;
&lt;br /&gt;
            BEQ     @@done              ; Terminate on zero&lt;br /&gt;
            ANDI    #$3FF,  R1          ; Factor address from data&lt;br /&gt;
            XORR    R1,     R2          ; Clear address from data&lt;br /&gt;
            SWAP    R2                  ; \_ put data in 6 LSBs&lt;br /&gt;
            SLR     R2,     2           ; /&lt;br /&gt;
&lt;br /&gt;
            SUBI    #$20,   R2          ; $20-$3F are cst $00-$1F.  &lt;br /&gt;
            BMI     @@cst_tbl           ; $00-$1F indicate &amp;quot;constant tbl&amp;quot;&lt;br /&gt;
&lt;br /&gt;
            MVO@    R2,     R1          ; \_ Store decoded constant &lt;br /&gt;
            B       @@next              ; /  and move to next initializer&lt;br /&gt;
&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
            ;;  If the encoded value was $00 - $1F, then we have one of     ;;&lt;br /&gt;
            ;;  the following:                                              ;;&lt;br /&gt;
            ;;      $00 - $0F   8 bit constant in packed 8-bit table        ;;&lt;br /&gt;
            ;;      $10 - $1E   16 bit constant in 16-bit table             ;;&lt;br /&gt;
            ;;      $1F         Escape code for arbitrary constant.         ;;&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
@@cst_tbl   INCR    R2                  ; \_ $1F specifies an escape&lt;br /&gt;
            BEQ     @@escape            ; /&lt;br /&gt;
&lt;br /&gt;
            ADDI    #$F,    R2          ; \_ $00-$0F specify 8 bit cst&lt;br /&gt;
            BMI     @@8bit              ; /  $10-$1E specify 16 bit cst&lt;br /&gt;
&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
            ;;  R2 now $00-$0E for $10-$1E input.  Use it to index into     ;;&lt;br /&gt;
            ;;  16-bit constants table.                                     ;;&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
            ADDI    #CST16, R2&lt;br /&gt;
            MVI@    R2,     R0          ; \_ Copy constant of interest out&lt;br /&gt;
            MVO@    R0,     R1          ; /  &lt;br /&gt;
            B       @@next&lt;br /&gt;
&lt;br /&gt;
@@escape    MVI@    R4,     R2          ; \_ Escape:  Copy next word to&lt;br /&gt;
            MVO@    R2,     R1          ; /  indicated address&lt;br /&gt;
            B       @@next&lt;br /&gt;
&lt;br /&gt;
@@8bit:&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
            ;;  R2 is now -$10 to -$01 to specify one of the 16 8-bit csts. ;;&lt;br /&gt;
            ;;  We add CST8*2 to the index and then right-shift by 1 to     ;;&lt;br /&gt;
            ;;  determine the integer index.  The C bit will tell us hi or  ;;&lt;br /&gt;
            ;;  lo byte.  We bias the result up by $20 since $00-$1F don't  ;;&lt;br /&gt;
            ;;  require the constant table.                                 ;;&lt;br /&gt;
            ;; ------------------------------------------------------------ ;;&lt;br /&gt;
            ADDI    #$FFFF AND (CST8*2+16), R2      ; &lt;br /&gt;
    IF (DEFINED CST8) AND ((CST8 AND $8000) = 0)&lt;br /&gt;
            CLRC                        ; MSB of CST8 was 0&lt;br /&gt;
    ELSE&lt;br /&gt;
_cst8_fix   SETC                        ; MSB of CST8 was 1&lt;br /&gt;
    ENDI&lt;br /&gt;
            RRC     R2                  ; Divide index by 2&lt;br /&gt;
            MVI@    R2,     R0          ; Get pair of 8 bit values&lt;br /&gt;
            ADCR    PC                  ; If idx%2 == 1, take lo half&lt;br /&gt;
            SWAP    R0                  ; else take hi half&lt;br /&gt;
            ANDI    #$FF,   R0          ; Clear away upper byte&lt;br /&gt;
            ADDI    #$20,   R0          ; &lt;br /&gt;
            MVO@    R0,     R1          ; Store it out&lt;br /&gt;
            B       @@next&lt;br /&gt;
&lt;br /&gt;
@@done      TSTR    R5                  ; Return after data?&lt;br /&gt;
            BEQ     @@jrr4              ; If R5==0, return after data.&lt;br /&gt;
            JR      R5                  ; Else return to R5.&lt;br /&gt;
@@jrr4      JR      R4                  &lt;br /&gt;
            ENDP&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  End of File:  initmem.asm                                               ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	</feed>