Jump to content
Sign in to follow this  
mizapf

TI console as keyboard

Recommended Posts

Following the reports on Stuart's web browser, people again suggested to use an old TI console and put a Raspberry PI inside. As I already said, at least MESS won't really run well on a Raspi, at least with its current performance, but faster models seem to come soon.

 

I got another idea that should be perfectly feasible: What about using the TI console as a USB keyboard?

  • Remove everything inside except for the keyboard
  • Attach the keyboard lines to the digital inputs of a microcontroller; I suppose an Arduino should be enough, don't need a full Raspi
  • You would then connect the TI console to the USB port of the PC, where it shows up as a keyboard

Does anyone know more about how to make an Arduino pretend to be a USB device, particularly a keyboard?

Share this post


Link to post
Share on other sites

Following the reports on Stuart's web browser, people again suggested to use an old TI console and put a Raspberry PI inside. As I already said, at least MESS won't really run well on a Raspi, at least with its current performance, but faster models seem to come soon.

The Raspberry Pi 2 was released just yesterday. Now with a quad core CPU and twice the RAM. Wonder if this will improve matters?

Share this post


Link to post
Share on other sites

I just recently tried to compile and run MESS on my Raspberry Pi (1), but I'm still stuck with a segfault from the audio system. It took 93368 seconds (!) to compile - my PC does the same in about 500 secs.

Share this post


Link to post
Share on other sites

I've seen cross-compilation instructions somewhere online. Maybe that would improve compile-times? Let's face it, the Pi isn't supposed to be in competition with a full-fledged PC (though Microsoft are supposedly offering Windows 10 for free on the Pi).

Share this post


Link to post
Share on other sites

Sure, this was also intended to learn more about the capabilities. I see people talking about the Raspberry Pi as if it could replace their desktop PC, but it is really far, far behind. If I succeed in getting the current MESS to run on the Raspi, I'll do a benchmark to see how fast it goes. At this point I can already see the intro screen (system description), but when you press a key to enter the TI emulation, it bails out. However, this is already a first impression on the speed - you have to type "OK" at the beginning, and you need to hold down O and K for at least one second.

 

I think the problem is with the X server. I should try to build the SDL lib without X so that it runs directly on the framebuffer.

 

----

 

Concerning my above idea, I just found that the Arduino Micro has 20 I/O pins which would be enough to connect the TI keyboard and the Joystick port. Could be possible ...

Share this post


Link to post
Share on other sites

Here's a completely different way of doing it, which won't require opening the TI at all.

 

It requires a little piece of hardware to plug into the side of the console, with a bit of code running at >4000 to hijack the console as soon as you turn it on. Once the code residing in the external hardware takes over, it will just run a keyscan routine and output the keystrokes via USB.

 

It's more complicated, but doesn't require opening the console, and it was a method used by the Triton TurboXT bridge box to get the TI to act as a PC keyboard, back in the day.

Edited by briantw

Share this post


Link to post
Share on other sites

Well, I already ordered an Arduino Micro, and I still have my old TI console, so I guess I'll just try and see how far I can get :) . The Arduino may be powered by the USB interface, so I would not even need a separate power supply. Also, I don't have to make sure the console is still in working condition (has not seen power for 25 years ...)

Share this post


Link to post
Share on other sites

OK, that was easier than expected... :-)

 

http://www.mizapf.de/ti99/tikeyboard.mp4

 

(35 MiB)

 

This is the Arduino sketch:

int column = 0;
int value[] = { 0, 0, 0, 0, 0, 0, 0 };
int inputpin[] = { A0, A1, A2, A3, A4, A5, 11, 12 };
char key[] = {
                'p',  '0',  'a',  ';',  '/',  '1',  'q',  'z',
                0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x00, 0x00,
                'y',  '6',  'g',  'h',  'n',  '5',  't',  'b',
                0xB0, 0x00, 0x81,  ' ',  '=', 0x82, 0x80, 0x00,
                'O',  '9',  's',  'l',  '.',  '2',  'w',  'x',
                'i',  '8',  'd',  'k',  ',',  '3',  'e',  'c',
                'u',  '7',  'f',  'j',  'm',  '4',  'r',  'v'
             };

void setup() {
  /* Problem: We need open collector outputs. This can be achieved
     by switching to input mode. */
  for (int i=0; i < 7; i++) {
     pinMode(i, INPUT_PULLUP);
     digitalWrite(i, HIGH);
  }

  for (int j=0; j < 8; j++) {
     pinMode(inputpin[j], INPUT_PULLUP);
     digitalWrite(inputpin[j], HIGH);   /* Activate pullup. */
  }

  // Kill switch
  pinMode(10, INPUT_PULLUP);
  digitalWrite(10, HIGH);
  column = 0;

  if (digitalRead(10)==LOW) {
    Keyboard.begin();
  }
}
  
void loop() {
   /* The "kill switch" is a recommendation for all sketches for Arduino emulating
      a keyboard, because when there is a bug you can at least stop it from messing
      with our input. */

   if (digitalRead(10)==LOW) {
     for (int i=0; i < 7; i++) {
        if (i==column) {
           /* Pull down line */
           pinMode(i, OUTPUT);
           digitalWrite(i, LOW);
        }
        else {
           /* Pull up line, but do not output +5V -> open collector */
           pinMode(i, INPUT_PULLUP);
           digitalWrite(i, HIGH);
        }
     }

    int newvalue = 0;
    int oldvalue = value[column];

    for (int j=0; j < 8; j++) {
       newvalue <<= 1;
       if (digitalRead(inputpin[j]) == HIGH) {
          if ((oldvalue & 0x80) != 0x00) {
             /* Sends the break code */
             Keyboard.release(key[column*8 + j]);
          }
       }
       else {
           newvalue |= 1;
           if ((oldvalue & 0x80) == 0x00) {
             /* Sends the make code */
             Keyboard.press(key[column*8 + j]);
           }
       }
       oldvalue <<= 1;
    }
     value[column] = newvalue;

     column++;
     if (column>=7) column = 0;
     /* Have a little break */
     delay(1);
   }
   else {
      /* Input disabled */
      delay(1000);
   }
}

Share this post


Link to post
Share on other sites

Here's a completely different way of doing it, which won't require opening the TI at all.

 

It requires a little piece of hardware to plug into the side of the console, with a bit of code running at >4000 to hijack the console as soon as you turn it on. Once the code residing in the external hardware takes over, it will just run a keyscan routine and output the keystrokes via USB.

 

It's more complicated, but doesn't require opening the console, and it was a method used by the Triton TurboXT bridge box to get the TI to act as a PC keyboard, back in the day.

 

heck i have a TurboXT box ;)

Share this post


Link to post
Share on other sites

I did a PS/2 one years ago, but I cheated and used a KeyWarrior (which was also fairly expensive at $50, but at least less than the one above). Cool that you got a modern interface going! (And released it!)

Share this post


Link to post
Share on other sites

There's a similar design using a Teensy controller here, but I like your Arduino solution much better!  It's something I've been wanting to do for over a year now ... maybe I can get some friends to set something up for Arduino Day.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...