1
0

COLORS.C 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // Prints some rgb colors for testing purposes
  2. #define word char
  3. #include "LIB/MATH.C"
  4. #include "LIB/STDLIB.C"
  5. #include "LIB/SYS.C"
  6. #include "LIB/GFX.C"
  7. #include "DATA/COLOR.C"
  8. #define DATA_OFFSET 3
  9. void testTiles()
  10. {
  11. asm(".dw 0 1 2 3\n");
  12. }
  13. int main()
  14. {
  15. GFX_initVram(); // clear all VRAM
  16. GFX_copyPaletteTable((word)DATA_PALETTE_COLOR);
  17. GFX_copyPatternTable((word)DATA_PATTERN_COLOR);
  18. word y = 0;
  19. word c = 1;
  20. word x;
  21. for (x = 0; x < 5; x++)
  22. {
  23. GFX_printWindowColored(((word)testTiles) + DATA_OFFSET, 4, GFX_WindowPosFromXY(x*4, y), x + 1);
  24. GFX_printBGColored(((word)testTiles) + DATA_OFFSET, 4, GFX_BackgroundPosFromXY(x*4, y+2), x + 1);
  25. }
  26. // Any key to quit
  27. while (1)
  28. {
  29. if (HID_FifoAvailable())
  30. {
  31. word c = HID_FifoRead();
  32. return 'q';
  33. }
  34. }
  35. return 'q';
  36. }
  37. void interrupt()
  38. {
  39. // handle all interrupts
  40. word i = getIntID();
  41. switch(i)
  42. {
  43. case INTID_TIMER1:
  44. timer1Value = 1; // notify ending of timer1
  45. break;
  46. case INTID_TIMER2:
  47. break;
  48. case INTID_UART0:
  49. break;
  50. case INTID_GPU:
  51. break;
  52. case INTID_TIMER3:
  53. break;
  54. case INTID_PS2:
  55. break;
  56. case INTID_UART1:
  57. break;
  58. case INTID_UART2:
  59. break;
  60. }
  61. }