← Documents Documentation/input/devices/atarikbd.rst GitHub 원문 ↗

Linux 6.18.37 · Input

Intelligent Keyboard (ikbd) Protocol

Atari ikbd의 키보드·마우스·조이스틱·시각 시계 프로토콜과 전체 명령·스캔 코드 표를 설명합니다.

Source pathDocumentation/input/devices/atarikbd.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

atarikbd.rst:1-820

Atari `ikbd`는 하나의 마이크로컨트롤러에서 키 매트릭스, 마우스, 두 조이스틱과 1초 해상도 시계를 통합한 직렬 입력 프로토콜입니다. 기본 이벤트 모드뿐 아니라 조회·고속 모니터링·키코드 변환을 지원하므로, 명령 코드와 패킷 경계를 정확히 지키는 것이 핵심입니다.

문서 범위
영역핵심 내용
SourceDocumentation/input/devices/atarikbd.rst
분량820 source lines
키보드make/break, 예약 보고 코드, GSX 104행 매핑
마우스relative, absolute, cursor-key modes
조이스틱event, interrogation, monitoring, fire, keycode modes
시스템packed BCD clock, memory load/read, controller execute
상태SET code OR `0x80`, 8-byte restorable reports

장문 프로토콜 문서의 주요 영역을 요약합니다.

ikbd 전체 데이터 경로
키·마우스·조이스틱과 시각 상태를 마이크로컨트롤러에서 유지선택한 모드의 임계값·배율·보고율 적용키 make/break 또는 다중 바이트 장치 레코드 생성양방향 직렬 채널로 호스트와 명령·응답 교환STATUS INQUIRY 응답을 저장해 이후 동일 상태로 복원

