main.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #include "data.h";
  2. #include "pad.h";
  3. #include "event.h";
  4. #include "myEvents.h";
  5. #include "ressource.h";
  6. #include "PPU.h"
  7. #include "debug.h"
  8. #include "crc.h"
  9. #include <stdlib.h>
  10. padStatus pad1;
  11. void initInternalRegisters(void) {
  12. characterLocation[0] = 0x0000;
  13. characterLocation[1] = 0x0000;
  14. characterLocation[2] = 0x0000;
  15. characterLocation[3] = 0x0000;
  16. initDebugMap();
  17. }
  18. void preInit(void) {
  19. // For testing purpose ...
  20. // Insert code here to be executed before register init
  21. }
  22. void main(void) {
  23. word i,j;
  24. word crc01;
  25. word crc02;
  26. padStatus pad1; //012345678901234567890123456789012
  27. char line_header[32] = "BANK ADDR VAL 123456789ABCDEF";
  28. char line[32] = " ";
  29. char space;
  30. unsigned long addr;
  31. initInternalRegisters();
  32. *(byte*) 0x2105 = 0x01; // MODE 1 value
  33. *(byte*) 0x212c = 0x01; // Plane 0 (bit one) enable register
  34. *(byte*) 0x212d = 0x00; // All subPlane disable
  35. *(byte*) 0x2100 = 0x0f; // enable background
  36. enablePad();
  37. enableDebugScreen();
  38. writeln(line_header,0);
  39. while(1){
  40. addr = 0x018000;
  41. for(j=1; j<16; j++) {
  42. int2hex((unsigned long)j,&line[0],4);
  43. int2hex((unsigned long)addr,&line[5],6);
  44. int2hex((unsigned long)*(byte*)addr,&line[12],4);
  45. writeln(line,j+1);
  46. addr+= 0x010000;
  47. pad1 = readPad((byte) 0);
  48. while(!pad1.start) {
  49. //waitForVBlank();
  50. pad1 = readPad((byte) 0);
  51. }
  52. }
  53. }
  54. while(1);
  55. }
  56. void IRQHandler(void) {
  57. }
  58. void NMIHandler(void) {
  59. //processEvents();
  60. }