bgstripes.fs 725 B

1234567891011121314151617181920212223242526272829303132
  1. start-microcode bgstripes
  2. \ renders a 64-line horizontal stripe in the BG_COLOR
  3. \ starting at line COMM+0
  4. \ Interface:
  5. \ COMM+0 stripe start
  6. \ 3E80-3EFF 64 color stripe
  7. : 1+ d# 1 + ;
  8. : - invert 1+ + ;
  9. : 0= d# 0 = ;
  10. : @ dup c@ swap 1+ c@ swab or ;
  11. : ! over swab over 1+ c! c! ;
  12. : 2dup over over ;
  13. : min 2dup < ;fallthru
  14. : ?: ( xt xf flag -- xt | xf) \ if flag xt, else xf
  15. if drop else nip then ;
  16. : max 2dup swap < ?: ;
  17. : main
  18. begin
  19. YLINE c@ \ line COMM+0 is line zero
  20. COMM+0 c@ -
  21. d# 0 max d# 63 min \ clamp to 0-63
  22. d# 2 * h# 3E80 + \ index into color table
  23. @ BG_COLOR ! \ fetch and write
  24. again
  25. ;
  26. end-microcode