Re: joystick ports

From: HÁRSFALVI Levente <>
Date: Mon, 09 Sep 2013 11:13:19 +0200
Message-ID: <>

On 09/08/13 16:07, Julian Perry wrote:
> Gerrit, HÁRSFALVI.
> Thanks both for your explanations - I'm getting there, I think.
> From what I gather:
> When a WRITE is written to the TED keyboard latch, during the same 1/2
> cycle that the CPU has the buss (and Data is still valid), the TED
> latches the contents of the TED input keyboard port. The actual BYTE
> written is not looked at by the TED - it is only used to assert the
> appropriate signals on the data buss (in the same way 6522/6526 timers are (re)started by a read.)

Yes. :-)

> If the byte written to the TED has bit1 clear, the the status of joy0 is applied to the pins of the TED keyboard input (column). Likewise bit2, and joy1. If both are set, then the joystick is ignored.
> Effectively, The buffered data bits from D1 and D2 are "probe" bits - which probe the joystick port, the result of which end up as signals on the TED keyboard input pins.

Yes, exactly.

> Having a peek at the keyboard scanning code in VICE, it seems that an opportunity may have been missed. This missed opportunity was the ability to isolate joystick activity from a keyboard scan. 
> Once the job of sending the column signals was taken over by the 6529 from the data buss, writing data with bits 1 and 2 set (EG $ff, or $06) to the TED keyboard latch would ensure that the joysticks could not interfere with the keyboard scan. 

Yeah, I've been wondering about that too. I can see no reason why the
joysticks had to be left active there either.

> The scnkey routine starts at $DB11, and the actual SCAN code is a short subroutine at $DB70.
> .A contains the bit pattern for the column. .A returns bit pattern of row.
> The code:
> $DB70	STA $FD30	;Write to 6529 - Column
> $DB73	STA $FF08	;Write trigger to latch TED keyboard input
> $DB76	LDA $FF08	;Read latch (Row)
> $DB79	RTS		;Return
> By adding 2 bytes, simply changing it to:
> STA $FD30	;Write to 6529 - Column
> LDA #FF	;disable joystick probe
> STA $FF08	;Write trigger to latch TED keyboard input
> LDA $FF08	;Read latch (Row)
> RTS		;Return
> The Joysticks could be left turned off for the duration. 

Yes. That's how it should have ended up IMHO.

> Or am I still missing the bleeding obvious somewhere??? :)

Nope, that's how those things look like as far as I know. ;-)

Best regards,


       Message was sent through the cbm-hackers mailing list
Received on 2013-09-09 10:00:07

Archive generated by hypermail 2.2.0.