ufo.h 4.7 KB

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