PageRenderTime 60ms CodeModel.GetById 29ms RepoModel.GetById 1ms app.codeStats 0ms

/sys/boot/forth/screen.4th

https://github.com/oza/FreeBSD-8.0-dyntick
Forth | 36 lines | 27 code | 9 blank | 0 comment | 0 complexity | 5dc1f7695083adf327201c8c4c078fc1 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, 0BSD, BSD-3-Clause
  1. \ Screen manipulation related words.
  2. \ $FreeBSD: src/sys/boot/forth/screen.4th,v 1.1.34.1.2.1 2009/10/25 01:10:29 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. ;