<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Input on Programming the Atari VCS in Assembly</title><link>https://cdeever.github.io/atari-vcs/docs/input/</link><description>Recent content in Input on Programming the Atari VCS in Assembly</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://cdeever.github.io/atari-vcs/docs/input/index.xml" rel="self" type="application/rss+xml"/><item><title>The Joystick</title><link>https://cdeever.github.io/atari-vcs/docs/input/the-joystick/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cdeever.github.io/atari-vcs/docs/input/the-joystick/</guid><description>&lt;h1 id="the-joystick"&gt;The Joystick&lt;a class="anchor" href="#the-joystick"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The standard CX40 joystick is the simplest input on the system: five switches — four directions and a fire button — and nothing analog. The four &lt;em&gt;directions&lt;/em&gt; of both joysticks are read from a single &lt;a href="https://cdeever.github.io/atari-vcs/docs/architecture/riot/"&gt;RIOT&lt;/a&gt; port, &lt;code&gt;SWCHA&lt;/code&gt;; the fire button comes in elsewhere (see &lt;a href="https://cdeever.github.io/atari-vcs/docs/input/buttons-and-switches/"&gt;Buttons &amp;amp; Console Switches&lt;/a&gt;).&lt;/p&gt;
&lt;h2 id="one-byte-two-joysticks"&gt;One byte, two joysticks&lt;a class="anchor" href="#one-byte-two-joysticks"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;SWCHA&lt;/code&gt; packs both controllers into its eight bits — &lt;strong&gt;player 0 in the high nibble, player 1 in the low nibble&lt;/strong&gt; — each nibble holding right/left/down/up:&lt;/p&gt;</description></item><item><title>Buttons &amp; Console Switches</title><link>https://cdeever.github.io/atari-vcs/docs/input/buttons-and-switches/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cdeever.github.io/atari-vcs/docs/input/buttons-and-switches/</guid><description>&lt;h1 id="buttons--console-switches"&gt;Buttons &amp;amp; Console Switches&lt;a class="anchor" href="#buttons--console-switches"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The &lt;a href="https://cdeever.github.io/atari-vcs/docs/input/the-joystick/"&gt;joystick directions&lt;/a&gt; come from &lt;code&gt;SWCHA&lt;/code&gt;, but the &lt;strong&gt;fire buttons&lt;/strong&gt; and the &lt;strong&gt;console switches&lt;/strong&gt; live elsewhere — and they introduce the one idea that separates &amp;ldquo;input that works&amp;rdquo; from &amp;ldquo;input that feels right&amp;rdquo;: telling a &lt;em&gt;held&lt;/em&gt; button from a &lt;em&gt;just-pressed&lt;/em&gt; one.&lt;/p&gt;
&lt;h2 id="fire-buttons-inpt4--inpt5"&gt;Fire buttons (INPT4 / INPT5)&lt;a class="anchor" href="#fire-buttons-inpt4--inpt5"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A joystick&amp;rsquo;s fire button is read not from the RIOT but from two &lt;strong&gt;TIA&lt;/strong&gt; registers: &lt;code&gt;INPT4&lt;/code&gt; for player 0, &lt;code&gt;INPT5&lt;/code&gt; for player 1. The state is in &lt;strong&gt;bit 7&lt;/strong&gt;, and like everything else it&amp;rsquo;s &lt;a href="https://cdeever.github.io/atari-vcs/docs/input/the-joystick/"&gt;active-low&lt;/a&gt; — pressed reads &lt;code&gt;0&lt;/code&gt;. Because the flag is in bit 7, &lt;a href="https://cdeever.github.io/atari-vcs/docs/6502-basics/registers/"&gt;&lt;code&gt;BIT&lt;/code&gt;&lt;/a&gt; is the natural test:&lt;/p&gt;</description></item><item><title>Paddles</title><link>https://cdeever.github.io/atari-vcs/docs/input/paddles/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cdeever.github.io/atari-vcs/docs/input/paddles/</guid><description>&lt;h1 id="paddles"&gt;Paddles&lt;a class="anchor" href="#paddles"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Everything so far has been a switch: on or off, one bit. &lt;strong&gt;Paddles&lt;/strong&gt; are different — they&amp;rsquo;re &lt;em&gt;analog&lt;/em&gt;, a knob that turns through a continuous range — and the VCS has no analog-to-digital converter. Reading one is a small, clever piece of analog timing, and it&amp;rsquo;s the most unusual input on the machine.&lt;/p&gt;
&lt;h2 id="reading-time-not-voltage"&gt;Reading time, not voltage&lt;a class="anchor" href="#reading-time-not-voltage"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A paddle is a &lt;strong&gt;potentiometer&lt;/strong&gt;: turning the knob changes a resistance. The TIA reads it by charging a capacitor &lt;em&gt;through&lt;/em&gt; that resistance and &lt;strong&gt;timing how long the charge takes&lt;/strong&gt; — a low resistance charges fast, a high resistance slowly. The charge time is the knob position.&lt;/p&gt;</description></item><item><title>Driving &amp; Keyboard Controllers</title><link>https://cdeever.github.io/atari-vcs/docs/input/other-controllers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://cdeever.github.io/atari-vcs/docs/input/other-controllers/</guid><description>&lt;h1 id="driving--keyboard-controllers"&gt;Driving &amp;amp; Keyboard Controllers&lt;a class="anchor" href="#driving--keyboard-controllers"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;The joystick, paddle, and console switches are the common cases — but the same controller ports accept stranger devices, and two are worth knowing because they show how flexible the VCS&amp;rsquo;s I/O really is. The &lt;strong&gt;driving controller&lt;/strong&gt; is a paddle look-alike that isn&amp;rsquo;t analog at all, and the &lt;strong&gt;keyboard controller&lt;/strong&gt; is a twelve-key matrix. Both are built entirely from the &lt;code&gt;SWCHA&lt;/code&gt; and &lt;code&gt;INPT&lt;/code&gt; registers you&amp;rsquo;ve already met.&lt;/p&gt;</description></item></channel></rss>