Daniel Caetano wrote:

> This is how the mistery was solved. In fact, the big trouble
> was in finding a BIOS procedure that was able to ready the
> keyboard with the IRQ disabled... and more: a procedure that
> should be in the same place on every computer. These procedures
> are 0d12h, which reads the keyboard and fill a keymatrix structure
> and 0d4eh, which translates this structure into a ASCII number
> on the keybuffer.


Undocumented? Quoting from the MSX Red Book (which is on FUNet):

- 51 -

4. ROM BIOS


     Address... 0C3CH
     Name...... KEYINT
     Entry..... None
     Exit...... None
     Modifies.. EI


... [snip!]

     A complete scan of the keyboard matrix is then performed to
identify new key depressions, any found are translated into key
codes and placed in KEYBUF (0D12H). If KEYBUF is found to be
empty at the end of this process REPCNT is decremented to see
whether the auto-repeat delay has expired, if not the routine
terminates. If the delay period has expired REPCNT is reset
with the fast repeat value (60 ms), the OLDKEY keyboard map is
reinitialized and the keyboard scanned again (0D4EH). Any keys
which are continuously pressed will show up as new transitions
during this scan. Note that keys will only auto-repeat while an
application program keeps KEYBUF empty by reading characters.
The interrupt handler then terminates.

     Address... 0D12H

     This routine performs a complete scan of all eleven rows of
the keyboard matrix for the interrupt handler. Each of the
eleven rows is read in via the PPI and placed in ascending '
order in NEWKEY. ENSTOP is then checked to see if warm starts
are enabled. If its contents are non-zero and the keys CODE,
GRAPH, CTRL and SHIFT are pressed control transfers to the BASIC
Interpreter (409BH) via the CALBAS standard routine. This
facility is useful as even a machine code program can be
terminated as long as the interrupt handler is running.
The contents of NEWKEY are compared with the previous scan
contained in OLDKEY. If any change at all has occurred REPCNT
is loaded with the initial auto-repeat delay (780 ms). Each row 1,
reading from NEWKEY is then compared with the previous one,
held in OLDKEY, to produce an active transition byte and OLDKEY
is updated with the new reading. The active transition byte is
normally zero but contains a 1 in each position where a
transition from unpressed to pressed has occurred. If the row
contains any transitions these are decoded and placed in KEYBUF
as key codes (0D89H). When all eleven rows have been completed
the routine checks whether there are any characters in KEYBUF,
by subtracting GETPNT from PUTPNT, and terminates.

-- 
----------- Manuel Bilderbeek -----------
Océ-Technologies B.V. tel  +31 77 3595039
St Urbanusweg 43      fax  +31 77 3595337
NL-5900 MA Venlo      home +31 24 3238923
The Netherlands       e-mail  [EMAIL PROTECTED]
-----------------------------------------


--
For info, see http://www.stack.nl/~wynke/MSX/listinfo.html

Reply via email to