in_keyboard.S 846 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. Whenever you press a key up or down,
  3. the keyboard hex scancode is printed to the screen.
  4. Only changes in state are shown.
  5. Scancode tables: TODO: official specs?
  6. - http://flint.cs.yale.edu/cs422/doc/art-of-asm/pdf/APNDXC.PDF
  7. - https://en.wikipedia.org/wiki/Scancode
  8. TODO Where does the 0x60 come from?
  9. - http://wiki.osdev.org/I/O_Ports
  10. - http://stackoverflow.com/questions/14194798/is-there-a-specification-of-x86-i-o-port-assignment
  11. TODO Possible to do this with the interrupt table instead of `in`?
  12. TODO understand http://wiki.osdev.org/PS2_Keyboard
  13. */
  14. #include "common.h"
  15. BEGIN
  16. CLEAR
  17. /* TODO why CLI makes no difference? We are not using interrupts? */
  18. /*cli*/
  19. loop:
  20. /* Store the scancode to al. */
  21. in $0x60, %al
  22. cmp %al, %cl
  23. jz loop
  24. mov %al, %cl
  25. PRINT_HEX(%al)
  26. PRINT_NEWLINE
  27. jmp loop
  28. END