<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.mcselec.com/bavr/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.mcselec.com/bavr/index.php?action=history&amp;feed=atom&amp;title=DECLARE_SUB</id>
		<title>DECLARE SUB - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.mcselec.com/bavr/index.php?action=history&amp;feed=atom&amp;title=DECLARE_SUB"/>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=DECLARE_SUB&amp;action=history"/>
		<updated>2026-04-26T07:55:11Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.18.6</generator>

	<entry>
		<id>http://wiki.mcselec.com/bavr/index.php?title=DECLARE_SUB&amp;diff=5003&amp;oldid=prev</id>
		<title>Admin at 20:48, 13 December 2014</title>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=DECLARE_SUB&amp;diff=5003&amp;oldid=prev"/>
				<updated>2014-12-13T20:48:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Nächstältere Version&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Version vom 13. Dezember 2014, 20:48 Uhr&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 69:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 69:&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;style&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;italic&lt;/del&gt;;&amp;quot;&amp;gt;Sub TestArray&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;(&lt;/del&gt;&amp;lt;/span&amp;gt;&amp;lt;span &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;style&lt;/del&gt;=&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;font-&lt;/del&gt;style: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;italic; font-weight: bold&lt;/del&gt;;&amp;quot;&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ar&lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;)&lt;/del&gt;&amp;lt;/span&amp;gt;&amp;lt;span &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;style&lt;/del&gt;=&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;font-&lt;/del&gt;style: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;italic&lt;/del&gt;;&amp;quot;&amp;gt;&amp;amp;nbsp;as byte, b as byte)&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;class=&amp;quot;f_CodeExample&amp;quot; &lt;/ins&gt;style=&amp;quot;font-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;weight&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bold; color: rgb(0, 0, 128)&lt;/ins&gt;;&amp;quot;&amp;gt;Sub&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;/ins&gt;TestArray&amp;lt;/span&amp;gt;&amp;lt;span &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;class&lt;/ins&gt;=&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;f_CodeExample&amp;quot; &lt;/ins&gt;style&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;=&amp;quot;color&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;rgb(255, 0, 0)&lt;/ins&gt;;&amp;quot;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;class&lt;/ins&gt;=&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;f_CodeExample&amp;quot;&amp;gt;ar&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; &lt;/ins&gt;style&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;=&amp;quot;color&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;rgb(255, 0, 0)&lt;/ins&gt;;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&amp;gt;()&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&lt;/ins&gt;&amp;quot;&amp;gt;&amp;amp;nbsp;as&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&lt;/ins&gt;byte&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; style=&amp;quot;color: rgb(255&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;0, 0);&amp;quot;&amp;gt;,&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;/ins&gt;b&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&lt;/ins&gt;as&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&lt;/ins&gt;byte&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; style=&amp;quot;color: rgb(255, 0, 0);&amp;quot;&amp;gt;&lt;/ins&gt;)&amp;lt;/span&amp;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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;style&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;italic&lt;/del&gt;;&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;print &lt;/del&gt;ar(1)&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;class=&amp;quot;f_CodeExample&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; &lt;/ins&gt;style=&amp;quot;font-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;weight&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bold; color: rgb(0, 0, 128)&lt;/ins&gt;;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&amp;gt;print&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&lt;/ins&gt;&amp;quot;&amp;gt;&amp;amp;nbsp;ar&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; style=&amp;quot;color: rgb&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;255, 0, 0);&amp;quot;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot;&amp;gt;&lt;/ins&gt;1&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; style=&amp;quot;color: rgb(255, 0, 0);&amp;quot;&amp;gt;&lt;/ins&gt;)&amp;lt;/span&amp;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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;style&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;italic&lt;/del&gt;;&amp;quot;&amp;gt;&amp;amp;nbsp;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;print &lt;/del&gt;ar(b)&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;class=&amp;quot;f_CodeExample&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; &lt;/ins&gt;style=&amp;quot;font-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;weight&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bold; color: rgb(0, 0, 128)&lt;/ins&gt;;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&amp;gt;print&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&lt;/ins&gt;&amp;quot;&amp;gt;&amp;amp;nbsp;ar&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; style=&amp;quot;color: rgb&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;255, 0, 0);&amp;quot;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot;&amp;gt;&lt;/ins&gt;b&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;f_CodeExample&amp;quot; style=&amp;quot;color: rgb(255, 0, 0);&amp;quot;&amp;gt;&lt;/ins&gt;)&amp;lt;/span&amp;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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;style&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;italic&lt;/del&gt;;&amp;quot;&amp;gt;End Sub&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;class=&amp;quot;f_CodeExample&amp;quot; &lt;/ins&gt;style=&amp;quot;font-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;weight&lt;/ins&gt;: &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bold; color: rgb(0, 0, 128)&lt;/ins&gt;;&amp;quot;&amp;gt;End&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&lt;/ins&gt;Sub&amp;lt;/span&amp;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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;In older BASCOM versions, it was not required to use (). You only needed to pass the base address. But that is potential unsafe&amp;amp;nbsp;: if you reference a variable as an array while it is actually a single variable, then you can write to the wrong address. When using (), the compiler &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;known &lt;/del&gt;when an array is expected and can inform you about a possible error.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;In older BASCOM versions, it was not required to use (). You only needed to pass the base address. But that is potential unsafe&amp;amp;nbsp;: if you reference a variable as an array while it is actually a single variable, then you can write to the wrong address. When using (), the compiler &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;knows &lt;/ins&gt;when an array is expected and can inform you about a possible error.&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If you have old code you can use CONFIG ERROR=IGNORE,380=IGNORE to ignore errors as a result of the updated syntax.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If you have old code you can use CONFIG ERROR=IGNORE,380=IGNORE to ignore errors as a result of the updated syntax.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 87:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 87:&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;When BYREF or BYVAL is not provided, the parameter will be passed by reference.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Parameter Passing&amp;lt;/span&amp;gt; =&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Use &lt;/del&gt;BYREF &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to pass a variable by reference with its address. When using the referenced address&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;you work on &lt;/del&gt;the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;original variable. So a change of the variable inside the sub routine, &lt;/del&gt;will &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;change the variable outside the routine as well&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;When &lt;/ins&gt;BYREF &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;| BYVAL | BYREG | BYLABEL or BYSTACK is not provided&lt;/ins&gt;, the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;parameter &lt;/ins&gt;will &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;be passed by reference (BYREF)&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; 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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;BYREF&amp;lt;/span&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; 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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Use BYREF to pass a variable by reference with its address. When using the referenced address, you work on the original variable. So a change of the variable inside the sub routine, will change the passed variable outside the routine as well.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; 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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; 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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; 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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;BYVAL&amp;lt;/span&amp;gt; =&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Use BYVAL to pass a copy of the variable. Passing a copy of the variable allows to alter the copy in the sub routine while leaving the original variable unaltered. BYVAL will not change the original passed variable but it requires more code since a copy of the parameter must be created.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Use BYVAL to pass a copy of the variable. Passing a copy of the variable allows to alter the copy in the sub routine while leaving the original variable unaltered. BYVAL will not change the original passed variable but it requires more code since a copy of the parameter must be created.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 97:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 107:&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Use BYLABEL to pass the address of a label. &amp;amp;nbsp;BYLABEL will pass the word address. It will not work for processors with multiple 64 KB pages.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;BYREG&amp;lt;/span&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Use BYREG to pass a copy of the variable using a register. The value will be passed to the register(s) you specify. When multiple bytes need to be passed, multiple registers will be used. Registers are named from R0-R31. When you pass a WORD to register R16, you will also use R17 since a word requires 2 bytes.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;You can not pass strings. Only numeric variables and constants.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Using BYREG requires some knowledge of the routines you call. The current implementation does not protect already loaded registers. This means that when you pass multiple registers you could destroy some already loaded registers just because a parameter will destroy the register.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Example&amp;amp;nbsp;: &amp;amp;nbsp;declare Sub MySub(byreg R16 as Word, byreg R18 as long, byreg R22 as dword)&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp; &amp;amp;nbsp;mysub 1000, var(J+100), var(j)&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In this example, R16 and R17 are loaded, after this the array index of variable var() need to be calculated which uses the ML16 routine which uses R16-R21&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Numeric constants and expression do not alter registers but functions might. A future version will track and protect registers.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Why would you want to use BYREG&amp;amp;nbsp;? Using BYREG is equivalent to using ASM. It is intended to be used with ASM code inside subs. The FT800 include files use BYREG and BYSTACK.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Example from FT800:&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Sub Stencilfunc(byreg &amp;amp;nbsp;r18 As Byte , Byreg r17 As Byte , Byreg R16 As Byte)&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;Cmd32 _stencilfunc(r18 , R17 , r16)&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;End Sub&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;BYSTACK&amp;lt;/span&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Use BYSTACK to pass a copy of the variable by the soft stack (Y-pointer). BYSTACK will not create a copy of the variable but instead will pass the data directly to the soft stack.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The first parameter is passed first , LSB first. You will find BYSTACK used in the FT800 include files. BYSTACK has the advantage compared to BYREG that no registers are altered. But it has the disadvantage that it requires an optional step to pass the data to the stack.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The SUB/FUNCTION need to clean up the stack. Typically you would use LD reg, y+ to pop data from the stack.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The FT800 uses&amp;amp;nbsp;[[CMDFTSTACK]]&amp;amp;nbsp;to pop data from the stack and send it to the FT800.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;BYLABEL&amp;lt;/span&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Use BYLABEL to pass the address of a label. &amp;amp;nbsp;BYLABEL will pass the&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;&lt;/ins&gt;word&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&amp;amp;nbsp;&lt;/ins&gt;address. It will not work for processors with multiple 64 KB pages.&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 111:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 173:&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If you pass a string you may specify the length of the string. This length will be the maximum length the string may grow. This is important when you pass a string BYVAL.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If you pass a string you may specify the length of the string. This length will be the maximum length the string may grow. This is important when you pass a string BYVAL.&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;When you for &lt;/del&gt;example pass a string like &amp;quot;ABC&amp;quot; to a subroutine or function BYVAL, the compiler will create a copy with a length of 3. This is sufficient to pass it to the sub routine.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;For &lt;/ins&gt;example&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &amp;amp;nbsp;when you &lt;/ins&gt;pass a string like &amp;quot;ABC&amp;quot; to a subroutine or function &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;using &lt;/ins&gt;BYVAL, the compiler will create a copy with a length of 3. This is sufficient to pass it to the sub routine.&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;But if the sub routine adds data to the string, it will not fit since the string is too short. In such a case you can specify the length.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;&lt;/del&gt;&amp;amp;nbsp;s as string * 10&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/span&amp;gt;&lt;/del&gt;, will create a string with a size of 10.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;But if the sub routine adds data to the string, it will not fit since the string is too short. In such a case you can specify the length.&amp;amp;nbsp;s as string * 10, will create a string with a size of 10.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;nbsp;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;amp;nbsp;&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;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;See the&amp;amp;nbsp;[[CALL]]&amp;amp;nbsp;statement for more details.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;See the&amp;amp;nbsp;[[CALL]]&amp;amp;nbsp;statement for more details.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://wiki.mcselec.com/bavr/index.php?title=DECLARE_SUB&amp;diff=580&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;= &lt;span class=&quot;f_Header&quot;&gt;Action&lt;/span&gt; =  Declares a subroutine.  &lt;span style=&quot;font-family: Arial;&quot;&gt;&amp;nbsp;&lt;/span&gt;  &lt;span style=&quot;font-family: Arial;&quot;&gt;&amp;nbsp;&lt;/span&gt;  = &lt;span cla...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.mcselec.com/bavr/index.php?title=DECLARE_SUB&amp;diff=580&amp;oldid=prev"/>
				<updated>2013-02-08T17:28:18Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Action&amp;lt;/span&amp;gt; =  Declares a subroutine.  &amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;  &amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;  = &amp;lt;span cla...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Action&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
