<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://f256wiki.wildbitscomputing.com/index.php?action=history&amp;feed=atom&amp;title=Use_the_PS%2F2_Mouse</id>
	<title>Use the PS/2 Mouse - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://f256wiki.wildbitscomputing.com/index.php?action=history&amp;feed=atom&amp;title=Use_the_PS%2F2_Mouse"/>
	<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;action=history"/>
	<updated>2026-04-30T02:23:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38054&amp;oldid=prev</id>
		<title>1BitFeverDreams: /* Common easy usage */</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38054&amp;oldid=prev"/>
		<updated>2025-05-10T15:27:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Common easy usage&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:27, 10 May 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l186&quot;&gt;Line 186:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 186:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# PEEK the current x and y positions as 16-bit values from 0xD6E2-0xD6E5 and add to them the signed 8-bit values of mouse.delta.x and mouse.delta.y. Keep in mind that this delta can be negative (left or up) or positive (right, or down).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# PEEK the current x and y positions as 16-bit values from 0xD6E2-0xD6E5 and add to them the signed 8-bit values of mouse.delta.x and mouse.delta.y. Keep in mind that this delta can be negative (left or up) or positive (right, or down).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039; Under a bitmap graphic resolution under 60Hz of 320x240 pixels, the mouse position resolution is instead 640x480, so plan accordingly if you want to interface where the mouse is and where graphics are influenced or interacted with.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039; Under a bitmap graphic resolution under 60Hz of 320x240 pixels, the mouse position resolution is instead 640x480, so plan accordingly if you want to interface where the mouse is and where graphics are influenced or interacted with.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# &#039;&#039;&#039;SECOND IMPORTANT NOTE:&#039;&#039;&#039; In a situation where you&#039;ll want to test if the mouse is in the right coordinates compared to a sprite location that could act as a button, remember that the visible top left coordinate of the screen for sprites is at (32,32) by default, because of the border.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Example C code can be found here: https://github.com/Mu0n/F256KsimpleCdoodles/blob/main/mousing/src/mousing.c&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Example C code can be found here: https://github.com/Mu0n/F256KsimpleCdoodles/blob/main/mousing/src/mousing.c&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key f256wikiDB:diff:1.41:old-38052:rev-38054:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>1BitFeverDreams</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38052&amp;oldid=prev</id>
		<title>1BitFeverDreams at 02:44, 6 May 2025</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38052&amp;oldid=prev"/>
		<updated>2025-05-06T02:44:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:44, 5 May 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l74&quot;&gt;Line 74:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 74:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Mouse Pointer Registers ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Mouse Pointer Registers ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The mouse pointer bitmap graphic is a grayscale 16x16 &quot;sprite&quot; that is not part of the regular 64 sprites provided by the TinyVicky, but can be thought of as a &quot;special&quot; sprite that can be directly controlled by these registers.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The mouse pointer bitmap graphic is a grayscale 16x16 &quot;sprite&quot; that is not part of the regular 64 sprites provided by the TinyVicky, but can be thought of as a &quot;special &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;65th&lt;/ins&gt;&quot; sprite that can be directly controlled by these registers.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The bitmap data is stored at address range 0xCC00-0xCFFF (256 bytes).&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The bitmap data is stored at address range 0xCC00-0xCFFF (256 bytes).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>1BitFeverDreams</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38051&amp;oldid=prev</id>
		<title>1BitFeverDreams: /* Common easy usage */</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38051&amp;oldid=prev"/>
		<updated>2025-05-06T02:36:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Common easy usage&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:36, 5 May 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l184&quot;&gt;Line 184:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 184:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Send 0x0100 as a 16-bit value to both 0xD6E2 and 0xD6E4 to set the mouse at a relatively central position on the screen&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# Send 0x0100 as a 16-bit value to both 0xD6E2 and 0xD6E4 to set the mouse at a relatively central position on the screen&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your device detection loop, look for a [[MicroKernel]] event of type mouse.DELTA which will trigger for both movement and also button clicks or mouse wheel movement&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# In your device detection loop, look for a [[MicroKernel]] event of type mouse.DELTA which will trigger for both movement and also button clicks or mouse wheel movement&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# PEEK the current x and y positions as 16-bit values and add to them the signed 8-bit values of mouse.delta.x and mouse.delta.y&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# PEEK the current x and y positions as 16-bit values &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;from 0xD6E2-0xD6E5 &lt;/ins&gt;and add to them the signed 8-bit values of mouse.delta.x and mouse.delta.y&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Keep in mind that this delta can be negative (left or up) or positive (right, or down).&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039; Under a bitmap graphic resolution under 60Hz of 320x240 pixels, the mouse position resolution is instead 640x480, so plan accordingly if you want to interface where the mouse is and where graphics are influenced or interacted with.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039; Under a bitmap graphic resolution under 60Hz of 320x240 pixels, the mouse position resolution is instead 640x480, so plan accordingly if you want to interface where the mouse is and where graphics are influenced or interacted with.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Example C code can be found here: https://github.com/Mu0n/F256KsimpleCdoodles/blob/main/mousing/src/mousing.c&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Example C code can be found here: https://github.com/Mu0n/F256KsimpleCdoodles/blob/main/mousing/src/mousing.c&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>1BitFeverDreams</name></author>
	</entry>
	<entry>
		<id>https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38048&amp;oldid=prev</id>
		<title>1BitFeverDreams: ps/2 mouse guide</title>
		<link rel="alternate" type="text/html" href="https://f256wiki.wildbitscomputing.com/index.php?title=Use_the_PS/2_Mouse&amp;diff=38048&amp;oldid=prev"/>
		<updated>2025-05-06T02:32:27Z</updated>

		<summary type="html">&lt;p&gt;ps/2 mouse guide&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=== PS/2 Port Registers ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Address&lt;br /&gt;
