Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.6KB

  1. # The Grid subsystem
  2. The grid subsystem at B401 supplies a set of words on top of
  3. the Grid protocol (see doc/protocol.txt) that facilitates the
  4. development of programs presenting a complex text interface,
  5. for example, the Visual Editor.
  6. It create the concept of a cursor, always being a some position
  7. on screen. That position is in the variable XYPOS, which is a
  8. simple integer following the same "pos" logic as in the Grid
  9. protocol.
  10. It implements (emit), which sets the cell under the cursor to
  11. the specified character, then moves the cursor right. If the
  12. cursor is at the last column of the screen, it overflows to the
  13. next line. If it's on the last line, it overflows to the first
  14. line.
  15. Grid's (emit) handles 0xd by moving the cursor to the next line
  16. and 0x8 by moving the cursor left.
  17. AT-XY ( x y -- ) moves the cursor to the specified position. It
  18. is equivalent to setting XYPOS directly, but uses separate X
  19. and y numbers.
  20. When the grid's cursor enters a new line, it clears its
  21. contents through a repeated call to CELL!. That implementation
  22. is in its world named NEWLN ( ln -- ). This word can be over-
  23. ridden. If it exists when the grid subsystem is loaded, the ex-
  24. isting NEWLN will be used.
  25. The clearing of the newly entered line is usually only desirable
  26. when in "shell" mode. In "graphical" mode, we usually don't
  27. want this to happen. XYMODE is a flag to indicate whether the
  28. grid system is in "graphical" mode. When its value is nonzero,
  29. NEWLN is not called when entering a new line.
  30. At build time, the Grid subsystem needs 3 bytes of system me-
  31. mory through the GRID_MEM constant. At run time, GRID$ needs to
  32. be called to initialize the system.