VIC 20 as PC keyboard?

Basic and Machine Language

Moderator: Moderators

nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

VIC 20 as PC keyboard?

Post by nippur72 »

I was thinking about a method of connecting the VIC20 Keyboard to the PC, using it as keyboard for real-life programming.

I know a solution is the Key-rah interface, but this would mean modding the VIC, with the risk of damaging it.

So I've come to this (crazy) idea:

I could write a program on the VIC that sends keystrokes as audio tones, just like in DTMF of telephone keyboards. It could use the two audio registers 36875 and 36876 and send the row-column information using two sets of non-overlapping 8 tones (orthogonal or whatever).

Then, after connecting the TV set audio out to the PC soundcard (earphones to mic-in), a program on the Windows would sample the audio, detect the tones with two band-pass filters and finally send keystrokes to the sytem using the API function SendMessage() passing the parameter WM_CHAR (or similar).

This way, a keypress on the VIC would result in two audio tones sent to the PC which had to simulate the corresponding keypress.

Does this sound too crazy?
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

How about using the serial bus or user port? It strikes me that the keyboard already is assigned device #0, perhaps you could hook some routine to the keyboard input vector that redirects this channel on the IEC connector.

Otherwise, some serial terminal program seems like the most obvious way to do it. Just hook a RS232 interface to the VIC. Perhaps even the C2N232 could be used in reverse order by "saving" your keystrokes to a "tape" device.
Anders Carlsson

Image Image Image Image Image
dragos
Vic 20 Afficionado
Posts: 479
Joined: Mon Nov 21, 2005 6:41 pm

Post by dragos »

I think its too much work.

The Keyrah doesn't pose any risk to damaging your vic, as you would remove the motherboard to use it.

And it probably does not matter what method you choose, you will most likely go back to not using it on your pc.
User avatar
Schema
factor
Posts: 1430
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

Post by Schema »

Sounds like a fun "Rube Goldberg" type of project ;-)

It could probably be made to work, but you would be better just using a terminal program on the VIC and an RS-232 interface to the PC. There must be some program (maybe as an Accessibility device?) that lets you use RS-232 input on the PC.

For a hardware solution, there's brain's c=key. Should work fine on the VIC.

http://www.jbrain.com/brain/c=key/
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

I was thinking about a method of connecting the VIC20 Keyboard to the PC, using it as keyboard for real-life programming.
This should be do-able. The serial port has the right electrical interface to connect to a PC keyboard port and the 6502 is easily as fast as the 804x micros commonly found in PC keyboards so it should just be a case of making up a lead and writing the software.

If you were feeling really adventurous you could wire some LEDs to the user port for shift/scroll/number lock indication.

Lee.
gklinger
Vic 20 Elite
Posts: 2051
Joined: Tue Oct 03, 2006 1:39 am

Re: VIC 20 as PC keyboard?

Post by gklinger »

nippur72 wrote:Does this sound too crazy?
While completely unnecessary, that would be a very cool hack and it could certainly be made to work. It's worth doing for laughs but if you really want to use your VIC-20 as keyboard for your PC would be much better off with the Keyrah or C=Key.
In the end it will be as if nothing ever happened.
User avatar
eslapion
ultimate expander
Posts: 5458
Joined: Fri Jun 23, 2006 7:50 pm
Location: Canada
Occupation: 8bit addict

Post by eslapion »

carlsson wrote:How about using the serial bus or user port? It strikes me that the keyboard already is assigned device #0, perhaps you could hook some routine to the keyboard input vector that redirects this channel on the IEC connector.

Otherwise, some serial terminal program seems like the most obvious way to do it. Just hook a RS232 interface to the VIC. Perhaps even the C2N232 could be used in reverse order by "saving" your keystrokes to a "tape" device.
I know there are some special input devices for PC used by handicapped people that send codes through standard RS-232 interfaces.

The driver needed is completely standard for Windows.

All you'd need really is some sort of terminal software running on the VIC and the right driver running in Windows.

I suppose Schema's expression (accessibility device) is correct. I would have to talk to a few handicapped friends for more details.
dragos wrote:The Keyrah doesn't pose any risk to damaging your vic, as you would remove the motherboard to use it.
Indeed. The keyboard of the C64/VIC-20 just just a large array of switches with no electronics at all and you need to disconnect it from the VIC/64 to use keyrah.

