# MIPS Input controller

[MIPS Documentation](https://asm-editor.specy.app/documentation/mips.md)

Web page: https://asm-editor.specy.app/documentation/mips/input-controller

Read held keys, key presses and releases, mouse buttons, pointer position and wheel events through memory registers.

13 entries, each with its own page of markdown:

- [What the Input controller is](https://asm-editor.specy.app/documentation/mips/input-controller/what-the-input-controller-is.md): The Input controller reports key presses and releases, held keys, mouse buttons, pointer position and wheel turns.
- [A first program](https://asm-editor.specy.app/documentation/mips/input-controller/first-program.md): This program prints a letter for each arrow key you press, R, L, D or U, and ends when you press Escape.
- [The registers](https://asm-editor.specy.app/documentation/mips/input-controller/registers.md): Offsets below are from 0xffff0300.
- [Events](https://asm-editor.specy.app/documentation/mips/input-controller/events.md): Key presses, repeats and releases, mouse button presses and releases, and wheel turns produce events, one word each.
- [Keys held now](https://asm-editor.specy.app/documentation/mips/input-controller/key-state.md): From offset 0x20, 32 bytes hold one bit per key code.
- [The pointer](https://asm-editor.specy.app/documentation/mips/input-controller/pointer.md): The Pointer word holds y in bits 30–21, x in bits 20–11, and held buttons in bits 2–0: bit 0 left, bit 1 right and bit 2 middle.
- [Waiting for input](https://asm-editor.specy.app/documentation/mips/input-controller/waiting.md): To wait for input, sleep for a few milliseconds with service 32, then read Status again, as the first program does.
- [When the queue is full](https://asm-editor.specy.app/documentation/mips/input-controller/full-queue.md): The normal queue holds 64 events, including any dropped markers.
- [Typed characters and keys](https://asm-editor.specy.app/documentation/mips/input-controller/typed-characters.md): A press that produces a character feeds both the keyboard registers at 0xffff0000 and the Input controller.
- [When the Input controller hears nothing](https://asm-editor.specy.app/documentation/mips/input-controller/hears-nothing.md): Before the program starts and after it ends.
- [Undo](https://asm-editor.specy.app/documentation/mips/input-controller/undo.md): Undo restores events removed by the instruction being undone, at the front of the queue and in their original order.
- [From C](https://asm-editor.specy.app/documentation/mips/input-controller/from-c.md): names the Input controller's registers, the parts of an event and every key: Registers: SIM_INPUT_ID, SIM_INPUT_CONTROL, SIM_INPUT_STATUS, SIM_INPUT_EVENT and…
- [Key codes](https://asm-editor.specy.app/documentation/mips/input-controller/key-codes.md): Each key is named after the browser's name for it, written in capitals with underscores: ArrowLeft is SIM_KEY_ARROW_LEFT in C.
