1
0

TEST.C 818 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #define word char
  2. #include "LIB/MATH.C"
  3. #include "LIB/STDLIB.C"
  4. #include "LIB/SYS.C"
  5. int main()
  6. {
  7. BDOS_PrintConsole("Running user program\n");
  8. while (1)
  9. {
  10. if (HID_FifoAvailable())
  11. {
  12. word c = HID_FifoRead();
  13. if (c == 27) // escape
  14. {
  15. return 'q';
  16. }
  17. if (c < 255)
  18. {
  19. BDOS_PrintcConsole(c);
  20. }
  21. }
  22. }
  23. return 'q';
  24. }
  25. void interrupt()
  26. {
  27. // handle all interrupts
  28. word i = getIntID();
  29. switch(i)
  30. {
  31. case INTID_TIMER1:
  32. timer1Value = 1; // notify ending of timer1
  33. break;
  34. case INTID_TIMER2:
  35. break;
  36. case INTID_UART0:
  37. break;
  38. case INTID_GPU:
  39. break;
  40. case INTID_TIMER3:
  41. break;
  42. case INTID_PS2:
  43. break;
  44. case INTID_UART1:
  45. break;
  46. case INTID_UART2:
  47. break;
  48. }
  49. }