Re: Commodore joystick ports

From: Hársfalvi Levente (
Date: 2004-10-25 20:59:23


Jim Brain wrote:

> I noticed a few things as I dug into the protocol:
> If you constrain your range to 64-192, you don't have to fight the SID 
> clamping the line low at each end. Also, jitter seems the least in the 
> 64-192 "sweet spot" ...

Yes, it was probably easier for the 1351 designers to choose this 
region. ...And as an other reason: as the mouse is clocked at exactly 
1Mhz, it's slightly off from both the PAL and NTSC C64. The difference 
isn't that much, but it's integrated at least for 256 cycles, thus it 
becomes noticeable, provided that we catch the H-->L transition and 
count cycles from there. This could or would cause problems if the full 
8-bit was used. If the used region is however the "middle" 7-bit area, 
one simply skip the MSB and everything will work and become "cyclic" 
(even the offset caused by the series resistor becomes unimportant).

Though, I won't bet my life that it's impossible to create a routine 
which introduces no jitter (or max. 1LSB) for the whole (or almost, 
excluding the highest values) range.

> I did not look at your code to see if you used a PIC with an onboard 
> RS232 port, but in my prototype, I'm bit banging something on the other 
> end, and that code is IRQ driven, so there are times, when my routines 
> clash on times.  For simulating a paddle, I doubt the extra jitter is an 
> issue, and if they constrain their range to 64-192, they shoudl see LSB 
> only jitter.  They can also go to 16MHz,  but I can't here, because I 
> use the SPI for the other interface, and I've got the SPI turned down 
> all the way (clock wise), and it's just barely slow enough.  As well, 
> I'd rather not have to put space on the board for a crystal and caps.

There is no RS-232 port in the 16c84... ;-) In the 1351 emulator code 
it's done by bit banging. The two concurrent routines share the only 
(8-bit) timer of the PIC. The cycle start is triggered by an external 
interrupt. But, while the code is waiting for the external interrupt to 
occur, the timer interrupts are disabled (the serial routine just polls 
the timer and the serial line).

Yep, for a paddle, it will be O.K. (original C= paddles behave much much 
worse). As for the jitter, it depends. At 8Mhz, each 8 cycles of random 
delay will give about 1 cycle of noise in the SID's side.

Best regards,


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.