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