I was thinking about keyboard input on the NES, and wondering what a sensible (i.e. relatively easy to build and use) interface for a modern keyboard would look like.
The Family Basic controller just lets you manually poll it to scan the key matrix 4 bits at a time. This seems relatively convenient, though with all of its I/O bits it needs to go through the expansion port.
In the DOS days, if I recall correctly, the interface was getting an interrupt whenever a key was pressed or released, during which you could read a byte of data (scancode) and command key flags (alt,shift etc.). The interrupt is probably not the best thing here, but I think the parsimony of scancode events is good.
I understand that modern USB keyboards are poll based, though. Does it retain a queue of scancodes since last poll that can be read?
So, my question is what the minimal (i.e. easiest to build) USB interface should look like, especially from the NES programming side. Could the NES directly communicate with a USB keyboard, or how much stuff would you need to put in an adapter between it? Is only having the $4016 strobe for upload a big problem? If a simple/direct communication isn't feasible, what does the next best thing look like?
I guess being able to use D1-D4 for each poll like the Family BASIC keyboard would be nice, but require use of the expansion port, though probably even 1 bit serial is fast enough for most purposes?
Also there's a question of how to identify the attached device, though I'd presume USB already has a convenient protocol for this.
Of course, several steps away from this level I could just throw like an Arduino or something at the problem, which seems like a valid solution to me but I was wondering if there's a relatively "simple" or "natural" alternative. My goal here isn't really requesting that someone design me a USB keyboard to NES adapter, I only want to get a rough idea of the possibilities and how complex they are.
What I really want to do is make an NES project that uses a keyboard/mouse in an emulator, but I'd like it to be something that could be built in hardware without too much trouble, if possible.
Oh, and also same question but USB mouse, I guess. (Or combo keyboard + mouse? Does it complicate things a lot if they're 1 device?)
The Family Basic controller just lets you manually poll it to scan the key matrix 4 bits at a time. This seems relatively convenient, though with all of its I/O bits it needs to go through the expansion port.
In the DOS days, if I recall correctly, the interface was getting an interrupt whenever a key was pressed or released, during which you could read a byte of data (scancode) and command key flags (alt,shift etc.). The interrupt is probably not the best thing here, but I think the parsimony of scancode events is good.
I understand that modern USB keyboards are poll based, though. Does it retain a queue of scancodes since last poll that can be read?
So, my question is what the minimal (i.e. easiest to build) USB interface should look like, especially from the NES programming side. Could the NES directly communicate with a USB keyboard, or how much stuff would you need to put in an adapter between it? Is only having the $4016 strobe for upload a big problem? If a simple/direct communication isn't feasible, what does the next best thing look like?
I guess being able to use D1-D4 for each poll like the Family BASIC keyboard would be nice, but require use of the expansion port, though probably even 1 bit serial is fast enough for most purposes?
Also there's a question of how to identify the attached device, though I'd presume USB already has a convenient protocol for this.
Of course, several steps away from this level I could just throw like an Arduino or something at the problem, which seems like a valid solution to me but I was wondering if there's a relatively "simple" or "natural" alternative. My goal here isn't really requesting that someone design me a USB keyboard to NES adapter, I only want to get a rough idea of the possibilities and how complex they are.
What I really want to do is make an NES project that uses a keyboard/mouse in an emulator, but I'd like it to be something that could be built in hardware without too much trouble, if possible.
Oh, and also same question but USB mouse, I guess. (Or combo keyboard + mouse? Does it complicate things a lot if they're 1 device?)