Skip to content

Commit

Permalink
Fix 8KB RAM mapper and add games
Browse files Browse the repository at this point in the history
- Fix 8KB RAM mapper
- Follow MAME names (A and B)
- Add games: King's Valley, Magical Kid Wiz, Star Soldier, Pippols, and The Castle (TW).
  • Loading branch information
jfroco committed Oct 15, 2024
1 parent b5cbc72 commit ad3c38a
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 44 deletions.
18 changes: 7 additions & 11 deletions Src/Memory/romMapperSg1000RamExpander.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <string.h>
#include <stdio.h>


typedef struct {
int deviceHandle;
UInt8* romData;
Expand Down Expand Up @@ -85,7 +84,7 @@ static UInt8 read(RomMapperSg1000RamExpander* rm, UInt16 address)

static UInt8 read_ram1(RomMapperSg1000RamExpander* rm, UInt16 address)
{
return rm->ram1[address - 0x2000];
return rm->ram1[address & 0x1fff];
}

static void write(RomMapperSg1000RamExpander* rm, UInt16 address, UInt8 value)
Expand All @@ -95,7 +94,7 @@ static void write(RomMapperSg1000RamExpander* rm, UInt16 address, UInt8 value)

static void write_ram1(RomMapperSg1000RamExpander* rm, UInt16 address, UInt8 value)
{
rm->ram1[address-0x2000] = value;
rm->ram1[address & 0x1fff] = value;
}

int romMapperSg1000RamExpanderCreate(const char* filename, UInt8* romData,
Expand Down Expand Up @@ -123,20 +122,17 @@ int romMapperSg1000RamExpanderCreate(const char* filename, UInt8* romData,
rm->slot = slot;
rm->sslot = sslot;
rm->startPage = startPage;
rm->mask2 = ROM_SG1000_RAMEXPANDER_A ? 0x0400 : 0x2000;
rm->mask2 = (type == ROM_SG1000_RAMEXPANDER_A) ? 0x3FF: 0x1FFF;

for (i = 0; i < pages; i++) {
if (i + startPage >= 2) slot = 0;
if (type == ROM_SG1000_RAMEXPANDER_A && i + startPage == 1) {
if (type == ROM_SG1000_RAMEXPANDER_A && i + startPage == 1)
slotRegister(slot, sslot, i + startPage, 1, read_ram1, read_ram1, write_ram1, destroy, rm);
}
else {
else
slotMapPage(slot, sslot, i + startPage, rm->romData + 0x2000 * i, 1, 0);
}
}

slotMapPage(0, 0, 6, rm->ram2, 1, 1);
slotMapPage(0, 0, 7, rm->ram2, 1, 1);
slotRegister(0, 0, 6, 2, read, read, write, destroy, rm);

return 1;
}
Expand Down
109 changes: 76 additions & 33 deletions system/bluemsx/Databases/segadb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1718,20 +1718,6 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">King&#39;s Valley</title>
<system>Sega</system>
<company>Konami</company>
<year>1985</year>
<country>JP</country>
<dump>
<original value="false" />
<rom>
<type>SG1000RamA</type>
<hash algo="sha1">922d23895c12707b2fc382ea5cb769c5cb9b5755</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">Konami&#39;s Ping-Pong</title>
<system>Sega</system>
Expand Down Expand Up @@ -3193,20 +3179,6 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
</dump>
</software>
<!-- SF-7000 roms -->
<software>
<title xml:lang="en">Magical Kid Wiz</title>
<system>Sega</system>
<company>Sony</company>
<year>1986</year>
<country>JP</country>
<dump>
<original value="false" />
<rom>
<type>SC3000</type>
<hash algo="sha1">fd24b501046cf811b04386129be0362a1eabf6b3</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">Super Boy I</title>
<system>Sega</system>
Expand Down Expand Up @@ -3278,6 +3250,7 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
</systemrom>
</dump>
</software>
<!-- Taiwan 8KB RAM expansion roms -->
<software>
<title xml:lang="en">Rally-X</title>
<system>Sega</system>
Expand All @@ -3287,7 +3260,7 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
<dump>
<original value="false" />
<rom>
<type>sg1000ramA</type>
<type>sg1000ramB</type>
<hash algo="sha1">0c1957a5faae5254c69f3331e79d87499dd7cf48</hash>
</rom>
</dump>
Expand Down Expand Up @@ -3328,15 +3301,15 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
</dump>
</software>
<software>
<title xml:lang="en">*Bomberman Special</title>
<title xml:lang="en">Bomberman Special</title>
<system>Sega</system>
<company>DahJee</company>
<year>1986</year>
<country>TW</country>
<dump>
<original value="false" />
<rom>
<type>sg1000ramA</type>
<type>sg1000ramB</type>
<hash algo="sha1">d1d56bcd996df94458f5901dc537a5e30021256b</hash>
</rom>
</dump>
Expand All @@ -3349,7 +3322,7 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
</dump>
</software>
<software>
<title xml:lang="en">Legend of Kage</title>
<title xml:lang="en">The Legend of Kage</title>
<system>Sega</system>
<company>DahJee</company>
<year>1986</year>
Expand Down Expand Up @@ -3378,7 +3351,7 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
<dump>
<original value="false" />
<rom>
<type>sg1000ramA</type>
<type>sg1000ramB</type>
<hash algo="sha1">2755f74019dc94559fd0c2248e2ecb7f48879b90</hash>
</rom>
</dump>
Expand Down Expand Up @@ -3411,4 +3384,74 @@ f0f128b25e5557e660d936995e6bf25c8ebd17e5</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">Star Soldier</title>
<system>Sega</system>
<company>DahJee</company>
<year>19xx</year>
<country>TW</country>
<dump>
<original value="false" />
<rom>
<type>sg1000ramA</type>
<hash algo="sha1">c1984257809ec5bce80a65d22b9b32561e04922c</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">King's Valley</title>
<system>Sega</system>
<company>Jinzita</company>
<year>198x</year>
<country>TW</country>
<dump>
<original value="false" />
<rom>
<type>sg1000ramA</type>
<hash algo="sha1">922d23895c12707b2fc382ea5cb769c5cb9b5755</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">Pippols</title>
<system>Sega</system>
<company>Jumbo</company>
<year>198x</year>
<country>TW</country>
<dump>
<original value="false" />
<rom>
<type>sg1000ramA</type>
<hash algo="sha1">4a95b98e127fb0c6428d6debcfc92152069ac531</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">The Castle</title>
<system>Sega</system>
<company>DahJee</company>
<year>1986</year>
<country>TW</country>
<dump>
<original value="false" />
<rom>
<type>sg1000ramB</type>
<hash algo="sha1">5a81d5103487695cabd811aabd9e71f48b9e7996</hash>
</rom>
</dump>
</software>
<software>
<title xml:lang="en">Magical Kid Wiz</title>
<system>Sega</system>
<company>Sony</company>
<year>1986</year>
<country>JP</country>
<dump>
<original value="false" />
<rom>
<type>sg1000ramB</type>
<hash algo="sha1">fd24b501046cf811b04386129be0362a1eabf6b3</hash>
</rom>
</dump>
</software>
</softwaredb>

0 comments on commit ad3c38a

Please sign in to comment.