https://github.com/akkartik/mu/blob/main/linux/305keyboard.subx
1
2
3
4 == code
5
6 enable-keyboard-immediate-mode:
7
8 55/push-ebp
9 89/<- %ebp 4/r32/esp
10
11 50/push-eax
12 51/push-ecx
13 52/push-edx
14 53/push-ebx
15 56/push-esi
16 57/push-edi
17
18 (_maybe-open-terminal)
19
20
21 81 5/subop/subtract %esp 0x100/imm32
22 89/<- %esi 4/r32/esp
23
24 89/<- %edx 6/r32/esi
25 b9/copy-to-ecx 0x5401/imm32/TCGETS
26 8b/-> *Terminal-file-descriptor 3/r32/ebx
27 e8/call syscall_ioctl/disp32
28
29
30
31
32
33 8b/-> *esi 0/r32/eax
34 23/and *Keyboard-immediate-mode-iflags 0/r32/eax
35 89/<- *esi 0/r32/eax
36
37
38
39
40
41
42
43
44
45 8b/-> *(esi+0xc) 0/r32/eax
46 23/and *Keyboard-immediate-mode-lflags 0/r32/eax
47 89/<- *(esi+0xc) 0/r32/eax
48
49
50
51
52
53 89/<- %edx 6/r32/esi
54 b9/copy-to-ecx 0x5402/imm32/TCSETS
55 8b/-> *Terminal-file-descriptor 3/r32/ebx
56 e8/call syscall_ioctl/disp32
57 $enable-keyboard-immediate-mode:end:
58
59 81 0/subop/add %esp 0x100/imm32
60
61 5f/pop-to-edi
62 5e/pop-to-esi
63 5b/pop-to-ebx
64 5a/pop-to-edx
65 59/pop-to-ecx
66 58/pop-to-eax
67
68 89/<- %esp 5/r32/ebp
69 5d/pop-to-ebp
70 c3/return
71
72 enable-keyboard-type-mode:
73
74 55/push-ebp
75 89/<- %ebp 4/r32/esp
76
77 50/push-eax
78 51/push-ecx
79 52/push-edx
80 53/push-ebx
81 56/push-esi
82 57/push-edi
83
84 (_maybe-open-terminal)
85
86
87 81 5/subop/subtract %esp 0x100/imm32
88 89/<- %esi 4/r32/esp
89
90 89/<- %edx 6/r32/esi
91 b9/copy-to-ecx 0x5401/imm32/TCGETS
92 8b/-> *Terminal-file-descriptor 3/r32/ebx
93 e8/call syscall_ioctl/disp32
94
95 8b/-> *esi 0/r32/eax
96 0b/or *Keyboard-type-mode-iflags 0/r32/eax
97 89/<- *esi 0/r32/eax
98
99 8b/-> *(esi+0xc) 0/r32/eax
100 0b/or *Keyboard-type-mode-lflags 0/r32/eax
101 89/<- *(esi+0xc) 0/r32/eax
102
103 89/<- %edx 6/r32/esi
104 b9/copy-to-ecx 0x5402/imm32/TCSETS
105 8b/-> *Terminal-file-descriptor 3/r32/ebx
106 e8/call syscall_ioctl/disp32
107 $enable-keyboard-type-mode:end:
108
109 81 0/subop/add %esp 0x100/imm32
110
111 5f/pop-to-edi
112 5e/pop-to-esi
113 5b/pop-to-ebx
114 5a/pop-to-edx
115 59/pop-to-ecx
116 58/pop-to-eax
117
118 89/<- %esp 5/r32/ebp
119 5d/pop-to-ebp
120 c3/return
121
122
123
124
125
126
127
128
129
130
131
132 read-key-from-real-keyboard:
133
134 55/push-ebp
135 89/<- %ebp 4/r32/esp
136
137 51/push-ecx
138
139 68/push 0/imm32/data
140 68/push 4/imm32/size
141 68/push 0/imm32/read
142 68/push 0/imm32/write
143 89/<- %ecx 4/r32/esp
144
145 (read 0 %ecx)
146 8b/-> *(ecx+0xc) 0/r32/eax
147 $read-key-from-real-keyboard:end:
148
149 81 0/subop/add %esp 0x10/imm32
150
151 59/pop-to-ecx
152
153 89/<- %esp 5/r32/ebp
154 5d/pop-to-ebp
155 c3/return
156
157
158 read-line-from-real-keyboard:
159
160 55/push-ebp
161 89/<- %ebp 4/r32/esp
162
163 (read-line-buffered Stdin *(ebp+8))
164 $read-line-from-real-keyboard:end:
165
166 89/<- %esp 5/r32/ebp
167 5d/pop-to-ebp
168 c3/return
169
170 == data
171
172
173
174
175
176
177
178
179
180
181
182
183
184
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; b