setpixel.fs 619 B

12345678910111213141516171819202122232425262728293031
  1. start-microcode setpixel
  2. : setpixel ( yx -- ) \ set pixel yx to color from COMM+2, about 35 cycles
  3. dup>r
  4. h# f and
  5. r@ d# 4 rshift h# 0ff0 and or
  6. r@ h# 30 and swab or
  7. RAM_SPRIMG or ( addr )
  8. dupc@ ( addr v )
  9. h# c0 r> d# 5 rshift h# 6 and rshift dup>r \ mask in R
  10. invert and r> COMM+2 c@ and or
  11. swap c!
  12. ;
  13. : main
  14. begin
  15. \ wait until command reg is nonzero
  16. begin
  17. COMM+2 c@
  18. until
  19. \ 0 is X, 1 is Y
  20. COMM+0 c@ COMM+1 c@ swab or
  21. setpixel
  22. \ tell host we're done
  23. d# 0 COMM+2 c!
  24. again
  25. ;
  26. end-microcode