main.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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;
  27. char line_header[32] = "BANK CRC 123456789ABCDEF";
  28. char line[32] = " ";
  29. char test_buffer[] = "da";
  30. char *pointer;
  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. pointer = (void*)0x8000;
  40. crc02 = crc_update(test_buffer,2);
  41. //crc01 = crc_update(pointer,255);
  42. for(j=0; j<8; j++) {
  43. crc01 = crc_update(pointer,0x8000);
  44. int2hex(j,&line[0]);
  45. int2hex(crc01,&line[5]);
  46. //int2hex((word)pointer,&line[10]);
  47. writeln(line,j+1);
  48. }
  49. while(!pad1.start) {
  50. waitForVBlank();
  51. pad1 = readPad((byte) 0);
  52. }
  53. }
  54. while(1);
  55. }
  56. void IRQHandler(void) {
  57. }
  58. void NMIHandler(void) {
  59. //processEvents();
  60. }