PageRenderTime 26ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/sys/boot/forth/screen.4th

https://github.com/oza/FreeBSD-7.3-dyntick
Forth | 36 lines | 27 code | 9 blank | 0 comment | 0 complexity | 18013a9c3d09ea621412cb0fcbf35b7b MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. \ Screen manipulation related words.
  2. \ $FreeBSD: src/sys/boot/forth/screen.4th,v 1.1.36.1 2010/02/10 00:26:20 kensmith Exp $
  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. ;