<!--
	Assembler Encoding for the Exchange mnemonic
	Version: 1.0.0
	Date Created:  2007-04-15
	Last Modified: 2007-05-22

	Designed for Pentium and higher x86 Processors in 32bit mode protected mode
	Optimized for Speed
	
	Done list:
	o U/S8-32,Boolean and U/S8-32,Boolean
	o EndRegs operations

	To Do:
	o U/S48-256 and Everything
-->
<encoding procfamily="x86" bitdepth="32" proc="P1">
	<!-- ############################################################################################################ -->
	<!-- ############################################################################################################ -->
	<!-- ############################################################################################################ -->
	<!-- Exchange Mnemonic -->
	<mnemonic name="Exchange" type="Dual" option="Speed">
		<!-- ********************************************************************************************************** -->
		<!-- Exchanging with 8bit values -->

		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 8bit and 8bit -->
		<codetypeset param0="U/S8" param1="U/S8">
			<codeset param0="M" param1="M" total="2" totalv="2"
				lostregs="al,dl" endregs="al=@1.U8,dl=@0.U8" endpipe="V">
				<line code="mov al, @0.U8" time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov dl, @1.U8" time=" V1" timev="U 1" comment="Get the other value" />
				<line code="mov @1.U8, al" time="U 1" timev="U*1" comment="Start the swap" />
				<line code="mov @0.U8, dl" time=" V1"             comment="Complete the swap" />
			</codeset>
			<codeset param0="M" param1="R" total="2" totalv="1"
				lostregs="al" endregs="al=@1.U8" endpipe="V">
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the memory value" />
				<line code="mov @0.U8, @1.U8" time="U*1" timev="U 1" comment="Swap to the memory value" />
				<line code="mov @1.U8, al"    time=" V1"             comment="Swap to the register value" />
			</codeset>

			<codeset param0="R" param1="M" total="2" totalv="1"
				lostregs="al" endregs="al=@0.U8" endpipe="V">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the memory value" />
				<line code="mov @1.U8, @0.U8" time="U*1" timev="U 1" comment="Swap to the memory value" />
				<line code="mov @0.U8, al"    time=" V1"             comment="Swap to the register value" />
			</codeset>
			<codeset param0="R" param1="R" total="2" totalv="1"
				lostregs="al" endregs="al=@0.U8" endpipe="S">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov @1.U8, @0.U8" time=" V1" timev="U 1" comment="Start the swap" />
				<line code="mov @0.U8, al"    time="U 1" timev=" V1" comment="Complete the swap" />
			</codeset>
		</codetypeset>


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 16bit and 8bit -->
		
		<!-- ====================================================================================== -->
		<!-- With U8 -->
		<codetypeset param0="U/S16" param1="U8" id="ExchangeUS16AndU8">
			<codeset param0="M" param1="M" total="3" totalv="3"
				lostregs="al,dl" endregs="al=@0.U8,dl=@1.U8" endpipe="U">
				<line code="mov al, @1.U8"   time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov dl, @0.U8"   time=" V1" timev="U 1" comment="Get the lower 8 bits of the 16bit value" />
				<line code="mov @0.U8, al"   time="U 1" timev="U*1" comment="Swap to the lower 8bits of the 16bit value" />
				<line code="mov @1.U8, dl"   time=" V1"             comment="Swap to the 8bit value" />
				<line code="mov @0.U8[1], 0" time="U 1"             comment="Store a zero to zero extend" />
			</codeset>
			<codeset param0="M" param1="R" total="3" totalv="2"
				lostregs="al" endregs="al=@1.U8" endpipe="U">
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the lower 8 bits of the 16bit value" />
				<line code="mov @0.U8, @1.U8" time="U*1" timev="U 1" comment="Swap to the lower 8 bits of the 16bit value" />
				<line code="mov @1.U8, al"    time=" V1"             comment="Swap to the 8bit value" />
				<line code="mov @0.U8[1], 0"  time="U 1"             comment="Store a zero to zero extend" />
			</codeset>

			<codeset param0="R" param1="M" total="2" totalv="2"
				lostregs="al" endregs="al=@0.U8" endpipe="V">
				<line code="xor @0.U8[1], @0.U8[1]" time="U 1" timev=" V1" comment="Clear to zero for zero extend" />
				<line code="mov al, @1.U8"          time=" V1" timev="U 1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8"       time="U 1" timev="U*1" comment="Swap to the 8bit value" />
				<line code="mov @0.U8, al"          time=" V1"             comment="Swap to the lower 8 bits of the 16bit value" />
			</codeset>
			<codeset param0="R" param1="R" total="2" totalv="2"
				lostregs="al" endregs="al=@0.U8" endpipe="S">
				<line code="xor @0.U8[1], @0.U8[1]" time="U 1" timev=" V1" comment="Clear to zero for zero extend" />
				<line code="mov al, @1.U8"          time=" V1" timev="U 1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8"       time="U 1" timev=" V1" comment="Swap to the 8bit value" />
				<line code="mov @0.U8, al"          time=" V1" timev="U 1" comment="Swap to the lower 8 bits of the 16bit value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U8" param1="U/S16" reverseof="ExchangeUS16AndU8" />

		<!-- ====================================================================================== -->
		<!-- With S8 -->
		<codetypeset param0="U/S16" param1="S8" id="ExchangeUS16AndS8">
			<codeset param0="M" param1="M" total="4" totalv="4"
				lostregs="al,dl" endregs="al=@0.U8,dl=@1.U8[1]" endpipe="U">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov dl, @0.U8"    time=" V1" timev="U 1" comment="Get the lower 8 bits of the 16bit value" />
				<line code="mov @0.U8, al"    time="U 1" timev="U*1" comment="Swap to the lower 8 bits of the 16bit value" />
				<line code="mov @1.U8, dl"    time=" V1"             comment="Swap to the 8bit value" />
				<line code="sar dl, 8"        time="U!1"             comment="SAR to effectively sign extend" />
				<line code="mov @0.U8[1], dl" time="U*1"             comment="Store the sign extended byte" />
			</codeset>
			<codeset param0="M" param1="R" total="4" totalv="3"
				lostregs="al" endregs="al=@0.U8[1]" endpipe="U">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8" time="U*1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="mov @0.U8, al"    time=" V1"             comment="Swap to the lower 8 bits of the 16bit value" />
				<line code="sar al, 8"        time="U!1"             comment="SAR to effectively sign extend" />
				<line code="mov @0.U8[1], al" time="U*1"             comment="Store the sign extended byte" />
			</codeset>

			<codeset param0="R" param1="M" total="3" totalv="2" endpipe="U">
				<line code="mov @0.U8[1], @1.U8" time="U 1" timev=" V1" comment="Store the 8bit value in the 16bit value's high byte" />
				<line code="mov @1.U8, @0.U8"    time="U*1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="mov @0.U8, @0.U8[1]" time=" V1"             comment="Put the 8bit value into the 16bit value's low byte" />
				<line code="sar @0.U8[1], 8"     time="U!1"             comment="SAR to effectively sign extend the high byte" />
			</codeset>
			<codeset param0="R" param1="R" total="3" totalv="2" endpipe="U">
				<line code="mov @0.U8[1], @1.U8" time="U 1" timev=" V1" comment="Get the 8bit value into the 16bit value's high byte" />
				<line code="mov @1.U8, @0.U8"    time=" V1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="mov @0.U8, @0.U8[1]" time="U 1" timev=" V1" comment="Put the 8bit value into the 16bit value's low byte" />
				<line code="sar @0.U8[1], 8"     time="U!1"             comment="SAR to effectively sign extend in the high byte" />
			</codeset>
		</codetypeset>
		<codetypeset param0="S8" param1="U/S16" reverseof="ExchangeUS16AndS8" />


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 24bit and 8bit -->
		
		<!-- ====================================================================================== -->
		<!-- With U8 -->
		<codetypeset param0="U/S24" param1="U8" id="ExchangeUS24AndU8">
			<codeset param0="M" param1="M" total="4" totalv="3"
				lostregs="al,dl" endregs="al=@0.U8,dl=@1.U8" endpipe="U">
				<line code="mov @0.U8[2], 0" time="U 1" timev=" V1" comment="Store a zero to zero extend" />
				<line code="mov al, @1.U8"   time=" V1" timev="U 1" comment="Get the 8bit value" />
				<line code="mov dl, @0.U8"   time="U 1" timev=" V1" comment="Get the lower 8bits of the 24bit value" />
				<line code="mov @0.U8, al"   time="U*1" timev="U 1" comment="Swap to the lower 8 bits of the 24bit value" />
				<line code="mov @1.U8, dl"   time=" V1"             comment="Swap to the 8bit value" />
				<line code="mov @0.U8[1], 0" time="U 1"             comment="Store a zero to zero extend" />
			</codeset>
			<codeset param0="M" param1="R" total="4" totalv="3"
				lostregs="al" endregs="al=@1.U8" endpipe="U">
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the lower 8bits of the 24bit value" />
				<line code="mov @0.U8, @1.U8" time="U*1" timev="U 1" comment="Swap to the lower 8 bits of the 24bit value" />
				<line code="mov @1.U8, al"    time=" V1"             comment="Swap to the 8bit value" />
				<line code="mov @0.U8[1], 0"  time="U 1"             comment="Store a zero to zero extend" />
				<line code="mov @0.U8[2], 0"  time="U*1"             comment="Store a zero to zero extend" />
			</codeset>

			<codeset param0="R" param1="M" total="3" totalv="2"
				lostregs="al" endregs="al=@0.U8" endpipe="U">
				<line code="mov al, @1.U8"      time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8"   time="U*1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="xor @0.U32, @0.U32" time=" V1" timev=" V1" comment="Clear to zero for zero extend" />
				<line code="mov @0.U8, al"      time="U 1"             comment="Swap to the lower 8 bits of the 24bit value" />
			</codeset>
			<codeset param0="R" param1="R" total="3" totalv="2"
				lostregs="al" endregs="al=@0.U8" endpipe="S">
				<line code="mov al, @1.U8"      time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8"   time="U*1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="xor @0.U32, @0.U32" time=" V1"             comment="Clear to zero for zero extend" />
				<line code="mov @0.U8, al"      time="U 1"             comment="Swap to the lower 8 bits of the 24bit value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U8" param1="U/S24" reverseof="ExchangeUS24AndU8" />


		<!-- ====================================================================================== -->
		<!-- With S8 -->
		<codetypeset param0="U/S24" param1="S8" id="ExchangeUS24AndS8">
			<codeset param0="M" param1="M" total="6" totalv="5"
				lostregs="eax,dl" endregs="al=@0.U8,ah=@0.U8[1],ah=@0.U8[2],eax=@0.S24,dl=@1.U8" endpipe="U">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="shl eax, 24"      time="U!1"             comment="Shift the 8bit value to the top 8 bits" />
				<line code="mov dl, @0.U8"    time=" V1"             comment="Get the lower 8 bits of the 24bit value" />
				<line code="sar eax, 24"      time="U!1"             comment="SAR back down to sign extend" />
				<line code="mov @1.U8, dl"    time=" V1"             comment="Swap to the 8bit value" />
				<line code="mov @0.U8, al"    time="U 1"             comment="Swap to the lower 8 bits of the 24bit value" />
				<line code="mov @0.U8[1], ah" time="U*1"             comment="Store the sign extended byte" />
				<line code="mov @0.U8[2], ah" time="U*1"             comment="Store the second sign extended byte" />
			</codeset>
			<codeset param0="M" param1="R" total="6" totalv="5"
				lostregs="eax" endregs="al=@0.U8,ah=@0.U8[1],ah=@0.U8[2],eax=@0.S24" endpipe="U">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="shl eax, 24"      time="U!1"             comment="Shift the 8bit value to the top 8 bits" />
				<line code="mov @1.U8, @0.U8" time=" V1"             comment="Swap to the 8bit value" />
				<line code="sar eax, 24"      time="U!1"             comment="SAR back down to sign extend" />
				<line code="mov @0.U8, al"    time="U*1"             comment="Swap to the lower 8 bits of the 24bit value" />
				<line code="mov @0.U8[1], ah" time="U*1"             comment="Store the sign extended byte" />
				<line code="mov @0.U8[2], ah" time="U*1"             comment="Store the second sign extended byte" />
			</codeset>

			<codeset param0="R" param1="M,R" param0type="U24" total="5" totalv="4"
				lostregs="eax" endregs="eax=@0.U24" endpipe="U">
				<line code="mov al, @1.U8"     time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="shl eax, 24"       time="U!1"             comment="Shift the 8bit value to the top 8 bits" />
				<line code="mov @1.U8, @0.U8"  time=" V1"             comment="Swap to the 8bit value" />
				<line code="sar eax, 24"       time="U!1"             comment="SAR back down to sign extend" />
				<line code="and eax, 0FFFFFFh" time="U*1"             comment="Clear the high byte" />
				<line code="mov @0.U32, eax"   time="U*1"             comment="Store the resulting 24bit value" />
			</codeset>
			<codeset param0="R" param1="M,R" param0type="S24" total="4" totalv="3"
				lostregs="eax" endregs="eax=@0.S24" endpipe="U">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="shl eax, 24"      time="U!1"             comment="Shift the 8bit value to the top 8 bits" />
				<line code="mov @1.U8, @0.U8" time=" V1"             comment="Swap to the 8bit value" />
				<line code="sar eax, 24"      time="U!1"             comment="SAR back down to sign extend" />
				<line code="mov @0.U32, eax"  time="U*1"             comment="Store the resulting 24bit value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="S8" param1="U/S24" reverseof="ExchangeUS24AndS8" />


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 32bit and 8bit -->

		<!-- ====================================================================================== -->
		<!-- With U8 -->
		<codetypeset param0="U/S32" param1="U8" id="ExchangeUS32AndU8">
			<codeset param0="M" param1="M" total="3" totalv="2"
				lostregs="eax,dl" endregs="eax=@0.U32,dl=@1.U8" endpipe="V">
				<line code="xor eax, eax"    time="U 1" timev=" V1" comment="Clear to zero so the 8bit value will be zero extended" />
				<line code="mov dl, @0.U8"   time=" V1" timev="U 1" comment="Get the lower 8 bits of the 32bit value" />
				<line code="mov al, @1.U8"   time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov @1.U8, dl"   time="U*1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="mov @0.U32, eax" time=" V1"             comment="Swap to the full 32bit value" />
			</codeset>
			<codeset param0="M" param1="R" total="3" totalv="2"
				lostregs="eax" endregs="eax=@0.U32" endpipe="U">
				<line code="xor eax, eax"     time="U 1" timev=" V1" comment="Clear to zero so the 8bit value will be zero extended" />
				<line code="mov al, @1.U8"    time="U*1" timev="U 1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8" time=" V1"             comment="Swap to the 8bit value" />
				<line code="mov @0.U32, eax"  time="U 1"             comment="Swap to the full 32bit value" />
			</codeset>

			<codeset param0="R" param1="M" total="2" totalv="2"
				lostregs="al" endregs="al=@0.U8" endpipe="V">
				<line code="xor @0.U32, @0.U32" time="U 1" timev=" V1" comment="Clear to zero for zero extend" />
				<line code="mov al, @1.U8"      time=" V1" timev="U 1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8"   time="U 1" timev="U*1" comment="Swap to the 8bit value" />
				<line code="mov @0.U8, al"      time=" V1"             comment="Swap to the lower 8 bits of the 32bit value" />
			</codeset>
			<codeset param0="R" param1="R" total="2" totalv="2"
				lostregs="al" endregs="al=@0.U8" endpipe="S">
				<line code="xor @0.U32, @0.U32" time="U 1" timev=" V1" comment="Clear to zero for zero extend" />
				<line code="mov al, @1.U8"      time=" V1" timev="U 1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8"   time="U 1" timev=" V1" comment="Swap to the 8bit value" />
				<line code="mov @0.U8, al"      time=" V1" timev="U 1" comment="Swap to the lower 8 bits of the 32bit value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U8" param1="U/S32" reverseof="ExchangeUS32AndU8" />

		<!-- ====================================================================================== -->
		<!-- With S8 -->
		<codetypeset param0="U/S32" param1="S8" id="ExchangeUS32AndS8">
			<codeset param0="M" param1="M" total="4" totalv="3"
				lostregs="eax,dl" endregs="eax=@0.U32,dl=@1.U8" endpipe="U">
				<line code="mov al, @1.U8"   time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="shl eax, 24"     time="U!1"             comment="Shift the 8bit value to the top 8 bits" />
				<line code="mov dl, @0.U8"   time=" V1"             comment="Get the lower 8 bits of the 32bit value" />
				<line code="sar eax, 24"     time="U!1"             comment="SAR back down to sign extend" />
				<line code="mov @1.U8, dl"   time=" V1"             comment="Swap to the 8bit value" />
				<line code="mov @0.U32, eax" time="U 1"             comment="Swap to the full 32bit value" />
			</codeset>
			<codeset param0="M" param1="R" total="4" totalv="3"
				lostregs="eax" endregs="eax=@0.U32" endpipe="U">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="shl eax, 24"      time="U!1"             comment="Shift the 8bit value to the top 8 bits" />
				<line code="mov @1.U8, @0.U8" time=" V1"             comment="Swap to the 8bit value" />
				<line code="sar eax, 24"      time="U!1"             comment="SAR back down to sign extend" />
				<line code="mov @0.U32, eax"  time="U*1"             comment="Swap to the full 32bit value" />
			</codeset>

			<codeset param0="R" param1="M,R" total="3" totalv="3"
				lostregs="al" endregs="al=@1.U8" endpipe="U">
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the lower 8 bits of the 32bit value" />
				<line code="mov @0.U8, @1.U8" time=" V1" timev="U 1" comment="Swap to the lower 8 bits of the 32bit value" />
				<line code="shl @0.U32, 24"   time="U!1"             comment="Shift the 8bit value to the top 8 bits" />
				<line code="mov @1.U8, al"    time=" V1"             comment="Swap to the 8bit value" />
				<line code="sar @0.U32, 24"   time="U!1"             comment="SAR back down to sign extend" />
			</codeset>
		</codetypeset>
		<codetypeset param0="S8" param1="U/S32" reverseof="ExchangeUS32AndS8" />


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between Boolean and 8bit -->
		<codetypeset param0="Boolean" param1="U/S8" id="ExchangeBooleanAndUS8">
			<codeset param0="M" param1="M" total="5" totalv="4"
				lostregs="al,dl" endregs="al=@0.U8,dl=@1.U8" endpipe="U">
				<line code="mov al, @1.U8" time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov dl, @0.U8" time=" V1" timev="U 1" comment="Get the boolean value" />
				<line code="add al, -1"    time="U 1" timev=" V1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov @1.U8, dl" time=" V1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="mov al, 0"     time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="adc al, al"    time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="mov @0.U8, al" time="U*1"             comment="Swap to the boolean value" />
			</codeset>
			<codeset param0="M" param1="R" total="5" totalv="4"
				lostregs="al" endregs="al=@0.U8" endpipe="U">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the 8bit value" />
				<line code="mov @1.U8, @0.U8" time=" V1" timev="U 1" comment="Swap to the 8bit value" />
				<line code="add al, -1"       time="U 1" timev=" V1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov al, 0"        time="U*1"             comment="Clear to zero" />
				<line code="adc al, al"       time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="mov @0.U8, al"    time="U*1"             comment="Swap to the boolean value" />
			</codeset>

			<codeset param0="R" param1="M" total="4" totalv="4"
				lostregs="al" endregs="al=@1.U8" endpipe="U">
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="mov @0.U8, @1.U8" time=" V1" timev="U 1" comment="Swap to the boolean value" />
				<line code="mov @1.U8, al"    time="U 1" timev="U*1" comment="Swap to the 8bit value" />
				<line code="add @0.U8, -1"    time=" V1"             comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov @0.U8, 0"     time="U 1"             comment="Clear to zero" />
				<line code="adc @0.U8, @0.U8" time="U!1"             comment="1 if carry, 0 if no carry" />
			</codeset>
			<codeset param0="R" param1="R" total="4" totalv="4"
				lostregs="al" endregs="al=@1.U8" endpipe="U">
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="mov @0.U8, @1.U8" time=" V1" timev="U 1" comment="Swap to the boolean value" />
				<line code="mov @1.U8, al"    time="U 1" timev=" V1" comment="Swap to the 8bit value" />
				<line code="add @0.U8, -1"    time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov @0.U8, 0"     time="U 1" timev="U*1" comment="Clear to zero" />
				<line code="adc @0.U8, @0.U8" time="U!1"             comment="1 if carry, 0 if no carry" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U/S8" param1="Boolean" reverseof="ExchangeBooleanAndUS8" />



		<!-- ********************************************************************************************************** -->
		<!-- Exchanging with 16bit values -->

		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 16bit and 16bit -->
		<codetypeset param0="U/S16" param1="U/S16">
			<codeset param0="M" param1="M" total="6" totalv="6"
				lostregs="ax,dx" endregs="ax=@1.U16,dx=@0.U16" endpipe="V">
				<line code="mov ax, @0.U16" time="U 1+1" timev=" V1+1" comment="Get one value" />
				<line code="mov dx, @1.U16" time=" V1+1" timev="U 1+1" comment="Get the other value" />
				<line code="mov @1.U16, ax" time="U 1+1" timev="U*1+1" comment="Start the swap" />
				<line code="mov @0.U16, dx" time=" V1+1"               comment="Complete the swap" />
			</codeset>
			<codeset param0="M" param1="R" total="4" endpipe="V">
				<line code="xchg @0.U16, @1.U16" time="&#45;&#45;3+1" comment="Exchange the two values" />
			</codeset>

			<codeset param0="R" param1="M" total="4" endpipe="V">
				<line code="xchg @0.U16, @1.U16" time="&#45;&#45;3+1" comment="Exchange the two values" />
			</codeset>
			<codeset param0="R" param1="R" total="2" totalv="1"
				lostregs="eax" endregs="eax=@1.U32" endpipe="S">
				<line code="mov eax, @0.U32"    time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov @0.U32, @1.U32" time=" V1" timev="U 1" comment="Get the other value" />
				<line code="mov @1.U32, eax"    time="U 1" timev=" V1" comment="Complete the swap" />
			</codeset>
		</codetypeset>


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 24bit and 16bit -->

		<!-- ====================================================================================== -->
		<!-- With U16 -->
		<codetypeset param0="U/S24" param1="U16" id="ExchangeUS24AndU16">
			<codeset param0="M" param1="M,R" total="7" totalv="6"
				lostregs="ax,dx" endregs="ax=@1.U16,dx=@0.U16" endpipe="S">
				<line code="mov ax, @0.U16"  time="U 1+1" timev=" V1+1" comment="Get the lower 16 bits of the 24bit value" />
				<line code="mov dx, @1.U16"  time=" V1+1" timev="U 1+1" comment="Get the 16bit value" />
				<line code="mov @0.U8[2], 0" time="U 1"   timev=" V1"   comment="Clear the top byte of the 24bit value to 0" />
				<line code="mov @1.U16, ax"  time=" V1+1" timev="U 1+1" comment="Swap to the 16bit value" />
				<line code="mov @0.U16, dx"  time="U 1+1" timev=" V1+1" comment="Swap to the lower 16 bits of the 24bit value" />
			</codeset>

			<codeset param0="R" param1="M" total="4" totalv="4"
				lostregs="eax" endregs="ax=@1.U16" endpipe="V">
				<line code="mov eax, @0.U32"    time="U 1"   timev=" V1"   comment="Get the full 32bit register of the 24bit value" />
				<line code="mov @0.U16, @1.U16" time=" V1+1" timev="U 1+1" comment="Swap to the lower 16 bits of the 24bit value" />
				<line code="mov @1.U16, ax"     time="U 1+1" timev="U*1+1" comment="Swap to the 16bit value" />
				<line code="and @0.U32, 0FFFFh" time=" V1"                 comment="Clear the upper 16 bits of the full 32bit register" />
			</codeset>
			<codeset param0="R" param1="R" total="2" totalv="2"
				lostregs="eax" endregs="ax=@1.U16" endpipe="S">
				<line code="mov eax, @0.U32"    time="U 1" timev=" V1" comment="Get the full 32bit register of the 24bit value" />
				<line code="mov @0.U32, @1.U32" time=" V1" timev="U 1" comment="Swap to the lower 16 bits of the 24bit value" />
				<line code="mov @1.U32, eax"    time="U 1" timev=" V1" comment="Swap to the 16bit value" />
				<line code="and @0.U32, 0FFFFh" time=" V1" timev="U 1" comment="Clear the upper 16 bits of the full 32bit register" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U16" param1="U/S24" reverseof="ExchangeUS24AndU16" />


		<!-- ====================================================================================== -->
		<!-- With S16 -->
		<codetypeset param0="U/S24" param1="S16" id="ExchangeUS24AndS16">
			<codeset param0="M" param1="M,R" total="8" totalv="8"
				lostregs="ax,dx" endregs="ax=@1.U16,dh=@0.U8[2],dl=@0.U8" endpipe="U">
				<line code="mov ax, @0.U16"   time="U 1+1" timev=" V1+1" comment="Get the lower 16 bits of the 24bit value" />
				<line code="mov dx, @1.U16"   time=" V1+1" timev="U 1+1" comment="Get the 16bit value" />
				<line code="mov @1.U16, ax"   time="U 1+1" timev="U*1+1" comment="Swap to the 16bit value" />
				<line code="mov @0.U16, dx"   time=" V1+1"               comment="Swap to the lower 16 bits of the 24bit value" />
				<line code="sar dh, 8"        time="U!1"                 comment="SAR the high byte to sign extend" />
				<line code="mov @0.U8[2], dh" time="U*1"                 comment="Store the sign extended byte" />
			</codeset>

			<codeset param0="R" param1="M" param0type="U24" total="8" totalv="7"
				lostregs="eax" endregs="eax=@0.U24" endpipe="U">
				<line code="mov ax, @1.U16"     time="U 1+1" timev=" V1+1" comment="Get the 16bit value" />
				<line code="mov @1.U16, @0.U16" time="U*1+1" timev="U 1+1" comment="Swap to the 16bit value" />
				<line code="shl eax, 16"        time="U!1"                 comment="Shift the 16 bit value to the high 16 bits" />
				<line code="sar eax, 16"        time="U!1"                 comment="SAR to sign extend" />
				<line code="and eax, 0FFFFFFh"  time="U*1"                 comment="Clear the high byte" />
				<line code="mov @0.U32, eax"    time="U*1"                 comment="Store the full register value" />
			</codeset>
			<codeset param0="R" param1="M" param0type="S24" total="7" totalv="6"
				lostregs="eax" endregs="eax=@0.S24" endpipe="U">
				<line code="mov ax, @1.U16"     time="U 1+1" timev=" V1+1" comment="Get the 16bit value" />
				<line code="mov @1.U16, @0.U16" time="U*1+1" timev="U 1+1" comment="Swap to the 16bit value" />
				<line code="shl eax, 16"        time="U!1"                 comment="Shift the 16 bit value to the high 16 bits" />
				<line code="sar eax, 16"        time="U!1"                 comment="SAR to sign extend" />
				<line code="mov @0.U32, eax"    time="U*1"                 comment="Store the full register value" />
			</codeset>
			<codeset param0="R" param1="R" param0type="U24" total="5" totalv="5"
				lostregs="eax" endregs="eax=@0.U24" endpipe="U">
				<line code="mov eax, @1.U32"    time="U 1" timev=" V1" comment="Get the 16bit value" />
				<line code="mov @1.U32, @0.U32" time=" V1" timev="U 1" comment="Swap to the 16bit value" />
				<line code="shl eax, 16"        time="U!1"             comment="Shift the 16 bit value to the high 16 bits" />
				<line code="sar eax, 16"        time="U!1"             comment="SAR to sign extend" />
				<line code="and eax, 0FFFFFFh"  time="U*1"             comment="Clear the high byte" />
				<line code="mov @0.U32, eax"    time="U*1"             comment="Store the full register value" />
			</codeset>
			<codeset param0="R" param1="R" param0type="S24" total="4" totalv="4"
				lostregs="eax" endregs="eax=@0.S24" endpipe="U">
				<line code="mov eax, @1.U32"    time="U 1" timev=" V1" comment="Get the 16bit value" />
				<line code="mov @1.U32, @0.U32" time=" V1" timev="U 1" comment="Swap to the 16bit value" />
				<line code="shl eax, 16"        time="U!1"             comment="Shift the 16 bit value to the high 16 bits" />
				<line code="sar eax, 16"        time="U!1"             comment="SAR to sign extend" />
				<line code="mov @0.U32, eax"    time="U*1"             comment="Store the full register value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="S16" param1="U/S24" reverseof="ExchangeUS24AndS16" />


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 32bit and 16bit -->

		<!-- ====================================================================================== -->
		<!-- With U16 -->
		<codetypeset param0="U/S32" param1="U16" id="Exchange32bitAndU16bit">
			<codeset param0="M" param1="M" total="5" totalv="4"
				lostregs="eax,edx" endregs="ax=@1.U16,edx=@0.U32" endpipe="V">
				<line code="xor edx, edx"    time="U 1"   timev=" V1"   comment="Clear to zero" />
				<line code="mov eax, @0.U32" time=" V1"   timev="U 1"   comment="Get the 32bit value" />
				<line code="mov dx, @1.U16"  time="U 1+1" timev=" V1+1" comment="Get the 16bit value" />
				<line code="mov @1.U16, ax"  time="U*1+1" timev="U 1+1" comment="Swap to the 16bit value" />
				<line code="mov @0.U32, edx" time=" V1"                 comment="Swap to the 32bit value" />
			</codeset>
			<codeset param0="M,R" param1="R" total="5" totalv="4"
				lostregs="eax" endregs="eax=@0.U32" endpipe="V">
				<line code="xor eax, eax"       time="U 1"   timev=" V1"   comment="Clear to zero" />
				<line code="mov ax, @1.U16"     time="U*1+1" timev="U 1+1" comment="Get the 16bit value" />
				<line code="mov @1.U16, @0.U16" time=" V1+1"               comment="Swap to the 16bit value" />
				<line code="mov @0.U32, eax"    time="U 1"                 comment="Swap to the 32bit value" />
			</codeset>

			<codeset param0="R" param1="M" total="4" totalv="4"
				lostregs="eax" endregs="ax=@1.U16" endpipe="V">
				<line code="mov eax, @0.U32"    time="U 1"   timev=" V1"   comment="Get the 32bit value" />
				<line code="mov @0.U16, @1.U16" time=" V1+1" timev="U 1+1" comment="Swap to the bottom 16 bits of the 32bit value" />
				<line code="mov @1.U16, ax"     time="U 1+1" timev="U*1+1" comment="Swap to the 16bit value" />
				<line code="and @0.U32, 0FFFFh" time=" V1"                 comment="Keep only the bottom 16 bits" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U16" param1="U/S32" reverseof="Exchange32bitAndU16bit" />


		<!-- ====================================================================================== -->
		<!-- With S16 -->
		<codetypeset param0="U/S32" param1="S16" id="Exchange32bitAndS16bit">
			<codeset param0="M" param1="M" total="6" totalv="5"
				lostregs="eax,edx" endregs="eax=@0.U32,dx=@1.U16" endpipe="U">
				<line code="mov ax, @1.U16"  time="U 1+1" timev=" V1+1" comment="Get the 16bit value" />
				<line code="shl eax, 16"     time="U!1"                 comment="Shift it to the upper 16 bits" />
				<line code="mov edx, @0.U32" time=" V1"                 comment="Get the 32bit value" />
				<line code="sar eax, 16"     time="U!1"                 comment="SAR it back down to sign extend" />
				<line code="mov @1.U16, dx"  time=" V1+1"               comment="Swap to the 16bit value" />
				<line code="mov @0.U32, eax" time="U 1"                 comment="Swap to the 32bit value" />
			</codeset>
			<codeset param0="M,R" param1="R" total="3"
				lostregs="eax" endregs="eax=@1.U32" endpipe="V">
				<line code="shl @1.U32, 16"     time="U!1" comment="Shift it to the upper 16 bits" />
				<line code="mov eax, @0.U32"    time=" V1" comment="Get the 16bit value" />
				<line code="sar @1.U32, 16"     time="U!1" comment="SAR it back down to sign extend" />
				<line code="and eax, 0FFFFh"    time=" V1" comment="Clear out the upper bits" />
				<line code="mov @0.U32, @1.U32" time="U 1" comment="Swap to the 32bit value" />
				<line code="mov @1.U32, eax"    time=" V1" comment="Swap to the 16bit value (the upper 16 bits are 0)" />
			</codeset>

			<codeset param0="R" param1="M" total="5" totalv="5"
				lostregs="eax" endregs="ax=@1.U16" endpipe="U">
				<line code="mov eax, @0.U32"    time="U 1"   timev=" V1"   comment="Get the 32bit value" />
				<line code="mov @0.U16, @1.U16" time=" V1+1" timev="U 1+1" comment="Swap to the lower 16 bits of the 32bit value" />
				<line code="shl @0.U32, 16"     time="U!1"                 comment="Shift it to the upper 16 bits" />
				<line code="mov @1.U16, ax"     time=" V1+1"               comment="Swap to the 16bit value" />
				<line code="sar @0.U32, 16"     time="U!1"                 comment="SAR it back down to sign extend" />
			</codeset>
		</codetypeset>
		<codetypeset param0="S16" param1="U/S32" reverseof="Exchange32bitAndS16bit" />


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between Boolean and 16bit -->
		<codetypeset param0="Boolean" param1="U/S16" id="ExchangeBooleanAnd16bit">
			<!-- 1/0 Version -->
			<codeset param0="M" param1="M" total="8" totalv="7"
				lostregs="ax,edx" endregs="al=@0.U8,edx=@1.U16" endpipe="U">
				<line code="mov ax, @1.U16" time="U 1+1" timev=" V1+1" comment="Get the 16bit value" />
				<line code="xor edx, edx"   time=" V1"   timev="U 1"   comment="Clear to zero" />
				<line code="add ax, -1"     time="U 1+1" timev=" V1+1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov dl, @0.U8"  time=" V1"   timev="U 1"   comment="Get the boolean value" />
				<line code="mov al, 0"      time="U 1"   timev=" V1"   comment="Clear to zero" />
				<line code="adc al, al"     time="U!1"                 comment="1 if carry, 0 if no carry" />
				<line code="mov @1.U16, dx" time=" V1+1"               comment="Swap to the 16bit value" />
				<line code="mov @0.U8, al"  time="U 1"                 comment="Swap to the boolean value" />
			</codeset>
			<codeset param0="M" param1="R" total="4" totalv="4"
				lostregs="eax,edx" endregs="al=@0.U8,edx=@1.U16" endpipe="U">
				<line code="xor edx, edx"     time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="add @1.U32, -1"   time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov dl, @0.U8"    time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="mov al, 0"        time=" V1" timev="U 1" comment="Clear to zero" />
				<line code="adc al, al"       time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="mov @1.U32, edx"  time=" V1"             comment="Swap to the register" />
				<line code="mov @0.U8, al"    time="U 1"             comment="Swap to the boolean value" />
			</codeset>

			<codeset param0="R" param1="M" total="7" totalv="6"
				lostregs="eax,dx" endregs="ax=@1.U16" endpipe="V">
				<line code="xor eax, eax"     time="U 1"   timev=" V1"   comment="Clear to zero" />
				<line code="mov dx, @1.U16"   time=" V1+1" timev="U 1+1" comment="Get the 16bit value" />
				<line code="mov al, @0.U8"    time="U 1"   timev=" V1"   comment="Get the boolean value" />
				<line code="add dx, -1"       time=" V1+1" timev="U 1+1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov @0.U8, 0"     time="U 1"   timev=" V1"   comment="Clear to zero" />
				<line code="adc @0.U8, @0.U8" time="U!1"                 comment="1 if carry, 0 if no carry" />
				<line code="mov @1.U16, ax"   time=" V1+1"               comment="Swap to the 16bit value" />
			</codeset>
			<codeset param0="R" param1="R" total="4" totalv="3"
				lostregs="eax" endregs="eax=@1.U16" endpipe="U">
				<line code="xor eax, eax"     time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="add @1.U32, -1"   time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="mov @0.U8, 0"     time=" V1" timev="U 1" comment="Clear to zero" />
				<line code="mov @1.U32, eax"  time="U 1" timev=" V1" comment="Swap to the register" />
				<line code="adc @0.U8, @0.U8" time="U!1"             comment="1 if carry, 0 if no carry" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U/S16" param1="Boolean" reverseof="ExchangeBooleanAnd16bit" />



		<!-- ********************************************************************************************************** -->
		<!-- Exchanging with 24bit values -->

		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 24bit and 24bit -->
		<codetypeset param0="U/S24" param1="U/S24">
			<codeset param0="M" param1="M" total="8" totalv="8"
				lostregs="ax,dx" endregs="ah=@1.U8[1],al=@1.U8[2],dh=@0.U8[1],dl=@0.U8[2]" endpipe="V">
				<line code="mov ax, @0.U16"   time="U 1+1" timev=" V1+1" comment="Get the lower 16 bits" />
				<line code="mov dx, @1.U16"   time=" V1+1" timev="U 1+1" comment="Get the lower 16 bits" />
				<line code="mov @1.U16, ax"   time="U 1+1" timev="U*1+1" comment="Swap to the lower 16 bits" />
				<line code="mov @0.U16, dx"   time=" V1+1"               comment="Swap to the lower 16 bits" />
				<line code="mov al, @0.U8[2]" time="U 1"                 comment="Get the high byte" />
				<line code="mov dl, @1.U8[2]" time=" V1"                 comment="Get the high byte" />
				<line code="mov @1.U8[2], al" time="U 1"                 comment="Swap to the high byte" />
				<line code="mov @0.U8[2], dl" time=" V1"                 comment="Swap to the high byte" />
			</codeset>
			<codeset param0="M" param1="R" total="8" totalv="8"
				lostregs="eax,edx" endregs="eax=@1.U32,dl=@0.U8[2]" endpipe="U">
				<line code="mov edx, @1.U32"  time="U 1"    timev=" V1" comment="Get the full register value" />
				<line code="mov al, @0.U8[2]" time=" V1"    timev="U 1" comment="Get the high byte from the memory value" />
				<line code="shl eax, 16"      time="U!1"                comment="Shift it into position" />
				<line code="mov ax, @0.U16"   time="U*1+1"              comment="Get the low 16 bits from the memory value" />
				<line code="mov @0.U16, dx"   time="U*1+1"              comment="Swap to the low 16 bits of the memory value" />
				<line code="mov @1.U32, eax"  time=" V1"                comment="Swap to the full memory value" />
				<line code="shr edx, 16"      time="U!1"                comment="Shift the value into position" />
				<line code="mov @0.U8[2], dl" time="U*1"                comment="Swap to the high byte of the memory value" />
			</codeset>

			<codeset param0="R" param1="M" param0type="U24" total="9" totalv="8"
				lostregs="eax,edx" endregs="eax=@0.U24,dl=@1.U8[2]" endpipe="U">
				<line code="xor eax, eax"     time="U 1"    timev=" V1" comment="Clear to zero" />
				<line code="mov edx, @0.U32"  time=" V1"    timev="U 1" comment="Get the full register value" />
				<line code="mov al, @1.U8[2]" time="U 1"    timev=" V1" comment="Get the high byte from the memory value" />
				<line code="shl eax, 16"      time="U!1"                comment="Shift it into position" />
				<line code="mov ax, @1.U16"   time="U*1+1"              comment="Get the low 16 bits from the memory value" />
				<line code="mov @1.U16, dx"   time="U*1+1"              comment="Swap to the low 16 bits of the memory value" />
				<line code="mov @0.U32, eax"  time=" V1"                comment="Swap to the full memory value" />
				<line code="shr edx, 16"      time="U!1"                comment="Shift the value into position" />
				<line code="mov @1.U8[2], dl" time="U*1"                comment="Swap to the high byte of the memory value" />
			</codeset>
			<codeset param0="R" param1="M" param0type="S24" total="9" totalv="9"
				lostregs="eax,edx" endregs="eax=@0.S24,dl=@1.U8[2]" endpipe="U">
				<line code="mov edx, @0.U32"  time="U 1"    timev=" V1" comment="Get the full register value" />
				<line code="mov al, @1.U8[2]" time=" V1"    timev="U 1" comment="Get the high byte from the memory value" />
				<line code="shl eax, 24"      time="U!1"                comment="Shift it into position" />
				<line code="sar eax, 8"       time="U!1"                comment="SAR to sign extend" />
				<line code="mov ax, @1.U16"   time="U*1+1"              comment="Get the low 16 bits from the memory value" />
				<line code="mov @1.U16, dx"   time="U*1+1"              comment="Swap to the low 16 bits of the memory value" />
				<line code="mov @0.U32, eax"  time=" V1"                comment="Swap to the full memory value" />
				<line code="shr edx, 16"      time="U!1"                comment="Shift the value into position" />
				<line code="mov @1.U8[2], dl" time="U*1"                comment="Swap to the high byte of the memory value" />
			</codeset>
			<codeset param0="R" param1="R" param0type="U24" param1type="U24" total="2" totalv="1" id="ExchangeU24AndU24_R_R"
				lostregs="eax" endregs="eax=@1.U32" endpipe="S">
				<line code="mov eax, @0.U32"    time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov @0.U32, @1.U32" time=" V1" timev="U 1" comment="Swap to that value" />
				<line code="mov @1.U32, eax"    time="U 1" timev=" V1" comment="Swap to the other value" />
			</codeset>
			<codeset param0="R" param1="R" param0type="S24" param1type="U24" total="4" totalv="3" id="ExchangeS24AndU24_R_R"
				lostregs="eax" endregs="eax=@1.U24" endpipe="U">
				<line code="mov eax, @0.U32"    time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov @0.U32, @1.U32" time=" V1" timev="U 1" comment="Swap to that value" />
				<line code="and eax, 0FFFFFFh"  time="U 1" timev=" V1" comment="Clear the high byte" />
				<line code="shl @0.U32, 8"      time="U!1"             comment="Shift to the high byte" />
				<line code="mov @1.U32, eax"    time=" V1"             comment="Swap to the other value" />
				<line code="sar @0.U32, 8"      time="U!1"             comment="SAR to sign extend" />
			</codeset>
			<codeset param0="R" param1="R" param0type="U24" param1type="S24" reverseof="ExchangeS24AndU24_R_R" />
			<codeset param0="R" param1="R" param0type="S24" param1type="S24" sameas="ExchangeU24AndU24_R_R" />
		</codetypeset>


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 32bit and 24bit -->

		<!-- ====================================================================================== -->
		<!-- With U24 -->
		<codetypeset param0="U/S32" param1="U24" id="ExchangeUS32AndU24">
			<codeset param0="M,R" param1="M" total="9" totalv="8"
				lostregs="eax,edx" endregs="eax=@0.U32,dl=@1.U8[2]" endpipe="U">
				<line code="xor eax, eax"     time="U 1"   timev=" V1" comment="Clear to zero" />
				<line code="mov edx, @0.U32"  time=" V1"   timev="U 1" comment="Get the 32bit value" />
				<line code="mov al, @1.U8[2]" time="U 1"   timev=" V1" comment="Get the high byte of the 24bit value" />
				<line code="shl eax, 16"      time="U!1"               comment="Shift it into position" />
				<line code="mov ax, @1.U16"   time="U*1+1"             comment="Get the low 16 bits of the 24bit value" />
				<line code="mov @1.U16, dx"   time="U*1+1"             comment="Swap to the low 16 bits of the 24bit value" />
				<line code="mov @0.U32, eax"  time=" V1"               comment="Swap to the 32bit value" />
				<line code="shr edx, 16"      time="U!1"               comment="Shift to get the high byte" />
				<line code="mov @1.U8[2], dl" time="U*1"               comment="Swap to the high byte of the 24bit value" />
			</codeset>
			<codeset param0="M,R" param1="R" total="2" totalv="2"
				lostregs="eax" endregs="eax=@0.U32" endpipe="U">
				<line code="mov eax, @1.U32"      time="U 1" timev=" V1" comment="Get the full register" />
				<line code="mov @1.U32, @0.U32"   time=" V1" timev="U 1" comment="Swap to the full register" />
				<line code="mov @0.U32, eax"      time="U 1" timev=" V1" comment="Swap to the 32bit value" />
				<line code="and @1.U32, 0FFFFFFh" time=" V1" timev="U 1" comment="Clear out the high byte" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U24" param1="U/S32" reverseof="ExchangeUS32AndU24" />

		<!-- ====================================================================================== -->
		<!-- With S24 -->
		<codetypeset param0="U/S32" param1="S24" id="ExchangeUS32AndS24">
			<codeset param0="M,R" param1="M" total="9" totalv="8"
				lostregs="eax,edx" endregs="eax=@0.U32,dl=@1.U8[2]" endpipe="U">
				<line code="mov ah, @1.U8[2]" time="U 1"   timev=" V1" comment="Get the high byte of the 24bit value" />
				<line code="shl eax, 16"      time="U!1"               comment="Shift it into the high byte" />
				<line code="mov edx, @0.U32"  time=" V1"               comment="Get the 32bit value" />
				<line code="sar eax, 8"       time="U!1"               comment="SAR to sign extend" />
				<line code="mov ax, @1.U16"   time="U*1+1"             comment="Get the low 16 bits of the 24bit value" />
				<line code="mov @1.U16, dx"   time="U*1+1"             comment="Swap to the low 16 bits of the 24bit value" />
				<line code="mod @0.U32, eax"  time=" V1"               comment="Swap to the 32bit value" />
				<line code="shr edx, 16"      time="U!1"               comment="Shift to get the high byte" />
				<line code="mov @1.U8[2], dl" time="U*1"               comment="Swap to the high byte of the 24bit value" />
			</codeset>
			<codeset param0="M,R" param1="R" total="4" totalv="3"
				lostregs="eax" endregs="eax=@1.S24" endpipe="U">
				<line code="mov eax, @0.U32"    time="U 1" timev=" V1" comment="Get the 32bit value" />
				<line code="shl eax, 8"         time="U!1"             comment="Shift to the high byte" />
				<line code="mov @0.U32, @1.U32" time=" V1"             comment="Swap to the 32bit value" />
				<line code="sar eax, 8"         time="U!1"             comment="SAR to sign extend" />
				<line code="mov @1.U32, eax"    time="U*1"             comment="Swap to the 24bit value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="S24" param1="U/S32" reverseof="ExchangeUS32AndS24" />


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between Boolean and 24bit -->
		<codetypeset param0="Boolean" param1="U/S24" id="ExchangeBoolAndUS24">
			<codeset param0="M,R" param1="M" total="9" totalv="8"
				lostregs="eax,dl" endregs="ah=@0.U8,al=@1.U8,dl=0,dl=@1.U8[1],dl=@0.U8[2]" endpipe="U">
				<line code="mov dl, @1.U8"    time="U 1" timev=" V1" comment="Get the low byte of the 24bit value" />
				<line code="xor eax, eax"     time=" V1" timev="U 1" comment="Clear to zero" />
				<line code="or dl, @1.U8[1]"  time="U 2" timev=" V2" comment="OR in the bits of the second byte" />
				<line code="mov al, @0.U8"    time=" V1" timev="U 1" comment="Get the boolean value" />
				<line code="or dl, @1.U8[2]"  time="U 2" timev=" V2" comment="OR in the bits of the third byte" />
				<line code="mov @1.U8, al"    time="U*1" timev="U 1" comment="Swap to the low byte of the 24bit value" />
				<line code="add dl, -1"       time=" V1"             comment="Add -1. This will set carry if it is non-zero" />
				<line code="adc ah, ah"       time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="xor dl, dl"       time=" V1"             comment="Clear to zero" />
				<line code="mov @1.U8[1], dl" time="U 1"             comment="Store a 0 in the middle byte of the 24bit value" />
				<line code="mov @0.U8, ah"    time=" V1"             comment="Swap to the boolean value" />
				<line code="mov @1.U8[2], dl" time="U 1"             comment="Store a 0 in the high byte of the 24bit value" />
			</codeset>
			<codeset param0="M,R" param1="R" total="5" totalv="4"
				lostregs="eax,edx" endregs="dh=@0.U8,dl=@1.U8" endpipe="U">
				<line code="xor edx, edx"    time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="mov eax, @1.U32" time=" V1" timev="U 1" comment="Get the full register value" />
				<line code="mov dl, @0.U8"   time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="add eax, -1"     time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov @1.U32, edx" time="U 1" timev=" V1" comment="Swap to the 24bit register value" />
				<line code="adc dh, dh"      time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="mov @0.U8, dh"   time="U*1"             comment="Swap to the boolean value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U/S24" param1="Boolean" reverseof="ExchangeBoolAndUS24" />



		<!-- ********************************************************************************************************** -->
		<!-- Exchanging with 32bit values -->

		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between 32bit and 32bit -->
		<codetypeset param0="U/S32" param1="U/S32">
			<codeset param0="M" param1="M" total="2" totalv="2"
				lostregs="eax,edx" endregs="eax=@1.U32,edx=@0.U32" endpipe="V">
				<line code="mov eax, @0.U32" time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov edx, @1.U32" time=" V1" timev="U 1" comment="Get the other value" />
				<line code="mov @1.U32, eax" time="U 1" timev="U*1" comment="Start the swap" />
				<line code="mov @0.U32, edx" time=" V1"             comment="Complete the swap" />
			</codeset>
			<codeset param0="M" param1="R" total="2" totalv="1"
				lostregs="eax" endregs="eax=@1.U32" endpipe="V">
				<line code="mov eax, @0.U32"    time="U 1" timev=" V1" comment="Get the memory value" />
				<line code="mov @0.U32, @1.U32" time="U*1" timev="U 1" comment="Swap to the memory value" />
				<line code="mov @1.U32, eax"    time=" V1"             comment="Swap to the register value" />
			</codeset>

			<codeset param0="R" param1="M" total="2" totalv="1"
				lostregs="eax" endregs="eax=@0.U32" endpipe="V">
				<line code="mov eax, @1.U32"    time="U 1" timev=" V1" comment="Get the memory value" />
				<line code="mov @1.U32, @0.U32" time="U*1" timev="U 1" comment="Swap to the memory value" />
				<line code="mov @0.U32, eax"    time=" V1"             comment="Swap to the register value" />
			</codeset>
			<codeset param0="R" param1="R" total="2" totalv="1"
				lostregs="eax" endregs="eax=@0.U32" endpipe="S">
				<line code="mov eax, @1.U32"    time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov @1.U32, @0.U32" time=" V1" timev="U 1" comment="Start the swap" />
				<line code="mov @0.U32, eax"    time="U 1" timev=" V1" comment="Complete the swap" />
			</codeset>
		</codetypeset>


		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between Boolean and 32bit -->
		<codetypeset param0="Boolean" param1="U/S32" id="ExchangeBooleanAnd32bit">
			<!-- 1/0 Version -->
			<codeset param0="M" param1="M" total="5" totalv="4"
				lostregs="eax,edx" endregs="dh=@0.U8,dl=@1.U8" endpipe="U">
				<line code="xor edx, edx"    time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="mov eax, @1.U32" time=" V1" timev="U 1" comment="Get the 32bit value" />
				<line code="mov dl, @0.U8"   time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="add eax, -1"     time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov @1.U32, edx" time="U 1" timev=" V1" comment="Swap to the 32bit value" />
				<line code="adc dh, dh"      time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="mov @0.U8, dh"   time="U*1"             comment="Swap to the boolean value" />
			</codeset>
			<codeset param0="M" param1="R" total="4" totalv="4"
				lostregs="eax,dl" endregs="eax=@1.U32,dl=@0.U8" endpipe="U">
				<line code="xor eax, eax"    time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="add @1.U32, -1"  time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov dl, 0"       time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="mov al, @0.U8"   time=" V1" timev="U 1" comment="Get the boolean value" />
				<line code="adc dl, dl"      time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="mov @1.U32, eax" time=" V1"             comment="Swap to the 32bit value" />
				<line code="mov @0.U8, dl"   time="U 1"             comment="Swap to the boolean value" />
			</codeset>

			<codeset param0="R" param1="M" total="4" totalv="4"
				lostregs="eax,edx" endregs="edx=@1.U32" endpipe="U">
				<line code="xor edx, edx"     time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="mov eax, @1.U32"  time=" V1" timev="U 1" comment="Get the 32bit value" />
				<line code="mov dl, @0.U8"    time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="add eax, -1"      time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov @0.U8, 0"     time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="mov @1.U32, edx"  time=" V1" timev="U 1" comment="Swap to the 32bit value" />
				<line code="adc @0.U8, @0.U8" time="U!1"             comment="1 if carry, 0 if no carry" />
			</codeset>
			<codeset param0="R" param1="R" total="3" totalv="3"
				lostregs="eax" endregs="eax=@1.U32" endpipe="V">
				<line code="xor eax, eax"     time="U 1" timev=" V1" comment="Clear to zero" />
				<line code="add @1.U32, -1"   time=" V1" timev="U 1" comment="Add -1. This will set carry if it is non-zero" />
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the boolean value" />
				<line code="mov @0.U8, 0"     time=" V1" timev="U 1" comment="Clear to zero" />
				<line code="adc @0.U8, @0.U8" time="U!1"             comment="1 if carry, 0 if no carry" />
				<line code="mov @1.U32, eax"  time=" V1"             comment="Swap to the 32bit value" />
			</codeset>
		</codetypeset>
		<codetypeset param0="U/S32" param1="Boolean" reverseof="ExchangeBooleanAnd32bit" />



		<!-- ********************************************************************************************************** -->
		<!-- Exchanging with Boolean values -->

		<!-- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ -->
		<!-- Between Boolean and Boolean -->
		<codetypeset param0="Boolean" param1="Boolean">
			<!-- 1/0 and -1/0 version are the same -->
			<codeset param0="M" param1="M" total="2" totalv="2"
				lostregs="al,dl" endregs="al=@1.U8,dl=@0.U8" endpipe="V">
				<line code="mov al, @0.U8" time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov dl, @1.U8" time=" V1" timev="U 1" comment="Get the other value" />
				<line code="mov @1.U8, al" time="U 1" timev="U*1" comment="Start the swap" />
				<line code="mov @0.U8, dl" time=" V1"             comment="Complete the swap" />
			</codeset>
			<codeset param0="M" param1="R" total="2" totalv="1"
				lostregs="al" endregs="al=@1.U8" endpipe="V">
				<line code="mov al, @0.U8"    time="U 1" timev=" V1" comment="Get the memory value" />
				<line code="mov @0.U8, @1.U8" time="U*1" timev="U 1" comment="Swap to the memory value" />
				<line code="mov @1.U8, al"    time=" V1"             comment="Swap to the register value" />
			</codeset>

			<codeset param0="R" param1="M" total="2" totalv="1"
				lostregs="al" endregs="al=@0.U8" endpipe="V">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get the memory value" />
				<line code="mov @1.U8, @0.U8" time="U*1" timev="U 1" comment="Swap to the memory value" />
				<line code="mov @0.U8, al"    time=" V1"             comment="Swap to the register value" />
			</codeset>
			<codeset param0="R" param1="R" total="2" totalv="1"
				lostregs="al" endregs="al=@0.U8" endpipe="S">
				<line code="mov al, @1.U8"    time="U 1" timev=" V1" comment="Get one value" />
				<line code="mov @1.U8, @0.U8" time=" V1" timev="U 1" comment="Start the swap" />
				<line code="mov @0.U8, al"    time="U 1" timev=" V1" comment="Complete the swap" />
			</codeset>
		</codetypeset>
	</mnemonic>
</encoding>
