main.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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,y;
  24. word crc01;
  25. word crc02;
  26. padStatus pad1;
  27. char line_header[32] = "BANK CRC ADDR 123456789ABCDEF";
  28. char line[32] = " ";
  29. char test_buffer[] = "da";
  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. enableDebugScreen();
  37. writeln(line_header,0);
  38. while(1){
  39. addr = 0x008000;
  40. crc02 = crc_update(test_buffer,2);
  41. y = 0;
  42. for(j=0; j<32; j++) {
  43. crc01 = crc_update_mem(addr,0x8000);
  44. int2hex((unsigned long)j,&line[0],4);
  45. int2hex((unsigned long)crc01,&line[5],4);
  46. int2hex((unsigned long)addr,&line[10],6);
  47. writeln(line,y + 1);
  48. y++;
  49. if (y==16)
  50. y = 0;
  51. addr += 0x010000;
  52. }
  53. while(!pad1.start) {
  54. waitForVBlank();
  55. pad1 = readPad((byte) 0);
  56. }
  57. }
  58. while(1);
  59. }
  60. void IRQHandler(void) {
  61. }
  62. void NMIHandler(void) {
  63. //processEvents();
  64. }