Mirror of CollapseOS
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

72 wiersze
2.3KB

  1. # Protocols
  2. Some subsystems (and in the case of KEY and EMIT, the core) re-
  3. quire drivers to implement certain words in a certain way. For
  4. example, the core requires drivers to implement (key) and (emit)
  5. or else it won't know how to provide a console.
  6. These protocols are described here.
  7. # TTY protocol
  8. (key) -- c Returns the next typed key on the console.
  9. If none, block until there is one.
  10. (emit) c -- Spit a character on the console.
  11. # PS/2 protocol
  12. This protocol enables communication with a device that spits
  13. PS/2 keycodes.
  14. (ps2kc) -- kc Returns the next typed PS/2 keycode from the
  15. console. Blocking.
  16. # SPI Relay protocol
  17. This protocol enables communication with a SPI relay. This
  18. protocol is designed to support devices with multiple endpoints.
  19. To that end, (spie) takes a device ID argument, with a meaning
  20. that is up to the device itself. To disable all devices, supply
  21. 0 to (spie).
  22. We expect relay devices to support only one enabled device at
  23. once. Enabling a specific device is expected to disable the
  24. previously enabled one.
  25. (spie) n -- Enable SPI device
  26. (spix) n -- n Perform SPI exchange (push a number, get a
  27. number back)
  28. # Grid protocol
  29. A grid is a device that shows as a grid of ASCII characters and
  30. allows random access to it.
  31. COLS -- n Number of columns in the device
  32. LINES -- n Number of lines in the device
  33. CELL! g pos -- Set glyph at pos
  34. Optional:
  35. NEWLN ln -- "Enter" line ln
  36. "pos" is a simple number (y * cols) + x. For example, if we
  37. have 40 columns per line, the position (x, y) (12, 10) is 412.
  38. A glyph is ASCII-0x20. If the resulting glyph number exceeds the
  39. number of glyphs in the font, it's up to CELL! to ignore it.
  40. Glyph 0 is always blank.
  41. NEWLN is called when we "enter" a new line, that is, when we
  42. overflow from previous line or when 0x0d ( ASCII CR ) is emit-
  43. ted.
  44. When this is called, the line being entered should be cleared
  45. of its contents. On some systems, some kinf of screen offset
  46. might be have to be set to give a "scrolling" effect. Now's the
  47. time.
  48. If it's not defined, the grid system uses multiple CELL!
  49. calls to clear it. On some devices, this is highly inefficient.
  50. Drivers for those devices should define NEWLINE.