Re: joystick ports

From: Julian Perry <jp_at_digitaltapestries.com>
Date: Mon, 9 Sep 2013 00:07:30 +1000
Message-ID: <18210692756.20130909000730@digitaltapestries.com>
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.)

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.


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. 

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. 

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

Julian




       Message was sent through the cbm-hackers mailing list
Received on 2013-09-08 15:00:03

Archive generated by hypermail 2.2.0.