trudnai / Steve2

Apple ][ Emulator for Mac
GNU General Public License v3.0
71 stars 5 forks source link

Add JoyStick Support #7

Open trudnai opened 4 years ago

trudnai commented 4 years ago
trudnai commented 4 years ago

Two keys on the //e's keyboard are actually directly connected to the game I/0 connector's push-button input lines. These are the OPEN-APPLE and CLOSED-APPLE keys that flank the space bar. These two keys are connected to PB0 and PB1, respectively.

$C061 (49249) PB0   Status of push button 0 (bit 7)
$C062 (49250) PB1   Status of push button 1 (bit 7)
$C063 (49251) PB2   Status of push button 2 (bit 7)
100 IF PEEK<49249>>127 THEN PRINT "DOWN WE GO!"
200 IF PEEK<49249><128 THEN PRINT "BACK AGAIN!"
300 GOTO 100
trudnai commented 4 years ago
$C064  (49252) GC0  Status of game controller 0 (bit 7)
$C065  (49253) GC1  Status of game controller 1 (bit 7)
$C066  (49254) GC2  Status of game controller 2 (bit 7)
$C067  (49255) GC3  Status of game controller 3 (bit 7)
$C070  (49264) GCRESET  Reset the game controllers

When this timer is reset, by accessing GCRESET ($C070), bit 7 of each GC I/0 memory location becomes high (1) but will eventually become low (0) when the timer "times out," that is, the period of time equal to the time constant for each of the four "RC" circuits has elapsed.

Maximum time constant for this circuit is 0.022 x 150,000 ohms = 0.0033 second. That is, when the resistance is at its maximum, the time required for the 558 Timer to bring bit 7 of the GC I/0 memory location low (0) is about 3.3 milliseconds

PREAD ($FB1E) subroutine located in the system monitor; it checks for a timeout condition every 11 microseconds.) You should note, however, that the PDL functions assume that your input resistance is in the range 0-150K ohms. This translates to a time constant that ranges from 0 to about 2.8 milliseconds and to PDL readings between 0 and 255. (Remember that the PDL subroutine's counter increments every 11 microseconds until the timer has timed out. This means that the maximum allowable time constant is 255* 11 microseconds, or 2.8 milliseconds.) If the upper limit of the resistance is higher than 150K ohms, then there will be a "dead area" where the resistance may change but the value calculated stays at 255; if it is lower, then the highest PDL value that can be generated will be less than 255.