<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://bobstaypolo.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://bobstaypolo.github.io/" rel="alternate" type="text/html" /><updated>2026-05-03T22:08:44+00:00</updated><id>https://bobstaypolo.github.io/feed.xml</id><title type="html">My Blog</title><subtitle>Probably mainly a technical writing blog</subtitle><entry><title type="html">How does moving the mouse move the cursor</title><link href="https://bobstaypolo.github.io/2026/05/03/How-does-moving-the-mouse-move-the-cursor.html" rel="alternate" type="text/html" title="How does moving the mouse move the cursor" /><published>2026-05-03T00:00:00+00:00</published><updated>2026-05-03T00:00:00+00:00</updated><id>https://bobstaypolo.github.io/2026/05/03/How-does-moving-the-mouse-move-the-cursor</id><content type="html" xml:base="https://bobstaypolo.github.io/2026/05/03/How-does-moving-the-mouse-move-the-cursor.html"><![CDATA[<p>My ultimate aim here is to make a series of explanations of how computers do various
things and in doing so naturally motivate teaching the various parts and concepts needed to understand computers. Kind of like teaching many real sentences of a language and
explaining grammar and vocab using these concrete sentences.</p>

<p>[gif of a hand moving a mouse side by side with the cursor moving on a display on the right]
Right, simple enough question.</p>

<p>The machine I’ll be considering is this 2019 amd laptop with a usb mouse plugged in.
I have arranged and photographed its innards on the right.
[picture of the machine - picture of the circuit boards aranged]</p>

<p>Ok, first a high level sequence of events, thinking in terms of abstract messages passing 
from one part of the machine to another, without yet worrying about how electricity is
used to send these signals</p>

<p>[diagram of innards on the left, abstract view from the processor on the right]</p>

<ol>
  <li>The mouse detects that it has moved and stores its relative x,y motion to respond with
when it is interrogated by the usb host controller.</li>
  <li>The usb host controller is configured to interrogate the usb mouse at a certain polling
rate, in this case 100Hz, or once every 10ms.</li>
  <li>The mouse returns a usb packet containing the total relative motion it recorded since 
it was last interrogated. (It also contains whether any buttons were pressed or releaded).</li>
  <li>The usb host controller, in this case a part of the main chip in the laptop, has been
configured to put this information at a location in RAM that it was told about previously
by a processor. The processes that allows things other than the cpu to read and write
information into ram is known as DMA - direct memory access.</li>
  <li>Once the usb host controller has put the data in ram, it pokes a processor to tell it 
that there is new mouse data in the ram and to go take a look right now. This type of 
signal is aptly called an interrupt.</li>
  <li>The cpu has a part where it stores the address in ram of a table of more addresses to the
the pieces of code that need to be run when a given interrupt is triggered.</li>
  <li>The cpu starts reading instructions from the relevant area in ram and doing them,
this code is called the interrupt handler and begins by saving the data that was in the
processor somewhere in ram so that it can get it back later when it goes back to what it
was in the middle of.</li>
  <li>The interrupt routine does something, code in the kernel gets run, in the xhci driver,
usb/usbhid/usbhost? driver, the</li>
  <li>Somehow the event file for the mouse gets updated and the kernel is storing which
programs are reading the file and waiting for the next piece of data to come in.
In this case the Xorg process is, it uses libinput which uses libevdev? which uses glibc
to do the read syscall.</li>
  <li>Something something something, the xorg process communicates with the integrated amd
gpu also on the main piece of silicon (putting info in ram that the gpu also has access
to?) by using some userspace amd driver library to do ioctl syscalls to tell the kernel
to use the amd driver to tell the amd gpu to update the cursor position so that when the
image nexts gets written out by the (scan unit?) it is with the curor in the updated
location</li>
</ol>]]></content><author><name></name></author><summary type="html"><![CDATA[My ultimate aim here is to make a series of explanations of how computers do various things and in doing so naturally motivate teaching the various parts and concepts needed to understand computers. Kind of like teaching many real sentences of a language and explaining grammar and vocab using these concrete sentences.]]></summary></entry><entry><title type="html">My First Post</title><link href="https://bobstaypolo.github.io/2026/05/03/my-first-post.html" rel="alternate" type="text/html" title="My First Post" /><published>2026-05-03T00:00:00+00:00</published><updated>2026-05-03T00:00:00+00:00</updated><id>https://bobstaypolo.github.io/2026/05/03/my-first-post</id><content type="html" xml:base="https://bobstaypolo.github.io/2026/05/03/my-first-post.html"><![CDATA[<p>We’ll all die someday, so why not explore and leave a little more for those who follow.</p>

<h2 id="some-possible-future-topics">Some possible future topics</h2>
<ul>
  <li>How computers work</li>
  <li>What money is, networks of balance sheets etc.</li>
  <li>The creation of buildings and places that warm the heart</li>
  <li>Crystals and symmetry</li>
  <li>Geometric algebra, mechanical models of EM, graphic statics</li>
  <li>The broad nature of compression</li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[We’ll all die someday, so why not explore and leave a little more for those who follow.]]></summary></entry></feed>