• Please review our updated Terms and Rules here

Keyboard scan codes problem with Sanyo MBC 555

tonata

Experienced Member
Joined
Sep 11, 2019
Messages
190
Location
France
Hi,

I bought a French Sanyo MBC 555. The keyboard is azerty in French. On other computers (not Sanyo) this is not a problem. Usually you can use an azerty keyboard as qwerty with a default English DOS version.
I do not have the original French Sanyo MBC disks.

So everything is switched. Pressing one key gives not what it says on the keyboard - in neither English or French.
So when I boot DOS 1.25 in English I get:

pressing "enter" => "b" (actually one time it was "r")
"azerty" => "12345"
"23456789" => "ABCDEFGH"
pressing "GRAPH" => "S"
pressing num lock => "P"
pressing PF9/PF4 => CTRL+C
pressing "a" => space bar
"sdfghjklm" => !"#$%&'() - this looks like direct mapping to the ASCII table!
Holding shift changes the characters printed. I get some Extended ASCII characters.

So it is actually unusable because I can not find the "enter" for example.

When you boot the computer "enter" should always be "enter", right?

So the ROM has: 1k of keyboard lookup tables, 2k of font (standard Codepage 437 at the 8x8 size)

So possible theories are:
- pin 1 on the connector is not OK (not sure how to test that). I have a logic analyzer.
- the 1 kb keyboard lookup tables are wrong ... or they were adapted for the French language and thus incompatible with an English DOS Sanyo disk. One solution is to change the ROM or find the original disks supplied with the computer.
- I myself am not doing something right. But the letters should produce letters, right? But they don't.

Any help will be much appreciated.

Resources:
https://www.seasip.info/VintagePC/sanyo.html
https://drive.google.com/file/d/1tua4tfew23Q4r1PWU3zBKsQTq1uaH-mm/view?usp=sharing
 
Last edited:
Didn't the Sanyo MBC-500 series have a minimal boot ROM and no real BIOS, per se? So the keyboard translation would likely be on the boot disk, no?
 
It is not quite clear to me how it works.

From here it says:
The keyboard translation table (which converts Sanyo scancodes to PC-compatible scancode+character pairs) is at the start of the ROM (0FE000h). It contains 512 words; the first 256 are for when the CTRL key is up, and the second 256 for when it is down.

Notable mappings in this table include:

05 -> Scancode 0Fh (TAB), ASCII 00
80-FF -> Scancode 00, ASCII unchanged
Ctrl+End -> Scancode 75h, ASCII 00
Ctrl+PgDn -> Scancode 76h, ASCII 00
Ctrl+Tab -> Scancode 00, ASCII 09
Ctrl+Enter -> Scancode 75h, ASCII 00
Ctrl+Home -> Scancode 77h, ASCII 00
Ctrl+function keys -> Scancode 68h-71h (F21-F30), ASCII 00

In general, Ctrl+key or Ctrl+Shift+key translates to a scancode of 54h or higher and an ASCII value of 0. The exceptions are the letter keys, which produce their normal IBM-compatible scancodes and the expected ASCII value in the range 01h-1Ah.

I do not understand if these 512 bytes tables are modified for the French keyboard and thus not compatible with the English version of Sanyo DOS.
 
Scancodes are always the same, since they are defined by the position of the key. It's up to the character mapping to translate that to the correct letter.

Or in other words: if you have a french keyboard and press the "a" key, you'd get an "q" on screen with an English version of DOS.

It sounds like a hardware issue you have there.
 
Still the keys do not come random.

Pressing "azerty" gives "12345"
Pressing "23456789" gives "ABCDEFGH"

Is it more likely that it is a cable problem where a byte is switched or that the ROM needs to be replaced.


If somebody can upload the ROM (English version), so that I can ask somebody else to make me a copy?
Were there different versions of DOS for each country? I can not find anything on the Internet.
 
Still the keys do not come random.
tonata said:
pressing "enter" => "b" (actually one time it was "r")
Well... ;)

If it would just be a software-issue, at least the keys that are the same on the keyboard in French and English should not be affected. If I had to make a wild guess, I'd say the keyboard matrix has a short somewhere.
 
sanyo_keyboard.png

So here is information about the keyboard.

I get these sequences as described in these tables. For example when I press "23456789" I get "ABCDEFGH". It is the same sequence, it is just not what it should be.
Another example is "abcdef" which gives another vertical line "space ! " # $ %"
So the the X and Y in these tables are shifted.
But such problem is in the keyboard or the ROM tables? The ROM is able to execute and load DOS, so it should be the keyboard.
 
Last edited:
So I tested the 8251 USART in my MBC 555 and it receives the codes that are shown on the screen. It receives incorrect codes. For example "q" gives me " " space and the code I see is 32 (32 is space in ASCII) in the LA.

The test was done with a Logic Analyser that uses the "Async Serial" value decoding plugin in the Logic 2 software from Saleae. Connect to pin3 (Receiver Data) and ground. The plugin/decoder was configured to: async serial 1200 baud, with 8 data bits (8 bits per Transfer), 2 stop bits and even parity. In addition it was set to "least significant bit sent first" and "Non inverted" which are standard behavior.

Still this does not narrow down the problem ... I need to hook between the keyboard connector and the computer to be 100% sure it is the keyboard and not something else between the keyboard and the USART.

Also I was thinking. I can use Arduino to type on the computer, right? I will gain temporally the possibility to send DOS commands. From what I see I just need to connect the Tx pin of the Arduino to pin 3 (Receiver Data) of the USART. Also a common ground is required. But that's it, I do need other cables, right?
 
Last edited:
Last edited:
A little update:

I am able to communicate through the Arduino as described in my previous post. I am able to send commands, though I haven't figured out why the backspace does not work.

