the family basic keyboard

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Post Reply
nickmaynard
Posts: 8
Joined: Wed Jul 07, 2010 5:32 am

the family basic keyboard

Post by nickmaynard » Sun Nov 13, 2011 9:52 am

before i buy one of these things, i wanted to ask the community here if it would be possible to connect the family basic keyboard for the famicom to a nintendo entertainment system, either by connecting it through the first and second player controller ports or by modifying the expansion port on the bottom.

i've checked out the nesdev wiki page (along with a few other resources about the keyboard) and i feel like i understand how to write the code to read the button presses of the keyboard. i just wanted verification from someone smarter than me that this was a possibility before i dropped a bunch of cash on one of these keyboards.

if this ends up working out, i will post a full picture/video tutorial on how to mod the keyboard and nintendo to work together along with some example code for reading the button presses.

thanks!

User avatar
jpx72
Posts: 178
Joined: Tue Sep 28, 2010 3:27 am
Location: Slovakia
Contact:

Post by jpx72 » Sun Nov 13, 2011 3:14 pm


slobu
Posts: 275
Joined: Tue Jul 12, 2011 10:58 am

Post by slobu » Mon Nov 14, 2011 7:33 am

As a side the PLAYPOWER people are figuring out how to code for the NOAC clones with keyboard
http://code.google.com/p/playpower/sour ... ame%2Fcode

I wonder how much modding Family BASIC would need to work on a clone.

My thinking here is instead of hacking hardware you could go the NOAC-as-Keyboard route.

tepples
Posts: 21842
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Mon Nov 14, 2011 7:43 am

slobu wrote:As a side the PLAYPOWER people are figuring out how to code for the NOAC clones with keyboard
What rewritable cartridge do they recommend for testing one's software on the clones? That's been the one reason I haven't got into the Playpower project: PowerPak incompatibility.

slobu
Posts: 275
Joined: Tue Jul 12, 2011 10:58 am

Post by slobu » Mon Nov 14, 2011 7:56 am

tepples wrote:
slobu wrote:As a side the PLAYPOWER people are figuring out how to code for the NOAC clones with keyboard
What rewritable cartridge do they recommend for testing one's software on the clones? That's been the one reason I haven't got into the Playpower project: PowerPak incompatibility.
I guess that does spoil my only software hacking needed plan. From what I've heard they've been making their own UNROM boards.

I'm already going a bit off topic but what are the options besides a PowerPak or self-made UNROM board? I've got a NOAC-as-Keyboard to test on.

nickmaynard
Posts: 8
Joined: Wed Jul 07, 2010 5:32 am

Post by nickmaynard » Mon Nov 28, 2011 3:27 pm

so, my family basic keyboard just arrived in the mail. it's in really great condition and i'm ready to get started.

first thing i did was open it up and pry open the controller jack itself. here's what i've found -

pin 1 - light brown wire - ground
pin 4 - red wire - port 1 d4
pin 5 - orange wire - port 1 d3
pin 6 - yellow wire - port 1 d2
pin 7 - green wire - port 1 d1
pin 10 - blue wire - out 2
pin 11 - light purple - out 1
pin 12 - grey wire - out 0
pin 13 - white wire - port 0 d1
pin 15 - dark purple - 5v

my initial plan was to install 25 pin connector jacks to both the NES and the keyboard and remove the controller cord from the keyboard completely. the 25 pin connector jack on the NES would be connected directly to the expansion slot via soldered wires. this way, i could plug the keyboard directly in to the expansion slot.

but here's my question. i'm still very new to all this and so there's a lot that is still unclear to me. some of these points are present in the pre-existing regular nintendo controller ports, correct? could i possibly use those with only slight modification?

tepples
Posts: 21842
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Mon Nov 28, 2011 3:57 pm

NES controller ports have only D0, D3, and D4. You'll have to use the front-loader's bottom expansion port.

nickmaynard
Posts: 8
Joined: Wed Jul 07, 2010 5:32 am

Post by nickmaynard » Mon Nov 28, 2011 8:56 pm

Thanks tepples!

FYI, I'm posting blog entries about this at - http://nickmaynard.tumblr.com/tagged/ni ... rd+project

User avatar
jpx72
Posts: 178
Joined: Tue Sep 28, 2010 3:27 am
Location: Slovakia
Contact:

