USB-KEYBOARD-TO-SNES BRIDGE: SUPPORTED KEYSTROKES ================================================== Each keystroke is encoded as a single byte and transmitted in one SNES poll frame with D-pad DOWN held (frame marker) plus the 8 face/shoulder buttons carrying the byte's bits (LSB at B, MSB at R). Byte ranges: 0x00 reserved (never sent) 0x01 - 0x7F ASCII (printable + standard controls) 0x80 - 0xFF extended keys (no ASCII equivalent) PRINTABLE ASCII --------------- Letters (US layout, Shift composes uppercase): Key Unshifted Shifted ---- --------- ------- a 0x61 a 0x41 A b 0x62 b 0x42 B c 0x63 c 0x43 C d 0x64 d 0x44 D e 0x65 e 0x45 E f 0x66 f 0x46 F g 0x67 g 0x47 G h 0x68 h 0x48 H i 0x69 i 0x49 I j 0x6A j 0x4A J k 0x6B k 0x4B K l 0x6C l 0x4C L m 0x6D m 0x4D M n 0x6E n 0x4E N o 0x6F o 0x4F O p 0x70 p 0x50 P q 0x71 q 0x51 Q r 0x72 r 0x52 R s 0x73 s 0x53 S t 0x74 t 0x54 T u 0x75 u 0x55 U v 0x76 v 0x56 V w 0x77 w 0x57 W x 0x78 x 0x58 X y 0x79 y 0x59 Y z 0x7A z 0x5A Z Digit row: Key Unshifted Shifted ---- --------- ------- 1 0x31 1 0x21 ! 2 0x32 2 0x40 @ 3 0x33 3 0x23 # 4 0x34 4 0x24 $ 5 0x35 5 0x25 % 6 0x36 6 0x5E ^ 7 0x37 7 0x26 & 8 0x38 8 0x2A * 9 0x39 9 0x28 ( 0 0x30 0 0x29 ) Punctuation: Key Unshifted Shifted ---- --------- ------- - 0x2D - 0x5F _ = 0x3D = 0x2B + [ 0x5B [ 0x7B { ] 0x5D ] 0x7D } \ 0x5C \ 0x7C | ; 0x3B ; 0x3A : ' 0x27 ' 0x22 " ` 0x60 ` 0x7E ~ , 0x2C , 0x3C < . 0x2E . 0x3E > / 0x2F / 0x3F ? Space: Space 0x20 ' ' STANDARD CONTROL CODES ---------------------- Key Byte ---- ---- Enter 0x0D (CR, '\r') Escape 0x1B (ESC) Backspace 0x08 (BS, '\b') Tab 0x09 (HT, '\t') Delete 0x7F (DEL) EXTENDED KEYS (no ASCII equivalent) ----------------------------------- Arrow keys: Key Byte ---- ---- Up Arrow 0x80 Down Arrow 0x81 Left Arrow 0x82 Right Arrow 0x83 Navigation: Key Byte ---- ---- Home 0x84 End 0x85 Page Up 0x86 Page Down 0x87 Insert 0x88 Print Screen 0x89 Pause / Break 0x8A Function keys: Key Byte ---- ---- F1 0x90 F2 0x91 F3 0x92 F4 0x93 F5 0x94 F6 0x95 F7 0x96 F8 0x97 F9 0x98 F10 0x99 F11 0x9A F12 0x9B UNSUPPORTED / NOT MAPPED ------------------------ These keys are recognized by the USB host but produce no byte on the wire. Either no obvious semantic or deferred for later. Caps Lock (state toggle, would need internal tracking) Scroll Lock Num Lock Numeric keypad (0-9, +, -, *, /, Enter, .) Non-US '#' / '~' (ISO-layout-only key) All modifier keys when pressed alone (Shift, Ctrl, Alt, GUI/Win/Cmd -- they only act as composers on top of other keys) WIRE PROTOCOL NOTES ------------------- Idle frame: no DOWN pressed, no buttons pressed. Data frame: DOWN pressed + byte encoded in 8 buttons. Hold/gap: each byte is held on the wire for ~17 ms (1 frame at 60 Hz) and followed by ~17 ms of idle, so consecutive identical bytes are distinguishable. Autorepeat: initial delay 500 ms, then ~30 bytes/sec while held. Bit layout of the payload byte on the wire: payload bit SNES button ----------- ----------- 0 (LSB) B 1 Y 2 Select 3 Start 4 A 5 X 6 L 7 (MSB) R D-pad LEFT, RIGHT, UP are reserved for future opcode/framing use.