<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.signature.net/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.signature.net/index.php?action=history&amp;feed=atom&amp;title=IB_Statements%2Fsetbit</id>
		<title>IB Statements/setbit - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.signature.net/index.php?action=history&amp;feed=atom&amp;title=IB_Statements%2Fsetbit"/>
		<link rel="alternate" type="text/html" href="http://wiki.signature.net/index.php?title=IB_Statements/setbit&amp;action=history"/>
		<updated>2026-05-04T20:33:02Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.0</generator>

	<entry>
		<id>http://wiki.signature.net/index.php?title=IB_Statements/setbit&amp;diff=413&amp;oldid=prev</id>
		<title>Badge: New page: '''SETBIT function'''   '''Discussion:'''  The SETBIT function sets the specified bit in a string expression.    '''Syntax:'''  Result = SETBIT(string-expression, bit-location, bit-value [...</title>
		<link rel="alternate" type="text/html" href="http://wiki.signature.net/index.php?title=IB_Statements/setbit&amp;diff=413&amp;oldid=prev"/>
				<updated>2009-05-22T09:43:03Z</updated>
		
		<summary type="html">&lt;p&gt;New page: &amp;#39;&amp;#39;&amp;#39;SETBIT function&amp;#39;&amp;#39;&amp;#39;   &amp;#39;&amp;#39;&amp;#39;Discussion:&amp;#39;&amp;#39;&amp;#39;  The SETBIT function sets the specified bit in a string expression.    &amp;#39;&amp;#39;&amp;#39;Syntax:&amp;#39;&amp;#39;&amp;#39;  Result = SETBIT(string-expression, bit-location, bit-value [...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''SETBIT function'''&lt;br /&gt;
 &lt;br /&gt;
'''Discussion:'''  The SETBIT function sets the specified bit in a string expression.  &lt;br /&gt;
&lt;br /&gt;
'''Syntax:'''  Result = SETBIT(string-expression, bit-location, bit-value [,EXCP=label])&lt;br /&gt;
&lt;br /&gt;
'''Where:'''&lt;br /&gt;
Result contains the value of the bit before it was set. Valid values are 0 and 1.&lt;br /&gt;
&lt;br /&gt;
String-expression is a string value encoded in binary form.&lt;br /&gt;
&lt;br /&gt;
Bit-location is a numeric value specifying the bit that is to be set.&lt;br /&gt;
&lt;br /&gt;
Bits are 0-based and are ordered according to the following scheme:&lt;br /&gt;
&lt;br /&gt;
If the string-expression contains 8 bits, they are ordered:&lt;br /&gt;
&lt;br /&gt;
7 6 5 4 3 2 1 0&lt;br /&gt;
&lt;br /&gt;
If the string-expression contains 16 bits, they are ordered:&lt;br /&gt;
&lt;br /&gt;
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8&lt;br /&gt;
&lt;br /&gt;
If the string-expression contains 24 bits, they are ordered:&lt;br /&gt;
&lt;br /&gt;
7 6 5 4 3 2 1 0 15 14 13 12 11 10 9 8 23 22 21 20 19 18 17 16&lt;br /&gt;
&lt;br /&gt;
Bit-value is 0 or 1.&lt;br /&gt;
&lt;br /&gt;
An exception occurs if the program attempts to set a bit beyond the declared length of the string-expression.  &lt;br /&gt;
&lt;br /&gt;
'''Example:'''&lt;br /&gt;
  A$ = “@0000@”&lt;br /&gt;
 !&lt;br /&gt;
  B$ = HEXASC(A$)&lt;br /&gt;
  Print “Before:”;B$&lt;br /&gt;
  !&lt;br /&gt;
  FOR I = 8 TO 11&lt;br /&gt;
  J = SETBIT(A$,I,1,EXCP=9999)&lt;br /&gt;
  Print “Bit”;I;”was”;J&lt;br /&gt;
  NEXT I&lt;br /&gt;
  !&lt;br /&gt;
  B$ = HEXASC(A$)&lt;br /&gt;
  Print “After”;B$&lt;/div&gt;</summary>
		<author><name>Badge</name></author>	</entry>

	</feed>