<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=Z80%3AApplication_Code</id>
	<title>Z80:Application Code - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://learn.cemetech.net/index.php?action=history&amp;feed=atom&amp;title=Z80%3AApplication_Code"/>
	<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;action=history"/>
	<updated>2026-04-28T22:22:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=392&amp;oldid=prev</id>
		<title>KermMartian at 08:00, 6 February 2016</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=392&amp;oldid=prev"/>
		<updated>2016-02-06T08:00:42Z</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 08:00, 6 February 2016&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-l59&quot;&gt;Line 59:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 59:&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;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; 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;The last difference you can note here is that to quit an flash application, you must use [[Z80:Macros:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;bjump&lt;/del&gt;|bjump(_JForceCmdNoChar)]].&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;The last difference you can note here is that to quit an flash application, you must use [[Z80:Macros:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;BJUMP&lt;/ins&gt;|bjump(_JForceCmdNoChar)]].&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;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;= Self Modifying Code (SMC) =&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;= Self Modifying Code (SMC) =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>KermMartian</name></author>
	</entry>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=255&amp;oldid=prev</id>
		<title>KermMartian at 18:01, 5 February 2016</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=255&amp;oldid=prev"/>
		<updated>2016-02-05T18:01:09Z</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 18:01, 5 February 2016&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-l31&quot;&gt;Line 31:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 31:&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;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; 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;It looks really similar to a regular assembly program at first glance. However, look carefully and the differences can be quite interesting. First of all, [[Z80:Directives:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;org&lt;/del&gt;|.org]] is set to $4000. This is because flash addresses are addressed starting at $4000, quite different from assembly programs which address from $9D93.&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;It looks really similar to a regular assembly program at first glance. However, look carefully and the differences can be quite interesting. First of all, [[Z80:Directives:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ORG&lt;/ins&gt;|.org]] is set to $4000. This is because flash addresses are addressed starting at $4000, quite different from assembly programs which address from $9D93.&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;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;Also notice that we wrote our own PutS routine. What&amp;#039;s up with that? The reason why we wrote our own PutS routine is because PutS can only display strings residing in RAM. Technically, we&amp;#039;re not in RAM (actually, we&amp;#039;ve just swapped our flash app into &amp;quot;RAM&amp;quot; so it can be executed, but it&amp;#039;s not what the OS thinks is &amp;quot;RAM). So, we have two solutions: copy our text to saferam (such as appbackupscreen, textShadow, etc.) or somewhere in actual RAM, then bcall PutS, or write our own PutS routine and just call it. Places that are actually in &amp;quot;RAM&amp;quot; are addresses &amp;#039;&amp;#039;&amp;#039;outside of&amp;#039;&amp;#039;&amp;#039; $4000-$8000.&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;Also notice that we wrote our own PutS routine. What&amp;#039;s up with that? The reason why we wrote our own PutS routine is because PutS can only display strings residing in RAM. Technically, we&amp;#039;re not in RAM (actually, we&amp;#039;ve just swapped our flash app into &amp;quot;RAM&amp;quot; so it can be executed, but it&amp;#039;s not what the OS thinks is &amp;quot;RAM). So, we have two solutions: copy our text to saferam (such as appbackupscreen, textShadow, etc.) or somewhere in actual RAM, then bcall PutS, or write our own PutS routine and just call it. Places that are actually in &amp;quot;RAM&amp;quot; are addresses &amp;#039;&amp;#039;&amp;#039;outside of&amp;#039;&amp;#039;&amp;#039; $4000-$8000.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>KermMartian</name></author>
	</entry>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=87&amp;oldid=prev</id>
		<title>KermMartian: Adjusted lowercase z80</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=87&amp;oldid=prev"/>
		<updated>2016-02-03T21:08:31Z</updated>

		<summary type="html">&lt;p&gt;Adjusted lowercase z80&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 21:08, 3 February 2016&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-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&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;Now that we have the header of the application, it&#039;s time to discuss the code for applications. [[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;z80&lt;/del&gt;:Intro to Flash Applications|Intro to Flash Applications]] discussed a few general things, but now we&#039;re ready to get into the nitty-gritty details. Note that this page will focus on things specific to single page flash applications. Multiple page applications have an added level of complexity, and are discussed [[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;z80&lt;/del&gt;:Multi-Page Apps|here]].&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;Now that we have the header of the application, it&#039;s time to discuss the code for applications. [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Z80&lt;/ins&gt;:Intro to Flash Applications|Intro to Flash Applications]] discussed a few general things, but now we&#039;re ready to get into the nitty-gritty details. Note that this page will focus on things specific to single page flash applications. Multiple page applications have an added level of complexity, and are discussed [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Z80&lt;/ins&gt;:Multi-Page Apps|here]].&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;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;= Hello world =&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;= Hello world =&lt;/div&gt;&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-l31&quot;&gt;Line 31:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 31:&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;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; 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;It looks really similar to a regular assembly program at first glance. However, look carefully and the differences can be quite interesting. First of all, [[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;z80&lt;/del&gt;:Directives:org|.org]] is set to $4000. This is because flash addresses are addressed starting at $4000, quite different from assembly programs which address from $9D93.&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;It looks really similar to a regular assembly program at first glance. However, look carefully and the differences can be quite interesting. First of all, [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Z80&lt;/ins&gt;:Directives:org|.org]] is set to $4000. This is because flash addresses are addressed starting at $4000, quite different from assembly programs which address from $9D93.&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;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;Also notice that we wrote our own PutS routine. What&amp;#039;s up with that? The reason why we wrote our own PutS routine is because PutS can only display strings residing in RAM. Technically, we&amp;#039;re not in RAM (actually, we&amp;#039;ve just swapped our flash app into &amp;quot;RAM&amp;quot; so it can be executed, but it&amp;#039;s not what the OS thinks is &amp;quot;RAM). So, we have two solutions: copy our text to saferam (such as appbackupscreen, textShadow, etc.) or somewhere in actual RAM, then bcall PutS, or write our own PutS routine and just call it. Places that are actually in &amp;quot;RAM&amp;quot; are addresses &amp;#039;&amp;#039;&amp;#039;outside of&amp;#039;&amp;#039;&amp;#039; $4000-$8000.&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;Also notice that we wrote our own PutS routine. What&amp;#039;s up with that? The reason why we wrote our own PutS routine is because PutS can only display strings residing in RAM. Technically, we&amp;#039;re not in RAM (actually, we&amp;#039;ve just swapped our flash app into &amp;quot;RAM&amp;quot; so it can be executed, but it&amp;#039;s not what the OS thinks is &amp;quot;RAM). So, we have two solutions: copy our text to saferam (such as appbackupscreen, textShadow, etc.) or somewhere in actual RAM, then bcall PutS, or write our own PutS routine and just call it. Places that are actually in &amp;quot;RAM&amp;quot; are addresses &amp;#039;&amp;#039;&amp;#039;outside of&amp;#039;&amp;#039;&amp;#039; $4000-$8000.&lt;/div&gt;&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-l59&quot;&gt;Line 59:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 59:&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;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; 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;The last difference you can note here is that to quit an flash application, you must use [[&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;z80&lt;/del&gt;:Macros:bjump|bjump(_JForceCmdNoChar)]].&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;The last difference you can note here is that to quit an flash application, you must use [[&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Z80&lt;/ins&gt;:Macros:bjump|bjump(_JForceCmdNoChar)]].&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;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;= Self Modifying Code (SMC) =&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;= Self Modifying Code (SMC) =&lt;/div&gt;&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-l91&quot;&gt;Line 91:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 91:&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;{{lowercase}}&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;{{lowercase}}&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;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;z80 &lt;/del&gt;Assembly]]&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;[[Category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Z80 &lt;/ins&gt;Assembly]]&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;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;z80 &lt;/del&gt;Heaven]]&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;[[Category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Z80 &lt;/ins&gt;Heaven]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>KermMartian</name></author>
	</entry>
	<entry>
		<id>http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=53&amp;oldid=prev</id>
		<title>KermMartian: Created page with &quot;Now that we have the header of the application, it&#039;s time to discuss the code for applications. Intro to Flash Applications discussed a few...&quot;</title>
		<link rel="alternate" type="text/html" href="http://learn.cemetech.net/index.php?title=Z80:Application_Code&amp;diff=53&amp;oldid=prev"/>
		<updated>2016-02-03T20:03:16Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;Now that we have the header of the application, it&amp;#039;s time to discuss the code for applications. &lt;a href=&quot;/index.php/Z80:Intro_to_Flash_Applications&quot; title=&quot;Z80:Intro to Flash Applications&quot;&gt;Intro to Flash Applications&lt;/a&gt; discussed a few...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Now that we have the header of the application, it&amp;#039;s time to discuss the code for applications. [[z80:Intro to Flash Applications|Intro to Flash Applications]] discussed a few general things, but now we&amp;#039;re ready to get into the nitty-gritty details. Note that this page will focus on things specific to single page flash applications. Multiple page applications have an added level of complexity, and are discussed [[z80:Multi-Page Apps|here]].&lt;br /&gt;