!R/W&lt;br /&gt;
!Name&lt;br /&gt;
!7&lt;br /&gt;
!6&lt;br /&gt;
!5&lt;br /&gt;
!4&lt;br /&gt;
!3&lt;br /&gt;
!2&lt;br /&gt;
!1&lt;br /&gt;
!0&lt;br /&gt;
|-&lt;br /&gt;
|0xD640&lt;br /&gt;
|R/W&lt;br /&gt;
|PS2_CTRL&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|MCLR&lt;br /&gt;
|KCLR&lt;br /&gt;
|M_WR&lt;br /&gt;
| -&lt;br /&gt;
|K_WR&lt;br /&gt;
| -&lt;br /&gt;
|-&lt;br /&gt;
|0xD641&lt;br /&gt;
|R/W&lt;br /&gt;
|PS2_OUT&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |Data to send to keyboard&lt;br /&gt;
|-&lt;br /&gt;
|0xD642&lt;br /&gt;
|R&lt;br /&gt;
|KBD_IN&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |Data from the keyboard input FIFO&lt;br /&gt;
|-&lt;br /&gt;
|0xD643&lt;br /&gt;
|R&lt;br /&gt;
|MS_IN&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |Data from the mouse input FIFO&lt;br /&gt;
|-&lt;br /&gt;
|0xD644&lt;br /&gt;
|R&lt;br /&gt;
|PS2_STAT&lt;br /&gt;
|K_AK&lt;br /&gt;
|K_NK&lt;br /&gt;
|M_AK&lt;br /&gt;
|M_NK&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|MEMP&lt;br /&gt;
|KEMP&lt;br /&gt;
|}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;K_WR&amp;#039;&amp;#039;&amp;#039; set to 1 then 0 to send a byte written on PS2_OUT to the keyboard&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;M_WR&amp;#039;&amp;#039;&amp;#039; set to 1 then 0 to send a byte written on PS2_OUT to the mouse&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;KCLR&amp;#039;&amp;#039;&amp;#039; set to 1 then 0 to clear the keyboard input FIFO queue.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;MCLR&amp;#039;&amp;#039;&amp;#039; set to 1 then 0 to clear the mouse input FIFO queue.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;K_AK&amp;#039;&amp;#039;&amp;#039; when 1, the code sent to the keyboard has been acknowledged&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;K_NK&amp;#039;&amp;#039;&amp;#039; when 1, the code sent to the keyboard has resulted in an error&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;M_AK&amp;#039;&amp;#039;&amp;#039; when 1, the code sent to the mouse has been acknowledged&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;M_NK&amp;#039;&amp;#039;&amp;#039; when 1, the code sent to the mouse has resulted in an error&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;KEMP&amp;#039;&amp;#039;&amp;#039; when 1, the keyboard input FIFO is empty&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;MEMP&amp;#039;&amp;#039;&amp;#039; when 1, the mouse input FIFO is empty&lt;br /&gt;
&lt;br /&gt;
=== Mouse Pointer Registers ===&lt;br /&gt;
The mouse pointer bitmap graphic is a grayscale 16x16 &amp;quot;sprite&amp;quot; that is not part of the regular 64 sprites provided by the TinyVicky, but can be thought of as a &amp;quot;special&amp;quot; sprite that can be directly controlled by these registers.&lt;br /&gt;
&lt;br /&gt;
The bitmap data is stored at address range 0xCC00-0xCFFF (256 bytes).&lt;br /&gt;
&lt;br /&gt;
The F256Jr manual reports that:&amp;lt;blockquote&amp;gt;The position of the mouse pointer is controlled in one of two ways. In the default approach (MODE = 0), the system software will monitor mouse movements, determine the mouse position programmatically, &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;and set the TinyVicky mouse position registers directly&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
In the legacy approach (MODE = 1), the system software will receive the three byte PS/2 mouse data packet and set the TinyVicky mouse PS2_BYTE registers. In this legacy mode, TinyVicky will interpret the mouse packets and track the mouse position for the system. This approach is less work for the system software, but is less flexible.&amp;lt;/blockquote&amp;gt;The &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;italic bold part&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; is proven to be untrue. You are responsible to set the mouse position yourself by keeping a local copy of its X and Y coordinates and set the appropriate registers below yourself.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Address&lt;br /&gt;
!R/W&lt;br /&gt;
!7&lt;br /&gt;
!6&lt;br /&gt;
!5&lt;br /&gt;
!4&lt;br /&gt;
!3&lt;br /&gt;
!2&lt;br /&gt;
!1&lt;br /&gt;
!0&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E0&lt;br /&gt;
|W&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|MODE&lt;br /&gt;
|EN&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E2&lt;br /&gt;
|RW&lt;br /&gt;
|X7&lt;br /&gt;
|X6&lt;br /&gt;
|X5&lt;br /&gt;
|X4&lt;br /&gt;
|X3&lt;br /&gt;
|X2&lt;br /&gt;
|X1&lt;br /&gt;
|X0&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E3&lt;br /&gt;
|RW&lt;br /&gt;
|X15&lt;br /&gt;
|X14&lt;br /&gt;
|X13&lt;br /&gt;
|X12&lt;br /&gt;
|X11&lt;br /&gt;
|X10&lt;br /&gt;
|X9&lt;br /&gt;
|X8&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E4&lt;br /&gt;
|RW&lt;br /&gt;
|Y7&lt;br /&gt;
|Y6&lt;br /&gt;
|Y5&lt;br /&gt;
|Y4&lt;br /&gt;
|Y3&lt;br /&gt;
|Y2&lt;br /&gt;
|Y1&lt;br /&gt;
|Y0&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E5&lt;br /&gt;
|RW&lt;br /&gt;
|Y15&lt;br /&gt;
|Y14&lt;br /&gt;
|Y13&lt;br /&gt;
|Y12&lt;br /&gt;
|Y11&lt;br /&gt;
|Y10&lt;br /&gt;
|Y9&lt;br /&gt;
|Y8&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E6&lt;br /&gt;
|W&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |PS2_BYTE_0&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E7&lt;br /&gt;
|W&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |PS2_BYTE_1&lt;br /&gt;
|-&lt;br /&gt;
|0xD6E8&lt;br /&gt;
|W&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |PS2_BYTE_2&lt;br /&gt;
|}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;EN&amp;#039;&amp;#039;&amp;#039; if set (1), the mouse pointer is displayed. If clear (0), the mouse pointer is not displayed&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;MODE&amp;#039;&amp;#039;&amp;#039; if clear (0), the mouse position is specified by setting the X and Y registers. If set (1), the&lt;br /&gt;
&lt;br /&gt;
program must pass along the 3 byte PS/2 mouse packet to the packet registers (this is a&lt;br /&gt;
&lt;br /&gt;
legacy mode).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;X&amp;#039;&amp;#039;&amp;#039; this is the X coordinate of the mouse and both readable and writable if MODE is clear (0)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Y&amp;#039;&amp;#039;&amp;#039; this is the Y coordinate of the mouse and both readable and writable if MODE is clear (0)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PS2_BYTE_0&amp;#039;&amp;#039;&amp;#039; the first byte of the PS/2 mouse message packet. Only used if MODE is set (1).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PS2_BYTE_1&amp;#039;&amp;#039;&amp;#039; the second byte of the PS/2 mouse message packet. Only used if MODE is set (1).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;PS2_BYTE_2&amp;#039;&amp;#039;&amp;#039; the third byte of the PS/2 mouse message packet. Only used if MODE is set (1).&lt;br /&gt;
&lt;br /&gt;
=== Common easy usage ===&lt;br /&gt;
&lt;br /&gt;
# Send 0x01 to 0xD6E0 in order to enable the mouse and set it to MODE 0, by far the easiest.&lt;br /&gt;
# Send 0x0100 as a 16-bit value to both 0xD6E2 and 0xD6E4 to set the mouse at a relatively central position on the screen&lt;br /&gt;
# In your device detection loop, look for a [[MicroKernel]] event of type mouse.DELTA which will trigger for both movement and also button clicks or mouse wheel movement&lt;br /&gt;
# PEEK the current x and y positions as 16-bit values and add to them the signed 8-bit values of mouse.delta.x and mouse.delta.y&lt;br /&gt;
# &amp;#039;&amp;#039;&amp;#039;IMPORTANT NOTE:&amp;#039;&amp;#039;&amp;#039; Under a bitmap graphic resolution under 60Hz of 320x240 pixels, the mouse position resolution is instead 640x480, so plan accordingly if you want to interface where the mouse is and where graphics are influenced or interacted with.&lt;br /&gt;
&lt;br /&gt;
Example C code can be found here: https://github.com/Mu0n/F256KsimpleCdoodles/blob/main/mousing/src/mousing.c&lt;/div&gt;</summary>
		<author><name>1BitFeverDreams</name></author>
	</entry>
</feed>