PageRenderTime 46ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/freebsd5/sys/boot/forth/screen.4th

https://github.com/kame/kame
Forth | 36 lines | 27 code | 9 blank | 0 comment | 0 complexity | 3e712aef0c545ed67adb891ad6523068 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. \ Screen manipulation related words.
  2. \ $FreeBSD: src/sys/boot/forth/screen.4th,v 1.1 2003/05/30 09:29:23 scottl 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. ;