Absolutely no risk there.
Be normal.
Richard James
Vic 20 Devotee
Posts: 269
Joined: Mon Feb 04, 2008 6:06 am

Post by Richard James »

I have a question. What is the best way to have a commodore keyboard with the special keys, layouts and labels so that programming in VICE is easier and I can do things like see what C=Q and Shift-Q print. At the moment you can map the PC keyboard to something like the VIC-20 but without printing out labels for each key it is very hard to use. I have though of using a virtual keyboard or a http://www.artlebedev.com/everything/optimus/ (very expensive) but this C=Key sounds like the right sort of thing.

Maybe I should just program on my VIC-20 plugged into the LCD but I don't want to have to move the VIC all the time.

Another option is to pull the keys off my G11 keyboard and print out labels to match the Commodore Keyboard. I believe someone might already sell such labels.

Maybe some sort of virtual keyboard that shows what each of your normal keyboard keys do when pressed. Like the Demo on the Optimus website.
Change is inevitable except from a vending machine.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

Richard James wrote:I have though of using a virtual keyboard or a http://www.artlebedev.com/everything/optimus/ (very expensive)
:shock: I didn't imagine that such keyboard existed out of sci-fi.

I've been using Keyrah for three months now, and it's excellent. I connected it to a spare keyboard from a defunct Commodore 64, and put together a mix with the keyboard and lower half of breadbox from a C64, upper half from a C16, and the metal plate from a VIC20. I use it both for VICE and windows: with the switch in the power switch hole you can change between the PC and CBM layout, and the power led indicates the layout status (on = VICE; off = PC). Also, you can use your old joystick plugging it in one of the two ports - it works perfectly in VICE.
Excellent product, cheap enough for what it does.
nippur72
de Lagash
Posts: 574
Joined: Thu Sep 07, 2006 8:35 am

Post by nippur72 »

regarding the "Rube Goldberg" audio solution, I was thinking about the small delay introduced by the Windows soundcard buffer (around 100ms) plus the additional delay introduced by the passband filters (let's say 50ms). I'm not sure the final result would be "responsive" enough to be usable for real typing.

Nonetheless I still think it's a funny (and totally useless) program to write. Perhaps it could be extended to C64 and all the other commodore machines.
Richard James
Vic 20 Devotee
Posts: 269
Joined: Mon Feb 04, 2008 6:06 am

Post by Richard James »

Past the keyboard idea nippur. By using sound like a modem does you can copy from the VIC to the PC. So you could have a program that copies tapes, disks etc to the PC. It just might be harder to copy back from the PC, given the VIC-20 has no A/D converter, or does it?
Change is inevitable except from a vending machine.
User avatar
ral-clan
plays wooden flutes
Posts: 3702
Joined: Thu Jan 26, 2006 2:01 pm
Location: Canada

Post by ral-clan »

orion70 wrote:
Richard James wrote:I have though of using a virtual keyboard or a http://www.artlebedev.com/everything/optimus/ (very expensive)
:shock: I didn't imagine that such keyboard existed out of sci-fi.
That is amazing! I think there is also a projection keyboard, (i.e. a device that projects an image of a keyboard on a surface, and you type on that image with your fingers). Apparently it's available and for sale (some people were talking about using one on another forum, but didn't provide a link).

Of course, a projection keyboard would probably be configurable in any way you could imagine.

Edit: I found some info here...
http://en.wikipedia.org/wiki/Projection_keyboard
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

Leading to...

Image
Richard James
Vic 20 Devotee
Posts: 269
Joined: Mon Feb 04, 2008 6:06 am

Post by Richard James »

http://www.virtual-laser-keyboard.com/ I was shown this link earlier this year. The keyboard is really designed for small devices like PDA's that have not got a full keyboard. The main thing I don't like about it is it is only one colour red, the other thing is there is no tactile feel because all you are touching is a surface.
http://youtube.com/watch?v=HH8CUTimTvY
Change is inevitable except from a vending machine.
User avatar
orion70
VICtalian
Posts: 4341
Joined: Thu Feb 02, 2006 4:45 am
Location: Piacenza, Italy
Occupation: Biologist

Post by orion70 »

When using the VKB settings can be changed either via your laptop, your PC or your compatible Smartphone and PDA:

- Sound: controllable Virtual Keyboard sound effects (keyclicks)
:shock:
Post Reply