1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-27 16:29:35 +00:00

First version; a quick note on Apple II analogue inputs.

Thomas Harte 2018-06-13 09:43:27 -04:00
parent 402ea65824
commit 545e1d2d99

@ -0,0 +1,11 @@
There is one capacitor per input.
If you access `C070` then all the input capacitors will be allowed to start charging. Each analogue input at `C064` to `C067` will then read b7=1 until its corresponding capacitor has fully charged. Upon any capacitor becoming fully charged, the corresponding b7 will change to 0 and the capacitor will begin to discharge.
Discharges take 250ns, less than a processor cycle.
Charges take an amount of time proportional to the analogue input; the built-in routine `PREAD` is implemented so that 2.82ms is assumed to be the longest the capacitor might want to charge, and integer values between 0 and 255 are spread linearly across the time range. E.g. a value of 64 implies approximately 1/4 of 2.82ms passed.
So the only caveat is that you can't inherently assume whether each capacitor is already charging when you access `C070`. If it is, it will be fully charged sooner than the input suggests it should be.
The workaround is either to check whether the channels you're interested in are charging before triggering `C070`, or else just leave a long enough period for your application between accesses. With paddles and joysticks, any period longer 2.82ms should do.