ufo.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. ufo.h - Super UFO for uCON64
  3. Copyright (c) 2003 dbjh
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef UFO_H
  17. #define UFO_H
  18. extern const st_getopt2_t ufo_usage[];
  19. /*
  20. Super UFO Pro 8 Header Format (researched by John Weidman)
  21. Byte-Offset Function
  22. ----------- ---------------------------------------------------
  23. 00-01 Chunk size: 04 00 == 4 Mbit (same format as the DX2)
  24. 02 LoROM games: 0x40 == continue loading another chunk after this one.
  25. 0x00 == This is the last chunk.
  26. HiROM games: 0x40 == more work to figure this out -- maybe interleave info
  27. 0x10 == more work to figure this out -- maybe interleave info
  28. 0x00 == This is the last chunk.
  29. 03-07 0x00
  30. 08-0F 53 55 50 45 52 55 46 4F (SUPERUFO)
  31. 10 0x01 == This file is a ROM image file
  32. 11 ROM size: 04 == 4 Mb, 0x18 == 24 Mb, 0x20 == 32 Mb, etc.
  33. 12 ROM format: 00 == HiROM, 01 == LoROM
  34. ==== Start SRAM address mapping config ===============
  35. 13 SRAM Size:
  36. 00: 0Kb
  37. 01: 16Kb
  38. 02: 64Kb
  39. 03: 256Kb
  40. 04-07: Not used
  41. 08: XXXKb (Used for sram sizes above 256Kb, like 1024Kb)
  42. 14 SRAM A15 control:
  43. 00: A15 not used for SRAM control?
  44. Use this for HiROM games
  45. LoROM: Use this if SRAM size = 0Kb (no SRAM)
  46. 01: A15=X selects SRAM
  47. 02: A15=0 selects SRAM
  48. 03: A15=1 selects SRAM
  49. 15 SRAM A20 and A21 control:
  50. Bits 3:2
  51. 00: A21=x selects SRAM
  52. 01: Not used?
  53. 10: A21=0 selects SRAM
  54. 11: A21=1 selects SRAM
  55. Bits 1:0
  56. 00: A20=x selects SRAM
  57. 01: Not used?
  58. 10: A20=0 selects SRAM
  59. 11: A20=1 selects SRAM
  60. 16 SRAM A22 and A23 control:
  61. Bits 3:2
  62. 00: A23=x selects SRAM
  63. 01: Not used?
  64. 10: A23=0 selects SRAM
  65. 11: A23=1 selects SRAM
  66. Bits 1:0
  67. 00: A22=x selects SRAM
  68. 01: Not used?
  69. 10: A22=0 selects SRAM
  70. 11: A22=1 selects SRAM
  71. 17 SRAM type
  72. 0x00: Linear (HiROM)
  73. 0x03: Skip (LoROM)
  74. ==== End SRAM address mapping config ================
  75. 18-1FF 00
  76. LoROM SRAM header
  77. =========================================================
  78. The SRAM mapping I would try first for LoROM games is:
  79. 0Kb SRAM
  80. 0012-0017 01 00 00 00 02 00
  81. 0Kb LoROM DSP
  82. 0012-0017 01 00 01 0C 00 03
  83. Note: LoROM DSPs with SRAM don't seem to work on the Super UFO
  84. (For reference, no LoROM DSP carts work on the SWC DX2)
  85. Non 0 SRAM - default map (map low halves of banks 7x to SRAM)
  86. 0012-0017 01 ss 02 0F 03 03
  87. Non 0 SRAM - alternate map (map all of banks 7x to SRAM -- will not work for > 28 Mbit
  88. games )
  89. 0012-0017 01 ss 01 0F 03 03
  90. HiROM SRAM header
  91. ==========================================================
  92. 0Kb SRAM
  93. 0012-0017 00 00 00 00 02 00
  94. Non 0 SRAM
  95. 0012-0017 00 ss 00 0C 02 00 (Hopefully this will work for everything?)
  96. If you find an SRAM protected game that doesn't work with the above mapping try:
  97. 0012-0017 00 ss 00 03 02 00 (seen in a couple of games but should work with above
  98. mapping too)
  99. --
  100. For Tales of Phantasia or Dai Kaijyu Monogatari II
  101. 0012-0017 00 ss 00 00 0E 00 (Unverified)
  102. */
  103. typedef struct st_ufo_header
  104. {
  105. unsigned char size_low;
  106. unsigned char size_high;
  107. unsigned char multi;
  108. unsigned char pad[5];
  109. unsigned char id[8]; // "SUPERUFO"
  110. unsigned char isrom;
  111. unsigned char size;
  112. unsigned char banktype;
  113. unsigned char sram_size;
  114. unsigned char sram_a15;
  115. unsigned char sram_a20_a21;
  116. unsigned char sram_a22_a23;
  117. unsigned char sram_type;
  118. unsigned char pad2[488];
  119. } st_ufo_header_t;
  120. #define UFO_HEADER_LEN (sizeof (st_ufo_header_t))
  121. #endif // UFO_H