&lt;br /&gt;
= Hello world =&lt;br /&gt;
&lt;br /&gt;
Let&amp;#039;s get started! We&amp;#039;ll create a simple hello world application to demonstrate a few of the novelties of flash application programming. So, here&amp;#039;s the code (with out header):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    .org $4000&lt;br /&gt;
    &lt;br /&gt;
    .include ti83plus.inc&lt;br /&gt;
    &lt;br /&gt;
    ;app header is here. Omitted for now&lt;br /&gt;
    &lt;br /&gt;
    main:&lt;br /&gt;
     ld hl,0&lt;br /&gt;
     ld (curRow),hl&lt;br /&gt;
     ld hl,txtHello&lt;br /&gt;
     call myPutS&lt;br /&gt;
     bcall(_GetKey)&lt;br /&gt;
     bjump(_JForceCmdNoChar)&lt;br /&gt;
    &lt;br /&gt;
    myPutS:&lt;br /&gt;
     ld a,(hl)&lt;br /&gt;
     or a&lt;br /&gt;
     ret z&lt;br /&gt;
     bcall(_PutC)&lt;br /&gt;
     jr myPutS&lt;br /&gt;
     &lt;br /&gt;
    txtHello:&lt;br /&gt;
    .db &amp;quot;Hello world!&amp;quot;,0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It looks really similar to a regular assembly program at first glance. However, look carefully and the differences can be quite interesting. First of all, [[z80:Directives:org|.org]] is set to $4000. This is because flash addresses are addressed starting at $4000, quite different from assembly programs which address from $9D93.&lt;br /&gt;
