iremh3001.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * IREMH3001 Mapper - The TI-NESulator Project
  3. * iremh3001.c
  4. *
  5. * Created by Manoel TRAPIER.
  6. * Copyright (c) 2003-2008 986Corp. All rights reserved.
  7. *
  8. * $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
  9. * $Author: godzil $
  10. * $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/iremh3001.h $
  11. * $Revision: 39 $
  12. *
  13. */
  14. #include "iremh3001.h"
  15. unsigned short iremh3001_prom_slot[3];
  16. unsigned short iremh3001_vrom_slot[8];
  17. int iremh3001_InitMapper(NesCart * cart)
  18. {
  19. set_prom_bank_16k(0x8000, 0);
  20. set_prom_bank_16k(0xC000, GETLAST16KBANK(cart));
  21. iremh3001_prom_slot[0] = 0;
  22. iremh3001_prom_slot[1] = 1;
  23. iremh3001_prom_slot[2] = GETLAST16KBANK(cart);
  24. set_vrom_bank_8k(0x0000,4);
  25. iremh3001_vrom_slot[0] = 0;
  26. iremh3001_vrom_slot[1] = 0;
  27. iremh3001_vrom_slot[2] = 0;
  28. iremh3001_vrom_slot[3] = 0;
  29. iremh3001_vrom_slot[4] = 0;
  30. iremh3001_vrom_slot[5] = 0;
  31. iremh3001_vrom_slot[6] = 0;
  32. iremh3001_vrom_slot[7] = 0;
  33. return 0;
  34. }
  35. int iremh3001_MapperWriteHook(register byte Addr, register byte Value)
  36. {
  37. switch(Addr)
  38. {
  39. case 0x8000: /* Set 8k PROM @ 8000 */
  40. printf("iremh3001: %X: change PROM to %d[%X]\n", Addr, Value, Value);
  41. set_prom_bank_8k(0x8000, Value);
  42. iremh3001_prom_slot[0] = Value;
  43. break;
  44. case 0x9003: /* Mirroring ??? */
  45. printf("iremh3001: Mirroring[0x%X:%d] ?\n", Value, Value);
  46. break;
  47. case 0x9005: /* IRQ ??? */
  48. printf("iremh3001: IRQ[0x%X:%d] ?\n", Value, Value);
  49. break;
  50. case 0x9006: /* IRQ ??? */
  51. printf("iremh3001: IRQ[0x%X:%d] ?\n", Value, Value);
  52. break;
  53. case 0xA000: /* Set 8k PROM @ A000 */
  54. printf("iremh3001: %X: change PROM to %d[%X]\n", Addr, Value, Value);
  55. set_prom_bank_8k(0xA000, Value);
  56. iremh3001_prom_slot[1] = Value;
  57. break;
  58. case 0xB000: /* Set 1k VROM @ 0000 */
  59. case 0xB001: /* Set 1k VROM @ 0400 */
  60. case 0xB002: /* Set 1k VROM @ 0800 */
  61. case 0xB003: /* Set 1k VROM @ 0C00 */
  62. case 0xB004: /* Set 1k VROM @ 1000 */
  63. case 0xB005: /* Set 1k VROM @ 1400 */
  64. case 0xB006: /* Set 1k VROM @ 1800 */
  65. case 0xB007: /* Set 1k VROM @ 1C00 */
  66. printf("iremh3001: %X: change VROM to %d[%X]\n", (Addr&0x0F)<<10, Value, Value);
  67. set_vrom_bank_1k((Addr&0xF)<<10, Value);
  68. iremh3001_vrom_slot[Addr&0x0F] = Value;
  69. break;
  70. case 0xC000: /* Set 8k PROM @ C000 */
  71. printf("iremh3001: %X: change PROM to %d[%X]\n", Addr, Value, Value);
  72. set_prom_bank_8k(0xC000, Value);
  73. iremh3001_prom_slot[2] = Value;
  74. break;
  75. default:
  76. printf("@:%X -- V:%X", Addr, Value);
  77. return 0;
  78. }
  79. return 1;
  80. }
  81. void iremh3001_MapperDump(FILE *fp)
  82. {
  83. fprintf(fp,"iremh3001: prom: $8000:%d $A000:%d $C000:%d\n",
  84. iremh3001_prom_slot[0],
  85. iremh3001_prom_slot[1],
  86. iremh3001_prom_slot[2]);
  87. fprintf(fp,"iremh3001: vrom: $0000:%d $0400:%d $0800:%d $0C00:%d\n" \
  88. " $1000:%d $1400:%d $1800:%d $1C00:%d\n",
  89. iremh3001_vrom_slot[0],
  90. iremh3001_vrom_slot[1],
  91. iremh3001_vrom_slot[2],
  92. iremh3001_vrom_slot[3],
  93. iremh3001_vrom_slot[4],
  94. iremh3001_vrom_slot[5],
  95. iremh3001_vrom_slot[6],
  96. iremh3001_prom_slot[7]);
  97. }
  98. int iremh3001_MapperIRQ(int cycledone)
  99. {
  100. return 0;
  101. }