/sys/boot/forth/screen.4th

https://bitbucket.org/iorivur/freebsd-bhyve-with-suspend-resume · Forth · 36 lines · 27 code · 9 blank · 0 comment · 0 complexity · 14d6e76af7c43b68146696abbb4f401e MD5 · raw file

  1. \ Screen manipulation related words.
  2. \ $FreeBSD: head/sys/boot/forth/screen.4th 115410 2003-05-30 09:29:24Z scottl $
  3. marker task-screen.4th
  4. : escc ( -- ) \ emit Esc-[
  5. 91 27 emit emit
  6. ;
  7. : ho ( -- ) \ Home cursor
  8. escc 72 emit \ Esc-[H
  9. ;
  10. : cld ( -- ) \ Clear from current position to end of display
  11. escc 74 emit \ Esc-[J
  12. ;
  13. : clear ( -- ) \ clear screen
  14. ho cld
  15. ;
  16. : at-xy ( x y -- ) \ move cursor to x rows, y cols (1-based coords)
  17. escc .# 59 emit .# 72 emit \ Esc-[%d;%dH
  18. ;
  19. : fg ( x -- ) \ Set foreground color
  20. escc 3 .# .# 109 emit \ Esc-[3%dm
  21. ;
  22. : bg ( x -- ) \ Set background color
  23. escc 4 .# .# 109 emit \ Esc-[4%dm
  24. ;
  25. : me ( -- ) \ Mode end (clear attributes)
  26. escc 109 emit
  27. ;