Mirror of CollapseOS
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

63 行
2.0KB

  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. CLRLN ln -- Clear line number 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. If CLRLN is not defined, the grid system uses multiple CELL!
  42. calls to clear it. On some devices, this is highly inefficient.
  43. Drivers for those devices should define CLRLN.