Detection of Family BASIC keyboard possible?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Detection of Family BASIC keyboard possible?
by on (#208519)
Is it possible to detect for the presence or absence of a Family BASIC keyboard without user interaction? I don't see anything in the interface described on the Wiki that would produce a detectable signature.

I could assume it's there, by default, but I don't like that this could conflict with an expansion controller on the second D1 line. The alternative question is whether I can detect the absence of a controller on D1?

Also assuming PowerPak / Everdrive could be in the mix here, though I also assume D1 is already pulled down to 0 when not connected regardless?

The backup plan is just letting the user choose manually, but I just want to know if I'm missing something that would make it easier.
Re: Detection of Family BASIC keyboard possible?
by on (#208550)
You should be able to use the "enable keyboard matrix" to detect it.

When it's disabled, the resistor array pulls the matrix all high, and the CD4019 will relay that, and then the 74'368 will return logical 0 when you read from it.

When it's enabled, the resistor array pulls the matrix low, except for whatever buttons are pressed, the CD4019 will relay the low voltage, and the 74'368 will return logical 1 for any buttons that aren't pressed.
Re: Detection of Family BASIC keyboard possible?
by on (#208552)
Ah1 Thank you, I missed the line that said a held key is 0. Well that's easy then. :)