rasterinterrupt.fs 729 B

12345678910111213141516171819202122232425
  1. start-microcode rasterinterrupt
  2. : 1+ d# 1 + ;
  3. : @ dup c@ swap 1+ c@ swab or ;
  4. \ COMM+0 holds the 16 bit raster line number:
  5. \ 0 is first line of screen
  6. \ 299 is last visible line of screen
  7. \ 300 is beginning of vertical blanking
  8. \
  9. \ This microprogram loop raises P2 when the raster is below line COMM+0,
  10. \ so the Arduino can trigger an interrupt
  11. : main
  12. d# 0 P2_DIR c! \ Make P2 an output
  13. \ Drive P2 high when raster is past line COMM+0
  14. begin
  15. COMM+0 @ \ user value
  16. YLINE c@ \ hardware line
  17. < \ true when hardware line is below user value
  18. P2_V c! \ write bool to P2
  19. again
  20. ;
  21. end-microcode