mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
602 lines
99 KiB
HTML
Executable file
602 lines
99 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.05">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF1>asm</span><span class=cF0> {
|
|
<a name="l2"></a></span><span class=cFD>NORMAL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>::
|
|
<a name="l3"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>CH_ESC</span><span class=cF0>, </span><span class=cF6>"1234567890-="</span><span class=cF0>, </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>, </span><span class=cF6>'\t'</span><span class=cF0>;
|
|
<a name="l4"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>"qwertyuiop[]"</span><span class=cF0>, </span><span class=cF6>'\n'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"as"</span><span class=cF0>;
|
|
<a name="l5"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>"dfghjkl;'\`"</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"\\zxcv"</span><span class=cF0>;
|
|
<a name="l6"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>"bnm,./"</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'*'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>CH_SPACE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l7"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'-'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'+'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l8"></a></span><span class=cFD>SHIFT_KEY_SCAN_DECODE_TABLE</span><span class=cF0>::
|
|
<a name="l9"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>, </span><span class=cF6>"!@#$%^&*()_+"</span><span class=cF0>, </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>, </span><span class=cF6>'\t'</span><span class=cF0>;
|
|
<a name="l10"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>"QWERTYUIOP{}"</span><span class=cF0>, </span><span class=cF6>'\n'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"AS"</span><span class=cF0>;
|
|
<a name="l11"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>"DFGHJKL:\"~"</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"|ZXCV"</span><span class=cF0>;
|
|
<a name="l12"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF6>"BNM<>?"</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'*'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>CH_SPACE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l13"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'-'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'+'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l14"></a></span><span class=cFD>CTRL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>::
|
|
<a name="l15"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>CH_ESC</span><span class=cF0>, </span><span class=cF6>"1234567890-="</span><span class=cF0>, </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>, </span><span class=cF6>'\t'</span><span class=cF0>;
|
|
<a name="l16"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>CH_CTRLQ</span><span class=cF0>, </span><span class=cF3>CH_CTRLW</span><span class=cF0>, </span><span class=cF3>CH_CTRLE</span><span class=cF0>, </span><span class=cF3>CH_CTRLR</span><span class=cF0>, </span><span class=cF3>CH_CTRLT</span><span class=cF0>, </span><span class=cF3>CH_CTRLY</span><span class=cF0>, </span><span class=cF3>CH_CTRLU</span><span class=cF0>, </span><span class=cF3>CH_CTRLI</span><span class=cF0>, </span><span class=cF3>CH_CTRLO</span><span class=cF0>,
|
|
<a name="l17"></a> </span><span class=cF3>CH_CTRLP</span><span class=cF0>, </span><span class=cF6>"[]"</span><span class=cF0>, </span><span class=cF6>'\n'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>CH_CTRLA</span><span class=cF0>, </span><span class=cF3>CH_CTRLS</span><span class=cF0>;
|
|
<a name="l18"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>CH_CTRLD</span><span class=cF0>, </span><span class=cF3>CH_CTRLF</span><span class=cF0>, </span><span class=cF3>CH_CTRLG</span><span class=cF0>, </span><span class=cF3>CH_CTRLH</span><span class=cF0>, </span><span class=cF3>CH_CTRLJ</span><span class=cF0>, </span><span class=cF3>CH_CTRLK</span><span class=cF0>, </span><span class=cF3>CH_CTRLL</span><span class=cF0>,
|
|
<a name="l19"></a> </span><span class=cF6>";'\`"</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>"\\"</span><span class=cF0>, </span><span class=cF3>CH_CTRLZ</span><span class=cF0>, </span><span class=cF3>CH_CTRLX</span><span class=cF0>, </span><span class=cF3>CH_CTRLC</span><span class=cF0>, </span><span class=cF3>CH_CTRLV</span><span class=cF0>;
|
|
<a name="l20"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cF3>CH_CTRLB</span><span class=cF0>, </span><span class=cF3>CH_CTRLN</span><span class=cF0>, </span><span class=cF3>CH_CTRLM</span><span class=cF0>, </span><span class=cF6>",./"</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'*'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>CH_SPACE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l21"></a> </span><span class=cF1>DU8</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'-'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF6>'+'</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l22"></a>}
|
|
<a name="l23"></a>
|
|
<a name="l24"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> port, </span><span class=cF1>U8</span><span class=cF0> val)
|
|
<a name="l25"></a>{
|
|
<a name="l26"></a> </span><span class=cF1>F64</span><span class=cF0> timeout = </span><span class=cF5>tS</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>125</span><span class=cF0>;
|
|
<a name="l27"></a>
|
|
<a name="l28"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> < timeout)
|
|
<a name="l29"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>KBD_CTRL</span><span class=cF0>) & </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l31"></a> {
|
|
<a name="l32"></a> </span><span class=cF5>OutU8</span><span class=cF0>(port, val);
|
|
<a name="l33"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l34"></a> }
|
|
<a name="l35"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l36"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l37"></a>}
|
|
<a name="l38"></a>
|
|
<a name="l39"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cFD>KbdCmdRead</span><span class=cF0>()
|
|
<a name="l40"></a>{
|
|
<a name="l41"></a> </span><span class=cF1>F64</span><span class=cF0> timeout = </span><span class=cF5>tS</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>125</span><span class=cF0>;
|
|
<a name="l42"></a>
|
|
<a name="l43"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> < timeout)
|
|
<a name="l44"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF3>KBD_CTRL</span><span class=cF7>)</span><span class=cF0> & </span><span class=cFE>1</span><span class=cF0>)
|
|
<a name="l45"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>);
|
|
<a name="l46"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l47"></a>}
|
|
<a name="l48"></a>
|
|
<a name="l49"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KbdCmdFlush</span><span class=cF0>()
|
|
<a name="l50"></a>{
|
|
<a name="l51"></a> </span><span class=cF1>F64</span><span class=cF0> timeout = </span><span class=cF5>tS</span><span class=cF0> + </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>03</span><span class=cF0>;
|
|
<a name="l52"></a>
|
|
<a name="l53"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>tS</span><span class=cF0> < timeout)
|
|
<a name="l54"></a> </span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>);
|
|
<a name="l55"></a>}
|
|
<a name="l56"></a>
|
|
<a name="l57"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KbdLEDsSet</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc)
|
|
<a name="l58"></a>{
|
|
<a name="l59"></a> </span><span class=cF1>U8</span><span class=cF0> v = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l60"></a>
|
|
<a name="l61"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&v, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&sc, </span><span class=cF3>SCf_SCROLL</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l62"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&v, </span><span class=cFE>1</span><span class=cF0>, </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&sc, </span><span class=cF3>SCf_NUM</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l63"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&v, </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&sc, </span><span class=cF3>SCf_CAPS</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l64"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l65"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l66"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>, </span><span class=cFE>0xED</span><span class=cF0>);
|
|
<a name="l67"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>, v);
|
|
<a name="l68"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l69"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l70"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l71"></a>}
|
|
<a name="l72"></a>
|
|
<a name="l73"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KbdMouseCmdAck</span><span class=cF0>(...)
|
|
<a name="l74"></a>{
|
|
<a name="l75"></a> </span><span class=cF9>I64</span><span class=cF0> i, ack, timeout;
|
|
<a name="l76"></a>
|
|
<a name="l77"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < argc; i++)
|
|
<a name="l78"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l79"></a> timeout = </span><span class=cFE>5</span><span class=cF0>;
|
|
<a name="l80"></a> </span><span class=cF1>do</span><span class=cF0>
|
|
<a name="l81"></a> {
|
|
<a name="l82"></a> ack = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l83"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l84"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l85"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_CTRL</span><span class=cF0>, </span><span class=cFE>0xD4</span><span class=cF0>);
|
|
<a name="l86"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>, argv[i]);
|
|
<a name="l87"></a> ack = </span><span class=cFD>KbdCmdRead</span><span class=cF0>;
|
|
<a name="l88"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l89"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l90"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l91"></a> </span><span class=cFD>KbdCmdFlush</span><span class=cF0>;
|
|
<a name="l92"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l94"></a> }
|
|
<a name="l95"></a> </span><span class=cF1>while</span><span class=cF0> (ack != </span><span class=cFE>0xFA</span><span class=cF0> && --timeout);
|
|
<a name="l96"></a>
|
|
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (!timeout)
|
|
<a name="l98"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l99"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l100"></a>}
|
|
<a name="l101"></a>
|
|
<a name="l102"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KbdTypeMatic</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> delay)
|
|
<a name="l103"></a>{</span><span class=cF2>//Set speed of repeated keys.</span><span class=cF0>
|
|
<a name="l104"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l105"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l106"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_CTRL</span><span class=cF0>, </span><span class=cFE>0xA7</span><span class=cF0>); </span><span class=cF2>//Disable Mouse</span><span class=cF0>
|
|
<a name="l107"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_CTRL</span><span class=cF0>, </span><span class=cFE>0xAE</span><span class=cF0>); </span><span class=cF2>//Enable Keyboard</span><span class=cF0>
|
|
<a name="l108"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>, </span><span class=cFE>0xF3</span><span class=cF0>);
|
|
<a name="l109"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>, delay);</span><span class=cF2>//Typematic rate</span><span class=cF0>
|
|
<a name="l110"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_CTRL</span><span class=cF0>, </span><span class=cFE>0xA8</span><span class=cF0>); </span><span class=cF2>//Enable Mouse</span><span class=cF0>
|
|
<a name="l111"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l112"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l113"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l114"></a> </span><span class=cFD>KbdCmdFlush</span><span class=cF0>;
|
|
<a name="l115"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l116"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l117"></a>}
|
|
<a name="l118"></a>
|
|
<a name="l119"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Char2ScanCode</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> ch, </span><span class=cF9>I64</span><span class=cF0> sc_flags=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l120"></a>{</span><span class=cF2>//ASCII val to scan code (Slow).</span><span class=cF0>
|
|
<a name="l121"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l122"></a> </span><span class=cF1>U8</span><span class=cF0> *table;
|
|
<a name="l123"></a>
|
|
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (sc_flags)
|
|
<a name="l125"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l126"></a> table = </span><span class=cFD>NORMAL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (sc_flags & </span><span class=cF3>SCF_CTRL</span><span class=cF0> || ch < </span><span class=cFE>26</span><span class=cF0>)
|
|
<a name="l128"></a> table = </span><span class=cFD>CTRL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l129"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc_flags & </span><span class=cF3>SCF_SHIFT</span><span class=cF0> || </span><span class=cF6>'A'</span><span class=cF0> <= ch <= </span><span class=cF6>'Z'</span><span class=cF0>)
|
|
<a name="l130"></a> {
|
|
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>sc_flags & </span><span class=cF3>SCF_CAPS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l132"></a> table = </span><span class=cFD>SHIFT_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l133"></a> }
|
|
<a name="l134"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l135"></a> {
|
|
<a name="l136"></a> </span><span class=cF1>if</span><span class=cF0> (sc_flags & </span><span class=cF3>SCF_CAPS</span><span class=cF0>)
|
|
<a name="l137"></a> table = </span><span class=cFD>SHIFT_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l138"></a> }
|
|
<a name="l139"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>0x50</span><span class=cF0>; i++)
|
|
<a name="l140"></a> </span><span class=cF1>if</span><span class=cF0> (table[i] == ch)
|
|
<a name="l141"></a> </span><span class=cF1>return</span><span class=cF0> i | sc_flags;
|
|
<a name="l142"></a> </span><span class=cF1>return</span><span class=cF0> sc_flags;
|
|
<a name="l143"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l144"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l145"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l146"></a> table = </span><span class=cFD>NORMAL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l147"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>0x50</span><span class=cF0>; i++)
|
|
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (table[i] == ch)
|
|
<a name="l149"></a> </span><span class=cF1>return</span><span class=cF0> i;
|
|
<a name="l150"></a> table = </span><span class=cFD>SHIFT_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l151"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>0x50</span><span class=cF0>; i++)
|
|
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (table[i] == ch)
|
|
<a name="l153"></a> </span><span class=cF1>return</span><span class=cF0> i | </span><span class=cF3>SCF_SHIFT</span><span class=cF0>;
|
|
<a name="l154"></a> table = </span><span class=cFD>CTRL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l155"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>0x50</span><span class=cF0>; i++)
|
|
<a name="l156"></a> </span><span class=cF1>if</span><span class=cF0> (table[i] == ch)
|
|
<a name="l157"></a> </span><span class=cF1>return</span><span class=cF0> i | </span><span class=cF3>SCF_CTRL</span><span class=cF0>;
|
|
<a name="l158"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l159"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l160"></a>}
|
|
<a name="l161"></a>
|
|
<a name="l162"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cF5>ScanCode2Char</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc)
|
|
<a name="l163"></a>{</span><span class=cF2>//Scan code to ASCII val.</span><span class=cF0>
|
|
<a name="l164"></a> </span><span class=cF1>U8</span><span class=cF0> *table = </span><span class=cFD>NORMAL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l165"></a>
|
|
<a name="l166"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_E0_PREFIX</span><span class=cF0>)
|
|
<a name="l167"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_CTRL</span><span class=cF0>)
|
|
<a name="l169"></a> table = </span><span class=cFD>CTRL_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l170"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
|
|
<a name="l171"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>sc & </span><span class=cF3>SCF_CAPS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l173"></a> table = </span><span class=cFD>SHIFT_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l174"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l175"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l176"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_CAPS</span><span class=cF0>)
|
|
<a name="l178"></a> table = </span><span class=cFD>SHIFT_KEY_SCAN_DECODE_TABLE</span><span class=cF0>;
|
|
<a name="l179"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l180"></a> sc &= </span><span class=cFE>0x7F</span><span class=cF0>;
|
|
<a name="l181"></a> </span><span class=cF1>if</span><span class=cF0> (sc >= </span><span class=cFE>0x50</span><span class=cF0>)
|
|
<a name="l182"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l183"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l184"></a> </span><span class=cF1>return</span><span class=cF0> table[sc];
|
|
<a name="l185"></a>}
|
|
<a name="l186"></a>
|
|
<a name="l187"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cFD>scan_code_map</span><span class=cF0>[</span><span class=cFE>0x100</span><span class=cF0>] =
|
|
<a name="l188"></a>{
|
|
<a name="l189"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l190"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l191"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l192"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_SHIFT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l193"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l194"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l195"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l196"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l197"></a>
|
|
<a name="l198"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l199"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_ENTER</span><span class=cF0>, </span><span class=cF3>SC_CTRL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l200"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l201"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0x35</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_ALT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l202"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_HOME</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>, </span><span class=cF3>SC_PAGE_UP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_END</span><span class=cF0>,
|
|
<a name="l203"></a> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>, </span><span class=cF3>SC_PAGE_DOWN</span><span class=cF0>, </span><span class=cF3>SC_INS</span><span class=cF0>, </span><span class=cF3>SC_DELETE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_GUI</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l204"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l205"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l206"></a>};
|
|
<a name="l207"></a>
|
|
<a name="l208"></a></span><span class=cF1>U8</span><span class=cF0> </span><span class=cFD>num_lock_map</span><span class=cF0>[</span><span class=cFE>0x100</span><span class=cF0>] =
|
|
<a name="l209"></a>{
|
|
<a name="l210"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l211"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l212"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l213"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_SHIFT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l214"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>8</span><span class=cF0>, </span><span class=cFE>9</span><span class=cF0>, </span><span class=cFE>10</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>5</span><span class=cF0>, </span><span class=cFE>6</span><span class=cF0>, </span><span class=cFE>7</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0>,
|
|
<a name="l215"></a> </span><span class=cFE>3</span><span class=cF0>, </span><span class=cFE>4</span><span class=cF0>, </span><span class=cFE>11</span><span class=cF0>, </span><span class=cFE>0x34</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l216"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l217"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l218"></a>
|
|
<a name="l219"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l220"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_ENTER</span><span class=cF0>, </span><span class=cF3>SC_CTRL</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l221"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l222"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0x35</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_ALT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l223"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_HOME</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>, </span><span class=cF3>SC_PAGE_UP</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_END</span><span class=cF0>,
|
|
<a name="l224"></a> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>, </span><span class=cF3>SC_PAGE_DOWN</span><span class=cF0>, </span><span class=cF3>SC_INS</span><span class=cF0>, </span><span class=cF3>SC_DELETE</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>SC_GUI</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l225"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l226"></a> </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>,
|
|
<a name="l227"></a>};
|
|
<a name="l228"></a>
|
|
<a name="l229"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>Char2KeyName</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> ch, </span><span class=cF1>Bool</span><span class=cF0> include_ctrl=</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l230"></a>{</span><span class=cF2>//ASCII val to key name.</span><span class=cF0>
|
|
<a name="l231"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l232"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>];
|
|
<a name="l233"></a>
|
|
<a name="l234"></a> </span><span class=cF1>if</span><span class=cF0> (ch <= </span><span class=cF3>CH_SPACE</span><span class=cF0>)
|
|
<a name="l235"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l236"></a> </span><span class=cF1>switch</span><span class=cF0> [ch]
|
|
<a name="l237"></a> {
|
|
<a name="l238"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\n'</span><span class=cF0>:
|
|
<a name="l239"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"ENTER"</span><span class=cF0>);
|
|
<a name="l240"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l241"></a>
|
|
<a name="l242"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_BACKSPACE</span><span class=cF0>:
|
|
<a name="l243"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"BACKSPACE"</span><span class=cF0>);
|
|
<a name="l244"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l245"></a>
|
|
<a name="l246"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'\t'</span><span class=cF0>:
|
|
<a name="l247"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"TAB"</span><span class=cF0>);
|
|
<a name="l248"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l249"></a>
|
|
<a name="l250"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_ESC</span><span class=cF0>:
|
|
<a name="l251"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"ESC"</span><span class=cF0>);
|
|
<a name="l252"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l253"></a>
|
|
<a name="l254"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0>:
|
|
<a name="l255"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"SHIFT_ESC"</span><span class=cF0>);
|
|
<a name="l256"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l257"></a>
|
|
<a name="l258"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>: </span><span class=cF2>//nobound switch</span><span class=cF0>
|
|
<a name="l259"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>29</span><span class=cF0>:
|
|
<a name="l260"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>30</span><span class=cF0>:
|
|
<a name="l261"></a> *buf = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l262"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l263"></a>
|
|
<a name="l264"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
|
|
<a name="l265"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"SPACE"</span><span class=cF0>);
|
|
<a name="l266"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l267"></a>
|
|
<a name="l268"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l269"></a> </span><span class=cF1>if</span><span class=cF0> (include_ctrl)
|
|
<a name="l270"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"CTRL "</span><span class=cF0>);
|
|
<a name="l271"></a> buf[i = </span><span class=cF5>StrLen</span><span class=cF0>(buf)] = ch - </span><span class=cFE>1</span><span class=cF0> + </span><span class=cF6>'a'</span><span class=cF0>;
|
|
<a name="l272"></a> buf[i + </span><span class=cFE>1</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l273"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l274"></a> }
|
|
<a name="l275"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l276"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_printable</span><span class=cF0>, ch</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l277"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l278"></a> *buf = ch;
|
|
<a name="l279"></a> buf[</span><span class=cFE>1</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l280"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l281"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l282"></a> *buf = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l283"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrNew</span><span class=cF0>(buf);
|
|
<a name="l284"></a>}
|
|
<a name="l285"></a>
|
|
<a name="l286"></a></span><span class=cF1>U8</span><span class=cF0> *</span><span class=cF5>ScanCode2KeyName</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> sc)
|
|
<a name="l287"></a>{</span><span class=cF2>//Scan code to key name.</span><span class=cF0>
|
|
<a name="l288"></a> </span><span class=cF9>I64</span><span class=cF0> ch;
|
|
<a name="l289"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cF3>STR_LEN</span><span class=cF0>], *st;
|
|
<a name="l290"></a>
|
|
<a name="l291"></a> *buf = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l292"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_CTRL</span><span class=cF0>)
|
|
<a name="l293"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"CTRL "</span><span class=cF0>);
|
|
<a name="l294"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_ALT</span><span class=cF0>)
|
|
<a name="l295"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"ALT "</span><span class=cF0>);
|
|
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
|
|
<a name="l297"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"SHIFT "</span><span class=cF0>);
|
|
<a name="l298"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_NO_SHIFT</span><span class=cF0>)
|
|
<a name="l299"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>" "</span><span class=cF0>);
|
|
<a name="l300"></a> </span><span class=cF1>if</span><span class=cF0> (ch = </span><span class=cF5>ScanCode2Char</span><span class=cF7>(</span><span class=cF0>sc & </span><span class=cFE>255</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l301"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l302"></a> st = </span><span class=cF5>Char2KeyName</span><span class=cF0>(ch, </span><span class=cF3>FALSE</span><span class=cF0>);
|
|
<a name="l303"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf + </span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>buf</span><span class=cF7>)</span><span class=cF0>, st);
|
|
<a name="l304"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l305"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l306"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l307"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l308"></a> </span><span class=cF1>switch</span><span class=cF0> (sc & </span><span class=cFE>255</span><span class=cF0>)
|
|
<a name="l309"></a> {
|
|
<a name="l310"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_BACKSPACE</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"BACK"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l311"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CAPS</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"CAPS"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l312"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_NUM</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"NUM"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l313"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_SCROLL</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"SCROLL"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l314"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_UP</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"UP"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l315"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_DOWN</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"DOWN"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l316"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_LEFT</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"LEFT"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l317"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CURSOR_RIGHT</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"RIGHT"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l318"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_PAGE_UP</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"PAGE_UP"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l319"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_PAGE_DOWN</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"PAGE_DOWN"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l320"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_HOME</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"HOME"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l321"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_END</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"END"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l322"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"INS"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l323"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"DELETE"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l324"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F1</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F1"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l325"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F2</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F2"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l326"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F3</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F3"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l327"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F4</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F4"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l328"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F5</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F5"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l329"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F6</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F6"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l330"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F7</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F7"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l331"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F8</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F8"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l332"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F9</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F9"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l333"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F10</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F10"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l334"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F11</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F11"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l335"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F12</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"F12"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l336"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_GUI</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"WINDOWS"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l337"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_PRINTSCREEN1</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"PRINTSCREEN1"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l338"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_PRINTSCREEN2</span><span class=cF0>: </span><span class=cF5>CatPrint</span><span class=cF0>(buf, </span><span class=cF6>"PRINTSCREEN2"</span><span class=cF0>); </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l339"></a> }
|
|
<a name="l340"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l341"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF5>StrNew</span><span class=cF0>(buf);
|
|
<a name="l342"></a>}
|
|
<a name="l343"></a>
|
|
<a name="l344"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KbdBuildSC</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> raw_byte, </span><span class=cF1>Bool</span><span class=cF0> in_irq, </span><span class=cF1>U8</span><span class=cF0> *_last_raw_byte, </span><span class=cF9>I64</span><span class=cF0> *_last_sc)
|
|
<a name="l345"></a>{
|
|
<a name="l346"></a> </span><span class=cF9>I64</span><span class=cF0> ch, sc_flags, sc, sc2, sc_raw, new_key_f;
|
|
<a name="l347"></a> </span><span class=cF1>Bool</span><span class=cF0> set_LEDs = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l348"></a>
|
|
<a name="l349"></a> </span><span class=cF1>if</span><span class=cF0> (raw_byte == </span><span class=cFE>0xE0</span><span class=cF0>)
|
|
<a name="l350"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l351"></a> *_last_sc &= ~</span><span class=cFE>0x1FF</span><span class=cF0>;
|
|
<a name="l352"></a> *_last_raw_byte = raw_byte;
|
|
<a name="l353"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l354"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l355"></a> sc = raw_byte;
|
|
<a name="l356"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&sc, </span><span class=cF3>SCf_E0_PREFIX</span><span class=cF0>, *_last_raw_byte == </span><span class=cFE>0xE0</span><span class=cF0>);
|
|
<a name="l357"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&sc, </span><span class=cF3>SCf_KEY_UP</span><span class=cF0>, raw_byte & </span><span class=cFE>0x80</span><span class=cF0>);
|
|
<a name="l358"></a> *_last_raw_byte = raw_byte;
|
|
<a name="l359"></a>
|
|
<a name="l360"></a> sc_flags = _last_sc->u32[</span><span class=cFE>0</span><span class=cF0>] & ~</span><span class=cFE>0x1FF</span><span class=cF0>;
|
|
<a name="l361"></a> sc_raw = sc;
|
|
<a name="l362"></a>
|
|
<a name="l363"></a> </span><span class=cF1>if</span><span class=cF0> (sc_flags & </span><span class=cF3>SCF_NUM</span><span class=cF0>)
|
|
<a name="l364"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l365"></a> </span><span class=cF1>if</span><span class=cF0> (sc2 = </span><span class=cFD>num_lock_map</span><span class=cF0>[sc.u8[</span><span class=cFE>0</span><span class=cF0>]])
|
|
<a name="l366"></a> sc.u8[</span><span class=cFE>0</span><span class=cF0>] = sc2;
|
|
<a name="l367"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l368"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l369"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l370"></a> </span><span class=cF1>if</span><span class=cF0> (sc2 = </span><span class=cFD>scan_code_map</span><span class=cF0>[sc.u8[</span><span class=cFE>0</span><span class=cF0>]])
|
|
<a name="l371"></a> sc.u8[</span><span class=cFE>0</span><span class=cF0>] = sc2;
|
|
<a name="l372"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l373"></a>
|
|
<a name="l374"></a> new_key_f = </span><span class=cF3>SCF_NEW_KEY</span><span class=cF0>;
|
|
<a name="l375"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cF3>SCF_KEY_UP</span><span class=cF0>)
|
|
<a name="l376"></a> </span><span class=cF1>switch</span><span class=cF0> (sc & ~</span><span class=cF3>SCF_KEY_UP</span><span class=cF0>)
|
|
<a name="l377"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l378"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_SHIFT</span><span class=cF0>: sc_flags &= ~</span><span class=cF3>SCF_SHIFT</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l379"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CTRL</span><span class=cF0>: sc_flags &= ~</span><span class=cF3>SCF_CTRL</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l380"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_ALT</span><span class=cF0>: sc_flags &= ~</span><span class=cF3>SCF_ALT</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l381"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>: sc_flags &= ~</span><span class=cF3>SCF_DELETE</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l382"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>: sc_flags &= ~</span><span class=cF3>SCF_INS</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l383"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CAPS</span><span class=cF0>: sc_flags ^= </span><span class=cF3>SCF_CAPS</span><span class=cF0>; set_LEDs=</span><span class=cF3>TRUE</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l384"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_NUM</span><span class=cF0>: sc_flags ^= </span><span class=cF3>SCF_NUM</span><span class=cF0>; set_LEDs=</span><span class=cF3>TRUE</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l385"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_SCROLL</span><span class=cF0>: sc_flags ^= </span><span class=cF3>SCF_SCROLL</span><span class=cF0>; set_LEDs=</span><span class=cF3>TRUE</span><span class=cF0>; </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l386"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l387"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l388"></a> </span><span class=cF1>switch</span><span class=cF0> (sc)
|
|
<a name="l389"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l390"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_SHIFT</span><span class=cF0>:
|
|
<a name="l391"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bts</span><span class=cF7>(</span><span class=cF0>&sc_flags, </span><span class=cF3>SCf_SHIFT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l392"></a> new_key_f = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l393"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l394"></a>
|
|
<a name="l395"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_CTRL</span><span class=cF0>:
|
|
<a name="l396"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bts</span><span class=cF7>(</span><span class=cF0>&sc_flags, </span><span class=cF3>SCf_CTRL</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l397"></a> new_key_f = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l398"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l399"></a>
|
|
<a name="l400"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_ALT</span><span class=cF0>:
|
|
<a name="l401"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bts</span><span class=cF7>(</span><span class=cF0>&sc_flags, </span><span class=cF3>SCf_ALT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l402"></a> new_key_f = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l403"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l404"></a>
|
|
<a name="l405"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>:
|
|
<a name="l406"></a> sc_flags |= </span><span class=cF3>SCF_DELETE</span><span class=cF0>;
|
|
<a name="l407"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l408"></a>
|
|
<a name="l409"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>:
|
|
<a name="l410"></a> sc_flags |= </span><span class=cF3>SCF_INS</span><span class=cF0>;
|
|
<a name="l411"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l412"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l413"></a>
|
|
<a name="l414"></a> sc_flags |= new_key_f;
|
|
<a name="l415"></a> sc = sc_flags | sc | (sc_flags | sc_raw) << </span><span class=cFE>32</span><span class=cF0>;
|
|
<a name="l416"></a> </span><span class=cF1>if</span><span class=cF0> (sc_flags & </span><span class=cF3>SCF_CTRL</span><span class=cF0> && sc_flags & </span><span class=cF3>SCF_ALT</span><span class=cF0>)
|
|
<a name="l417"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l418"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>sc & </span><span class=cF3>SCF_KEY_UP</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l419"></a> {
|
|
<a name="l420"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>SC_DELETE</span><span class=cF0> && !</span><span class=cF7>(</span><span class=cF0>sc_flags & </span><span class=cF3>SCF_SHIFT</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l421"></a> </span><span class=cFD>CtrlAltDel</span><span class=cF0>(sc);
|
|
<a name="l422"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l423"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l424"></a> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>SC_ESC</span><span class=cF0>)
|
|
<a name="l425"></a> ch = </span><span class=cF6>'t'</span><span class=cF0>;
|
|
<a name="l426"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (sc & </span><span class=cFE>255</span><span class=cF0> == </span><span class=cF3>SC_TAB</span><span class=cF0>)
|
|
<a name="l427"></a> ch = </span><span class=cF6>'n'</span><span class=cF0>;
|
|
<a name="l428"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l429"></a> ch = </span><span class=cF5>ScanCode2Char</span><span class=cF0>(sc & </span><span class=cFE>255</span><span class=cF0>);
|
|
<a name="l430"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'a'</span><span class=cF0> <= ch <= </span><span class=cF6>'z'</span><span class=cF0>)
|
|
<a name="l431"></a> {
|
|
<a name="l432"></a> sc &= ~(</span><span class=cF3>SCF_NEW_KEY</span><span class=cF0> | </span><span class=cF3>SCF_NEW_KEY</span><span class=cF0> << </span><span class=cFE>32</span><span class=cF0>);
|
|
<a name="l433"></a> ch -= </span><span class=cF6>'a'</span><span class=cF0>;
|
|
<a name="l434"></a> </span><span class=cFB>kbd</span><span class=cF0>.last_down_scan_code = sc;
|
|
<a name="l435"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>keydev</span><span class=cF0>.fp_ctrl_alt_cbs[ch] &&
|
|
<a name="l436"></a> </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_in_irq_flags, ch</span><span class=cF7>)</span><span class=cF0> == in_irq &&
|
|
<a name="l437"></a> </span><span class=cF7>(</span><span class=cF0>!(sc_flags & </span><span class=cF3>SCF_SHIFT</span><span class=cF0>) &&
|
|
<a name="l438"></a> </span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_no_shift_descs[ch]</span><span class=cF7>)</span><span class=cF0> || sc_flags & </span><span class=cF3>SCF_SHIFT</span><span class=cF0> && </span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_shift_descs[ch])
|
|
<a name="l439"></a> (*</span><span class=cFB>keydev</span><span class=cF0>.fp_ctrl_alt_cbs[ch])(sc);
|
|
<a name="l440"></a> }
|
|
<a name="l441"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l442"></a> }
|
|
<a name="l443"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l444"></a> </span><span class=cF1>if</span><span class=cF0> (set_LEDs && !in_irq)
|
|
<a name="l445"></a> </span><span class=cFD>KbdLEDsSet</span><span class=cF0>(sc);
|
|
<a name="l446"></a> *_last_sc = sc;
|
|
<a name="l447"></a>}
|
|
<a name="l448"></a>
|
|
<a name="l449"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KbdPacketRead</span><span class=cF0>()
|
|
<a name="l450"></a>{
|
|
<a name="l451"></a> </span><span class=cF1>static</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> last_raw_byte = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l452"></a> </span><span class=cF1>static</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> last_sc = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l453"></a> </span><span class=cF1>U8</span><span class=cF0> raw_byte;
|
|
<a name="l454"></a>
|
|
<a name="l455"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>TSCGet</span><span class=cF0>></span><span class=cFB>kbd</span><span class=cF0>.timestamp + </span><span class=cFB>counts</span><span class=cF0>.time_stamp_freq >> </span><span class=cFE>3</span><span class=cF0>)
|
|
<a name="l456"></a> </span><span class=cF5>FifoU8Flush</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.fifo);
|
|
<a name="l457"></a> </span><span class=cFB>kbd</span><span class=cF0>.timestamp = </span><span class=cF5>TSCGet</span><span class=cF0>;
|
|
<a name="l458"></a> raw_byte = </span><span class=cF5>InU8</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>);
|
|
<a name="l459"></a> </span><span class=cFD>KbdBuildSC</span><span class=cF0>(raw_byte, </span><span class=cF3>TRUE</span><span class=cF0>, &last_raw_byte, &last_sc);
|
|
<a name="l460"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>FifoU8Count</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.fifo</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l461"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l462"></a> </span><span class=cF5>FifoU8Insert</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.fifo, raw_byte);
|
|
<a name="l463"></a> </span><span class=cF1>if</span><span class=cF0> (raw_byte != </span><span class=cFE>0xE0</span><span class=cF0>)
|
|
<a name="l464"></a> {
|
|
<a name="l465"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>FifoU8Remove</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.fifo, &raw_byte</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l466"></a> </span><span class=cF5>FifoU8Insert</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.fifo2, raw_byte);
|
|
<a name="l467"></a> }
|
|
<a name="l468"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l469"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l470"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l471"></a> </span><span class=cF5>FifoU8Insert</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.fifo, raw_byte);
|
|
<a name="l472"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>FifoU8Remove</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.fifo, &raw_byte</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l473"></a> </span><span class=cF5>FifoU8Insert</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.fifo2, raw_byte);
|
|
<a name="l474"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l475"></a>}
|
|
<a name="l476"></a>
|
|
<a name="l477"></a></span><span class=cF1>interrupt</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>IRQKbd</span><span class=cF0>()
|
|
<a name="l478"></a>{
|
|
<a name="l479"></a> </span><span class=cF1>CLD</span><span class=cF0>
|
|
<a name="l480"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>PIC_1</span><span class=cF0>, </span><span class=cF3>PIC_EOI</span><span class=cF0>);
|
|
<a name="l481"></a> </span><span class=cFB>kbd</span><span class=cF0>.irqs_working = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l482"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse_hard</span><span class=cF0>.install_in_progress)
|
|
<a name="l483"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l484"></a> </span><span class=cFB>kbd</span><span class=cF0>.reset = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l485"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l486"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l487"></a> </span><span class=cFB>keydev</span><span class=cF0>.ctrl_alt_ret_addr = </span><span class=cF5>RBPGet</span><span class=cF0>()(</span><span class=cF9>I64</span><span class=cF0>) + </span><span class=cFE>8</span><span class=cF0>;
|
|
<a name="l488"></a> </span><span class=cFD>KbdPacketRead</span><span class=cF0>;
|
|
<a name="l489"></a>}
|
|
<a name="l490"></a>
|
|
<a name="l491"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>KbdInit</span><span class=cF0>()
|
|
<a name="l492"></a>{
|
|
<a name="l493"></a> </span><span class=cF1>try</span><span class=cF0>
|
|
<a name="l494"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l495"></a> </span><span class=cFD>KbdCmdFlush</span><span class=cF0>;
|
|
<a name="l496"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_CTRL</span><span class=cF0>, </span><span class=cFE>0xA7</span><span class=cF0>); </span><span class=cF2>//Disable Mouse</span><span class=cF0>
|
|
<a name="l497"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_CTRL</span><span class=cF0>, </span><span class=cFE>0xAE</span><span class=cF0>); </span><span class=cF2>//Enable Keyboard</span><span class=cF0>
|
|
<a name="l498"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>, </span><span class=cFE>0xF0</span><span class=cF0>);
|
|
<a name="l499"></a> </span><span class=cFD>KbdCmdSend</span><span class=cF0>(</span><span class=cF3>KBD_PORT</span><span class=cF0>, </span><span class=cFE>0x02</span><span class=cF0>);
|
|
<a name="l500"></a> </span><span class=cFD>KbdLEDsSet</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.scan_code);
|
|
<a name="l501"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l502"></a> </span><span class=cF1>catch</span><span class=cF0>
|
|
<a name="l503"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l504"></a> </span><span class=cFD>KbdCmdFlush</span><span class=cF0>;
|
|
<a name="l505"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l506"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l507"></a> </span><span class=cF5>IntEntrySet</span><span class=cF0>(</span><span class=cFE>0x21</span><span class=cF0>, &</span><span class=cFD>IRQKbd</span><span class=cF0>);
|
|
<a name="l508"></a> </span><span class=cF5>OutU8</span><span class=cF0>(</span><span class=cF3>PIC_1_DATA</span><span class=cF0>, </span><span class=cF5>InU8</span><span class=cF7>(</span><span class=cF3>PIC_1_DATA</span><span class=cF7>)</span><span class=cF0> & ~</span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l509"></a>}
|
|
<a name="l510"></a>
|
|
<a name="l511"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cFD>KbdHandler</span><span class=cF0>()
|
|
<a name="l512"></a>{
|
|
<a name="l513"></a> </span><span class=cF1>static</span><span class=cF0> </span><span class=cF1>U8</span><span class=cF0> last_raw_byte = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l514"></a> </span><span class=cF1>U8</span><span class=cF0> raw_byte;
|
|
<a name="l515"></a>
|
|
<a name="l516"></a> </span><span class=cF5>FifoU8Remove</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.fifo2, &raw_byte);
|
|
<a name="l517"></a> </span><span class=cFD>KbdBuildSC</span><span class=cF0>(raw_byte, </span><span class=cF3>FALSE</span><span class=cF0>, &last_raw_byte, &</span><span class=cFB>kbd</span><span class=cF0>.scan_code);
|
|
<a name="l518"></a> </span><span class=cF1>if</span><span class=cF0> (raw_byte == </span><span class=cFE>0xE0</span><span class=cF0>)
|
|
<a name="l519"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l520"></a> </span><span class=cF5>FifoU8Remove</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.fifo2, &raw_byte);
|
|
<a name="l521"></a> </span><span class=cFD>KbdBuildSC</span><span class=cF0>(raw_byte, </span><span class=cF3>FALSE</span><span class=cF0>, &last_raw_byte, &</span><span class=cFB>kbd</span><span class=cF0>.scan_code);
|
|
<a name="l522"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l523"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Btr</span><span class=cF7>(</span><span class=cF0>&</span><span class=cFB>kbd</span><span class=cF0>.scan_code, </span><span class=cF3>SCf_NEW_KEY</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l524"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l525"></a> </span><span class=cFB>kbd</span><span class=cF0>.new_key_timestamp = </span><span class=cFB>kbd</span><span class=cF0>.timestamp;
|
|
<a name="l526"></a> </span><span class=cF5>Btr</span><span class=cF0>(&</span><span class=cFB>kbd</span><span class=cF0>.scan_code, </span><span class=cFE>32</span><span class=cF0> + </span><span class=cF3>SCf_NEW_KEY</span><span class=cF0>);
|
|
<a name="l527"></a> </span><span class=cF5>FifoI64Ins</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.scan_code_fifo, </span><span class=cFB>kbd</span><span class=cF0>.scan_code);
|
|
<a name="l528"></a> </span><span class=cFB>kbd</span><span class=cF0>.count++;
|
|
<a name="l529"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.scan_code & </span><span class=cF3>SCF_KEY_UP</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l530"></a> {
|
|
<a name="l531"></a> </span><span class=cFB>kbd</span><span class=cF0>.last_down_scan_code = </span><span class=cFB>kbd</span><span class=cF0>.scan_code;
|
|
<a name="l532"></a> </span><span class=cF5>Bts</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, </span><span class=cFB>kbd</span><span class=cF0>.scan_code.u8[</span><span class=cFE>0</span><span class=cF0>]);
|
|
<a name="l533"></a> </span><span class=cF5>Bts</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap2, </span><span class=cFB>kbd</span><span class=cF0>.scan_code.u8[</span><span class=cFE>4</span><span class=cF0>]);
|
|
<a name="l534"></a> }
|
|
<a name="l535"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l536"></a> {
|
|
<a name="l537"></a> </span><span class=cF5>Btr</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap, </span><span class=cFB>kbd</span><span class=cF0>.scan_code.u8[</span><span class=cFE>0</span><span class=cF0>]);
|
|
<a name="l538"></a> </span><span class=cF5>Btr</span><span class=cF0>(</span><span class=cFB>kbd</span><span class=cF0>.down_bitmap2, </span><span class=cFB>kbd</span><span class=cF0>.scan_code.u8[</span><span class=cFE>4</span><span class=cF0>]);
|
|
<a name="l539"></a> }
|
|
<a name="l540"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l541"></a>}
|
|
<a name="l542"></a>
|
|
<a name="l543"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>KbdMessagesQueue</span><span class=cF0>()
|
|
<a name="l544"></a>{
|
|
<a name="l545"></a> </span><span class=cF9>I64</span><span class=cF0> arg1, arg2, message_code = </span><span class=cF3>MESSAGE_NULL</span><span class=cF0>;
|
|
<a name="l546"></a> </span><span class=cF9>CTask</span><span class=cF0> *task_focus;
|
|
<a name="l547"></a> </span><span class=cF1>if</span><span class=cF0> (task_focus = </span><span class=cFB>sys_focus_task</span><span class=cF0>)
|
|
<a name="l548"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l549"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>FifoI64Remove</span><span class=cF7>(</span><span class=cFB>kbd</span><span class=cF0>.scan_code_fifo, &arg2</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l550"></a> {
|
|
<a name="l551"></a> arg1 = </span><span class=cF5>ScanCode2Char</span><span class=cF0>(arg2);
|
|
<a name="l552"></a> </span><span class=cF1>if</span><span class=cF0> (arg2 & </span><span class=cF3>SCF_KEY_UP</span><span class=cF0>)
|
|
<a name="l553"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l554"></a> </span><span class=cF5>TaskMessage</span><span class=cF0>(task_focus, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l555"></a> message_code = </span><span class=cF3>MESSAGE_KEY_UP</span><span class=cF0>;
|
|
<a name="l556"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l557"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l558"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l559"></a> </span><span class=cF5>TaskMessage</span><span class=cF0>(task_focus, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>, arg1, arg2, </span><span class=cFE>0</span><span class=cF0>);
|
|
<a name="l560"></a> message_code = </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>;
|
|
<a name="l561"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l562"></a> }
|
|
<a name="l563"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l564"></a> </span><span class=cF1>return</span><span class=cF0> message_code;
|
|
<a name="l565"></a>}
|
|
<a name="l566"></a>
|
|
<a name="l567"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>KbdMouseEventTime</span><span class=cF0>()
|
|
<a name="l568"></a>{</span><span class=cF2>//Timestamp of last key or mouse event.</span><span class=cF0>
|
|
<a name="l569"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>mouse_hard</span><span class=cF0>.timestamp > </span><span class=cFB>kbd</span><span class=cF0>.timestamp)
|
|
<a name="l570"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>mouse_hard</span><span class=cF0>.timestamp;
|
|
<a name="l571"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l572"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFB>kbd</span><span class=cF0>.new_key_timestamp;
|
|
<a name="l573"></a>}
|
|
</span></pre></body>
|
|
</html>
|