PageRenderTime 57ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://github.com/kame/kame
Forth | 90 lines | 80 code | 10 blank | 0 comment | 1 complexity | 523bb135a8ae5e6c5793ab912edb7f73 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. \ Words implementing frame drawing
  2. \ XXX Filled boxes are left as an exercise for the reader... ;-/
  3. \ $FreeBSD: src/sys/boot/forth/frames.4th,v 1.1 2003/05/30 09:29:23 scottl Exp $
  4. marker task-frames.4th
  5. variable h_el
  6. variable v_el
  7. variable lt_el
  8. variable lb_el
  9. variable rt_el
  10. variable rb_el
  11. variable fill
  12. \ Single frames
  13. 196 constant sh_el
  14. 179 constant sv_el
  15. 218 constant slt_el
  16. 192 constant slb_el
  17. 191 constant srt_el
  18. 217 constant srb_el
  19. \ Double frames
  20. 205 constant dh_el
  21. 186 constant dv_el
  22. 201 constant dlt_el
  23. 200 constant dlb_el
  24. 187 constant drt_el
  25. 188 constant drb_el
  26. \ Fillings
  27. 0 constant fill_none
  28. 32 constant fill_blank
  29. 176 constant fill_dark
  30. 177 constant fill_med
  31. 178 constant fill_bright
  32. : hline ( len x y -- ) \ Draw horizontal single line
  33. at-xy \ move cursor
  34. 0 do
  35. h_el @ emit
  36. loop
  37. ;
  38. : f_single ( -- ) \ set frames to single
  39. sh_el h_el !
  40. sv_el v_el !
  41. slt_el lt_el !
  42. slb_el lb_el !
  43. srt_el rt_el !
  44. srb_el rb_el !
  45. ;
  46. : f_double ( -- ) \ set frames to double
  47. dh_el h_el !
  48. dv_el v_el !
  49. dlt_el lt_el !
  50. dlb_el lb_el !
  51. drt_el rt_el !
  52. drb_el rb_el !
  53. ;
  54. : vline ( len x y -- ) \ Draw vertical single line
  55. 2dup 4 pick
  56. 0 do
  57. at-xy
  58. v_el @ emit
  59. 1+
  60. 2dup
  61. loop
  62. 2drop 2drop drop
  63. ;
  64. : box ( w h x y -- ) \ Draw a box
  65. 2dup 1+ 4 pick 1- -rot
  66. vline \ Draw left vert line
  67. 2dup 1+ swap 5 pick + swap 4 pick 1- -rot
  68. vline \ Draw right vert line
  69. 2dup swap 1+ swap 5 pick 1- -rot
  70. hline \ Draw top horiz line
  71. 2dup swap 1+ swap 4 pick + 5 pick 1- -rot
  72. hline \ Draw bottom horiz line
  73. 2dup at-xy lt_el @ emit \ Draw left-top corner
  74. 2dup 4 pick + at-xy lb_el @ emit \ Draw left bottom corner
  75. 2dup swap 5 pick + swap at-xy rt_el @ emit \ Draw right top corner
  76. 2 pick + swap 3 pick + swap at-xy rb_el @ emit
  77. 2drop
  78. ;
  79. f_single
  80. fill_none fill !