This is the simple Arduino code:
Code:
int incomingByte = 0; // for incoming serial data

void setup() 
{
  Serial.begin(1200,SERIAL_8E2);
  Serial.flush();
  int bytesSent = Serial.write("\n\r"); //prints garbage and then goes to the next line with proper prompt
}

void loop() 
{
  if (Serial.available() > 0)
  {
    // read the incoming byte:
    incomingByte = Serial.read();
  
    //Serial.write(45); // send a byte with the value 45

    //int bytesSent = Serial.write("hello");  //send the string "hello" and return the length of the string.
    int bytesSent = Serial.write(incomingByte);
  }
}

I use Putty to connect to my virtual Arduino serial port with the above configuration.
 
Leds are OK. Each click give "R" and "S".

By "microcontroller" you mean the D8049HC which is inside the keyboard? Which pin is that? This is the datasheet.

There is not really too much in the keyboard to go wrong...

http://www.eriscreations.com/sanyo/diskimages/sams-computerfacts-sanyo-mbc-55x-schematics-only.pdf

I suspect the microcontroller would be different between the UK and French layouts (a guess).

Do the two LEDs work on the keyboard (LOCK and GRAPH) out of interest?

I can’t see much correspondence between the GRAPH and ‘S’ key in the matrix though...

Is the 6MHz clock OK on the microcontroller.

Dave
 
Last edited:
Yes, the microcontroller is the 8049 inside the keyboard.

The clock is on pin 3.

The schematics I linked to had some oscilloscope traces indicated. The serial data output oscilloscope trace was taken by holding down the SPACE bar.

Dave
 
Maybe that is what I need - the English version of the keyboard controller. Probably there was something on the original French boot disk for the mappings, but now it is lost.

Actually I have an Intel D8748 ... which might be compatible with D8049HC? I do not have an EPROM programmer though.
 
The 8748 has 1K EPROM whereas the 8749 has 2K.

It looks like most of the keys on the French and British keyboards are the same, so I would have expected that the same keys that are in the same row/column on both keyboards would produce the same codes. Different keys would produce different codes.

So what did your arduino test tell you about the codes? Are they ASCII between the keyboard and the main unit? If they are, then I assume you have proven that the main unit is OK and the problem is with the keyboard itself?

Dave
 
Dave, thank you for your help!

First I will need to measure pin 38 on the D8049HC with my LA, which should be pin 1 on the keyboard connector and pin 3 on the 8251 UART.
This way I will know from where the "wrong" scan code originates.
 
sanbyo_mbc_keyboard2.png
Above is a picture of the pins on the back of the card.

So I tested and it looks like the keyboard controller is sending wrong codes.

I pressed "f" and it gives 35 which is # and shows as # on the screen.

Still I am confused - was this intentional? Is the keyboard controller flashed specifically to work with a french computer or it is an error either in the controller or the lines that the controller is connected to?
 
According to this website https://geekhack.org/index.php?topic=86197.0 the codes sent from the keyboard should be ASCII codes. The control key (when used in conjunction with a standard key) causes a parity error...

If you are not getting ASCII character codes, either your keyboard is not working correctly, or your interpretation of the serial stream is in error.

In the schematic link I posted to were oscilloscope traces at certain points in the keyboard.

Have you tested the keyboard microcontroller clock frequency and the TX data line with the SPACE key held down as I requested?

The keyboard should contain a French microcontroller image to convert the key layout into the corresponding ASCII serial characters. But the only keys that should be different should be those that are not in the same location as a UK keyboard.

All of the keys that are in the same place should produce the same ASCII character codes.

The conversion routines/table within the EPROM should convert the ASCII character codes from the keyboard into IBM key codes for compatibility with software that use these key-codes...

Dave
 
Last edited:
It is a wrong code on pin 38 of the keyboard's controller. Instead of 102 (ASCII code for "f") I get 35 (ASCII code for "#") and the screen also shows # which is 35.

Dave, do you have the English keyboard? Is it possible to read and publish the ROM of your keyboard's microcontroller? I can try to put it into my keyboard and see what happens.
 
Nope, I don't even have a Sanyo computer...

I am going off the schematics and the technical description of the keyboard interface in the Sanyo manual.

I think we all agree that the keyboard is at fault. What we are trying to deduce is "why". What we need to do is to look around the keyboard matrix itself and deduce if there is something at fault there or not. If not, the problem must be the micro controller itself (by a process of elimination).

Do you have an oscilloscope? You have a logic analyser, right?

The first thing to do is to make sure you have a stable 5V supply at the micro controller. Pin 40 = +5V and pin 20 = 0V. Use a multimeter or oscilloscope.

The next thing is to check for the presence of a 6 MHz clock at pin 3 of the micro controller. Use an oscilloscope.

The next thing to check is that the outputs from the 4 to 16 decoder (74159) pins 1-11 and pin 13 are scanning. They should go low in an orderly fashion one at a time. No two pins should be low at the same time (although there may be an occasion where they are all high simultaneously). Use a logic analyser.

The next thing to do is to check the micro controller keyboard inputs (pins 27-34 of the micro controller). These should all be pulled up high with no keys pressed. Use a multimeter or oscilloscope.

When you press a single key, one (and only) input to the micro controller should go low - corresponding to the row and column of the key and the output form the 74159. Use a logic analyser, oscilloscope or logic probe.

The last thing to check is the serial output data from the micro controller (pin 38) WITH THE SPACE BAR PRESSED. Use an oscilloscope and post the recorded trace if you can.

The traces should all correspond with those as described on page 2 of http://www.eriscreations.com/sanyo/diskimages/sams-computerfacts-sanyo-mbc-55x-schematics-only.pdf.

Dave
 
Back
Top