MSX1 keyboard matrix

By Shinobi

Expert (84)

Shinobi's picture

31-07-2020, 03:09

Hi

How fast MSX scans the keyboard matrix?? for msx engine s3527, for example.

Login or register to post comments

By gdx

Prophet (3557)

gdx's picture

31-07-2020, 09:28

Keyboard matrix is scanned at each interrupt so if you haven't rewritten the interrupt routine, you can simply read the system variables at 0FBE5h-0FBEFh.

By Manuel

Ascended (16689)

Manuel's picture

31-07-2020, 09:24

In basic? BIOS?

The state can be read out at any time.

By theNestruo

Master (155)

theNestruo's picture

31-07-2020, 09:56

gdx wrote:

Keyboard matrix is scanned at each interrupt so if you haven't rewritten the interrupt routine, you can simply read the system variables at 0FBE5h-0FBEFh.

Minor nitpicking correction: not each interrupt, but every 3 interrupts (the value depends on BIOS implementation, IIRC)

By gdx

Prophet (3557)

gdx's picture

31-07-2020, 10:58

Put a break point at 00038h with BlueMSX or OpenMSX. Keep a different key pressed at each re-execution and you will see that these variables change at each next interrupt after continuing execution.

By jltursan

Prophet (2280)

jltursan's picture

31-07-2020, 11:12

Check this thread. There's some interesting info in there about this subject.

By Shinobi

Expert (84)

Shinobi's picture

31-07-2020, 17:26

Guys..i have a broken msx keyboard..so i began to use arduino to simulate key press..took a line from keyboard socket pin Y0 and took a line from keyboard socket pin X0....
Now with arduino i am checking when Y0 is 0 to send 0 to X0 to get character 0 on screen..but what i am getting is character 8
As if arduino is late and sending 0 to X0 when Y1 is becoming 0 not Y0
Checking frequency of keyboard socket pins is giving me 8.5 khz for a line...thats slow compared to arduino pin sending speed which is several hundreds khz..
So as we know msx sends 0 to each y line one after another and monitor if an x line is 0 and registers a keypress

So what is keyboard matrix scan speed?

By Danjovic

Master (144)

Danjovic's picture

01-08-2020, 01:26

The problem resides on attending the pin change with a minimum latency. In most cases you'll succeed if you can answer the interrupt within 3.7us (Link) (Example code).
Yet, depending upon the condition that the Software scans the keyboard you may ned to answer within 600ns (Link).

By pgimeno

Master (188)

pgimeno's picture

01-08-2020, 12:58

gdx wrote:

Put a break point at 00038h with BlueMSX or OpenMSX. Keep a different key pressed at each re-execution and you will see that these variables change at each next interrupt after continuing execution.

Just checked. It works like that on e.g. a Philips VG-8020/20. In a Toshiba HX-10 it scans every 3 interrupts as theNestruo said.

If the BIOS does not have serious modifications, PEEK(&HC97) will tell you the interval, but that's not standard.

Anyway, that's irrelevant to the OP. Danjovic gave the relevant answer.

By gdx

Prophet (3557)

gdx's picture

01-08-2020, 13:20

I checked on Turbo R emulated with BlueMSX.

By Grauw

Ascended (9156)

Grauw's picture

01-08-2020, 13:21

As you can read on jltursan's link, it depends on the system.