Declares a subroutine.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Syntax&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span class=&amp;quot;f_Syntax&amp;quot;&amp;gt;DECLARE SUB&amp;lt;/span&amp;gt;&amp;amp;nbsp;TEST[( [BYREF/BYVAL/BYLABEL] var as type)]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Remarks&amp;lt;/span&amp;gt; =&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding: 0px; margin: 0px 0px 0px 4px;&amp;quot;&amp;gt;&lt;br /&gt;
{| width=&amp;quot;573&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;1&amp;quot; border=&amp;quot;1&amp;quot; style=&amp;quot;border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;14%&amp;quot; style=&amp;quot;width: 77px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
test&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;86%&amp;quot; style=&amp;quot;width: 487px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
Name of the procedure.&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;14%&amp;quot; style=&amp;quot;width: 77px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
Var&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;86%&amp;quot; style=&amp;quot;width: 487px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
Name of the variable(s).&lt;br /&gt;
&lt;br /&gt;
|- style=&amp;quot;vertical-align: top;&amp;quot;&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;14%&amp;quot; style=&amp;quot;width: 77px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
Type&lt;br /&gt;
&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; width=&amp;quot;86%&amp;quot; style=&amp;quot;width: 487px; border: 1px solid rgb(0, 0, 0);&amp;quot; | &lt;br /&gt;
Type of the variable(s). Byte, Word, Dword, &amp;amp;nbsp;Integer, Long, Single, Double or String.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;ARRAYS&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
Arrays can be passed by reference only. You need to add &amp;amp;nbsp;empty parenthesis&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;()&amp;lt;/span&amp;gt;&amp;amp;nbsp;after the variable to indicate that you pass an array.&lt;br /&gt;
&lt;br /&gt;
Inside the sub/function you also need to use () when accessing the variable.&lt;br /&gt;
&lt;br /&gt;
Let's have a look at an example.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;Declare Sub TestArray(&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;font-style: italic; font-weight: bold;&amp;quot;&amp;gt;ar()&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;as byte, b as byte)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;Dim a(10) as byte , q as byte&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;TestArray&amp;amp;nbsp;&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;font-style: italic; font-weight: bold;&amp;quot;&amp;gt;a(1)&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;, q&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial; font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, we add () after the variable to indicate that it is an array we pass.&lt;br /&gt;
&lt;br /&gt;
When we call the sub program, we pass the first address or the base address of the array. That is a(1) in this case.&lt;br /&gt;
&lt;br /&gt;
Inside the sub module, we also refer to the variable using ().&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;Sub TestArray(&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;font-style: italic; font-weight: bold;&amp;quot;&amp;gt;ar()&amp;lt;/span&amp;gt;&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;as byte, b as byte)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;print ar(1)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;print ar(b)&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;End Sub&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-style: italic;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In older BASCOM versions, it was not required to use (). You only needed to pass the base address. But that is potential unsafe&amp;amp;nbsp;: if you reference a variable as an array while it is actually a single variable, then you can write to the wrong address. When using (), the compiler known when an array is expected and can inform you about a possible error.&lt;br /&gt;
&lt;br /&gt;
If you have old code you can use CONFIG ERROR=IGNORE,380=IGNORE to ignore errors as a result of the updated syntax.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When BYREF or BYVAL is not provided, the parameter will be passed by reference.&lt;br /&gt;
&lt;br /&gt;
Use BYREF to pass a variable by reference with its address. When using the referenced address, you work on the original variable. So a change of the variable inside the sub routine, will change the variable outside the routine as well.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Use BYVAL to pass a copy of the variable. Passing a copy of the variable allows to alter the copy in the sub routine while leaving the original variable unaltered. BYVAL will not change the original passed variable but it requires more code since a copy of the parameter must be created.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Use BYLABEL to pass the address of a label. &amp;amp;nbsp;BYLABEL will pass the word address. It will not work for processors with multiple 64 KB pages.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Using BYLABEL on the EEPROM is possible but the EEPROM image must &amp;amp;nbsp;proceed the call with the label name.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
See also&amp;amp;nbsp;[[READEEPROM]],&amp;amp;nbsp;[[LOADLABEL]]&amp;amp;nbsp;and&amp;amp;nbsp;[[Memory usage|Memory usage]]&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
If you pass a string you may specify the length of the string. This length will be the maximum length the string may grow. This is important when you pass a string BYVAL.&lt;br /&gt;
&lt;br /&gt;
When you for example pass a string like &amp;quot;ABC&amp;quot; to a subroutine or function BYVAL, the compiler will create a copy with a length of 3. This is sufficient to pass it to the sub routine.&lt;br /&gt;
&lt;br /&gt;
But if the sub routine adds data to the string, it will not fit since the string is too short. In such a case you can specify the length.&amp;lt;span style=&amp;quot;font-weight: bold;&amp;quot;&amp;gt;&amp;amp;nbsp;s as string * 10&amp;lt;/span&amp;gt;, will create a string with a size of 10.&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the&amp;amp;nbsp;[[CALL]]&amp;amp;nbsp;statement for more details.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Notice.jpg|left|Notice.jpg]]&amp;amp;nbsp;You must declare each function before writing the function or calling the function. And the declaration must match the function. Optional you can use CONFIG SUBMODE=NEW so DECLARE is not required.&lt;br /&gt;
&lt;br /&gt;
Bits are global and can not be passed with functions or subs.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;See also&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
[[CALL]]&amp;amp;nbsp;,&amp;amp;nbsp;[[SUB]]&amp;amp;nbsp;,&amp;amp;nbsp;[[FUNCTION]]&amp;amp;nbsp;,&amp;amp;nbsp;[[CONFIG SUBMODE|CONFIG SUBMODE]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;font-family: Arial;&amp;quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= &amp;lt;span class=&amp;quot;f_Header&amp;quot;&amp;gt;Example&amp;lt;/span&amp;gt; =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'-----------------------------------------------------------------------------------------&lt;br /&gt;
'name : declare.bas&lt;br /&gt;
'copyright : (c) 1995-2005, MCS Electronics&lt;br /&gt;
'purpose : demonstrate using declare&lt;br /&gt;
'micro : Mega48&lt;br /&gt;
'suited for demo : yes&lt;br /&gt;
'commercial addon needed : no&lt;br /&gt;
' Note that the usage of SUBS works different in BASCOM-8051&lt;br /&gt;
'-----------------------------------------------------------------------------------------&lt;br /&gt;
 &lt;br /&gt;
$regfile = &amp;quot;m48def.dat&amp;quot; ' specify the used micro&lt;br /&gt;
$crystal = 4000000 ' used crystal frequency&lt;br /&gt;
$baud = 19200 ' use baud rate&lt;br /&gt;
$hwstack = 32 ' default use 32 for the hardware stack&lt;br /&gt;
$swstack = 10 ' default use 10 for the SW stack&lt;br /&gt;
$framesize = 40 ' default use 40 for the frame space&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
' First the SUB programs must be declared&lt;br /&gt;
 &lt;br /&gt;
'Try a SUB without parameters&lt;br /&gt;
Declare Sub Test2&lt;br /&gt;
 &lt;br /&gt;
'SUB with variable that can not be changed(A) and&lt;br /&gt;
'a variable that can be changed(B1), by the sub program&lt;br /&gt;
'When BYVAL is specified, the value is passed to the subprogram&lt;br /&gt;
'When BYREF is specified or nothing is specified, the address is passed to&lt;br /&gt;
'the subprogram&lt;br /&gt;
 &lt;br /&gt;
Declare Sub Test(byval A As Byte , B1 As Byte)&lt;br /&gt;
Declare Sub Testarray(byval A As Byte , B1 As Byte)&lt;br /&gt;
'All variable types that can be passed&lt;br /&gt;
'Notice that BIT variables can not be passed.&lt;br /&gt;
'BIT variables are GLOBAL to the application&lt;br /&gt;
Declare Sub Testvar(b As Byte , I As Integer , W As Word , L As Long , S As String)&lt;br /&gt;
 &lt;br /&gt;
'passing string arrays needs a different syntax because the length of the strings must be passed by the compiler&lt;br /&gt;
'the empty () indicated that an array will be passed&lt;br /&gt;
Declare Sub Teststr(b As Byte , Dl() As String)&lt;br /&gt;
 &lt;br /&gt;
Dim Bb As Byte , I As Integer , W As Word , L As Long , S As String * 10 'dim used variables&lt;br /&gt;
Dim Ar(10) As Byte&lt;br /&gt;
Dim Sar(10) As String * 8 'strng array&lt;br /&gt;
 &lt;br /&gt;
For Bb = 1 To 10&lt;br /&gt;
Sar(bb) = Str(bb) 'fill the array&lt;br /&gt;
Next&lt;br /&gt;
Bb = 1&lt;br /&gt;
'now call the sub and notice that we always must pass the first address with index 1&lt;br /&gt;
Call Teststr(bb , Sar(1))&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Call Test2 'call sub&lt;br /&gt;
Test2 'or use without CALL&lt;br /&gt;
'Note that when calling a sub without the statement CALL, the enclosing parentheses must be left out&lt;br /&gt;
Bb = 1&lt;br /&gt;
Call Test(1 , Bb) 'call sub with parameters&lt;br /&gt;
Print Bb 'print value that is changed&lt;br /&gt;
 &lt;br /&gt;
'now test all the variable types&lt;br /&gt;
Call Testvar(bb , I , W , L , S )&lt;br /&gt;
Print Bb ; I ; W ; L ; S&lt;br /&gt;
 &lt;br /&gt;
'now pass an array&lt;br /&gt;
'note that it must be passed by reference&lt;br /&gt;
Testarray 2 , Ar(1)&lt;br /&gt;
Print &amp;quot;ar(1) = &amp;quot; ; Ar(1)&lt;br /&gt;
Print &amp;quot;ar(3) = &amp;quot; ; Ar(3)&lt;br /&gt;
 &lt;br /&gt;
$notypecheck ' turn off type checking&lt;br /&gt;
Testvar Bb , I , I , I , S&lt;br /&gt;
'you can turn off type checking when you want to pass a block of memory&lt;br /&gt;
$typecheck 'turn it back on&lt;br /&gt;
End&lt;br /&gt;
 &lt;br /&gt;
'End your code with the subprograms&lt;br /&gt;
'Note that the same variables and names must be used as the declared ones&lt;br /&gt;
 &lt;br /&gt;
Sub Test(byval A As Byte , B1 As Byte) 'start sub&lt;br /&gt;
 Print A ; &amp;quot; &amp;quot; ; B1 'print passed variables&lt;br /&gt;
 B1 = 3 'change value&lt;br /&gt;
 'You can change A, but since a copy is passed to the SUB,&lt;br /&gt;
 'the change will not reflect to the calling variable&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub Test2 'sub without parameters&lt;br /&gt;
 Print &amp;quot;No parameters&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Sub Testvar(b As Byte , I As Integer , W As Word , L As Long , S As String)&lt;br /&gt;
 Local X As Byte&lt;br /&gt;
 X = 5 'assign local&lt;br /&gt;
 B = X&lt;br /&gt;
 I = -1&lt;br /&gt;
 W = 40000&lt;br /&gt;
 L = 20000&lt;br /&gt;
 S = &amp;quot;test&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Sub Testarray(byval A As Byte , B1 As Byte) 'start sub&lt;br /&gt;
 Print A ; &amp;quot; &amp;quot; ; B1 'print passed variables&lt;br /&gt;
 B1 = 3 'change value of element with index 1&lt;br /&gt;
 B1(1) = 3 'specify the index which does the same as the line above&lt;br /&gt;
 B1(3) = 3 'modify other element of array&lt;br /&gt;
 'You can change A, but since a copy is passed to the SUB,&lt;br /&gt;
 'the change will not reflect to the calling variable&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
'notice the empty() to indicate that a string array is passed&lt;br /&gt;
Sub Teststr(b As Byte , Dl() As String)&lt;br /&gt;
Dl(b) = Dl(b) + &amp;quot;add&amp;quot;&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Example BYLABEL&lt;br /&gt;
$regfile = &amp;quot;m88def.dat&amp;quot;&lt;br /&gt;
$hwstack = 40&lt;br /&gt;
$swstack = 80&lt;br /&gt;
$framesize = 80&lt;br /&gt;
 &lt;br /&gt;
Dim B As Byte , W As Word&lt;br /&gt;
 &lt;br /&gt;
Declare Sub Somesub(bylabel Mylabel As Word)&lt;br /&gt;
Somesub Alabel&lt;br /&gt;
End&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
Sub Somesub(bylabel Mylabel As Word)&lt;br /&gt;
 W = Mylabel ' this points to the BYTE address of the data&lt;br /&gt;
 lds _dptrl,{W } ' point to&lt;br /&gt;
 LDS _dptrh,{W+1}&lt;br /&gt;
 Read B : Print B&lt;br /&gt;
End Sub&lt;br /&gt;
 &lt;br /&gt;
Alabel:&lt;br /&gt;
Data 1 , 2 , 3&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;{{Languages}}&lt;br /&gt;
&lt;br /&gt;
[[Category:BASCOM Language Reference]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>