spectrum.ino 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include <SPI.h>
  2. #include <GD.h>
  3. #include "spectrum.h"
  4. #include "spectrum_data.h"
  5. void setup()
  6. {
  7. GD.begin();
  8. GD.microcode(spectrum_code, sizeof(spectrum_code));
  9. GD.uncompress(0x7000, spectrum_tables);
  10. // fill screen with TRANSPARENT
  11. GD.fill(RAM_PIC, 0xff, 64 * 64);
  12. GD.wr16(RAM_PAL + 8 * 255, TRANSPARENT);
  13. GD.wr16(BG_COLOR, RGB(128, 0, 0)); // dark red border
  14. // paint the 256x192 window as alternating lines of
  15. // chars 0-31 and 32-63
  16. for (byte y = 0; y < 24; y += 2) {
  17. for (byte x = 0; x < 32; x++) {
  18. GD.wr(RAM_PIC + 64 * (y + 6) + (9 + x), x);
  19. GD.wr(RAM_PIC + 64 * (y + 7) + (9 + x), 32 + x);
  20. }
  21. }
  22. // Slow things down for a proper loading-from-tape look
  23. SPI.setClockDivider(SPI_CLOCK_DIV128);
  24. }
  25. static void pause()
  26. {
  27. delay(3000);
  28. GD.fill(0x4000, 0x00, 32 * 192);
  29. GD.fill(0x5800, 0x07, 3 * 256);
  30. }
  31. void loop()
  32. {
  33. GD.uncompress(0x4000, screen_mm1); pause();
  34. GD.uncompress(0x4000, screen_mm2); pause();
  35. GD.uncompress(0x4000, screen_aa0); pause();
  36. GD.uncompress(0x4000, screen_aa1); pause();
  37. GD.uncompress(0x4000, screen_jp0); pause();
  38. GD.uncompress(0x4000, screen_jp1); pause();
  39. GD.uncompress(0x4000, screen_kl0); pause();
  40. GD.uncompress(0x4000, screen_kl1); pause();
  41. }