myEvents.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. static byte fadeOutValue;
  8. if(counter == 0) {
  9. // init fade value
  10. fadeOutValue = 0x0f;
  11. } else {
  12. fadeOutValue--;
  13. }
  14. *(byte*) 0x2100 = fadeOutValue;
  15. if(fadeOutValue == 0x00) {
  16. return EVENT_STOP;
  17. } else {
  18. return EVENT_CONTINUE;
  19. }
  20. }
  21. char fadeIn(word counter) {
  22. static byte fadeInValue;
  23. if(counter == 0) {
  24. // init fade value
  25. fadeInValue = 0x00;
  26. } else {
  27. fadeInValue++;
  28. }
  29. *(byte*) 0x2100 = fadeInValue;
  30. if(fadeInValue >= 0x0f) {
  31. return EVENT_STOP;
  32. } else {
  33. return EVENT_CONTINUE;
  34. }
  35. }
  36. char mosaicOut(word counter) {
  37. static byte mosaicOutValue;
  38. if(counter == 0) {
  39. // init fade value
  40. mosaicOutValue = 0xff;
  41. } else {
  42. mosaicOutValue -= 0x10;
  43. }
  44. *(byte*) 0x2106 = mosaicOutValue;
  45. if(mosaicOutValue == 0x0f) {
  46. return EVENT_STOP;
  47. } else {
  48. return EVENT_CONTINUE;
  49. }
  50. }
  51. char mosaicIn(word counter) {
  52. static byte mosaicInValue;
  53. if(counter == 0) {
  54. // init fade value
  55. mosaicInValue = 0x0f;
  56. } else {
  57. mosaicInValue += 0x10;
  58. }
  59. *(byte*) 0x2106 = mosaicInValue;
  60. if(mosaicInValue == 0xff) {
  61. return EVENT_STOP;
  62. } else {
  63. return EVENT_CONTINUE;
  64. }
  65. }
  66. char NMIReadPad(word counter) {
  67. pad1 = readPad((byte) 0);
  68. return EVENT_CONTINUE;
  69. }
  70. char scrollLeft(word counter) {
  71. scrollValue++;
  72. *(byte*) 0x210d = (byte) scrollValue;
  73. *(byte*) 0x210d = (byte) (scrollValue>>8);
  74. return EVENT_CONTINUE;
  75. }