Post by jpx72 » Mon Nov 28, 2011 10:43 pm

Have you checked the famicomworld link I posted? Xious posted a pin-to-pin diagram of connecting FC keyboard to Frontloader's Exp connector...

nickmaynard
Posts: 8
Joined: Wed Jul 07, 2010 5:32 am

Post by nickmaynard » Mon Nov 28, 2011 10:45 pm

jpx72 wrote:Have you checked the famicomworld link I posted? Xious posted a pin-to-pin diagram of connecting FC keyboard to Frontloader's Exp connector...
i did, yeah! it was exactly what i was looking for. thanks a lot!

nickmaynard
Posts: 8
Joined: Wed Jul 07, 2010 5:32 am

Post by nickmaynard » Tue Dec 06, 2011 11:52 pm

another entry in the series.

http://nickmaynard.tumblr.com/post/1386 ... -modifying

i'm posting these here with the hopes that someone will point out to me when i'm doing something wrong.

User avatar
jpx72
Posts: 178
Joined: Tue Sep 28, 2010 3:27 am
Location: Slovakia
Contact:

Post by jpx72 » Wed Dec 07, 2011 12:58 am

Very nice and clean soldering job you did there, with all the protecting tubes on contacts and everything! A pair of screw washers should make the connector less inclinable to breaking off the plastic. Looking forward to the cable's other end!

User avatar
neilbaldwin
Posts: 481
Joined: Tue Apr 28, 2009 4:12 am
Contact:

Post by neilbaldwin » Sat Dec 24, 2011 3:31 am

Nick asked me for some help with writing code to read the keyboard. I tried to have a go based on info from the wiki etc. but I cannot test it myself as I don't have the ability to hook my keyboard up to my NES (yet). Thought I'd post it here as someone might be able to check the code so we can get Nick being able to test his hardware.

Code: Select all

;----------------------------------------

keyboardInput = $4016
keyboardOutput = $4017

keyboardMatrix:	.RES 9	;nine bytes of RAM to store keyboard bit matrix

;----------------------------------------

resetKeyboardMatrix:
	ldx #$08
	lda #$FF		;for the keyboard, bits are set when the key is NOT held
@a:	sta keyboardMatrix,x
	dex
	bpl @a:
	rts

;
;Scan keyboard port and store any held keys in bit matrix
;
;IMPORTANT: the keyboard actually reads a '0' for a key that is held and
; a '1' for a key that is not held - opposite to the controller pads etc.
;
readKeyboard:
	lda #$05		;reset port
	sta keyboardInput
	
	ldx #$00
@a:	lda #$04		;select column 0
	sta keyboardInput
	lda keyboardOutput	;read port
	lsr a
	and #$0F		;put in LSB
	sta keyboardMatrix,x
	lda #$06		;select column 1
	sta keyboardInput
	lda keyboardOutput	;read port
	asl a
	asl a
	asl a
	and #$F0		;put into MSB
	ora keyboardMatrix,x	;'add' to LSB
	sta keyboardMatrix,x	;store in matrix
	inx
	cpx #$09		;there are nine rows to read
	bne @a
	rts

BIT_MASK:	.BYTE $01,$02,$04,$08,$10,$20,$40,$80

;
;Input: Y = row, X = column
;Output: A=0, key pressed, A=anything other than 0, key not pressed
;
;Example, Y=6, X=03 will check the 'A' key and return a 0 if the
; 'A' key is held down
;	
readKey:
	lda keyboardMatrix,y
	and BIT_MASK,x
	rts
	
		
; Row   Bit0   Bit1   Bit2   Bit3   Bit4   Bit5   Bit6   Bit7
;  0     F8     RETURN [      ]      KANA   R-SHFT \(Yen) STOP
;  1     F7     @      :      ;      _      /      -      ^
;  2     F6     O      L      K      .      ,      P      0
;  3     F5     I      U      J      M      N      9      8
;  4     F4     Y      G      H      B      V      7      6
;  5     F3     T      R      D      F      C      5      4
;  6     F2     W      S      A      X      Z      E      3
;  7     F1     ESC    Q      CTRL   L-SHFT GRPH   1      2
;  8     CLR    UP     RIGHT  LEFT   DOWN   SPACE  DEL    INS

	

Post Reply