1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-21 06:31:06 +00:00
2 Apple II Analogue Inputs
Thomas Harte edited this page 2018-08-08 10:15:18 -04:00

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=0. When any capacitor becomes fully charged, the corresponding b7 will change to 1 and the capacitor will be permitted 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.

Triggering close charges

Some capacitors may already be in the process of charging when you access C070. If so then they will be fully charged sooner than expected.

So either:

  • check whether the channels you're interested in are charging before triggering C070; or
  • make sure you always leave a sufficiently long period between triggers so that all capacitors can be assumed to have completed their charge and discharge cycle. With paddles and joysticks, any period longer 2.82ms should do.