입력 감지에서 직렬 보고와 상태 복원까지의 큰 흐름입니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 ====================================
2 Intelligent Keyboard (ikbd) Protocol
3 ====================================
4
5
6 Introduction
7 ============
8
9 The Atari Corp. Intelligent Keyboard (ikbd) is a general purpose keyboard
10 controller that is flexible enough that it can be used in a variety of
11 products without modification. The keyboard, with its microcontroller,
12 provides a convenient connection point for a mouse and switch-type joysticks.
13 The ikbd processor also maintains a time-of-day clock with one second
14 resolution.
15 The ikbd has been designed to be general enough that it can be used with a
16 variety of new computer products. Product variations in a number of
17 keyswitches, mouse resolution, etc. can be accommodated.
18 The ikbd communicates with the main processor over a high speed bi-directional
19 serial interface. It can function in a variety of modes to facilitate
20 different applications of the keyboard, joysticks, or mouse. Limited use of
21 the controller is possible in applications in which only a unidirectional
22 communications medium is available by carefully designing the default modes.
23
24 Keyboard
25 ========
26
27 The keyboard always returns key make/break scan codes. The ikbd generates
28 keyboard scan codes for each key press and release. The key scan make (key
29 closure) codes start at 1, and are defined in Appendix A. For example, the
30 ISO key position in the scan code table should exist even if no keyswitch
31 exists in that position on a particular keyboard. The break code for each key
32 is obtained by ORing 0x80 with the make code.
33
34 The special codes 0xF6 through 0xFF are reserved for use as follows:
35
36 =================== ====================================================
37 Code Command
38 =================== ====================================================
39 0xF6 status report
40 0xF7 absolute mouse position record
41 0xF8-0xFB relative mouse position records (lsbs determined by
42 mouse button states)
43 0xFC time-of-day
44 0xFD joystick report (both sticks)
45 0xFE joystick 0 event
46 0xFF joystick 1 event
47 =================== ====================================================
48
49 The two shift keys return different scan codes in this mode. The ENTER key
50 and the RETurn key are also distinct.
51
52 Mouse
53 =====
54
55 The mouse port should be capable of supporting a mouse with resolution of
56 approximately 200 counts (phase changes or 'clicks') per inch of travel. The
57 mouse should be scanned at a rate that will permit accurate tracking at
58 velocities up to 10 inches per second.
59 The ikbd can report mouse motion in three distinctly different ways. It can
60 report relative motion, absolute motion in a coordinate system maintained
61 within the ikbd, or by converting mouse motion into keyboard cursor control
62 key equivalents.
63 The mouse buttons can be treated as part of the mouse or as additional
64 keyboard keys.
65
66 Relative Position Reporting
67 ---------------------------
68
69 In relative position mode, the ikbd will return relative mouse position
70 records whenever a mouse event occurs. A mouse event consists of a mouse
71 button being pressed or released, or motion in either axis exceeding a
72 settable threshold of motion. Regardless of the threshold, all bits of
73 resolution are returned to the host computer.
74 Note that the ikbd may return mouse relative position reports with
75 significantly more than the threshold delta x or y. This may happen since no
76 relative mouse motion events will be generated: (a) while the keyboard has
77 been 'paused' ( the event will be stored until keyboard communications is
78 resumed) (b) while any event is being transmitted.
79
80 The relative mouse position record is a three byte record of the form
81 (regardless of keyboard mode)::
82
83 %111110xy ; mouse position record flag
84 ; where y is the right button state
85 ; and x is the left button state
86 X ; delta x as twos complement integer
87 Y ; delta y as twos complement integer
88
89 Note that the value of the button state bits should be valid even if the
90 MOUSE BUTTON ACTION has set the buttons to act like part of the keyboard.
91 If the accumulated motion before the report packet is generated exceeds the
92 +127...-128 range, the motion is broken into multiple packets.
93 Note that the sign of the delta y reported is a function of the Y origin
94 selected.
95
96 Absolute Position reporting
97 ---------------------------
98
99 The ikbd can also maintain absolute mouse position. Commands exist for
100 resetting the mouse position, setting X/Y scaling, and interrogating the
101 current mouse position.
102
103 Mouse Cursor Key Mode
104 ---------------------
105
106 The ikbd can translate mouse motion into the equivalent cursor keystrokes.
107 The number of mouse clicks per keystroke is independently programmable in
108 each axis. The ikbd internally maintains mouse motion information to the
109 highest resolution available, and merely generates a pair of cursor key events
110 for each multiple of the scale factor.
111 Mouse motion produces the cursor key make code immediately followed by the
112 break code for the appropriate cursor key. The mouse buttons produce scan
113 codes above those normally assigned for the largest envisioned keyboard (i.e.
114 LEFT=0x74 & RIGHT=0x75).
115
116 Joystick
117 ========
118
119 Joystick Event Reporting
120 ------------------------
121
122 In this mode, the ikbd generates a record whenever the joystick position is
123 changed (i.e. for each opening or closing of a joystick switch or trigger).
124
125 The joystick event record is two bytes of the form::
126
127 %1111111x ; Joystick event marker
128 ; where x is Joystick 0 or 1
129 %x000yyyy ; where yyyy is the stick position
130 ; and x is the trigger
131
132 Joystick Interrogation
133 ----------------------
134
135 The current state of the joystick ports may be interrogated at any time in
136 this mode by sending an 'Interrogate Joystick' command to the ikbd.
137
138 The ikbd response to joystick interrogation is a three byte report of the form::
139
140 0xFD ; joystick report header
141 %x000yyyy ; Joystick 0
142 %x000yyyy ; Joystick 1
143 ; where x is the trigger
144 ; and yyy is the stick position
145
146 Joystick Monitoring
147 -------------------
148
149 A mode is available that devotes nearly all of the keyboard communications
150 time to reporting the state of the joystick ports at a user specifiable rate.
151 It remains in this mode until reset or commanded into another mode. The PAUSE
152 command in this mode not only stop the output but also temporarily stops
153 scanning the joysticks (samples are not queued).
154
155 Fire Button Monitoring
156 ----------------------
157
158 A mode is provided to permit monitoring a single input bit at a high rate. In
159 this mode the ikbd monitors the state of the Joystick 1 fire button at the
160 maximum rate permitted by the serial communication channel. The data is packed
161 8 bits per byte for transmission to the host. The ikbd remains in this mode
162 until reset or commanded into another mode. The PAUSE command in this mode not
163 only stops the output but also temporarily stops scanning the button (samples
164 are not queued).
165
166 Joystick Key Code Mode
167 ----------------------
168
169 The ikbd may be commanded to translate the use of either joystick into the
170 equivalent cursor control keystroke(s). The ikbd provides a single breakpoint
171 velocity joystick cursor.
172 Joystick events produce the make code, immediately followed by the break code
173 for the appropriate cursor motion keys. The trigger or fire buttons of the
174 joysticks produce pseudo key scan codes above those used by the largest key
175 matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).
176
177 Time-of-Day Clock
178 =================
179
180 The ikbd also maintains a time-of-day clock for the system. Commands are
181 available to set and interrogate the timer-of-day clock. Time-keeping is
182 maintained down to a resolution of one second.
183
184 Status Inquiries
185 ================
186
187 The current state of ikbd modes and parameters may be found by sending status
188 inquiry commands that correspond to the ikbd set commands.
189
190 Power-Up Mode
191 =============
192
193 The keyboard controller will perform a simple self-test on power-up to detect
194 major controller faults (ROM checksum and RAM test) and such things as stuck
195 keys. Any keys down at power-up are presumed to be stuck, and their BREAK
196 (sic) code is returned (which without the preceding MAKE code is a flag for a
197 keyboard error). If the controller self-test completes without error, the code
198 0xF0 is returned. (This code will be used to indicate the version/release of
199 the ikbd controller. The first release of the ikbd is version 0xF0, should
200 there be a second release it will be 0xF1, and so on.)
201 The ikbd defaults to a mouse position reporting with threshold of 1 unit in
202 either axis and the Y=0 origin at the top of the screen, and joystick event
203 reporting mode for joystick 1, with both buttons being logically assigned to
204 the mouse. After any joystick command, the ikbd assumes that joysticks are
205 connected to both Joystick0 and Joystick1. Any mouse command (except MOUSE
206 DISABLE) then causes port 0 to again be scanned as if it were a mouse, and
207 both buttons are logically connected to it. If a mouse disable command is
208 received while port 0 is presumed to be a mouse, the button is logically
209 assigned to Joystick1 (until the mouse is reenabled by another mouse command).
210
211 ikbd Command Set
212 ================
213
214 This section contains a list of commands that can be sent to the ikbd. Command
215 codes (such as 0x00) which are not specified should perform no operation
216 (NOPs).
217
218 RESET
219 -----
220
221 ::
222
223 0x80
224 0x01
225
226 N.B. The RESET command is the only two byte command understood by the ikbd.
227 Any byte following an 0x80 command byte other than 0x01 is ignored (and causes
228 the 0x80 to be ignored).
229 A reset may also be caused by sending a break lasting at least 200mS to the
230 ikbd.
231 Executing the RESET command returns the keyboard to its default (power-up)
232 mode and parameter settings. It does not affect the time-of-day clock.
233 The RESET command or function causes the ikbd to perform a simple self-test.
234 If the test is successful, the ikbd will send the code of 0xF0 within 300mS
235 of receipt of the RESET command (or the end of the break, or power-up). The
236 ikbd will then scan the key matrix for any stuck (closed) keys. Any keys found
237 closed will cause the break scan code to be generated (the break code arriving
238 without being preceded by the make code is a flag for a key matrix error).
239
240 SET MOUSE BUTTON ACTION
241 -----------------------
242
243 ::
244
245 0x07
246 %00000mss ; mouse button action
247 ; (m is presumed = 1 when in MOUSE KEYCODE mode)
248 ; mss=0xy, mouse button press or release causes mouse
249 ; position report
250 ; where y=1, mouse key press causes absolute report
251 ; and x=1, mouse key release causes absolute report
252 ; mss=100, mouse buttons act like keys
253
254 This command sets how the ikbd should treat the buttons on the mouse. The
255 default mouse button action mode is %00000000, the buttons are treated as part
256 of the mouse logically.
257 When buttons act like keys, LEFT=0x74 & RIGHT=0x75.
258
259 SET RELATIVE MOUSE POSITION REPORTING
260 -------------------------------------
261
262 ::
263
264 0x08
265
266 Set relative mouse position reporting. (DEFAULT) Mouse position packets are
267 generated asynchronously by the ikbd whenever motion exceeds the setable
268 threshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse
269 key mode, mouse position reports may also be generated when either mouse
270 button is pressed or released. Otherwise the mouse buttons behave as if they
271 were keyboard keys.
272
273 SET ABSOLUTE MOUSE POSITIONING
274 ------------------------------
275
276 ::
277
278 0x09
279 XMSB ; X maximum (in scaled mouse clicks)
280 XLSB
281 YMSB ; Y maximum (in scaled mouse clicks)
282 YLSB
283
284 Set absolute mouse position maintenance. Resets the ikbd maintained X and Y
285 coordinates.
286 In this mode, the value of the internally maintained coordinates does NOT wrap
287 between 0 and large positive numbers. Excess motion below 0 is ignored. The
288 command sets the maximum positive value that can be attained in the scaled
289 coordinate system. Motion beyond that value is also ignored.
290
291 SET MOUSE KEYCODE MODE
292 ----------------------
293
294 ::
295
296 0x0A
297 deltax ; distance in X clicks to return (LEFT) or (RIGHT)
298 deltay ; distance in Y clicks to return (UP) or (DOWN)
299
300 Set mouse monitoring routines to return cursor motion keycodes instead of
301 either RELATIVE or ABSOLUTE motion records. The ikbd returns the appropriate
302 cursor keycode after mouse travel exceeding the user specified deltas in
303 either axis. When the keyboard is in key scan code mode, mouse motion will
304 cause the make code immediately followed by the break code. Note that this
305 command is not affected by the mouse motion origin.
306
307 SET MOUSE THRESHOLD
308 -------------------
309
310 ::
311
312 0x0B
313 X ; x threshold in mouse ticks (positive integers)
314 Y ; y threshold in mouse ticks (positive integers)
315
316 This command sets the threshold before a mouse event is generated. Note that
317 it does NOT affect the resolution of the data returned to the host. This
318 command is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds
319 default to 1 at RESET (or power-up).
320
321 SET MOUSE SCALE
322 ---------------
323
324 ::
325
326 0x0C
327 X ; horizontal mouse ticks per internal X
328 Y ; vertical mouse ticks per internal Y
329
330 This command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode.
331 In this mode, the specified number of mouse phase changes ('clicks') must
332 occur before the internally maintained coordinate is changed by one
333 (independently scaled for each axis). Remember that the mouse position
334 information is available only by interrogating the ikbd in the ABSOLUTE MOUSE
335 POSITIONING mode unless the ikbd has been commanded to report on button press
336 or release (see SET MOUSE BUTTON ACTION).
337
338 INTERROGATE MOUSE POSITION
339 --------------------------
340
341 ::
342
343 0x0D
344 Returns:
345 0xF7 ; absolute mouse position header
346 BUTTONS
347 0000dcba ; where a is right button down since last interrogation
348 ; b is right button up since last
349 ; c is left button down since last
350 ; d is left button up since last
351 XMSB ; X coordinate
352 XLSB
353 YMSB ; Y coordinate
354 YLSB
355
356 The INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE
357 POSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.
358
359 LOAD MOUSE POSITION
360 -------------------
361
362 ::
363
364 0x0E
365 0x00 ; filler
366 XMSB ; X coordinate
367 XLSB ; (in scaled coordinate system)
368 YMSB ; Y coordinate
369 YLSB
370
371 This command allows the user to preset the internally maintained absolute
372 mouse position.
373
374 SET Y=0 AT BOTTOM
375 -----------------
376
377 ::
378
379 0x0F
380
381 This command makes the origin of the Y axis to be at the bottom of the
382 logical coordinate system internal to the ikbd for all relative or absolute
383 mouse motion. This causes mouse motion toward the user to be negative in sign
384 and away from the user to be positive.
385
386 SET Y=0 AT TOP
387 --------------
388
389 ::
390
391 0x10
392
393 Makes the origin of the Y axis to be at the top of the logical coordinate
394 system within the ikbd for all relative or absolute mouse motion. (DEFAULT)
395 This causes mouse motion toward the user to be positive in sign and away from
396 the user to be negative.
397
398 RESUME
399 ------
400
401 ::
402
403 0x11
404
405 Resume sending data to the host. Since any command received by the ikbd after
406 its output has been paused also causes an implicit RESUME this command can be
407 thought of as a NO OPERATION command. If this command is received by the ikbd
408 and it is not PAUSED, it is simply ignored.
409
410 DISABLE MOUSE
411 -------------
412
413 ::
414
415 0x12
416
417 All mouse event reporting is disabled (and scanning may be internally
418 disabled). Any valid mouse mode command resumes mouse motion monitoring. (The
419 valid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SET
420 ABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. )
421 N.B. If the mouse buttons have been commanded to act like keyboard keys, this
422 command DOES affect their actions.
423
424 PAUSE OUTPUT
425 ------------
426
427 ::
428
429 0x13
430
431 Stop sending data to the host until another valid command is received. Key
432 matrix activity is still monitored and scan codes or ASCII characters enqueued
433 (up to the maximum supported by the microcontroller) to be sent when the host
434 allows the output to be resumed. If in the JOYSTICK EVENT REPORTING mode,
435 joystick events are also queued.
436 Mouse motion should be accumulated while the output is paused. If the ikbd is
437 in RELATIVE MOUSE POSITIONING REPORTING mode, motion is accumulated beyond the
438 normal threshold limits to produce the minimum number of packets necessary for
439 transmission when output is resumed. Pressing or releasing either mouse button
440 causes any accumulated motion to be immediately queued as packets, if the
441 mouse is in RELATIVE MOUSE POSITION REPORTING mode.
442 Because of the limitations of the microcontroller memory this command should
443 be used sparingly, and the output should not be shut of for more than <tbd>
444 milliseconds at a time.
445 The output is stopped only at the end of the current 'even'. If the PAUSE
446 OUTPUT command is received in the middle of a multiple byte report, the packet
447 will still be transmitted to conclusion and then the PAUSE will take effect.
448 When the ikbd is in either the JOYSTICK MONITORING mode or the FIRE BUTTON
449 MONITORING mode, the PAUSE OUTPUT command also temporarily stops the
450 monitoring process (i.e. the samples are not enqueued for transmission).
451
452 SET JOYSTICK EVENT REPORTING
453 ----------------------------
454
455 ::
456
457 0x14
458
459 Enter JOYSTICK EVENT REPORTING mode (DEFAULT). Each opening or closure of a
460 joystick switch or trigger causes a joystick event record to be generated.
461
462 SET JOYSTICK INTERROGATION MODE
463 -------------------------------
464
465 ::
466
467 0x15
468
469 Disables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK
470 INTERROGATE commands to sense joystick state.
471
472 JOYSTICK INTERROGATE
473 --------------------
474
475 ::
476
477 0x16
478
479 Return a record indicating the current state of the joysticks. This command
480 is valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK
481 INTERROGATION MODE.
482
483 SET JOYSTICK MONITORING
484 -----------------------
485
486 ::
487
488 0x17
489 rate ; time between samples in hundredths of a second
490 Returns: (in packets of two as long as in mode)
491 %000000xy ; where y is JOYSTICK1 Fire button
492 ; and x is JOYSTICK0 Fire button
493 %nnnnmmmm ; where m is JOYSTICK1 state
494 ; and n is JOYSTICK0 state
495
496 Sets the ikbd to do nothing but monitor the serial command line, maintain the
497 time-of-day clock, and monitor the joystick. The rate sets the interval
498 between joystick samples.
499 N.B. The user should not set the rate higher than the serial communications
500 channel will allow the 2 bytes packets to be transmitted.
501
502 SET FIRE BUTTON MONITORING
503 --------------------------
504
505 ::
506
507 0x18
508 Returns: (as long as in mode)
509 %bbbbbbbb ; state of the JOYSTICK1 fire button packed
510 ; 8 bits per byte, the first sample if the MSB
511
512 Set the ikbd to do nothing but monitor the serial command line, maintain the
513 time-of-day clock, and monitor the fire button on Joystick 1. The fire button
514 is scanned at a rate that causes 8 samples to be made in the time it takes for
515 the previous byte to be sent to the host (i.e. scan rate = 8/10 * baud rate).
516 The sample interval should be as constant as possible.
517
518 SET JOYSTICK KEYCODE MODE
519 -------------------------
520
521 ::
522
523 0x19
524 RX ; length of time (in tenths of seconds) until
525 ; horizontal velocity breakpoint is reached
526 RY ; length of time (in tenths of seconds) until
527 ; vertical velocity breakpoint is reached
528 TX ; length (in tenths of seconds) of joystick closure
529 ; until horizontal cursor key is generated before RX
530 ; has elapsed
531 TY ; length (in tenths of seconds) of joystick closure
532 ; until vertical cursor key is generated before RY
533 ; has elapsed
534 VX ; length (in tenths of seconds) of joystick closure
535 ; until horizontal cursor keystrokes are generated
536 ; after RX has elapsed
537 VY ; length (in tenths of seconds) of joystick closure
538 ; until vertical cursor keystrokes are generated
539 ; after RY has elapsed
540
541 In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes.
542 On initial closure, a keystroke pair (make/break) is generated. Then up to Rn
543 tenths of seconds later, keystroke pairs are generated every Tn tenths of
544 seconds. After the Rn breakpoint is reached, keystroke pairs are generated
545 every Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint
546 feature.
547 Note that by setting RX and/or Ry to zero, the velocity feature can be
548 disabled. The values of TX and TY then become meaningless, and the generation
549 of cursor 'keystrokes' is set by VX and VY.
550
551 DISABLE JOYSTICKS
552 -----------------
553
554 ::
555
556 0x1A
557
558 Disable the generation of any joystick events (and scanning may be internally
559 disabled). Any valid joystick mode command resumes joystick monitoring. (The
560 joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK
561 INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and
562 SET JOYSTICK KEYCODE MODE.)
563
564 TIME-OF-DAY CLOCK SET
565 ---------------------
566
567 ::
568
569 0x1B
570 YY ; year (2 least significant digits)
571 MM ; month
572 DD ; day
573 hh ; hour
574 mm ; minute
575 ss ; second
576
577 All time-of-day data should be sent to the ikbd in packed BCD format.
578 Any digit that is not a valid BCD digit should be treated as a 'don't care'
579 and not alter that particular field of the date or time. This permits setting
580 only some subfields of the time-of-day clock.
581
582 INTERROGATE TIME-OF-DAT CLOCK
583 -----------------------------
584
585 ::
586
587 0x1C
588 Returns:
589 0xFC ; time-of-day event header
590 YY ; year (2 least significant digits)
591 MM ; month
592 DD ; day
593 hh ; hour
594 mm ; minute
595 ss ; second
596
597 All time-of-day is sent in packed BCD format.
598
599 MEMORY LOAD
600 -----------
601
602 ::
603
604 0x20
605 ADRMSB ; address in controller
606 ADRLSB ; memory to be loaded
607 NUM ; number of bytes (0-128)
608 { data }
609
610 This command permits the host to load arbitrary values into the ikbd
611 controller memory. The time between data bytes must be less than 20ms.
612
613 MEMORY READ
614 -----------
615
616 ::
617
618 0x21
619 ADRMSB ; address in controller
620 ADRLSB ; memory to be read
621 Returns:
622 0xF6 ; status header
623 0x20 ; memory access
624 { data } ; 6 data bytes starting at ADR
625
626 This command permits the host to read from the ikbd controller memory.
627
628 CONTROLLER EXECUTE
629 ------------------
630
631 ::
632
633 0x22
634 ADRMSB ; address of subroutine in
635 ADRLSB ; controller memory to be called
636
637 This command allows the host to command the execution of a subroutine in the
638 ikbd controller memory.
639
640 STATUS INQUIRIES
641 ----------------
642
643 ::
644
645 Status commands are formed by inclusively ORing 0x80 with the
646 relevant SET command.
647
648 Example:
649 0x88 (or 0x89 or 0x8A) ; request mouse mode
650 Returns:
651 0xF6 ; status response header
652 mode ; 0x08 is RELATIVE
653 ; 0x09 is ABSOLUTE
654 ; 0x0A is KEYCODE
655 param1 ; 0 is RELATIVE
656 ; XMSB maximum if ABSOLUTE
657 ; DELTA X is KEYCODE
658 param2 ; 0 is RELATIVE
659 ; YMSB maximum if ABSOLUTE
660 ; DELTA Y is KEYCODE
661 param3 ; 0 if RELATIVE
662 ; or KEYCODE
663 ; YMSB is ABSOLUTE
664 param4 ; 0 if RELATIVE
665 ; or KEYCODE
666 ; YLSB is ABSOLUTE
667 0 ; pad
668 0
669
670 The STATUS INQUIRY commands request the ikbd to return either the current mode
671 or the parameters associated with a given command. All status reports are
672 padded to form 8 byte long return packets. The responses to the status
673 requests are designed so that the host may store them away (after stripping
674 off the status report header byte) and later send them back as commands to
675 ikbd to restore its state. The 0 pad bytes will be treated as NOPs by the
676 ikbd.
677
678 Valid STATUS INQUIRY commands are::
679
680 0x87 mouse button action
681 0x88 mouse mode
682 0x89
683 0x8A
684 0x8B mnouse threshold
685 0x8C mouse scale
686 0x8F mouse vertical coordinates
687 0x90 ( returns 0x0F Y=0 at bottom
688 0x10 Y=0 at top )
689 0x92 mouse enable/disable
690 ( returns 0x00 enabled)
691 0x12 disabled )
692 0x94 joystick mode
693 0x95
694 0x96
695 0x9A joystick enable/disable
696 ( returns 0x00 enabled
697 0x1A disabled )
698
699 It is the (host) programmer's responsibility to have only one unanswered
700 inquiry in process at a time.
701 STATUS INQUIRY commands are not valid if the ikbd is in JOYSTICK MONITORING
702 mode or FIRE BUTTON MONITORING mode.
703
704
705 SCAN CODES
706 ==========
707
708 The key scan codes returned by the ikbd are chosen to simplify the
709 implementation of GSX.
710
711 GSX Standard Keyboard Mapping
712
713 ======= ============
714 Hex Keytop
715 ======= ============
716 01 Esc
717 02 1
718 03 2
719 04 3
720 05 4
721 06 5
722 07 6
723 08 7
724 09 8
725 0A 9
726 0B 0
727 0C \-
728 0D \=
729 0E BS
730 0F TAB
731 10 Q
732 11 W
733 12 E
734 13 R
735 14 T
736 15 Y
737 16 U
738 17 I
739 18 O
740 19 P
741 1A [
742 1B ]
743 1C RET
744 1D CTRL
745 1E A
746 1F S
747 20 D
748 21 F
749 22 G
750 23 H
751 24 J
752 25 K
753 26 L
754 27 ;
755 28 '
756 29 \`
757 2A (LEFT) SHIFT
758 2B \\
759 2C Z
760 2D X
761 2E C
762 2F V
763 30 B
764 31 N
765 32 M
766 33 ,
767 34 .
768 35 /
769 36 (RIGHT) SHIFT
770 37 { NOT USED }
771 38 ALT
772 39 SPACE BAR
773 3A CAPS LOCK
774 3B F1
775 3C F2
776 3D F3
777 3E F4
778 3F F5
779 40 F6
780 41 F7
781 42 F8
782 43 F9
783 44 F10
784 45 { NOT USED }
785 46 { NOT USED }
786 47 HOME
787 48 UP ARROW
788 49 { NOT USED }
789 4A KEYPAD -
790 4B LEFT ARROW
791 4C { NOT USED }
792 4D RIGHT ARROW
793 4E KEYPAD +
794 4F { NOT USED }
795 50 DOWN ARROW
796 51 { NOT USED }
797 52 INSERT
798 53 DEL
799 54 { NOT USED }
800 5F { NOT USED }
801 60 ISO KEY
802 61 UNDO
803 62 HELP
804 63 KEYPAD (
805 64 KEYPAD /
806 65 KEYPAD *
807 66 KEYPAD *
808 67 KEYPAD 7
809 68 KEYPAD 8
810 69 KEYPAD 9
811 6A KEYPAD 4
812 6B KEYPAD 5
813 6C KEYPAD 6
814 6D KEYPAD 1
815 6E KEYPAD 2
816 6F KEYPAD 3
817 70 KEYPAD 0
818 71 KEYPAD .
819 72 KEYPAD ENTER
820 ======= ============
821

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

ikbd 개요와 키보드 스캔 코드

1-51

Atari Corp. Intelligent Keyboard(`ikbd`)는 제품을 바꾸지 않고도 여러 시스템에 사용할 수 있도록 설계된 범용 키보드 컨트롤러입니다. 키보드의 마이크로컨트롤러는 마우스와 스위치형 조이스틱의 연결 지점도 제공하며, 1초 해상도의 시각 시계까지 유지합니다.

키 스위치 수나 마우스 해상도가 다른 제품 변형을 수용할 수 있고, 주 프로세서와 고속 양방향 직렬 인터페이스로 통신합니다. 키보드·조이스틱·마우스의 여러 동작 모드를 제공하며, 기본 모드를 신중히 설계하면 단방향 통신만 가능한 응용에서도 제한적으로 사용할 수 있습니다.

키보드는 누름(make)과 놓음(break) 스캔 코드를 항상 반환합니다. 누름 코드는 1부터 시작하며 부록 A의 GSX 표에 정의됩니다. 특정 키보드에 실제 스위치가 없어도 ISO 키 위치 같은 표준 위치는 표에 남습니다. 각 놓음 코드는 누름 코드와 `0x80`을 OR하여 얻습니다.

예약 특수 코드
코드용도
`0xF6`상태 보고
`0xF7`절대 마우스 위치 레코드
`0xF8`~`0xFB`상대 마우스 위치 레코드. 하위 비트는 마우스 버튼 상태로 결정
`0xFC`시각(time-of-day)
`0xFD`두 조이스틱 상태 보고
`0xFE`조이스틱 0 이벤트
`0xFF`조이스틱 1 이벤트

`0xF6`~`0xFF`의 보고 레코드 용도를 보존합니다.

왼쪽과 오른쪽 Shift는 서로 다른 스캔 코드를 반환하고, ENTER와 RETurn 키도 구별됩니다.

키 이벤트 인코딩
키 매트릭스에서 스위치 닫힘 또는 열림 감지닫힘이면 부록 A의 make code 선택열림이면 make code에 `0x80`을 OR하여 break code 생성고속 직렬 인터페이스로 호스트에 전송`0xF6` 이상은 키가 아닌 상태·마우스·시각·조이스틱 보고로 해석

키 스위치 변화가 호스트 코드로 전달되는 과정입니다.

====================================
Intelligent Keyboard (ikbd) Protocol
====================================


Introduction
============

The Atari Corp. Intelligent Keyboard (ikbd) is a general purpose keyboard
controller that is flexible enough that it can be used in a variety of
products without modification. The keyboard, with its microcontroller,
provides a convenient connection point for a mouse and switch-type joysticks.
The ikbd processor also maintains a time-of-day clock with one second
resolution.
The ikbd has been designed to be general enough that it can be used with a
variety of new computer products. Product variations in a number of
keyswitches, mouse resolution, etc. can be accommodated.
The ikbd communicates with the main processor over a high speed bi-directional
serial interface. It can function in a variety of modes to facilitate
different applications of the keyboard,  joysticks, or mouse. Limited use of
the controller is possible in applications in which only a unidirectional
communications medium is available by carefully designing the default modes.

Keyboard
========

The keyboard always returns key make/break scan codes. The ikbd generates
keyboard scan codes for each key press and release. The key scan make (key
closure) codes start at 1, and are defined in Appendix A. For example, the
ISO key position in the scan code table should exist even if no keyswitch
exists in that position on a particular keyboard. The break code for each key
is obtained by ORing 0x80 with the make code.

The special codes 0xF6 through 0xFF are reserved for use as follows:

=================== ====================================================
    Code            Command
=================== ====================================================
    0xF6            status report
    0xF7            absolute mouse position record
    0xF8-0xFB       relative mouse position records (lsbs determined by
                    mouse button states)
    0xFC            time-of-day
    0xFD            joystick report (both sticks)
    0xFE            joystick 0 event
    0xFF            joystick 1 event
=================== ====================================================

The two shift keys return different scan codes in this mode. The ENTER key
and the RETurn key are also distinct.

마우스 상대·절대·커서 키 모드

52-115

마우스 포트는 이동 1인치당 약 200카운트(위상 변화 또는 클릭)의 해상도를 지원해야 하며, 초당 10인치 속도까지 정확히 추적할 수 있는 주기로 스캔해야 합니다. `ikbd`는 상대 이동, 내부 좌표계의 절대 위치, 또는 커서 제어 키 변환이라는 세 방식으로 이동을 보고합니다. 버튼은 마우스 일부 또는 추가 키보드 키로 취급할 수 있습니다.

마우스 보고 모드
모드내부 처리호스트 출력
Relative축별 이동량 누적과 설정 가능한 이벤트 임계값`%111110xy`, 2의 보수 X delta, 2의 보수 Y delta
Absolute내부 X/Y 좌표, 축별 배율과 최대값 유지조회 또는 버튼 동작 설정에 따라 절대 위치 레코드
Cursor key축별 클릭 수를 최고 해상도로 누적배율 배수마다 해당 커서 키 make 직후 break

세 모드의 상태 유지 방식과 출력을 비교합니다.

상대 위치 모드에서는 버튼 누름·놓음 또는 어느 한 축의 이동이 설정 임계값을 넘을 때 레코드를 반환합니다. 임계값은 이벤트 발생 시점만 결정하고, 호스트에는 모든 해상도 비트가 전달됩니다. 출력이 PAUSE 상태이거나 다른 이벤트를 전송 중이면 즉시 상대 이벤트를 만들 수 없으므로, 실제 보고량이 임계값보다 훨씬 클 수 있습니다.

상대 마우스 3바이트 레코드
바이트비트/값의미
0`%111110xy`마우스 위치 플래그. `x`=왼쪽 버튼, `y`=오른쪽 버튼 상태
1`X`2의 보수 정수 X 이동량
2`Y`2의 보수 정수 Y 이동량

키보드 모드와 무관한 상대 위치 패킷입니다.

버튼이 키처럼 동작하도록 설정되어도 패킷의 버튼 상태 비트는 유효해야 합니다. 누적 이동량이 +127~-128 범위를 넘으면 여러 패킷으로 나눕니다. Y 이동량 부호는 선택한 Y 원점에 따라 달라집니다.

절대 위치 모드는 내부 좌표를 유지하며, 위치 재설정·X/Y 배율 설정·현재 위치 조회 명령을 제공합니다. 커서 키 모드에서는 축마다 한 번의 키 입력에 필요한 클릭 수를 독립적으로 설정하고, 그 배수만큼 이동할 때 해당 방향의 make/break 쌍을 냅니다. 버튼은 일반 키 매트릭스보다 높은 `LEFT=0x74`, `RIGHT=0x75`를 사용합니다.

상대 위치 보고 조건
버튼 변화 또는 축 이동량이 임계값을 넘음PAUSE 또는 다른 이벤트 전송 중이면 이동량 누적X/Y가 단일 signed byte 범위를 넘으면 여러 레코드로 분할선택한 Y 원점에 따라 Y 부호 결정버튼 비트와 X/Y delta를 3바이트로 전송

이동 또는 버튼 변화에서 패킷을 만드는 규칙입니다.

Mouse
=====

The mouse port should be capable of supporting a mouse with resolution of
approximately 200 counts (phase changes or 'clicks') per inch of travel. The
mouse should be scanned at a rate that will permit accurate tracking at
velocities up to 10 inches per second.
The ikbd can report mouse motion in three distinctly different ways. It can
report relative motion, absolute motion in a coordinate system maintained
within the ikbd, or by converting mouse motion into keyboard cursor control
key equivalents.
The mouse buttons can be treated as part of the mouse or as additional
keyboard keys.

Relative Position Reporting
---------------------------

In relative position mode, the ikbd will return relative mouse position
records whenever a mouse event occurs. A mouse event consists of a mouse
button being pressed or released, or motion in either axis exceeding a
settable threshold of motion. Regardless of the threshold, all bits of
resolution are returned to the host computer.
Note that the ikbd may return mouse relative position reports with
significantly more than the threshold delta x or y. This may happen since no
relative mouse motion events will be generated: (a) while the keyboard has
been 'paused' ( the event will be stored until keyboard communications is
resumed) (b) while any event is being transmitted.

The relative mouse position record is a three byte record of the form
(regardless of keyboard mode)::

    %111110xy           ; mouse position record flag
                        ; where y is the right button state
                        ; and x is the left button state
    X                   ; delta x as twos complement integer
    Y                   ; delta y as twos complement integer

Note that the value of the button state bits should be valid even if the
MOUSE BUTTON ACTION has set the buttons to act like part of the keyboard.
If the accumulated motion before the report packet is generated exceeds the
+127...-128 range, the motion is broken into multiple packets.
Note that the sign of the delta y reported is a function of the Y origin
selected.

Absolute Position reporting
---------------------------

The ikbd can also maintain absolute mouse position. Commands exist for
resetting the mouse position, setting X/Y scaling, and interrogating the
current mouse position.

Mouse Cursor Key Mode
---------------------

The ikbd can translate mouse motion into the equivalent cursor keystrokes.
The number of mouse clicks per keystroke is independently programmable in
each axis. The ikbd internally maintains mouse motion information to the
highest resolution available, and merely generates a pair of cursor key events
for each multiple of the scale factor.
Mouse motion produces the cursor key make code immediately followed by the
break code for the appropriate cursor key. The mouse buttons produce scan
codes above those normally assigned for the largest envisioned keyboard (i.e.
LEFT=0x74 & RIGHT=0x75).

조이스틱 모드, 시각 시계와 전원 투입 상태

116-210

조이스틱 이벤트 보고 모드는 스위치나 트리거가 열리거나 닫힐 때마다 레코드를 생성합니다. 이벤트 레코드는 첫 바이트 `%1111111x`에서 `x`로 조이스틱 0/1을 구분하고, 둘째 바이트 `%x000yyyy`에서 `x`는 트리거, `yyyy`는 스틱 위치를 나타냅니다.

조이스틱 이벤트와 조회 레코드
종류바이트형식과 의미
이벤트0`%1111111x`: 조이스틱 이벤트 표식, `x`=포트 0/1
이벤트1`%x000yyyy`: `x`=트리거, `yyyy`=스틱 위치
조회0`0xFD`: 조이스틱 보고 헤더
조회1`%x000yyyy`: 조이스틱 0
조회2`%x000yyyy`: 조이스틱 1

변화 이벤트와 두 포트 동시 조회의 바이트 형식을 비교합니다.

조회 모드에서는 `Interrogate Joystick` 명령으로 언제든 현재 두 포트 상태를 받을 수 있습니다. 조이스틱 모니터링 모드는 통신 시간 대부분을 사용자가 정한 주기의 상태 보고에 할당하며, 재설정 또는 다른 모드 명령 전까지 지속됩니다. 이 모드의 PAUSE는 출력뿐 아니라 스캔도 멈추므로 샘플을 큐에 넣지 않습니다.

Fire Button Monitoring은 조이스틱 1의 fire 버튼 한 비트를 직렬 채널이 허용하는 최고 속도로 감시하고 8샘플을 한 바이트에 묶습니다. 이 모드도 재설정이나 다른 모드 명령까지 유지되며, PAUSE 동안 스캔과 큐 적재가 모두 중단됩니다.

Joystick Key Code Mode는 어느 조이스틱이든 커서 제어 키로 바꾸며 하나의 속도 전환 지점을 제공합니다. 방향 이벤트는 해당 커서 키의 make 직후 break를 내고, 트리거는 큰 키 매트릭스 범위를 넘는 의사 스캔 코드 `JOYSTICK0=0x74`, `JOYSTICK1=0x75`를 냅니다.

컨트롤러는 1초 해상도의 시각 시계를 유지하고 설정·조회 명령을 제공합니다. 현재 모드와 매개변수는 각 설정 명령에 대응하는 상태 조회 명령으로 확인할 수 있습니다.

전원 투입 기본 상태
항목기본 동작
자체 검사ROM checksum, RAM, 붙은 키 검사
성공 코드300ms 이내 `0xF0`; 이후 릴리스는 `0xF1` 등으로 증가 가능
붙은 키선행 make 없이 break를 반환하여 키 매트릭스 오류 표시
마우스상대 위치, X/Y 임계값 1, 화면 위쪽이 Y=0
조이스틱조이스틱 1 이벤트 보고
버튼두 버튼 모두 논리적으로 마우스에 배정

자체 검사와 포트 논리 배정을 정리합니다.

조이스틱 명령 뒤에는 두 포트 모두 조이스틱이 연결된 것으로 가정합니다. `MOUSE DISABLE`을 제외한 마우스 명령을 받으면 포트 0을 다시 마우스로 스캔하고 두 버튼을 마우스에 연결합니다. 포트 0이 마우스로 간주되는 동안 마우스를 비활성화하면 버튼은 다음 마우스 명령으로 재활성화될 때까지 조이스틱 1에 논리적으로 배정됩니다.

전원 투입과 포트 전환
ROM·RAM·키 매트릭스 자체 검사성공 시 `0xF0`, 붙은 키가 있으면 선행 make 없는 break 전송포트 0=마우스, 조이스틱 1=이벤트 모드로 시작조이스틱 명령을 받으면 두 포트를 조이스틱으로 간주유효 마우스 모드 명령을 받으면 포트 0을 마우스로 복귀

부팅 기본값에서 명령에 따라 포트 역할이 바뀌는 과정입니다.

Joystick
========

Joystick Event Reporting
------------------------

In this mode, the ikbd generates a record whenever the joystick position is
changed (i.e. for each opening or closing of a joystick switch or trigger).

The joystick event record is two bytes of the form::

    %1111111x           ; Joystick event marker
                        ; where x is Joystick 0 or 1
    %x000yyyy           ; where yyyy is the stick position
                        ; and x is the trigger

Joystick Interrogation
----------------------

The current state of the joystick ports may be interrogated at any time in
this mode by sending an 'Interrogate Joystick' command to the ikbd.

The ikbd response to joystick interrogation is a three byte report of the form::

    0xFD                ; joystick report header
    %x000yyyy           ; Joystick 0
    %x000yyyy           ; Joystick 1
                        ; where x is the trigger
                        ; and yyy is the stick position

Joystick Monitoring
-------------------

A mode is available that devotes nearly all of the keyboard communications
time to reporting the state of the joystick ports at a user specifiable rate.
It remains in this mode until reset or commanded into another mode. The PAUSE
command in this mode not only stop the output but also temporarily stops
scanning the joysticks (samples are not queued).

Fire Button Monitoring
----------------------

A mode is provided to permit monitoring a single input bit at a high rate. In
this mode the ikbd monitors the state of the Joystick 1 fire button at the
maximum rate permitted by the serial communication channel. The data is packed
8 bits per byte for transmission to the host. The ikbd remains in this mode
until reset or commanded into another mode. The PAUSE command in this mode not
only stops the output but also temporarily stops scanning the button (samples
are not queued).

Joystick Key Code Mode
----------------------

The ikbd may be commanded to translate the use of either joystick into the
equivalent cursor control keystroke(s). The ikbd provides a single breakpoint
velocity joystick cursor.
Joystick events produce the make code, immediately followed by the break code
for the appropriate cursor motion keys. The trigger or fire buttons of the
joysticks produce pseudo key scan codes above those used by the largest key
matrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).

Time-of-Day Clock
=================

The ikbd also maintains a time-of-day clock for the system. Commands are
available to set and interrogate the timer-of-day clock. Time-keeping is
maintained down to a resolution of one second.

Status Inquiries
================

The current state of ikbd modes and parameters may be found by sending status
inquiry commands that correspond to the ikbd set commands.

Power-Up Mode
=============

The keyboard controller will perform a simple self-test on power-up to detect
major controller faults (ROM checksum and RAM test) and such things as stuck
keys. Any keys down at power-up are presumed to be stuck, and their BREAK
(sic) code is returned (which without the preceding MAKE code is a flag for a
keyboard error). If the controller self-test completes without error, the code
0xF0 is returned. (This code will be used to indicate the version/release of
the ikbd controller. The first release of the ikbd is version 0xF0, should
there be a second release it will be 0xF1, and so on.)
The ikbd defaults to a mouse position reporting with threshold of 1 unit in
either axis and the Y=0 origin at the top of the screen, and joystick event
reporting mode for joystick 1, with both buttons being logically assigned to
the mouse. After any joystick command, the ikbd assumes that joysticks are
connected to both Joystick0 and Joystick1. Any mouse command (except MOUSE
DISABLE) then causes port 0 to again be scanned as if it were a mouse, and
both buttons are logically connected to it. If a mouse disable command is
received while port 0 is presumed to be a mouse, the button is logically
assigned to Joystick1 (until the mouse is reenabled by another mouse command).

RESET과 마우스 명령 세트

211-397

이 절은 호스트가 `ikbd`로 보낼 수 있는 명령을 정의합니다. 명시되지 않은 코드, 예를 들어 `0x00`은 아무 동작도 하지 않는 NOP로 처리해야 합니다.

RESET 및 마우스 명령 요약
명령바이트 형식효과
RESET`0x80 0x01`기본 모드·매개변수 복원, 자체 검사. 시각 시계는 유지
SET MOUSE BUTTON ACTION`0x07 mss`버튼을 위치 보고 트리거 또는 키로 취급
SET RELATIVE MOUSE POSITION REPORTING`0x08`임계값 기반 비동기 상대 위치 보고
SET ABSOLUTE MOUSE POSITIONING`0x09 XMSB XLSB YMSB YLSB`최대 좌표 설정, 내부 좌표를 0으로 재설정
SET MOUSE KEYCODE MODE`0x0A deltax deltay`이동을 커서 키 make/break 쌍으로 변환
SET MOUSE THRESHOLD`0x0B X Y`상대 모드 이벤트 임계값 설정
SET MOUSE SCALE`0x0C X Y`절대 모드 축별 클릭/좌표 배율 설정
INTERROGATE MOUSE POSITION`0x0D``0xF7` 헤더, 버튼 이력과 X/Y 좌표 반환
LOAD MOUSE POSITION`0x0E 0x00 XMSB XLSB YMSB YLSB`내부 절대 좌표 미리 지정
SET Y=0 AT BOTTOM`0x0F`Y 원점을 아래쪽으로 설정
SET Y=0 AT TOP`0x10`Y 원점을 위쪽으로 설정하는 기본값

원문의 명령 코드, 매개변수와 핵심 효과를 모두 정리합니다.

RESET은 `0x80 0x01`이며 `ikbd`가 이해하는 유일한 2바이트 명령입니다. `0x80` 뒤의 바이트가 `0x01`이 아니면 둘 다 무시합니다. 200ms 이상 break를 보내도 재설정할 수 있습니다. 기본 모드와 매개변수를 복원하지만 시각 시계는 바꾸지 않습니다.

RESET, 긴 break 또는 전원 투입 뒤 자체 검사가 성공하면 300ms 이내 `0xF0`을 보냅니다. 이어서 닫힌 키를 검사하고, 발견하면 break 스캔 코드를 보냅니다. 선행 make가 없는 break는 키 매트릭스 오류 표식입니다.

SET MOUSE BUTTON ACTION의 `mss`
값/비트동작
`mss=0xy`버튼 누름 또는 놓음이 마우스 위치 보고를 유발
`x=1`마우스 키 놓음이 절대 위치 보고를 유발
`y=1`마우스 키 누름이 절대 위치 보고를 유발
`mss=100`버튼을 키처럼 취급
기본 `%00000000`버튼을 논리적으로 마우스 일부로 취급

`0x07` 뒤 `%00000mss` 비트가 버튼을 처리하는 방식을 나타냅니다.

MOUSE KEYCODE 모드에서는 `m`을 1로 간주하며, 버튼을 키로 취급할 때 왼쪽은 `0x74`, 오른쪽은 `0x75`입니다. 상대 위치 명령 `0x08`은 기본 모드이며 임계값을 넘으면 비동기 패킷을 냅니다. 버튼 보고 여부는 버튼 동작 설정에 따르고, 그렇지 않으면 버튼은 키처럼 동작합니다.

절대 위치 명령 `0x09`는 X/Y 최대값을 MSB·LSB로 받고 내부 좌표를 재설정합니다. 좌표는 0과 큰 양수 사이에서 wrap하지 않습니다. 0 아래 이동과 지정 최대값을 넘는 이동은 무시합니다. KEYCODE 명령 `0x0A`는 축별 `deltax`, `deltay`를 넘을 때 커서 make/break를 내며 Y 원점 설정의 영향을 받지 않습니다.

임계값 명령 `0x0B`는 상대 모드에서 이벤트를 생성할 X/Y 양의 tick 수를 정하지만 반환 데이터 해상도는 줄이지 않습니다. RESET 기본값은 양 축 1입니다. 배율 명령 `0x0C`는 절대 모드에서 내부 좌표 1이 변하는 데 필요한 축별 위상 변화 수를 지정합니다. 절대 위치는 조회하거나 버튼 누름·놓음 보고를 활성화했을 때만 얻습니다.

절대 위치 조회 반환값
필드형식의미
Header`0xF7`절대 마우스 위치 헤더
BUTTONS`0000dcba`마지막 조회 이후 버튼 변화
`a`bit 0오른쪽 버튼 눌림
`b`bit 1오른쪽 버튼 놓임
`c`bit 2왼쪽 버튼 눌림
`d`bit 3왼쪽 버튼 놓임
X`XMSB XLSB`절대 X 좌표
Y`YMSB YLSB`절대 Y 좌표

`0x0D`가 반환하는 `0xF7` 패킷과 버튼 이력 비트입니다.

위치 조회는 MOUSE BUTTON ACTION 설정과 관계없이 절대 모드에서 유효합니다. `0x0E 0x00 XMSB XLSB YMSB YLSB`는 내부 절대 좌표를 미리 설정합니다. `0x0F`는 아래쪽을 Y=0으로 하여 사용자 쪽 이동을 음수, 반대쪽을 양수로 만들고, 기본값 `0x10`은 위쪽을 Y=0으로 하여 그 부호를 반대로 만듭니다.

마우스 모드 설정 순서
RESET 또는 현재 상태 조회로 기준 상태 확인`0x07`로 버튼을 마우스 보고 또는 키로 배정`0x08`, `0x09`, `0x0A` 중 한 보고 모드 선택상대 모드면 `0x0B`, 절대 모드면 `0x0C`와 최대 좌표 설정`0x0F` 또는 `0x10`으로 Y 원점 선택절대 모드에서 `0x0D` 조회 또는 `0x0E` 위치 적재

필요한 보고 방식을 선택하고 매개변수를 적용하는 일반 흐름입니다.

ikbd Command Set
================

This section contains a list of commands that can be sent to the ikbd. Command
codes (such as 0x00) which are not specified should perform no operation
(NOPs).

RESET
-----

::

    0x80
    0x01

N.B. The RESET command is the only two byte command understood by the ikbd.
Any byte following an 0x80 command byte other than 0x01 is ignored (and causes
the 0x80 to be ignored).
A reset may also be caused by sending a break lasting at least 200mS to the
ikbd.
Executing the RESET command returns the keyboard to its default (power-up)
mode and parameter settings. It does not affect the time-of-day clock.
The RESET command or function causes the ikbd to perform a simple self-test.
If the test is successful, the ikbd will send the code of 0xF0 within 300mS
of receipt of the RESET command (or the end of the break, or power-up). The
ikbd will then scan the key matrix for any stuck (closed) keys. Any keys found
closed will cause the break scan code to be generated (the break code arriving
without being preceded by the make code is a flag for a key matrix error).

SET MOUSE BUTTON ACTION
-----------------------

::

    0x07
    %00000mss           ; mouse button action
                        ;       (m is presumed = 1 when in MOUSE KEYCODE mode)
                        ; mss=0xy, mouse button press or release causes mouse
                        ;  position report
                        ;  where y=1, mouse key press causes absolute report
                        ;  and x=1, mouse key release causes absolute report
                        ; mss=100, mouse buttons act like keys

This command sets how the ikbd should treat the buttons on the mouse. The
default mouse button action mode is %00000000, the buttons are treated as part
of the mouse logically.
When buttons act like keys, LEFT=0x74 & RIGHT=0x75.

SET RELATIVE MOUSE POSITION REPORTING
-------------------------------------

::

    0x08

Set relative mouse position reporting. (DEFAULT) Mouse position packets are
generated asynchronously by the ikbd whenever motion exceeds the setable
threshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mouse
key mode, mouse position reports may also be generated when either mouse
button is pressed or released. Otherwise the mouse buttons behave as if they
were keyboard keys.

SET ABSOLUTE MOUSE POSITIONING
------------------------------

::

    0x09
    XMSB                ; X maximum (in scaled mouse clicks)
    XLSB
    YMSB                ; Y maximum (in scaled mouse clicks)
    YLSB

Set absolute mouse position maintenance. Resets the ikbd maintained X and Y
coordinates.
In this mode, the value of the internally maintained coordinates does NOT wrap
between 0 and large positive numbers. Excess motion below 0 is ignored. The
command sets the maximum positive value that can be attained in the scaled
coordinate system. Motion beyond that value is also ignored.

SET MOUSE KEYCODE MODE
----------------------

::

    0x0A
    deltax              ; distance in X clicks to return (LEFT) or (RIGHT)
    deltay              ; distance in Y clicks to return (UP) or (DOWN)

Set mouse monitoring routines to return cursor motion keycodes instead of
either RELATIVE or ABSOLUTE motion records. The ikbd returns the appropriate
cursor keycode after mouse travel exceeding the user specified deltas in
either axis. When the keyboard is in key scan code mode, mouse motion will
cause the make code immediately followed by the break code. Note that this
command is not affected by the mouse motion origin.

SET MOUSE THRESHOLD
-------------------

::

    0x0B
    X                   ; x threshold in mouse ticks (positive integers)
    Y                   ; y threshold in mouse ticks (positive integers)

This command sets the threshold before a mouse event is generated. Note that
it does NOT affect the resolution of the data returned to the host. This
command is valid only in RELATIVE MOUSE POSITIONING mode. The thresholds
default to 1 at RESET (or power-up).

SET MOUSE SCALE
---------------

::

    0x0C
    X                   ; horizontal mouse ticks per internal X
    Y                   ; vertical mouse ticks per internal Y

This command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode.
In this mode, the specified number of mouse phase changes ('clicks') must
occur before the internally maintained coordinate is changed by one
(independently scaled for each axis). Remember that the mouse position
information is available only by interrogating the ikbd in the ABSOLUTE MOUSE
POSITIONING mode unless the ikbd has been commanded to report on button press
or release (see SET MOUSE BUTTON ACTION).

INTERROGATE MOUSE POSITION
--------------------------

::

    0x0D
    Returns:
            0xF7       ; absolute mouse position header
    BUTTONS
            0000dcba   ; where a is right button down since last interrogation
                       ; b is right button up since last
                       ; c is left button down since last
                       ; d is left button up since last
            XMSB       ; X coordinate
            XLSB
            YMSB       ; Y coordinate
            YLSB

The INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSE
POSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.

LOAD MOUSE POSITION
-------------------

::

    0x0E
    0x00                ; filler
    XMSB                ; X coordinate
    XLSB                ; (in scaled coordinate system)
    YMSB                ; Y coordinate
    YLSB

This command allows the user to preset the internally maintained absolute
mouse position.

SET Y=0 AT BOTTOM
-----------------

::

    0x0F

This command makes the origin of the Y axis to be at the bottom of the
logical coordinate system internal to the ikbd for all relative or absolute
mouse motion. This causes mouse motion toward the user to be negative in sign
and away from the user to be positive.

SET Y=0 AT TOP
--------------

::

    0x10

Makes the origin of the Y axis to be at the top of the logical coordinate
system within the ikbd for all relative or absolute mouse motion. (DEFAULT)
This causes mouse motion toward the user to be positive in sign and away from
the user to be negative.

출력 제어와 조이스틱 명령

398-563
출력·조이스틱 명령 요약
명령바이트 형식효과
RESUME`0x11`일시 정지된 출력을 재개. 다른 유효 명령도 묵시적으로 재개
DISABLE MOUSE`0x12`마우스 이벤트 보고 중지
PAUSE OUTPUT`0x13`현재 다중 바이트 패킷을 끝낸 뒤 출력 정지
SET JOYSTICK EVENT REPORTING`0x14`스위치 변화마다 이벤트를 내는 기본 모드
SET JOYSTICK INTERROGATION MODE`0x15`자동 이벤트를 끄고 호스트 조회만 사용
JOYSTICK INTERROGATE`0x16`현재 조이스틱 상태 반환
SET JOYSTICK MONITORING`0x17 rate`지정한 1/100초 간격으로 두 바이트 샘플 전송
SET FIRE BUTTON MONITORING`0x18`조이스틱 1 fire 버튼을 8샘플/바이트로 전송
SET JOYSTICK KEYCODE MODE`0x19 RX RY TX TY VX VY`조이스틱 0을 가속 구간이 있는 커서 키로 변환
DISABLE JOYSTICKS`0x1A`모든 조이스틱 이벤트 생성 중지

`0x11`~`0x1A` 명령과 지속 모드를 정리합니다.

RESUME `0x11`은 호스트로의 전송을 재개합니다. PAUSE 뒤 유효한 명령은 모두 묵시적 RESUME이므로 사실상 NOP처럼 볼 수 있고, 일시 정지 상태가 아니면 무시됩니다. DISABLE MOUSE `0x12`는 모든 마우스 이벤트를 끄며 내부 스캔도 멈출 수 있습니다. `0x08`, `0x09`, `0x0A` 중 어느 유효 마우스 모드 명령이든 모니터링을 재개합니다. 버튼을 키로 설정한 경우에도 비활성화의 영향을 받습니다.

PAUSE OUTPUT `0x13`은 다음 유효 명령까지 출력을 중지합니다. 키 매트릭스는 계속 감시하고 마이크로컨트롤러 용량까지 코드를 큐에 저장하며, joystick event 모드의 이벤트도 큐에 넣습니다. 상대 마우스 이동은 정상 임계값을 넘어 누적하고 재개 시 최소 패킷 수로 보냅니다. 버튼 변화가 생기면 누적 이동을 즉시 패킷 큐에 넣습니다.

메모리 한계 때문에 PAUSE는 드물게 사용해야 하며, 원문은 최대 정지 시간을 `<tbd>` 밀리초로 미정 상태로 둡니다. 정지는 현재 이벤트가 끝난 뒤 적용되므로 다중 바이트 보고 중간에 명령이 와도 패킷을 끝까지 전송합니다. 조이스틱 모니터링 또는 fire 버튼 모니터링에서는 출력과 샘플링 자체를 함께 멈추고 샘플을 큐에 넣지 않습니다.

조이스틱 모니터링 반환 패킷
바이트형식의미
0`%000000xy``x`=JOYSTICK0 fire, `y`=JOYSTICK1 fire
1`%nnnnmmmm``n`=JOYSTICK0 상태, `m`=JOYSTICK1 상태

`0x17 rate` 모드에서 계속 반환하는 두 바이트의 비트 배치입니다.

`rate`는 샘플 사이의 1/100초 단위 시간입니다. 직렬 채널이 두 바이트 패킷을 전송할 수 있는 속도보다 높은 보고율을 지정하면 안 됩니다. Fire 모니터링 `0x18`은 `%bbbbbbbb`로 조이스틱 1 fire 상태를 묶으며 첫 샘플은 MSB에 놓습니다. 스캔율은 이전 바이트 전송 시간 동안 8회, 즉 `8/10 * baud rate`이고 샘플 간격은 가능한 한 일정해야 합니다.

조이스틱 KEYCODE 속도 매개변수
매개변수단위의미
RX0.1초수평 속도 전환점까지 시간
RY0.1초수직 속도 전환점까지 시간
TX0.1초RX 이전 수평 커서 키 반복 간격
TY0.1초RY 이전 수직 커서 키 반복 간격
VX0.1초RX 이후 수평 커서 키 반복 간격
VY0.1초RY 이후 수직 커서 키 반복 간격

`0x19` 뒤 여섯 값이 초기 반복과 전환 후 반복을 축별로 제어합니다.

KEYCODE 모드에서는 조이스틱 0을 커서 키처럼 스캔합니다. 처음 닫힐 때 make/break 쌍을 즉시 만들고, Rn 전까지 Tn 간격, 전환점 뒤에는 Vn 간격으로 반복하여 자동 반복 속도 전환을 구현합니다. RX 또는 RY를 0으로 두면 해당 축의 속도 기능이 꺼지고 TX/TY는 의미가 없어지며 VX/VY만 반복을 정합니다.

DISABLE JOYSTICKS `0x1A`는 이벤트 생성과 필요에 따라 내부 스캔을 끕니다. `0x14`~`0x19`의 유효한 조이스틱 모드 명령을 보내면 다시 모니터링합니다.

PAUSE와 모니터링 모드의 차이
일반 키·joystick event 모드: 스캔을 계속하고 용량 한도까지 큐 적재상대 마우스: 이동을 누적하고 재개 시 최소 패킷으로 분할현재 다중 바이트 패킷은 끝까지 전송joystick monitoring·fire monitoring: 스캔 자체를 중지하고 큐에 넣지 않음다음 유효 명령을 받으면 출력이 묵시적으로 재개

일시 정지 중 어떤 입력을 계속 보존하는지 구분합니다.

RESUME
------

::

    0x11

Resume sending data to the host. Since any command received by the ikbd after
its output has been paused also causes an implicit RESUME this command can be
thought of as a NO OPERATION command. If this command is received by the ikbd
and it is not PAUSED, it is simply ignored.

DISABLE MOUSE
-------------

::

    0x12

All mouse event reporting is disabled (and scanning may be internally
disabled). Any valid mouse mode command resumes mouse motion monitoring. (The
valid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SET
ABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. )
N.B. If the mouse buttons have been commanded to act like keyboard keys, this
command DOES affect their actions.

PAUSE OUTPUT
------------

::

    0x13

Stop sending data to the host until another valid command is received. Key
matrix activity is still monitored and scan codes or ASCII characters enqueued
(up to the maximum supported by the microcontroller) to be sent when the host
allows the output to be resumed. If in the JOYSTICK EVENT REPORTING mode,
joystick events are also queued.
Mouse motion should be accumulated while the output is paused. If the ikbd is
in RELATIVE MOUSE POSITIONING REPORTING mode, motion is accumulated beyond the
normal threshold limits to produce the minimum number of packets necessary for
transmission when output is resumed. Pressing or releasing either mouse button
causes any accumulated motion to be immediately queued as packets, if the
mouse is in RELATIVE MOUSE POSITION REPORTING mode.
Because of the limitations of the microcontroller memory this command should
be used sparingly, and the output should not be shut of for more than <tbd>
milliseconds at a time.
The output is stopped only at the end of the current 'even'. If the PAUSE
OUTPUT command is received in the middle of a multiple byte report, the packet
will still be transmitted to conclusion and then the PAUSE will take effect.
When the ikbd is in either the JOYSTICK MONITORING mode or the FIRE BUTTON
MONITORING mode, the PAUSE OUTPUT command also temporarily stops the
monitoring process (i.e. the samples are not enqueued for transmission).

SET JOYSTICK EVENT REPORTING
----------------------------

::

    0x14

Enter JOYSTICK EVENT REPORTING mode (DEFAULT). Each opening or closure of a
joystick switch or trigger causes a joystick event record to be generated.

SET JOYSTICK INTERROGATION MODE
-------------------------------

::

    0x15

Disables JOYSTICK EVENT REPORTING. Host must send individual JOYSTICK
INTERROGATE commands to sense joystick state.

JOYSTICK INTERROGATE
--------------------

::

    0x16

Return a record indicating the current state of the joysticks. This command
is valid in either the JOYSTICK EVENT REPORTING mode or the JOYSTICK
INTERROGATION MODE.

SET JOYSTICK MONITORING
-----------------------

::

    0x17
    rate                ; time between samples in hundredths of a second
    Returns: (in packets of two as long as in mode)
            %000000xy   ; where y is JOYSTICK1 Fire button
                        ; and x is JOYSTICK0 Fire button
            %nnnnmmmm   ; where m is JOYSTICK1 state
                        ; and n is JOYSTICK0 state

Sets the ikbd to do nothing but monitor the serial command line, maintain the
time-of-day clock, and monitor the joystick. The rate sets the interval
between joystick samples.
N.B. The user should not set the rate higher than the serial communications
channel will allow the 2 bytes packets to be transmitted.

SET FIRE BUTTON MONITORING
--------------------------

::

    0x18
    Returns: (as long as in mode)
            %bbbbbbbb   ; state of the JOYSTICK1 fire button packed
                        ; 8 bits per byte, the first sample if the MSB

Set the ikbd to do nothing but monitor the serial command line, maintain the
time-of-day clock, and monitor the fire button on Joystick 1. The fire button
is scanned at a rate that causes 8 samples to be made in the time it takes for
the previous byte to be sent to the host (i.e. scan rate = 8/10 * baud rate).
The sample interval should be as constant as possible.

SET JOYSTICK KEYCODE MODE
-------------------------

::

    0x19
    RX                  ; length of time (in tenths of seconds) until
                        ; horizontal velocity breakpoint is reached
    RY                  ; length of time (in tenths of seconds) until
                        ; vertical velocity breakpoint is reached
    TX                  ; length (in tenths of seconds) of joystick closure
                        ; until horizontal cursor key is generated before RX
                        ; has elapsed
    TY                  ; length (in tenths of seconds) of joystick closure
                        ; until vertical cursor key is generated before RY
                        ; has elapsed
    VX                  ; length (in tenths of seconds) of joystick closure
                        ; until horizontal cursor keystrokes are generated
                        ; after RX has elapsed
    VY                  ; length (in tenths of seconds) of joystick closure
                        ; until vertical cursor keystrokes are generated
                        ; after RY has elapsed

In this mode, joystick 0 is scanned in a way that simulates cursor keystrokes.
On initial closure, a keystroke pair (make/break) is generated. Then up to Rn
tenths of seconds later, keystroke pairs are generated every Tn tenths of
seconds. After the Rn breakpoint is reached, keystroke pairs are generated
every Vn tenths of seconds. This provides a velocity (auto-repeat) breakpoint
feature.
Note that by setting RX and/or Ry to zero, the velocity feature can be
disabled. The values of TX and TY then become meaningless, and the generation
of cursor 'keystrokes' is set by VX and VY.

DISABLE JOYSTICKS
-----------------

::

    0x1A

Disable the generation of any joystick events (and scanning may be internally
disabled). Any valid joystick mode command resumes joystick monitoring. (The
joystick mode commands are SET JOYSTICK EVENT REPORTING, SET JOYSTICK
INTERROGATION MODE, SET JOYSTICK MONITORING, SET FIRE BUTTON MONITORING, and
SET JOYSTICK KEYCODE MODE.)

시각·메모리 명령과 상태 조회

564-702
시각과 컨트롤러 메모리 명령
명령바이트 형식동작
TIME-OF-DAY CLOCK SET`0x1B YY MM DD hh mm ss`packed BCD 시각 설정
INTERROGATE TIME-OF-DAT CLOCK`0x1C``0xFC`와 packed BCD 시각 반환
MEMORY LOAD`0x20 ADRMSB ADRLSB NUM {data}`컨트롤러 메모리에 0~128바이트 적재
MEMORY READ`0x21 ADRMSB ADRLSB``0xF6 0x20` 뒤에 주소부터 6바이트 반환
CONTROLLER EXECUTE`0x22 ADRMSB ADRLSB`컨트롤러 메모리의 서브루틴 실행

`0x1B`~`0x22` 시스템 명령의 바이트 형식을 보존합니다.

시각 설정 값은 모두 packed BCD로 보냅니다. 유효한 BCD 숫자가 아닌 자릿수는 don't-care로 처리해 해당 날짜·시간 필드를 바꾸지 않아야 하므로, 일부 하위 필드만 선택해 설정할 수 있습니다. 조회 `0x1C`는 `0xFC YY MM DD hh mm ss`를 모두 packed BCD로 반환합니다. 원문 명령 제목의 `TIME-OF-DAT` 철자는 그대로 보존합니다.

MEMORY LOAD `0x20`은 16비트 주소, 바이트 수 `NUM` 0~128, 데이터를 받아 컨트롤러 메모리에 임의 값을 적재합니다. 데이터 바이트 사이 간격은 20ms 미만이어야 합니다. MEMORY READ `0x21`은 `0xF6` 상태 헤더와 `0x20` 메모리 접근 표식 뒤에 지정 주소부터 6바이트를 반환합니다. CONTROLLER EXECUTE `0x22`는 지정 주소의 서브루틴을 호출합니다.

상태 명령은 대응하는 SET 명령 코드에 `0x80`을 포괄적 OR하여 만듭니다. 예를 들어 `0x88`, `0x89`, `0x8A`는 마우스 모드를 묻고, `0xF6` 헤더 뒤 mode와 네 매개변수, 두 개의 0 padding을 포함한 8바이트 패킷을 반환합니다.

마우스 모드 상태 응답
필드Relative `0x08`Absolute `0x09`Keycode `0x0A`
mode`0x08``0x09``0x0A`
param10XMSB maximumDELTA X
param20YMSB maximumDELTA Y
param30YMSB0
param40YLSB0
pad0, 00, 00, 0

상대·절대·키코드 모드에서 `mode`와 `param1`~`param4`의 의미입니다.

모든 상태 보고는 8바이트가 되도록 padding합니다. 호스트는 `0xF6` 헤더를 제거한 응답을 저장했다가 나중에 명령으로 다시 보내 `ikbd` 상태를 복원할 수 있습니다. 0 padding은 NOP로 처리됩니다.

유효한 STATUS INQUIRY
조회 코드대상
`0x87`mouse button action
`0x88`, `0x89`, `0x8A`mouse mode: relative, absolute, keycode
`0x8B`mouse threshold. 원문에는 `mnouse`로 표기
`0x8C`mouse scale
`0x8F`, `0x90`수직 좌표 원점. `0x0F`=아래, `0x10`=위
`0x92`mouse enable/disable. `0x00`=활성, `0x12`=비활성
`0x94`, `0x95`, `0x96`joystick mode
`0x9A`joystick enable/disable. `0x00`=활성, `0x1A`=비활성

원문에 열거된 조회 코드와 반환 대상을 정리합니다.

호스트 프로그래머는 응답을 받지 않은 조회를 한 번에 하나만 유지해야 합니다. JOYSTICK MONITORING 또는 FIRE BUTTON MONITORING 모드에서는 STATUS INQUIRY를 사용할 수 없습니다.

상태 저장과 복원
필요한 SET 코드에 `0x80`을 OR하여 inquiry 전송다른 미응답 inquiry 없이 `0xF6` 상태 패킷 수신헤더를 제거하고 mode·parameters·padding 저장복원이 필요할 때 저장한 바이트를 명령으로 재전송0 padding은 NOP로 소비되어 원래 상태가 복원

8바이트 상태 보고를 다시 명령으로 사용하는 절차입니다.

TIME-OF-DAY CLOCK SET
---------------------

::

    0x1B
    YY                  ; year (2 least significant digits)
    MM                  ; month
    DD                  ; day
    hh                  ; hour
    mm                  ; minute
    ss                  ; second

All time-of-day data should be sent to the ikbd in packed BCD format.
Any digit that is not a valid BCD digit should be treated as a 'don't care'
and not alter that particular field of the date or time. This permits setting
only some subfields of the time-of-day clock.

INTERROGATE TIME-OF-DAT CLOCK
-----------------------------

::

    0x1C
    Returns:
            0xFC        ; time-of-day event header
            YY          ; year (2 least significant digits)
            MM          ; month
            DD          ; day
            hh          ; hour
            mm          ; minute
            ss          ; second

    All time-of-day is sent in packed BCD format.

MEMORY LOAD
-----------

::

    0x20
    ADRMSB              ; address in controller
    ADRLSB              ; memory to be loaded
    NUM                 ; number of bytes (0-128)
    { data }

This command permits the host to load arbitrary values into the ikbd
controller memory. The time between data bytes must be less than 20ms.

MEMORY READ
-----------

::

    0x21
    ADRMSB              ; address in controller
    ADRLSB              ; memory to be read
    Returns:
            0xF6        ; status header
            0x20        ; memory access
            { data }    ; 6 data bytes starting at ADR

This command permits the host to read from the ikbd controller memory.

CONTROLLER EXECUTE
------------------

::

    0x22
    ADRMSB              ; address of subroutine in
    ADRLSB              ; controller memory to be called

This command allows the host to command the execution of a subroutine in the
ikbd controller memory.

STATUS INQUIRIES
----------------

::

    Status commands are formed by inclusively ORing 0x80 with the
    relevant SET command.

    Example:
    0x88 (or 0x89 or 0x8A)  ; request mouse mode
    Returns:
            0xF6        ; status response header
            mode        ; 0x08 is RELATIVE
                        ; 0x09 is ABSOLUTE
                        ; 0x0A is KEYCODE
            param1      ; 0 is RELATIVE
                        ; XMSB maximum if ABSOLUTE
                        ; DELTA X is KEYCODE
            param2      ; 0 is RELATIVE
                        ; YMSB maximum if ABSOLUTE
                        ; DELTA Y is KEYCODE
            param3      ; 0 if RELATIVE
                        ; or KEYCODE
                        ; YMSB is ABSOLUTE
            param4      ; 0 if RELATIVE
                        ; or KEYCODE
                        ; YLSB is ABSOLUTE
            0           ; pad
            0

The STATUS INQUIRY commands request the ikbd to return either the current mode
or the parameters associated with a given command. All status reports are
padded to form 8 byte long return packets. The responses to the status
requests are designed so that the host may store them away (after stripping
off the status report header byte) and later send them back as commands to
ikbd to restore its state. The 0 pad bytes will be treated as NOPs by the
ikbd.

    Valid STATUS INQUIRY commands are::

            0x87    mouse button action
            0x88    mouse mode
            0x89
            0x8A
            0x8B    mnouse threshold
            0x8C    mouse scale
            0x8F    mouse vertical coordinates
            0x90    ( returns       0x0F Y=0 at bottom
                            0x10 Y=0 at top )
            0x92    mouse enable/disable
                    ( returns       0x00 enabled)
                            0x12 disabled )
            0x94    joystick mode
            0x95
            0x96
            0x9A    joystick enable/disable
                    ( returns       0x00 enabled
                            0x1A disabled )

It is the (host) programmer's responsibility to have only one unanswered
inquiry in process at a time.
STATUS INQUIRY commands are not valid if the ikbd is in JOYSTICK MONITORING
mode or FIRE BUTTON MONITORING mode.

GSX 표준 키보드 스캔 코드

703-820

`ikbd`가 반환하는 키 스캔 코드는 GSX 구현을 단순하게 만들도록 선택되었습니다. 다음 표는 원문의 `Hex`와 `Keytop` 항목을 모두 보존하고 각 키의 의미를 덧붙입니다. 표에 없는 `0x55`~`0x5E`는 원문에서도 정의하지 않습니다.

GSX 표준 키보드 매핑
Hex원문 Keytop한국어 의미
01EscEscape
021숫자 1
032숫자 2
043숫자 3
054숫자 4
065숫자 5
076숫자 6
087숫자 7
098숫자 8
0A9숫자 9
0B0숫자 0
0C\-빼기 기호
0D\=등호
0EBSBackspace
0FTABTab
10QQ
11WW
12EE
13RR
14TT
15YY
16UU
17II
18OO
19PP
1A[왼쪽 대괄호
1B]오른쪽 대괄호
1CRETReturn
1DCTRLControl
1EAA
1FSS
20DD
21FF
22GG
23HH
24JJ
25KK
26LL
27;세미콜론
28'작은따옴표
29\`백틱
2A(LEFT) SHIFT왼쪽 Shift
2B\\백슬래시
2CZZ
2DXX
2ECC
2FVV
30BB
31NN
32MM
33,쉼표
34.마침표
35/슬래시
36(RIGHT) SHIFT오른쪽 Shift
37{ NOT USED }사용하지 않음
38ALTAlt
39SPACE BARSpace
3ACAPS LOCKCaps Lock
3BF1기능 키 F1
3CF2기능 키 F2
3DF3기능 키 F3
3EF4기능 키 F4
3FF5기능 키 F5
40F6기능 키 F6
41F7기능 키 F7
42F8기능 키 F8
43F9기능 키 F9
44F10기능 키 F10
45{ NOT USED }사용하지 않음
46{ NOT USED }사용하지 않음
47HOMEHome
48UP ARROW위쪽 화살표
49{ NOT USED }사용하지 않음
4AKEYPAD -키패드 빼기
4BLEFT ARROW왼쪽 화살표
4C{ NOT USED }사용하지 않음
4DRIGHT ARROW오른쪽 화살표
4EKEYPAD +키패드 더하기
4F{ NOT USED }사용하지 않음
50DOWN ARROW아래쪽 화살표
51{ NOT USED }사용하지 않음
52INSERTInsert
53DELDelete
54{ NOT USED }사용하지 않음
5F{ NOT USED }사용하지 않음
60ISO KEYISO 키 위치
61UNDOUndo
62HELPHelp
63KEYPAD (키패드 왼쪽 괄호
64KEYPAD /키패드 나누기
65KEYPAD *키패드 곱하기
66KEYPAD *키패드 곱하기. 원문 중복 표기
67KEYPAD 7키패드 7
68KEYPAD 8키패드 8
69KEYPAD 9키패드 9
6AKEYPAD 4키패드 4
6BKEYPAD 5키패드 5
6CKEYPAD 6키패드 6
6DKEYPAD 1키패드 1
6EKEYPAD 2키패드 2
6FKEYPAD 3키패드 3
70KEYPAD 0키패드 0
71KEYPAD .키패드 소수점
72KEYPAD ENTER키패드 Enter

원문에 수록된 104개 스캔 코드 행 전체입니다.

`0x37`, `0x45`, `0x46`, `0x49`, `0x4C`, `0x4F`, `0x51`, `0x54`, `0x5F`는 사용하지 않는 위치로 명시됩니다. `0x60`은 ISO 키 위치이며 `0x61`과 `0x62`는 각각 UNDO와 HELP입니다. 원문은 `0x65`와 `0x66`을 모두 `KEYPAD *`로 적고 있으므로 중복을 그대로 유지합니다.

스캔 코드 해석
`0x01`~`0x72`의 정의된 값이면 make code로 해석make code에 `0x80`이 더해진 값이면 해당 키의 break로 해석왼쪽·오른쪽 Shift와 RET·KEYPAD ENTER를 각각 구별정의되지 않거나 NOT USED 위치는 일반 키로 매핑하지 않음`0xF6`~`0xFF`는 상태·마우스·시각·조이스틱 보고 헤더로 분기

호스트가 수신 바이트를 키 이벤트와 특수 보고로 구분하는 기준입니다.



SCAN CODES
==========

The key scan codes returned by the ikbd are chosen to simplify the
implementation of GSX.

GSX Standard Keyboard Mapping

======= ============
Hex        Keytop
======= ============
01        Esc
02        1
03        2
04        3
05        4
06        5
07        6
08        7
09        8
0A        9
0B        0
0C        \-
0D        \=
0E        BS
0F        TAB
10        Q
11        W
12        E
13        R
14        T
15        Y
16        U
17        I
18        O
19        P
1A        [
1B        ]
1C        RET
1D        CTRL
1E        A
1F        S
20        D
21        F
22        G
23        H
24        J
25        K
26        L
27        ;
28        '
29        \`
2A        (LEFT) SHIFT
2B        \\
2C        Z
2D        X
2E        C
2F        V
30        B
31        N
32        M
33        ,
34        .
35        /
36        (RIGHT) SHIFT
37        { NOT USED }
38        ALT
39        SPACE BAR
3A        CAPS LOCK
3B        F1
3C        F2
3D        F3
3E        F4
3F        F5
40        F6
41        F7
42        F8
43        F9
44        F10
45        { NOT USED }
46        { NOT USED }
47        HOME
48        UP ARROW
49        { NOT USED }
4A        KEYPAD -
4B        LEFT ARROW
4C        { NOT USED }
4D        RIGHT ARROW
4E        KEYPAD +
4F        { NOT USED }
50        DOWN ARROW
51        { NOT USED }
52        INSERT
53        DEL
54        { NOT USED }
5F        { NOT USED }
60        ISO KEY
61        UNDO
62        HELP
63        KEYPAD (
64        KEYPAD /
65        KEYPAD *
66        KEYPAD *
67        KEYPAD 7
68        KEYPAD 8
69        KEYPAD 9
6A        KEYPAD 4
6B        KEYPAD 5
6C        KEYPAD 6
6D        KEYPAD 1
6E        KEYPAD 2
6F        KEYPAD 3
70        KEYPAD 0
71        KEYPAD .
72        KEYPAD ENTER
======= ============