Famicom World

Family Computer => Technical & Repair Assistance => Topic started by: boye on March 25, 2021, 08:37:56 am

Title: Using PS/2 / USB keyboard with Family Baisc
Post by: boye on March 25, 2021, 08:37:56 am
Exactly as the title says. What pins does the keyboard use on the expansion port, and is it possible to use a modern PS/2 or USB keyboard with Family Basic?
Title: Re: Using PS/2 / USB keyboard with Family Baisc
Post by: emerson on March 25, 2021, 09:48:54 am
I was unable to get this working with Family Basic but it works with my custom rom.

https://forums.nesdev.com/viewtopic.php?f=9&t=16363&hilit=Ps%2F2+keyboard+mouse&start=30#p211153 (https://forums.nesdev.com/viewtopic.php?f=9&t=16363&hilit=Ps%2F2+keyboard+mouse&start=30#p211153)
Title: Re: Using PS/2 / USB keyboard with Family Baisc
Post by: P on March 25, 2021, 10:37:27 am
That's a shame, I would have hoped that it would work with Family BASIC.


Keyboard info is found here (http://wiki.nesdev.com/w/index.php/Family_BASIC_Keyboard) and tape driver here (http://wiki.nesdev.com/w/index.php/Family_BASIC_Data_Recorder).


  Famicom Expansion Port
  1___________________8
   \ o o o o o o o o /
  9 \ o o o o o o o / 15
     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Keyboard schematics can be found here ("ファミリーBASICキーボードの回路図") (http://www43.tok2.com/home/cmpslv/Famic/Fambas.htm).
It looks like it uses pins 1, 4, 5, 6, 7, 10, 11, 12, 13 and 15.
The data pins are used in a similar way to read the controllers, but has a system for selecting which row in the key-matrix to read from. The PS/2 keyboard on the other hand, handles reading the keys itself and sends an interrupt request when a key is pressed so the computer doesn't have to poll it all the time. It then returns the state of all keys upon request I think.


Since the Family BASIC keyboard seems to only use off-the-shelf parts (much like the controllers), it should be possible to build one by using a PS/2 keyboard and throwing out the circuit and use the key-matrix the same way the Family Keyboard does, maybe.
You need a 4019 (logic chip), a 4017, four 4069, some resistors and other discrete components, two 3.5 mm mono phone connectors (for READ and WRITE ports), a Famicom Expansion port connector (you can use Neo-Geo extension cable from Tototek (http://www.tototek.com/store/index.php?main_page=product_info&cPath=23&products_id=192)) and some kind of key-matrix with 8x9 (72 total) keys.
Title: Re: Using PS/2 / USB keyboard with Family Baisc
Post by: emerson on March 25, 2021, 04:52:08 pm
Yeah I was disappointed it didn't work with Family Basic because that was the main objective. Mode 1 converts all three PS/2 scancode types to a Family Basic keyboard report and Mode 2 converts everything to scancode 3 as to not deal with extended codes. It's some type of timing issue. One of the many projects I need to revisit...

For what it's worth, before I bought my Family Basic keyboard I built one based on Enri's schematic and it worked flawlessly.
Title: Re: Using PS/2 / USB keyboard with Family Baisc
Post by: P on March 26, 2021, 05:52:48 pm
Oh that is exciting to hear! Now I feel like building one (although I already have the original). It uses very few parts.

What did you use as the key-matrix? That seems to be the hardest part.
Title: Re: Using PS/2 / USB keyboard with Family Baisc
Post by: emerson on March 27, 2021, 04:52:35 am
Just a large matrix of SPST switches. It was built on a breadboard and intended as a temporary setup until I found an actual Family Basic keyboard.

Using an existing keyboard's matrix will prove difficult because the row/column layout will almost certainly not match the Family Basic keyboard layout. This will result in improper key mapping. If you are considering building a diy keyboard, you are better off building the matrix from scratch. One could easily design a small key-matrix pcb where the multiple small pcbs could be strung in series to create the full key-matrix. With the several prototype pcb manufacturers available you could have 5-10 pcbs made quite affordably and have enough for more than one keyboard.
Title: Re: Using PS/2 / USB keyboard with Family Baisc
Post by: P on March 29, 2021, 04:31:57 pm
Oh I see. I thought of maybe just using a cheap keyboard's matrix and not use all lines, but I didn't really think about it very thoroughly. The problem with building a matrix is a source for good and affordable buttons suitable for typing with. Arcade buttons are very nice, but very expensive to have 72 of.
Title: Re: Using PS/2 / USB keyboard with Family Baisc
Post by: emerson on March 30, 2021, 09:58:04 am
Exactly. I did not much care for the tactile switches I used but it's what I had in the bin. You spend more time looking and pecking then anything else. A good option would be to repurpose an electronic typewriter keyboard. At least then you could cut pcb traces and rewire accordingly.