myEvents.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #include "data.h";
  2. #include "pad.h";
  3. #include "event.h";
  4. extern padStatus pad1;
  5. extern word scrollValue;
  6. char fadeOut(word counter)
  7. {
  8. static byte fadeOutValue;
  9. if (counter == 0) {
  10. // init fade value
  11. fadeOutValue = 0x0f;
  12. } else {
  13. fadeOutValue--;
  14. }
  15. *(byte *) 0x2100 = fadeOutValue;
  16. if (fadeOutValue == 0x00) {
  17. return EVENT_STOP;
  18. } else {
  19. return EVENT_CONTINUE;
  20. }
  21. }
  22. char fadeIn(word counter)
  23. {
  24. static byte fadeInValue;
  25. if (counter == 0) {
  26. // init fade value
  27. fadeInValue = 0x00;
  28. } else {
  29. fadeInValue++;
  30. }
  31. *(byte *) 0x2100 = fadeInValue;
  32. if (fadeInValue >= 0x0f) {
  33. return EVENT_STOP;
  34. } else {
  35. return EVENT_CONTINUE;
  36. }
  37. }
  38. char mosaicOut(word counter)
  39. {
  40. static byte mosaicOutValue;
  41. if (counter == 0) {
  42. // init fade value
  43. mosaicOutValue = 0xff;
  44. } else {
  45. mosaicOutValue -= 0x10;
  46. }
  47. *(byte *) 0x2106 = mosaicOutValue;
  48. if (mosaicOutValue == 0x0f) {
  49. return EVENT_STOP;
  50. } else {
  51. return EVENT_CONTINUE;
  52. }
  53. }
  54. char mosaicIn(word counter)
  55. {
  56. static byte mosaicInValue;
  57. if (counter == 0) {
  58. // init fade value
  59. mosaicInValue = 0x0f;
  60. } else {
  61. mosaicInValue += 0x10;
  62. }
  63. *(byte *) 0x2106 = mosaicInValue;
  64. if (mosaicInValue == 0xff) {
  65. return EVENT_STOP;
  66. } else {
  67. return EVENT_CONTINUE;
  68. }
  69. }
  70. char NMIReadPad(word counter)
  71. {
  72. pad1 = readPad((byte) 0);
  73. return EVENT_CONTINUE;
  74. }
  75. char scrollLeft(word counter)
  76. {
  77. scrollValue++;
  78. *(byte *) 0x210d = (byte) scrollValue;
  79. *(byte *) 0x210d = (byte) (scrollValue >> 8);
  80. return EVENT_CONTINUE;
  81. }