&lt;br /&gt;
Also notice that we wrote our own PutS routine. What&amp;#039;s up with that? The reason why we wrote our own PutS routine is because PutS can only display strings residing in RAM. Technically, we&amp;#039;re not in RAM (actually, we&amp;#039;ve just swapped our flash app into &amp;quot;RAM&amp;quot; so it can be executed, but it&amp;#039;s not what the OS thinks is &amp;quot;RAM). So, we have two solutions: copy our text to saferam (such as appbackupscreen, textShadow, etc.) or somewhere in actual RAM, then bcall PutS, or write our own PutS routine and just call it. Places that are actually in &amp;quot;RAM&amp;quot; are addresses &amp;#039;&amp;#039;&amp;#039;outside of&amp;#039;&amp;#039;&amp;#039; $4000-$8000.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    ;alternative way copying to saferam:&lt;br /&gt;
    .org $4000&lt;br /&gt;
    &lt;br /&gt;
    .include ti83plus.inc&lt;br /&gt;
    &lt;br /&gt;
    ;app header is here. Omitted for now&lt;br /&gt;
    &lt;br /&gt;
    main:&lt;br /&gt;
     ld hl,0&lt;br /&gt;
     ld (curRow),hl&lt;br /&gt;
     ld hl,txtHello&lt;br /&gt;
     ld de,appbackupscreen&lt;br /&gt;
     ld bc,12&lt;br /&gt;
     ldir&lt;br /&gt;
     ld hl,appbackupscreen&lt;br /&gt;
     bcall(_PutS)&lt;br /&gt;
     bcall(_GetKey)&lt;br /&gt;
     bjump(_JForceCmdNoChar)&lt;br /&gt;
    &lt;br /&gt;
    txtHello:&lt;br /&gt;
    .db &amp;quot;Hello world!&amp;quot;,0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The last difference you can note here is that to quit an flash application, you must use [[z80:Macros:bjump|bjump(_JForceCmdNoChar)]].&lt;br /&gt;
&lt;br /&gt;
= Self Modifying Code (SMC) =&lt;br /&gt;
&lt;br /&gt;
In flash application coding, you can not create code that will modify &amp;#039;&amp;#039;&amp;#039;anything&amp;#039;&amp;#039;&amp;#039; between the addresses of $4000-$8000 (where the actual application is). To create SMC, you must first copy your code to somewhere else (saferam works best) and then that code is free to be modified.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    ;error&lt;br /&gt;
     ld (putix+1),hl&lt;br /&gt;
    putix:&lt;br /&gt;
     ld ix,$0000&lt;br /&gt;
    &lt;br /&gt;
    ;ok&lt;br /&gt;
     ld hl,putix&lt;br /&gt;
     ld de,appbackupscreen&lt;br /&gt;
     ld bc,4&lt;br /&gt;
     ldir&lt;br /&gt;
     ld (appbackupscreen+1),hl&lt;br /&gt;
     call putix&lt;br /&gt;
    ;...&lt;br /&gt;
    putix:&lt;br /&gt;
     ld ix,$0000&lt;br /&gt;
     ret&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Technically, I believe instructions that try to write to memory between $4000-$8000 are ignored, but their behavior is not really documented. It could result in a crash that could completely mess up your calculator.&lt;br /&gt;
&lt;br /&gt;
= Emulators Note =&lt;br /&gt;
&lt;br /&gt;
It is always a good idea to test on an emulator before testing on a real calculator. However, it is wise to note that emulators are not exactly accurate, especially when it comes to Flash memory. It is the least documented, and has the worst possible consequences if you mess with something you&amp;#039;re not suppose to.&lt;br /&gt;
&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
[[Category:z80 Assembly]]&lt;br /&gt;
[[Category:z80 Heaven]]&lt;/div&gt;</summary>
		<author><name>KermMartian</name></author>
	</entry>
</feed>