From dbb4e62da60ca3164987e1fff046d98ecd876ba6 Mon Sep 17 00:00:00 2001 From: iq_132 <1191709+iq132@users.noreply.github.com> Date: Thu, 24 May 2012 05:36:51 +0000 Subject: [PATCH] Big update of PGM protection routines. Quite a lot changed/merged. Some formatting changes in d_pgm.cpp --- src/burn/drv/pgm/d_pgm.cpp | 677 +++--- src/burn/drv/pgm/pgm.h | 1 + src/burn/drv/pgm/pgm_crypt.cpp | 26 +- src/burn/drv/pgm/pgm_prot.cpp | 3670 ++++++++++++++------------------ 4 files changed, 1952 insertions(+), 2422 deletions(-) diff --git a/src/burn/drv/pgm/d_pgm.cpp b/src/burn/drv/pgm/d_pgm.cpp index 2a3d790dd..d8a905eca 100644 --- a/src/burn/drv/pgm/d_pgm.cpp +++ b/src/burn/drv/pgm/d_pgm.cpp @@ -5,7 +5,7 @@ #include "pgm.h" static struct BurnRomInfo emptyRomDesc[] = { - { "", 0, 0, 0 }, + { "", 0, 0, 0 }, }; static struct BurnInputInfo pgmInputList[] = { @@ -67,307 +67,214 @@ static struct BurnInputInfo pgmInputList[] = { STDINPUTINFO(pgm) static struct BurnDIPInfo pgmDIPList[] = { - {0x2D, 0xFF, 0xFF, 0x00, NULL }, - {0x2F, 0xFF, 0x01, 0x01, NULL }, + {0x2D, 0xFF, 0xFF, 0x00, NULL }, + {0x2F, 0xFF, 0x01, 0x01, NULL }, - {0, 0xFE, 0, 2, "Test mode" }, - {0x2D, 0x01, 0x01, 0x00, "Off" }, - {0x2D, 0x01, 0x01, 0x01, "On" }, + {0, 0xFE, 0, 2, "Test mode" }, + {0x2D, 0x01, 0x01, 0x00, "Off" }, + {0x2D, 0x01, 0x01, 0x01, "On" }, - {0, 0xFE, 0, 2, "Music" }, - {0x2D, 0x01, 0x02, 0x02, "Off" }, - {0x2D, 0x01, 0x02, 0x00, "On" }, + {0, 0xFE, 0, 2, "Music" }, + {0x2D, 0x01, 0x02, 0x02, "Off" }, + {0x2D, 0x01, 0x02, 0x00, "On" }, - {0, 0xFE, 0, 2, "Voice" }, - {0x2D, 0x01, 0x04, 0x04, "Off" }, - {0x2D, 0x01, 0x04, 0x00, "On" }, + {0, 0xFE, 0, 2, "Voice" }, + {0x2D, 0x01, 0x04, 0x04, "Off" }, + {0x2D, 0x01, 0x04, 0x00, "On" }, - {0, 0xFE, 0, 2, "Free play" }, - {0x2D, 0x01, 0x08, 0x00, "Off" }, - {0x2D, 0x01, 0x08, 0x08, "On" }, + {0, 0xFE, 0, 2, "Free play" }, + {0x2D, 0x01, 0x08, 0x00, "Off" }, + {0x2D, 0x01, 0x08, 0x08, "On" }, - {0, 0xFE, 0, 2, "Stop mode" }, - {0x2D, 0x01, 0x10, 0x00, "Off" }, - {0x2D, 0x01, 0x10, 0x10, "On" }, + {0, 0xFE, 0, 2, "Stop mode" }, + {0x2D, 0x01, 0x10, 0x00, "Off" }, + {0x2D, 0x01, 0x10, 0x10, "On" }, - {0, 0xFE, 0, 4, "Bios select (Fake)" }, - {0x2F, 0x01, 0x0f, 0x00, "Older" }, - {0x2F, 0x01, 0x0f, 0x01, "Newer" }, - {0x2F, 0x01, 0x0f, 0x02, "Newer (no intro, calendar)" }, - {0x2F, 0x01, 0x0f, 0x03, "Newer (no intro)" }, + {0, 0xFE, 0, 4, "Bios select (Fake)" }, + {0x2F, 0x01, 0x0f, 0x00, "Older" }, + {0x2F, 0x01, 0x0f, 0x01, "Newer" }, + {0x2F, 0x01, 0x0f, 0x02, "Newer (no intro, calendar)" }, + {0x2F, 0x01, 0x0f, 0x03, "Newer (no intro)" }, }; STDDIPINFO(pgm) static struct BurnDIPInfo jammaDIPList[] = { - {0x2D, 0xFF, 0xFF, 0x00, NULL }, - {0x2F, 0xFF, 0x01, 0x00, NULL }, + {0x2D, 0xFF, 0xFF, 0x00, NULL }, + {0x2F, 0xFF, 0x01, 0x00, NULL }, - {0, 0xFE, 0, 2, "Test mode" }, - {0x2D, 0x01, 0x01, 0x00, "Off" }, - {0x2D, 0x01, 0x01, 0x01, "On" }, + {0, 0xFE, 0, 2, "Test mode" }, + {0x2D, 0x01, 0x01, 0x00, "Off" }, + {0x2D, 0x01, 0x01, 0x01, "On" }, - {0, 0xFE, 0, 2, "Music" }, - {0x2D, 0x01, 0x02, 0x02, "Off" }, - {0x2D, 0x01, 0x02, 0x00, "On" }, + {0, 0xFE, 0, 2, "Music" }, + {0x2D, 0x01, 0x02, 0x02, "Off" }, + {0x2D, 0x01, 0x02, 0x00, "On" }, - {0, 0xFE, 0, 2, "Voice" }, - {0x2D, 0x01, 0x04, 0x04, "Off" }, - {0x2D, 0x01, 0x04, 0x00, "On" }, + {0, 0xFE, 0, 2, "Voice" }, + {0x2D, 0x01, 0x04, 0x04, "Off" }, + {0x2D, 0x01, 0x04, 0x00, "On" }, - {0, 0xFE, 0, 2, "Free play" }, - {0x2D, 0x01, 0x08, 0x00, "Off" }, - {0x2D, 0x01, 0x08, 0x08, "On" }, + {0, 0xFE, 0, 2, "Free play" }, + {0x2D, 0x01, 0x08, 0x00, "Off" }, + {0x2D, 0x01, 0x08, 0x08, "On" }, - {0, 0xFE, 0, 2, "Stop mode" }, - {0x2D, 0x01, 0x10, 0x00, "Off" }, - {0x2D, 0x01, 0x10, 0x10, "On" }, + {0, 0xFE, 0, 2, "Stop mode" }, + {0x2D, 0x01, 0x10, 0x00, "Off" }, + {0x2D, 0x01, 0x10, 0x10, "On" }, }; STDDIPINFO(jamma) static struct BurnDIPInfo orlegendDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x00, NULL }, + {0x2E, 0xFF, 0xFF, 0x00, NULL }, - {0, 0xFE, 0, 2, "Disable Ba-Chieh" }, - {0x2E, 0x02, 0x01, 0x00, "Off" }, - {0x2E, 0x02, 0x01, 0x01, "On" }, + {0, 0xFE, 0, 2, "Disable Ba-Chieh" }, + {0x2E, 0x02, 0x01, 0x00, "Off" }, + {0x2E, 0x02, 0x01, 0x01, "On" }, - {0, 0xFE, 0, 3, "Region (Fake)" }, - {0x2E, 0x01, 0x03, 0x00, "World" }, - {0x2E, 0x01, 0x03, 0x02, "Korea" }, - {0x2E, 0x01, 0x03, 0x03, "China" }, -}; - -static struct BurnDIPInfo orlegend112cDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x03, NULL }, - - {0, 0xFE, 0, 2, "Disable Ba-Chieh" }, - {0x2E, 0x02, 0x01, 0x00, "Off" }, - {0x2E, 0x02, 0x01, 0x01, "On" }, - - {0, 0xFE, 0, 3, "Region (Fake)" }, - {0x2E, 0x01, 0x03, 0x00, "World" }, - {0x2E, 0x01, 0x03, 0x02, "Korea" }, - {0x2E, 0x01, 0x03, 0x03, "China" }, + {0, 0xFE, 0, 3, "Region (Fake)" }, + {0x2E, 0x01, 0x03, 0x00, "World" }, + {0x2E, 0x01, 0x03, 0x02, "Korea" }, + {0x2E, 0x01, 0x03, 0x03, "China" }, }; static struct BurnDIPInfo orld111cDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x02, NULL }, + {0x2E, 0xFF, 0xFF, 0x02, NULL }, - {0, 0xFE, 0, 2, "Region (Fake)" }, - {0x2E, 0x01, 0x03, 0x00, "Hong Kong" }, - {0x2E, 0x01, 0x03, 0x02, "China" }, + {0, 0xFE, 0, 2, "Region (Fake)" }, + {0x2E, 0x01, 0x03, 0x00, "Hong Kong" }, + {0x2E, 0x01, 0x03, 0x02, "China" }, }; static struct BurnDIPInfo orld105kDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x02, NULL }, -}; - -static struct BurnDIPInfo sangoDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x05, NULL }, - - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x00, "China" }, - {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x02, "Japan" }, - {0x2E, 0x01, 0x0F, 0x03, "Korea" }, - {0x2E, 0x01, 0x0F, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x05, "World" }, -}; - -static struct BurnDIPInfo oldsDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x04, NULL }, - - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x02, "China" }, - {0x2E, 0x01, 0x0F, 0x03, "Japan" }, - {0x2E, 0x01, 0x0F, 0x04, "Korea" }, - {0x2E, 0x01, 0x0F, 0x05, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x06, "World" }, -}; - -static struct BurnDIPInfo olds100DIPList[] = { - {0x2E, 0xFF, 0xFF, 0x05, NULL }, - - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x02, "China" }, - {0x2E, 0x01, 0x0F, 0x03, "Japan" }, - {0x2E, 0x01, 0x0F, 0x04, "Korea" }, - {0x2E, 0x01, 0x0F, 0x05, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x06, "World" }, -}; - -static struct BurnDIPInfo kov100DIPList[] = { - {0x2E, 0xFF, 0xFF, 0x02, NULL }, - - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x00, "China" }, - {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x02, "Japan" }, - {0x2E, 0x01, 0x0F, 0x03, "Korea" }, - {0x2E, 0x01, 0x0F, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x05, "World" }, + {0x2E, 0xFF, 0xFF, 0x02, NULL }, }; static struct BurnDIPInfo killbldDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x21, NULL }, + {0x2E, 0xFF, 0xFF, 0x21, NULL }, - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0xFF, 0x16, "Taiwan" }, - {0x2E, 0x01, 0xFF, 0x17, "China" }, - {0x2E, 0x01, 0xFF, 0x18, "Hong Kong" }, - {0x2E, 0x01, 0xFF, 0x19, "Japan" }, - {0x2E, 0x01, 0xFF, 0x20, "Korea" }, - {0x2E, 0x01, 0xFF, 0x21, "World" }, + {0, 0xFE, 0, 6, "Region (Fake)" }, + {0x2E, 0x01, 0xFF, 0x16, "Taiwan" }, + {0x2E, 0x01, 0xFF, 0x17, "China" }, + {0x2E, 0x01, 0xFF, 0x18, "Hong Kong" }, + {0x2E, 0x01, 0xFF, 0x19, "Japan" }, + {0x2E, 0x01, 0xFF, 0x20, "Korea" }, + {0x2E, 0x01, 0xFF, 0x21, "World" }, }; static struct BurnDIPInfo photoy2kDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x03, NULL }, + {0x2E, 0xFF, 0xFF, 0x03, NULL }, - {0, 0xFE, 0, 7, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x00, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x01, "China" }, - {0x2E, 0x01, 0x0F, 0x02, "Japan" }, - {0x2E, 0x01, 0x0F, 0x03, "World" }, - {0x2E, 0x01, 0x0F, 0x04, "Korea" }, - {0x2E, 0x01, 0x0F, 0x05, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x06, "Singapore / Malaysia" }, + {0, 0xFE, 0, 7, "Region (Fake)" }, + {0x2E, 0x01, 0x0F, 0x00, "Taiwan" }, + {0x2E, 0x01, 0x0F, 0x01, "China" }, + {0x2E, 0x01, 0x0F, 0x02, "Japan" }, + {0x2E, 0x01, 0x0F, 0x03, "World" }, + {0x2E, 0x01, 0x0F, 0x04, "Korea" }, + {0x2E, 0x01, 0x0F, 0x05, "Hong Kong" }, + {0x2E, 0x01, 0x0F, 0x06, "Singapore / Malaysia" }, }; -static struct BurnDIPInfo raf102jDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x02, NULL }, +static struct BurnDIPInfo oldsDIPList[] = { + {0x2E, 0xFF, 0xFF, 0x05, NULL }, - {0, 0xFE, 0, 7, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x00, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x01, "China" }, - {0x2E, 0x01, 0x0F, 0x02, "Japan" }, - {0x2E, 0x01, 0x0F, 0x03, "World" }, - {0x2E, 0x01, 0x0F, 0x04, "Korea" }, - {0x2E, 0x01, 0x0F, 0x05, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x06, "Singapore / Malaysia" }, + {0, 0xFE, 0, 6, "Region (Fake)" }, + {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, + {0x2E, 0x01, 0x0F, 0x02, "China" }, + {0x2E, 0x01, 0x0F, 0x03, "Japan" }, + {0x2E, 0x01, 0x0F, 0x04, "Korea" }, + {0x2E, 0x01, 0x0F, 0x05, "Hong Kong" }, + {0x2E, 0x01, 0x0F, 0x06, "World" }, }; static struct BurnDIPInfo puzzli2DIPList[] = { - {0x2E, 0xFF, 0xFF, 0x05, NULL }, + {0x2E, 0xFF, 0xFF, 0x05, NULL }, - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x00, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x01, "China" }, - {0x2E, 0x01, 0x0F, 0x02, "Japan" }, - {0x2E, 0x01, 0x0F, 0x03, "Korea" }, - {0x2E, 0x01, 0x0F, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x05, "World" }, + {0, 0xFE, 0, 6, "Region (Fake)" }, + {0x2E, 0x01, 0x0F, 0x00, "Taiwan" }, + {0x2E, 0x01, 0x0F, 0x01, "China" }, + {0x2E, 0x01, 0x0F, 0x02, "Japan" }, + {0x2E, 0x01, 0x0F, 0x03, "Korea" }, + {0x2E, 0x01, 0x0F, 0x04, "Hong Kong" }, + {0x2E, 0x01, 0x0F, 0x05, "World" }, }; -static struct BurnDIPInfo kov2DIPList[] = { - {0x2E, 0xFF, 0xFF, 0x04, NULL }, +static struct BurnDIPInfo kovDIPList[] = { + {0x2E, 0xFF, 0xFF, 0x05, NULL }, - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x07, 0x00, "China" }, - {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x07, 0x02, "Japan" }, - {0x2E, 0x01, 0x07, 0x03, "Korea" }, - {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x07, 0x05, "World" }, + {0, 0xFE, 0, 6, "Region (Fake)" }, + {0x2E, 0x01, 0x0F, 0x00, "China" }, + {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, + {0x2E, 0x01, 0x0F, 0x02, "Japan" }, + {0x2E, 0x01, 0x0F, 0x03, "Korea" }, + {0x2E, 0x01, 0x0F, 0x04, "Hong Kong" }, + {0x2E, 0x01, 0x0F, 0x05, "World" }, }; static struct BurnDIPInfo martmastDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x06, NULL }, + {0x2E, 0xFF, 0xFF, 0x05, NULL }, - {0, 0xFE, 0, 7, "Region (Fake)" }, - {0x2E, 0x01, 0x07, 0x00, "China" }, - {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x07, 0x02, "China" }, - {0x2E, 0x01, 0x07, 0x03, "Korea" }, - {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x07, 0x05, "World" }, - {0x2E, 0x01, 0x07, 0x06, "USA" }, -}; - -static struct BurnDIPInfo martmastcDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x00, NULL }, - - {0, 0xFE, 0, 7, "Region (Fake)" }, - {0x2E, 0x01, 0x07, 0x00, "China" }, - {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x07, 0x02, "China" }, - {0x2E, 0x01, 0x07, 0x03, "Korea" }, - {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x07, 0x05, "World" }, - {0x2E, 0x01, 0x07, 0x06, "USA" }, + {0, 0xFE, 0, 7, "Region (Fake)" }, + {0x2E, 0x01, 0x07, 0x00, "China" }, + {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, + {0x2E, 0x01, 0x07, 0x02, "China" }, + {0x2E, 0x01, 0x07, 0x03, "Korea" }, + {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, + {0x2E, 0x01, 0x07, 0x05, "World" }, + {0x2E, 0x01, 0x07, 0x06, "USA" }, }; static struct BurnDIPInfo martmastc102DIPList[] = { - {0x2E, 0xFF, 0xFF, 0x00, NULL }, + {0x2E, 0xFF, 0xFF, 0x05, NULL }, - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x07, 0x00, "China" }, - {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x07, 0x02, "Japan" }, - {0x2E, 0x01, 0x07, 0x03, "Korea" }, - {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x07, 0x05, "World" }, + {0, 0xFE, 0, 6, "Region (Fake)" }, + {0x2E, 0x01, 0x07, 0x00, "China" }, + {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, + {0x2E, 0x01, 0x07, 0x02, "Japan" }, + {0x2E, 0x01, 0x07, 0x03, "Korea" }, + {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, + {0x2E, 0x01, 0x07, 0x05, "World" }, +// {0x2E, 0x01, 0x07, 0x06, "USA" }, }; static struct BurnDIPInfo ddp2DIPList[] = { - {0x2E, 0xFF, 0xFF, 0x05, NULL }, + {0x2E, 0xFF, 0xFF, 0x05, NULL }, - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x07, 0x00, "China" }, - {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x07, 0x02, "Japan (Cave License)" }, - {0x2E, 0x01, 0x07, 0x03, "Korea" }, - {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x07, 0x05, "World" }, -}; - -static struct BurnDIPInfo dmnfrntDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x05, NULL }, - - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x07, 0x00, "China" }, - {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x07, 0x02, "Japan" }, - {0x2E, 0x01, 0x07, 0x03, "Korea" }, - {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x07, 0x05, "World" }, + {0, 0xFE, 0, 6, "Region (Fake)" }, + {0x2E, 0x01, 0x07, 0x00, "China" }, + {0x2E, 0x01, 0x07, 0x01, "Taiwan" }, + {0x2E, 0x01, 0x07, 0x02, "Japan (Cave License)" }, + {0x2E, 0x01, 0x07, 0x03, "Korea" }, + {0x2E, 0x01, 0x07, 0x04, "Hong Kong" }, + {0x2E, 0x01, 0x07, 0x05, "World" }, }; static struct BurnDIPInfo kovassgaDIPList[] = { - {0x2E, 0xFF, 0xFF, 0x00, NULL }, + {0x2E, 0xFF, 0xFF, 0x00, NULL }, - {0, 0xFE, 0, 6, "Region (Fake)" }, - {0x2E, 0x01, 0x0F, 0x00, "China" }, - {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, - {0x2E, 0x01, 0x0F, 0x02, "Japan" }, - {0x2E, 0x01, 0x0F, 0x03, "Korea" }, - {0x2E, 0x01, 0x0F, 0x04, "Hong Kong" }, - {0x2E, 0x01, 0x0F, 0x05, "World" }, + {0, 0xFE, 0, 6, "Region (Fake)" }, + {0x2E, 0x01, 0x0F, 0x00, "China" }, + {0x2E, 0x01, 0x0F, 0x01, "Taiwan" }, + {0x2E, 0x01, 0x0F, 0x02, "Japan" }, + {0x2E, 0x01, 0x0F, 0x03, "Korea" }, + {0x2E, 0x01, 0x0F, 0x04, "Hong Kong" }, + {0x2E, 0x01, 0x0F, 0x05, "World" }, }; -STDDIPINFOEXT(orlegend, pgm, orlegend ) -STDDIPINFOEXT(orlegend112c, pgm, orlegend112c ) -STDDIPINFOEXT(orld111c, pgm, orld111c ) -STDDIPINFOEXT(orld105k, pgm, orld105k ) -STDDIPINFOEXT(sango, pgm, sango ) -STDDIPINFOEXT(kovassga, pgm, kovassga ) -STDDIPINFOEXT(kov100, pgm, kov100 ) -STDDIPINFOEXT(killbld, pgm, killbld ) -STDDIPINFOEXT(photoy2k, pgm, photoy2k ) -STDDIPINFOEXT(raf102j, pgm, raf102j ) -STDDIPINFOEXT(puzzli2, pgm, puzzli2 ) -STDDIPINFOEXT(kov2, pgm, kov2 ) -STDDIPINFOEXT(martmast, pgm, martmast ) -STDDIPINFOEXT(martmastc, pgm, martmastc ) -STDDIPINFOEXT(martmastc102, pgm, martmastc102 ) -STDDIPINFOEXT(olds, pgm, olds ) -STDDIPINFOEXT(olds100, pgm, olds100 ) -STDDIPINFOEXT(ddp2, pgm, ddp2 ) -STDDIPINFOEXT(dmnfrnt, pgm, dmnfrnt ) -STDDIPINFOEXT(dmnfrntpcb, jamma, dmnfrnt ) +STDDIPINFOEXT(orlegend, pgm, orlegend ) +STDDIPINFOEXT(orld111c, pgm, orld111c ) +STDDIPINFOEXT(orld105k, pgm, orld105k ) +STDDIPINFOEXT(kov, pgm, kov ) +STDDIPINFOEXT(kovassga, pgm, kovassga ) +STDDIPINFOEXT(killbld, pgm, killbld ) +STDDIPINFOEXT(photoy2k, pgm, photoy2k ) +STDDIPINFOEXT(puzzli2, pgm, puzzli2 ) +STDDIPINFOEXT(martmast, pgm, martmast ) +STDDIPINFOEXT(martmastc102, pgm, martmastc102 ) +STDDIPINFOEXT(olds, pgm, olds ) +STDDIPINFOEXT(ddp2, pgm, ddp2 ) +STDDIPINFOEXT(dmnfrntpcb, jamma, kov ) // ----------------------------------------------------------------------------- // BIOS @@ -566,7 +473,7 @@ struct BurnDriver BurnDrvOrlegend112c = { "Oriental Legend - Xi Yo Gi Shi Re Zuang (V112, China)\0", NULL, "IGS", "PolyGameMaster", L"Oriental Legend\0\u897F\u6E38\u91CA\u5384\u4F20 (V112, China)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM, GBF_SCRFIGHT, 0, - NULL, orlegend112cRomInfo, orlegend112cRomName, NULL, NULL, pgmInputInfo, orlegend112cDIPInfo, + NULL, orlegend112cRomInfo, orlegend112cRomName, NULL, NULL, pgmInputInfo, orlegendDIPInfo, orlegendInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -601,7 +508,7 @@ struct BurnDriver BurnDrvOrlegend112ca = { "Oriental Legend - Xi Yo Gi Shi Re Zuang (V112 alt, China)\0", NULL, "IGS", "PolyGameMaster", L"Oriental Legend\0\u897F\u6E38\u91CA\u5384\u4F20 (V112 alt, China)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM, GBF_SCRFIGHT, 0, - NULL, orlegend112caRomInfo, orlegend112caRomName, NULL, NULL, pgmInputInfo, orlegend112cDIPInfo, + NULL, orlegend112caRomInfo, orlegend112caRomName, NULL, NULL, pgmInputInfo, orlegendDIPInfo, orlegendInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1166,7 +1073,7 @@ struct BurnDriver BurnDrvOlds100 = { "Oriental Legend Special - Xi Yo Gi Shi Re Zuang Super (V100)\0", "Imperfect Protection Emulation", "IGS", "PolyGameMaster", L"Oriental Legend Super\0\u897F\u6E38\u91CA\u5384\u4F20 Super (V100)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM, GBF_SCRFIGHT, 0, - NULL, olds100RomInfo, olds100RomName, NULL, NULL, pgmInputInfo, olds100DIPInfo, + NULL, olds100RomInfo, olds100RomName, NULL, NULL, pgmInputInfo, oldsDIPInfo, oldsInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1196,7 +1103,7 @@ static struct BurnRomInfo olds100aRomDesc[] = { { "m0500.rom", 0x200000, 0x37928cdd, 5 | BRF_SND }, // 14 Samples #if !defined (ROM_VERIFY) - { "protection_data.u6", 0x010000, 0x00000000, 0 | BRF_PRG | BRF_NODUMP }, // 15 Protection Rom + { "protection_data.u6", 0x010000, 0x00000000, 0 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 15 Protection Rom #else { "", 0x000000, 0x00000000, 0 }, // 15 #endif @@ -1212,7 +1119,7 @@ struct BurnDriver BurnDrvOlds100a = { "Oriental Legend Special - Xi Yo Gi Shi Re Zuang Super (V100 alt)\0", "Imperfect Protection Emulation", "IGS", "PolyGameMaster", L"Oriental Legend Super\0\u897F\u6E38\u91CA\u5384\u4F20 Super (V100 alt)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM, GBF_SCRFIGHT, 0, - NULL, olds100aRomInfo, olds100aRomName, NULL, NULL, pgmInputInfo, olds100DIPInfo, + NULL, olds100aRomInfo, olds100aRomName, NULL, NULL, pgmInputInfo, oldsDIPInfo, oldsInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1235,7 +1142,7 @@ static struct BurnRomInfo kovRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 8 Samples - { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 9 Internal ARM7 Rom + { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 9 Internal ARM7 Rom }; STDROMPICKEXT(kov, kov, pgm) @@ -1254,7 +1161,7 @@ struct BurnDriver BurnDrvKov = { "Knights of Valour - Sangoku Senki (V117)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour\0\u4E09\u56FD\u6226\u7D00\0\u4E09\u56FD\u6218\u7EAA (V117)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, kovRomInfo, kovRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovRomInfo, kovRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1277,7 +1184,7 @@ static struct BurnRomInfo kov115RomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 8 Samples - { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 9 Internal ARM7 Rom + { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 9 Internal ARM7 Rom }; STDROMPICKEXT(kov115, kov115, pgm) @@ -1288,7 +1195,7 @@ struct BurnDriver BurnDrvKov115 = { "Knights of Valour - Sangoku Senki (V115)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour\0\u4E09\u56FD\u6226\u7D00\0\u4E09\u56FD\u6218\u7EAA (V115)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, kov115RomInfo, kov115RomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kov115RomInfo, kov115RomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1315,7 +1222,7 @@ static struct BurnRomInfo kov100RomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 12 Samples - { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 13 Internal ARM7 Rom + { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 13 Internal ARM7 Rom }; STDROMPICKEXT(kov100, kov100, pgm) @@ -1326,7 +1233,7 @@ struct BurnDriver BurnDrvKov100 = { "Knights of Valour - Sangoku Senki (V100, Japan)\0", NULL, "IGS (Alta Co., LTD License)", "PolyGameMaster", L"Knights of Valour\0\u4E09\u56FD\u6226\u7D00\0\u4E09\u56FD\u6218\u7EAA (V100, Japan)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, kov100RomInfo, kov100RomName, NULL, NULL, pgmInputInfo, kov100DIPInfo, + NULL, kov100RomInfo, kov100RomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1349,7 +1256,7 @@ static struct BurnRomInfo kovplusRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 8 Samples - { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 9 Internal ARM7 Rom + { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 9 Internal ARM7 Rom }; STDROMPICKEXT(kovplus, kovplus, pgm) @@ -1360,7 +1267,7 @@ struct BurnDriver BurnDrvKovplus = { "Knights of Valour Plus - Sangoku Senki Plus (V119)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour Plus\0\u4E09\u56FD\u6226\u7D00 Plus\0\u4E09\u56FD\u6218\u7EAA Plus (V119)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, kovplusRomInfo, kovplusRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovplusRomInfo, kovplusRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1387,7 +1294,7 @@ static struct BurnRomInfo kovplusaRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 12 Samples - { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 13 Internal ARM7 Rom + { "kov_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 13 Internal ARM7 Rom }; STDROMPICKEXT(kovplusa, kovplusa, pgm) @@ -1398,7 +1305,7 @@ struct BurnDriver BurnDrvKovplusa = { "Knights of Valour Plus - Sangoku Senki Plus (V119 alt)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour Plus\0\u4E09\u56FD\u6226\u7D00 Plus\0\u4E09\u56FD\u6218\u7EAA Plus (V119 alt)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, kovplusaRomInfo, kovplusaRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovplusaRomInfo, kovplusaRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1407,7 +1314,7 @@ struct BurnDriver BurnDrvKovplusa = { // Knights of Valour Superheroes / Sangoku Senki Superheroes (V104, China) static struct BurnRomInfo kovshRomDesc[] = { - { "p0600.322", 0x400000, 0x7c78e5f3, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "p0600.322", 0x400000, 0x7c78e5f3, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "t0600.rom", 0x800000, 0x4acc1ad6, 2 | BRF_GRA }, // 1 Tile data @@ -1423,7 +1330,7 @@ static struct BurnRomInfo kovshRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 10 Samples - { "kovsh_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_ESS | BRF_PRG }, // 11 Internal ARM7 Rom + { "kovsh_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom }; STDROMPICKEXT(kovsh, kovsh, pgm) @@ -1446,7 +1353,7 @@ struct BurnDriver BurnDrvKovsh = { "Knights of Valour Superheroes / Sangoku Senki Superheroes (V104, China)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour Superheroes\0\u4E09\u56FD\u6218\u7EAA\0\u98CE\u4E91\u518D\u8D77 (V104, China)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, - NULL, kovshRomInfo, kovshRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovshRomInfo, kovshRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovshInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1455,7 +1362,7 @@ struct BurnDriver BurnDrvKovsh = { // Knights of Valour Superheroes / Sangoku Senki Superheroes (V103) static struct BurnRomInfo kovsh103RomDesc[] = { - { "p0600.103", 0x400000, 0xf0b3da82, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "p0600.103", 0x400000, 0xf0b3da82, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "t0600.rom", 0x800000, 0x4acc1ad6, 2 | BRF_GRA }, // 1 Tile data @@ -1471,7 +1378,7 @@ static struct BurnRomInfo kovsh103RomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 10 Samples - { "kovsh_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_ESS | BRF_PRG }, // 11 Internal ARM7 Rom + { "kovsh_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom }; STDROMPICKEXT(kovsh103, kovsh103, pgm) @@ -1482,7 +1389,7 @@ struct BurnDriver BurnDrvKovsh103 = { "Knights of Valour Superheroes / Sangoku Senki Superheroes (V103)\0", NULL, "IGS", "PolyGameMaster", NULL, NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, - NULL, kovsh103RomInfo, kovsh103RomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovsh103RomInfo, kovsh103RomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovshInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1555,7 +1462,7 @@ static struct BurnRomInfo photoy2k104RomDesc[] = { { "m0700.rom", 0x080000, 0xacc7afce, 5 | BRF_SND }, // 10 Samples - { "igs027a_photoy2k_v100_china_alt.asic", 0x004000, 0x6dd7f257, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom + { "igs027a_photoy2k_v100_china_alt.asic", 0x004000, 0x6dd7f257, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom }; STDROMPICKEXT(photoy2k104, photoy2k104, pgm) @@ -1594,7 +1501,7 @@ static struct BurnRomInfo photoy2k102RomDesc[] = { { "m0700.rom", 0x080000, 0xacc7afce, 5 | BRF_SND }, // 13 Samples - { "igs027a_photoy2k_v100_china_alt.asic", 0x0004000, 0x6dd7f257, 7 | BRF_PRG | BRF_ESS }, // 14 Internal ARM7 Rom + { "igs027a_photoy2k_v100_china_alt.asic", 0x0004000, 0x6dd7f257, 7 | BRF_PRG | BRF_ESS }, // 14 Internal ARM7 Rom }; STDROMPICKEXT(photoy2k102, photoy2k102, pgm) @@ -1605,7 +1512,7 @@ struct BurnDriver BurnDrvphotoy2k102 = { "Real and Fake\0Photo Y2K (V102, Japan)\0", NULL, "IGS", "PolyGameMaster", L"\u30EA\u30A2\u30EB\u30A2\u30F3\u30C9 \u30D5\u30A7\u30A4\u30AF\0Photo Y2K\0\u5927\u5BB6\u6765 \u627E\u78B4\0\u8D85\u7EA7 \u6BD4\u4E00\u6BD4 (V102, Japan)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_PUZZLE, 0, - NULL, photoy2k102RomInfo, photoy2k102RomName, NULL, NULL, pgmInputInfo, raf102jDIPInfo, + NULL, photoy2k102RomInfo, photoy2k102RomName, NULL, NULL, pgmInputInfo, photoy2kDIPInfo, photoy2kInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1625,7 +1532,7 @@ static struct BurnRomInfo puzlstarRomDesc[] = { { "m0800.u2", 0x400000, 0xe1a46541, 5 | BRF_SND }, // 5 Samples - { "puzlstar_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "puzlstar_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom }; STDROMPICKEXT(puzlstar, puzlstar, pgm) @@ -1645,7 +1552,7 @@ struct BurnDriver BurnDrvPuzlstar = { "Puzzle Star (V100MG)\0", "Incomplete dump", "IGS", "PolyGameMaster", L"Puzzle Star\0\u30D1\u30BA\u30EB\u30B9\u30BF\u30FC\0\u9B54\u5E7B\u661F\u5EA7 (V100MG)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_PUZZLE, 0, - NULL, puzlstarRomInfo, puzlstarRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, puzlstarRomInfo, puzlstarRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, puzlstarInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1665,7 +1572,7 @@ static struct BurnRomInfo puzzli2RomDesc[] = { { "m0900.u2", 0x400000, 0x9ea7af2e, 5 | BRF_SND }, // 5 Samples - { "puzzli2_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "puzzli2_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom }; STDROMPICKEXT(puzzli2, puzzli2, pgm) @@ -1711,7 +1618,7 @@ static struct BurnRomInfo martmastRomDesc[] = { { "m1000.u5", 0x800000, 0xed407ae8, 5 | BRF_SND }, // 9 Samples { "m1001.u7", 0x400000, 0x662d2d48, 5 | BRF_SND }, // 10 - { "martial_masters_v102_usa.asic", 0x004000, 0xa6c0828c, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom + { "martial_masters_v102_usa.asic", 0x004000, 0xa6c0828c, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom { "v102_16m.u10", 0x200000, 0x18b745e6, 8 | BRF_PRG | BRF_ESS }, // 12 External ARM7 Rom }; @@ -1761,7 +1668,7 @@ static struct BurnRomInfo martmastcRomDesc[] = { { "m1000.u5", 0x800000, 0xed407ae8, 5 | BRF_SND }, // 9 Samples { "m1001.u7", 0x400000, 0x662d2d48, 5 | BRF_SND }, // 10 - { "martial_masters_v101_cn.asic", 0x004000, 0xb3e25b7d, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom + { "martial_masters_v101_cn.asic", 0x004000, 0xb3e25b7d, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom { "v102_16m.u10", 0x200000, 0x18b745e6, 8 | BRF_PRG | BRF_ESS }, // 12 External ARM7 Rom }; @@ -1774,7 +1681,7 @@ struct BurnDriver BurnDrvmartmastc = { "Martial Masters (V104, 102, 101, China)\0", NULL, "IGS", "PolyGameMaster", L"Martial Masters\0\u5f62\u610f\u62f3 (V104, 102, 101, China)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_VSFIGHT, 0, - NULL, martmastcRomInfo, martmastcRomName, NULL, NULL, pgmInputInfo, martmastcDIPInfo, + NULL, martmastcRomInfo, martmastcRomName, NULL, NULL, pgmInputInfo, martmastDIPInfo, martmastInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -1799,7 +1706,7 @@ static struct BurnRomInfo martmastc102RomDesc[] = { { "m1000.u5", 0x800000, 0xed407ae8, 5 | BRF_SND }, // 9 Samples { "m1001.u7", 0x400000, 0x662d2d48, 5 | BRF_SND }, // 10 - { "martial_masters_v101_cn.asic", 0x004000, 0xb3e25b7d, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom + { "martial_masters_v101_cn.asic", 0x004000, 0xb3e25b7d, 7 | BRF_PRG | BRF_ESS }, // 11 Internal ARM7 Rom { "martmast_u10-v101.160", 0x200000, 0xd5d93294, 8 | BRF_PRG | BRF_ESS }, // 12 External ARM7 Rom }; @@ -1833,7 +1740,7 @@ static struct BurnRomInfo py2k2RomDesc[] = { { "y2k2_m1100.u3", 0x200000, 0xfb1515f8, 5 | BRF_SND }, // 7 Samples - { "igs027a_photoy2k2.asic", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom + { "igs027a_photoy2k2.asic", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom }; STDROMPICKEXT(py2k2, py2k2, pgm) @@ -1842,6 +1749,7 @@ STD_ROM_FN(py2k2) static INT32 py2k2Init() { pPgmInitCallback = pgm_decrypt_py2k2; + pPgmProtCallback = install_protection_asic27a_py2k2; // pPgmProtCallback = install_protection_asic27a_kovsh; return pgmInit(); @@ -1901,7 +1809,7 @@ struct BurnDriver BurnDrvKov2 = { "Knights of Valour 2 (V107, 102, 100, Hong Kong)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour 2\0\u4e09\u56fd\u6218\u7eaa 2 (V107, 102, 100, Hong Kong)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, - NULL, kov2RomInfo, kov2RomName, NULL, NULL, pgmInputInfo, kov2DIPInfo, + NULL, kov2RomInfo, kov2RomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kov2Init, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -2001,7 +1909,7 @@ static struct BurnRomInfo kov2102RomDesc[] = { { "kov2_v100_hongkong.asic", 0x004000, 0xe0d7679f, 7 | BRF_PRG | BRF_ESS }, // 10 Internal ARM7 Rom - { "u19.101", 0x200000, 0x8c35f2fe, 8 | BRF_PRG | BRF_ESS }, // 11 External ARM7 Rom + { "u19.101", 0x200000, 0x8c35f2fe, 8 | BRF_PRG | BRF_ESS }, // 11 External ARM7 Rom }; STDROMPICKEXT(kov2102, kov2102, pgm) @@ -2038,7 +1946,7 @@ static struct BurnRomInfo kov2101RomDesc[] = { { "kov2_v100_hongkong.asic", 0x004000, 0xe0d7679f, 7 | BRF_PRG | BRF_ESS }, // 10 Internal ARM7 Rom - { "u19.101", 0x200000, 0x8c35f2fe, 8 | BRF_PRG | BRF_ESS }, // 11 External ARM7 Rom + { "u19.101", 0x200000, 0x8c35f2fe, 8 | BRF_PRG | BRF_ESS }, // 11 External ARM7 Rom }; STDROMPICKEXT(kov2101, kov2101, pgm) @@ -2147,7 +2055,7 @@ struct BurnDriver BurnDrvKov2p = { "Knights of Valour 2 Plus - Nine Dragons (VM204XX)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour 2 Plus\0\u4e09\u56fd\u6218\u7eaa 2 - \u7fa4\u96c4\u4e89\u9738 (VM204XX)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, - NULL, kov2pRomInfo, kov2pRomName, NULL, NULL, pgmInputInfo, kov2DIPInfo, + NULL, kov2pRomInfo, kov2pRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kov2pInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -2184,7 +2092,7 @@ struct BurnDriver BurnDrvKov2p205 = { "Knights of Valour 2 Plus - Nine Dragons (VM205XX, China)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour 2 Plus\0\u4e09\u56fd\u6218\u7eaa 2 - \u7fa4\u96c4\u4e89\u9738 (VM205XX, China)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, - NULL, kov2p205RomInfo, kov2p205RomName, NULL, NULL, pgmInputInfo, kov2DIPInfo, + NULL, kov2p205RomInfo, kov2p205RomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kov2pInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -2238,7 +2146,7 @@ struct BurnDriver BurnDrvDdp2 = { // Bee Storm - DoDonPachi II (V100) static struct BurnRomInfo ddp2100RomDesc[] = { - { "v100.u8", 0x200000, 0x0c8aa8ea, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "v100.u8", 0x200000, 0x0c8aa8ea, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "t1300.u21", 0x800000, 0xe748f0cb, 2 | BRF_GRA }, // 1 Tile data @@ -2249,9 +2157,9 @@ static struct BurnRomInfo ddp2100RomDesc[] = { { "m1300.u5", 0x400000, 0x82d4015d, 5 | BRF_SND }, // 5 Samples - { "ddp2_igs027a_japan.bin", 0x004000, 0x742d34d2, 7 | BRF_PRG | BRF_ESS }, // 6 Internal ARM7 Rom + { "ddp2_igs027a_japan.bin", 0x004000, 0x742d34d2, 7 | BRF_PRG | BRF_ESS }, // 6 Internal ARM7 Rom - { "v100.u23", 0x020000, 0x06c3dd29, 8 | BRF_PRG | BRF_ESS }, // 7 External ARM7 Rom + { "v100.u23", 0x020000, 0x06c3dd29, 8 | BRF_PRG | BRF_ESS }, // 7 External ARM7 Rom }; STDROMPICKEXT(ddp2100, ddp2100, pgm) @@ -2315,9 +2223,9 @@ static struct BurnRomInfo dw2001RomDesc[] = { { "2001.u7", 0x200000, 0x4ea62f21, 5 | BRF_SND }, // 6 Samples - { "dw2001_igs027a_japan.bin", 0x004000, 0x3a79159b, 7 | BRF_PRG }, // 7 Internal ARM7 rom + { "dw2001_igs027a_japan.bin", 0x004000, 0x3a79159b, 7 | BRF_PRG }, // 7 Internal ARM7 rom - { "2001.u12", 0x080000, 0x973db1ab, 8 | BRF_PRG | BRF_ESS }, // 8 External ARM7 rom + { "2001.u12", 0x080000, 0x973db1ab, 8 | BRF_PRG | BRF_ESS }, // 8 External ARM7 rom }; STDROMPICKEXT(dw2001, dw2001, pgm) @@ -2328,7 +2236,11 @@ static INT32 dw2001Init() pPgmInitCallback = pgm_decrypt_martmast; pPgmProtCallback = install_protection_asic27a_martmast; - return pgmInit(); + INT32 nRet = pgmInit(); + + Arm7SetIdleLoopAddress(0x8000228); + + return nRet; } struct BurnDriverD BurnDrvDw2001 = { @@ -2356,9 +2268,9 @@ static struct BurnRomInfo dwpcRomDesc[] = { { "dwpc_v100jp.u7", 0x200000, 0x5cf9bada, 5 | BRF_SND }, // 6 Samples - { "dwpc_igs027a_japan.bin", 0x004000, 0x3a79159b, 7 | BRF_PRG }, // 7 Internal ARM7 rom + { "dwpc_igs027a_japan.bin", 0x004000, 0x3a79159b, 7 | BRF_PRG }, // 7 Internal ARM7 rom - { "dwpc_v100jp.u12", 0x080000, 0x0d112126, 8 | BRF_PRG | BRF_ESS }, // 8 External ARM7 rom + { "dwpc_v100jp.u12", 0x080000, 0x0d112126, 8 | BRF_PRG | BRF_ESS }, // 8 External ARM7 rom }; STDROMPICKEXT(dwpc, dwpc, pgm) @@ -2391,9 +2303,14 @@ static struct BurnRomInfo dmnfrntRomDesc[] = { { "w04501.u5", 0x800000, 0x3ab58137, 5 | BRF_SND }, // 7 Samples - { "dmnfrnt_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 8 Internal ARM7 Rom + { "dmnfrnt_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom - { "v105_32m.u26", 0x400000, 0xc798c2ef, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom +#if !defined ROM_VERIFY + { "v105_32m.u26", 0x400000, 0xc798c2ef, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom +#else + { "chinese-v105.u62", 0x400000, 0xc798c2ef, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom + { "v105_32m.u26", 0x400000, 0xd200ee63, 0 | BRF_PRG | BRF_OPT }, // 9 External ARM7 Rom +#endif }; STDROMPICKEXT(dmnfrnt, dmnfrnt, pgm) @@ -2441,7 +2358,7 @@ struct BurnDriver BurnDrvDmnfrnt = { "Demon Front (V105)\0", NULL, "IGS", "PolyGameMaster", L"Demon Front\0\u9B54\u57DF\u6218\u7EBF\0\u9B54\u57DF\u6230\u7DDA (V105)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_PLATFORM, 0, - NULL, dmnfrntRomInfo, dmnfrntRomName, NULL, NULL, pgmInputInfo, dmnfrntDIPInfo, + NULL, dmnfrntRomInfo, dmnfrntRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, dmnfrntInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -2463,7 +2380,7 @@ static struct BurnRomInfo dmnfrntaRomDesc[] = { { "w04501.u5", 0x800000, 0x3ab58137, 5 | BRF_SND }, // 7 Samples - { "dmnfrnt_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 8 Internal ARM7 Rom + { "dmnfrnt_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom { "v101_32m.u26", 0x400000, 0x93965281, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom }; @@ -2476,7 +2393,7 @@ struct BurnDriver BurnDrvdmnfrnta = { "Demon Front (V102, China)\0", NULL, "IGS", "PolyGameMaster", L"Demon Front\0\u9B54\u57DF\u6218\u7EBF\0\u9B54\u57DF\u6230\u7DDA (V102, China)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_PLATFORM, 0, - NULL, dmnfrntaRomInfo, dmnfrntaRomName, NULL, NULL, pgmInputInfo, dmnfrntDIPInfo, + NULL, dmnfrntaRomInfo, dmnfrntaRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, dmnfrntInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -2498,7 +2415,7 @@ static struct BurnRomInfo thegladRomDesc[] = { { "w04601.u1", 0x800000, 0x5f15ddb3, 5 | BRF_SND }, // 7 Samples - { "theglad_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 8 Internal ARM7 Rom + { "theglad_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom { "v107.u26", 0x200000, 0xf7c61357, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom }; @@ -2541,7 +2458,7 @@ static struct BurnRomInfo thegladaRomDesc[] = { { "w04601.u1", 0x800000, 0x5f15ddb3, 5 | BRF_SND }, // 7 Samples - { "theglad_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 8 Internal ARM7 Rom + { "theglad_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom { "u2.rom", 0x200000, 0xc7bcf2ae, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom @@ -2575,7 +2492,7 @@ static struct BurnRomInfo happy6RomDesc[] = { { "w01w64m.u17", 0x800000, 0x7e23e2be, 5 | BRF_SND }, // 5 Samples - { "happy6_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "happy6_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom { "happy6in1_v101cn.u26", 0x400000, 0x4a48ca1c, 8 | BRF_PRG | BRF_ESS }, // 7 External ARM7 Rom }; @@ -2605,7 +2522,7 @@ struct BurnDriverD BurnDrvhappy6 = { // Knights of Valour Super Heroes Plus / Sangoku Senki Super Heroes Plus (ver. 100) static struct BurnRomInfo kovshpRomDesc[] = { - { "p0600h.rom", 0x400000, 0xe251e8e4, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "p0600h.rom", 0x400000, 0xe251e8e4, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "t0600.rom", 0x800000, 0x4acc1ad6, 2 | BRF_GRA }, // 1 Tile data @@ -2619,7 +2536,7 @@ static struct BurnRomInfo kovshpRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 8 Samples - { "kovshp_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_ESS | BRF_PRG }, // 9 Internal ARM7 Rom + { "kovshp_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 9 Internal ARM7 Rom }; STDROMPICKEXT(kovshp, kovshp, pgm) @@ -2668,7 +2585,7 @@ struct BurnDriver BurnDrvkovshp = { "Knights of Valour Super Heroes Plus / Sangoku Senki Super Heroes Plus (ver. 100)\0", "Imperfect Protection Emulation", "IGS", "PolyGameMaster", L"Knights of Valour Super Heroes Plus\0\u4E09\u56FD\u6218\u7EAA\0\u4E71\u4E16\u67AD\u96C4 (ver. 100)\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, - NULL, kovshpRomInfo, kovshpRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovshpRomInfo, kovshpRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovshpInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -2691,7 +2608,7 @@ static struct BurnRomInfo oldsplusRomDesc[] = { { "m05301.rom", 0x400000, 0x86ec83bc, 5 | BRF_SND }, // 8 Samples - { "oldsplus_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 9 Internal ARM7 Rom + { "oldsplus_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 9 Internal ARM7 Rom }; STDROMPICKEXT(oldsplus, oldsplus, pgm) @@ -2711,7 +2628,7 @@ struct BurnDriver BurnDrvoldsplus = { "Oriental Legend Special Plus / Xi You Shi E Zhuan Super Plus (ver. 205)\0", "Incomplete Dump", "IGS", "PolyGameMaster", L"Oriental Legend Special Plus\0\u897F\u6E38\u91CA\u5384\u4F20 Plus\0", NULL, NULL, NULL, BDF_GAME_WORKING, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, oldsplusRomInfo, oldsplusRomName, NULL, NULL, pgmInputInfo, pgmDIPInfo, + NULL, oldsplusRomInfo, oldsplusRomName, NULL, NULL, pgmInputInfo, puzzli2DIPInfo, oldsplusInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -2782,7 +2699,7 @@ static struct BurnRomInfo svgRomDesc[] = { { "w05601b064.bin", 0x800000, 0xbfe61a71, 5 | BRF_SND }, // 8 Samples { "w05602b032.bin", 0x400000, 0x0685166d, 5 | BRF_SND }, // 9 - { "svg_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 10 Internal ARM7 Rom + { "svg_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 10 Internal ARM7 Rom { "u26.bin", 0x400000, 0x46826ec8, 8 | BRF_PRG | BRF_ESS }, // 11 External ARM7 Rom { "u29.bin", 0x400000, 0xfa5f3901, 8 | BRF_PRG | BRF_ESS }, // 12 @@ -2828,12 +2745,12 @@ static struct BurnRomInfo ddp3RomDesc[] = { { "m04401b032.u17", 0x400000, 0x5a0dbd76, 5 | BRF_SND }, // 5 Samples - { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom { "ddp3_defaults.nv", 0x020000, 0x571e96c0, 0 | BRF_OPT }, // 7 NV RAM }; -STDROMPICKEXT(ddp3, ddp3, ddp3Bios) /* custom bios */ +STDROMPICKEXT(ddp3, ddp3, ddp3Bios) // custom bios STD_ROM_FN(ddp3) static INT32 ddp3Init() @@ -2869,12 +2786,12 @@ static struct BurnRomInfo ddp3aRomDesc[] = { { "m04401b032.u17", 0x400000, 0x5a0dbd76, 5 | BRF_SND }, // 5 Samples - { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom { "ddp3_defaults.nv", 0x020000, 0x571e96c0, 0 | BRF_OPT }, // 7 NV RAM }; -STDROMPICKEXT(ddp3a, ddp3a, ddp3Bios) /* custom bios */ +STDROMPICKEXT(ddp3a, ddp3a, ddp3Bios) // custom bios STD_ROM_FN(ddp3a) struct BurnDriver BurnDrvDdp3a = { @@ -2902,12 +2819,12 @@ static struct BurnRomInfo ddp3bRomDesc[] = { { "m04401b032.u17", 0x400000, 0x5a0dbd76, 5 | BRF_SND }, // 5 Samples - { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom { "ddp3_defaults.nv", 0x020000, 0x571e96c0, 0 | BRF_OPT }, // 7 NV RAM }; -STDROMPICKEXT(ddp3b, ddp3b, ddp3Bios) /* custom bios */ +STDROMPICKEXT(ddp3b, ddp3b, ddp3Bios) // custom bios STD_ROM_FN(ddp3b) struct BurnDriver BurnDrvDdp3b = { @@ -2935,12 +2852,12 @@ static struct BurnRomInfo ddp3blkRomDesc[] = { { "m04401b032.u17", 0x400000, 0x5a0dbd76, 5 | BRF_SND }, // 5 Samples - { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "ddp3_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom { "ddp3blk_defaults.nv", 0x020000, 0xa1651904, 0 | BRF_OPT }, // 7 NV RAM (patch below instead) }; -STDROMPICKEXT(ddp3blk, ddp3blk, ddp3Bios) /* custom bios */ +STDROMPICKEXT(ddp3blk, ddp3blk, ddp3Bios) // custom bios STD_ROM_FN(ddp3blk) static void ddp3blkPatchRAM() @@ -2993,12 +2910,12 @@ static struct BurnRomInfo ketRomDesc[] = { { "m04701b032.u17", 0x400000, 0xb46e22d1, 5 | BRF_SND }, // 5 Samples - { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 6 Internal ARM7 Rom + { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom { "ket_defaults.nv", 0x020000, 0x3ca892d8, 0 | BRF_OPT }, // 7 NV RAM }; -STDROMPICKEXT(ket, ket, ketsuiBios) /* custom bios */ +STDROMPICKEXT(ket, ket, ketsuiBios) // custom bios STD_ROM_FN(ket) static INT32 ketsuiInit() @@ -3023,23 +2940,23 @@ struct BurnDriver BurnDrvKet = { // Ketsui Kizuna Jigoku Tachi (Revision 1?, Japan) static struct BurnRomInfo ketaRomDesc[] = { - { "ketsui_prg_revised.bin", 0x200000, 0x69fcf5eb, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "ketsui_prg_revised.bin", 0x200000, 0x69fcf5eb, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "t04701w064.u19", 0x800000, 0x2665b041, 2 | BRF_GRA }, // 1 Tile data + { "t04701w064.u19", 0x800000, 0x2665b041, 2 | BRF_GRA }, // 1 Tile data - { "a04701w064.u7", 0x800000, 0x5ef1b94b, 3 | BRF_GRA }, // 2 Sprite Color Data - { "a04702w064.u8", 0x800000, 0x26d6da7f, 3 | BRF_GRA }, // 3 + { "a04701w064.u7", 0x800000, 0x5ef1b94b, 3 | BRF_GRA }, // 2 Sprite Color Data + { "a04702w064.u8", 0x800000, 0x26d6da7f, 3 | BRF_GRA }, // 3 - { "b04701w064.u1", 0x800000, 0x1bec008d, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes + { "b04701w064.u1", 0x800000, 0x1bec008d, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes - { "m04701b032.u17", 0x400000, 0xb46e22d1, 5 | BRF_SND }, // 5 Samples + { "m04701b032.u17", 0x400000, 0xb46e22d1, 5 | BRF_SND }, // 5 Samples - { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP },// 6 Internal ARM7 Rom + { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom - { "ket_defaults.nv", 0x020000, 0x3ca892d8, 0 | BRF_OPT }, // 7 NV RAM + { "ket_defaults.nv", 0x020000, 0x3ca892d8, 0 | BRF_OPT }, // 7 NV RAM }; -STDROMPICKEXT(keta, keta, ketsuiBios) /* custom bios */ +STDROMPICKEXT(keta, keta, ketsuiBios) // custom bios STD_ROM_FN(keta) struct BurnDriver BurnDrvKeta = { @@ -3056,23 +2973,23 @@ struct BurnDriver BurnDrvKeta = { // Ketsui Kizuna Jigoku Tachi (Original?, Japan) static struct BurnRomInfo ketbRomDesc[] = { - { "ketsui_prg_original.bin", 0x200000, 0xcca5e153, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "ketsui_prg_original.bin", 0x200000, 0xcca5e153, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "t04701w064.u19", 0x800000, 0x2665b041, 2 | BRF_GRA }, // 1 Tile data + { "t04701w064.u19", 0x800000, 0x2665b041, 2 | BRF_GRA }, // 1 Tile data - { "a04701w064.u7", 0x800000, 0x5ef1b94b, 3 | BRF_GRA }, // 2 Sprite Color Data - { "a04702w064.u8", 0x800000, 0x26d6da7f, 3 | BRF_GRA }, // 3 + { "a04701w064.u7", 0x800000, 0x5ef1b94b, 3 | BRF_GRA }, // 2 Sprite Color Data + { "a04702w064.u8", 0x800000, 0x26d6da7f, 3 | BRF_GRA }, // 3 - { "b04701w064.u1", 0x800000, 0x1bec008d, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes + { "b04701w064.u1", 0x800000, 0x1bec008d, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes - { "m04701b032.u17", 0x400000, 0xb46e22d1, 5 | BRF_SND }, // 5 Samples + { "m04701b032.u17", 0x400000, 0xb46e22d1, 5 | BRF_SND }, // 5 Samples - { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP },// 6 Internal ARM7 Rom + { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom - { "ket_defaults.nv", 0x020000, 0x3ca892d8, 0 | BRF_OPT }, // 7 NV RAM + { "ket_defaults.nv", 0x020000, 0x3ca892d8, 0 | BRF_OPT }, // 7 NV RAM }; -STDROMPICKEXT(ketb, ketb, ketsuiBios) /* custom bios */ +STDROMPICKEXT(ketb, ketb, ketsuiBios) // custom bios STD_ROM_FN(ketb) struct BurnDriver BurnDrvKetb = { @@ -3089,23 +3006,23 @@ struct BurnDriver BurnDrvKetb = { // Ketsui Kizuna Jigoku Tachi (Arrange Mode version 1.0, hack by Trap15) static struct BurnRomInfo kethRomDesc[] = { - { "ketsui_v100h.u38", 0x200000, 0xd4c7a8ab, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "ketsui_v100h.u38", 0x200000, 0xd4c7a8ab, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "t04701w064.u19", 0x800000, 0x2665b041, 2 | BRF_GRA }, // 1 Tile data + { "t04701w064.u19", 0x800000, 0x2665b041, 2 | BRF_GRA }, // 1 Tile data - { "a04701w064.u7", 0x800000, 0x5ef1b94b, 3 | BRF_GRA }, // 2 Sprite Color Data - { "a04702w064.u8", 0x800000, 0x26d6da7f, 3 | BRF_GRA }, // 3 + { "a04701w064.u7", 0x800000, 0x5ef1b94b, 3 | BRF_GRA }, // 2 Sprite Color Data + { "a04702w064.u8", 0x800000, 0x26d6da7f, 3 | BRF_GRA }, // 3 - { "b04701w064.u1", 0x800000, 0x1bec008d, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes + { "b04701w064.u1", 0x800000, 0x1bec008d, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes - { "m04701b032.u17", 0x400000, 0xb46e22d1, 5 | BRF_SND }, // 5 Samples + { "m04701b032.u17", 0x400000, 0xb46e22d1, 5 | BRF_SND }, // 5 Samples - { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP },// 6 Internal ARM7 Rom + { "ket_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom - { "ket_defaults.nv", 0x020000, 0x3ca892d8, 0 | BRF_OPT }, // 7 NV RAM + { "ket_defaults.nv", 0x020000, 0x3ca892d8, 0 | BRF_OPT }, // 7 NV RAM }; -STDROMPICKEXT(keth, keth, ketsuiBios) /* custom bios */ +STDROMPICKEXT(keth, keth, ketsuiBios) // custom bios STD_ROM_FN(keth) struct BurnDriver BurnDrvketh = { @@ -3122,21 +3039,21 @@ struct BurnDriver BurnDrvketh = { // Espgaluda (V100, Japan) static struct BurnRomInfo espgalRomDesc[] = { - { "espgaluda_v100.u38", 0x200000, 0x08ecec34, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code + { "espgaluda_v100.u38", 0x200000, 0x08ecec34, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code - { "t04801w064.u19", 0x800000, 0x6021c79e, 2 | BRF_GRA }, // 1 Tile data + { "t04801w064.u19", 0x800000, 0x6021c79e, 2 | BRF_GRA }, // 1 Tile data - { "a04801w064.u7", 0x800000, 0x26dd4932, 3 | BRF_GRA }, // 2 Sprite Color Data - { "a04802w064.u8", 0x800000, 0x0e6bf7a9, 3 | BRF_GRA }, // 3 + { "a04801w064.u7", 0x800000, 0x26dd4932, 3 | BRF_GRA }, // 2 Sprite Color Data + { "a04802w064.u8", 0x800000, 0x0e6bf7a9, 3 | BRF_GRA }, // 3 - { "b04801w064.u1", 0x800000, 0x98dce13a, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes + { "b04801w064.u1", 0x800000, 0x98dce13a, 4 | BRF_GRA }, // 4 Sprite Masks & Color Indexes - { "w04801b032.u17", 0x400000, 0x60298536, 5 | BRF_SND }, // 5 Samples + { "w04801b032.u17", 0x400000, 0x60298536, 5 | BRF_SND }, // 5 Samples - { "espgal_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP },// 6 Internal ARM7 Rom + { "espgal_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 6 Internal ARM7 Rom }; -STDROMPICKEXT(espgal, espgal, espgalBios) /* custom bios */ +STDROMPICKEXT(espgal, espgal, espgalBios) // custom bios STD_ROM_FN(espgal) static INT32 espgalInit() @@ -3174,12 +3091,12 @@ static struct BurnRomInfo thegladpcbRomDesc[] = { { "w04601.u1", 0x800000, 0x5f15ddb3, 5 | BRF_SND }, // 7 Samples - { "theglad_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 8 Internal ARM7 Rom + { "theglad_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom { "igs.62", 0x200000, 0x0f3f511e, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom }; -STDROMPICKEXT(thegladpcb, thegladpcb, thegladBIOS) /* custom bios */ +STDROMPICKEXT(thegladpcb, thegladpcb, thegladBIOS) // custom bios STD_ROM_FN(thegladpcb) static INT32 thegladpcbInit() @@ -3222,12 +3139,12 @@ static struct BurnRomInfo dmnfrntpcbRomDesc[] = { { "w04501.u5", 0x800000, 0x3ab58137, 5 | BRF_SND }, // 7 Samples - { "dmnfrnt_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 8 Internal ARM7 Rom + { "dmnfrnt_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 8 Internal ARM7 Rom { "demonfront_v107-u62.bin", 0x400000, 0xcb94772e, 8 | BRF_PRG | BRF_ESS }, // 9 External ARM7 Rom }; -STDROMPICKEXT(dmnfrntpcb, dmnfrntpcb, dmnfrntBIOS) /* custom bios */ +STDROMPICKEXT(dmnfrntpcb, dmnfrntpcb, dmnfrntBIOS) // custom bios STD_ROM_FN(dmnfrntpcb) struct BurnDriverD BurnDrvDmnfrntpcb = { @@ -3259,13 +3176,13 @@ static struct BurnRomInfo svgpcbRomDesc[] = { { "w05601b064.bin", 0x800000, 0xbfe61a71, 5 | BRF_SND }, // 8 Samples { "w05602b032.bin", 0x400000, 0x0685166d, 5 | BRF_SND }, // 9 - { "svg_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 10 Internal ARM7 Rom + { "svg_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 10 Internal ARM7 Rom { "svg_v100jp.u64", 0x400000, 0x399d4a8b, 8 | BRF_PRG | BRF_ESS }, // 11 External ARM7 Rom { "svg_v100jp.u65", 0x400000, 0x6e1c33b1, 8 | BRF_PRG | BRF_ESS }, // 12 }; -STDROMPICKEXT(svgpcb, svgpcb, svgpcbBIOS) /* custom bios */ +STDROMPICKEXT(svgpcb, svgpcb, svgpcbBIOS) // custom bios STD_ROM_FN(svgpcb) static INT32 svgpcbInit() @@ -3382,7 +3299,7 @@ struct BurnDriver BurnDrvPgemeni = { // Knights of Valour: Quan Huang San Guo Special / Sangoku Senki: Quan Huang San Guo Special (ver. 303CN) static struct BurnRomInfo kovqhsgsRomDesc[] = { - { "qhsg_c51.rom", 0x0400000, 0xe5cbac85, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "qhsg_c51.rom", 0x0400000, 0xe5cbac85, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "lsqh2_t01.rom", 0x1000000, 0xd498d97f, 2 | BRF_GRA }, // 1 Tile data @@ -3394,7 +3311,7 @@ static struct BurnRomInfo kovqhsgsRomDesc[] = { { "lsqh2_m01.rom", 0x1000000, 0x01af1b65, 5 | BRF_SND }, // 6 Samples - { "qhsg_prot.c51", 0x0004000, 0x0f09a5c1, 7 | BRF_ESS | BRF_PRG }, // 7 Internal ARM7 Rom + { "qhsg_prot.c51", 0x0004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 7 Internal ARM7 Rom }; STDROMPICKEXT(kovqhsgs, kovqhsgs, pgm) @@ -3417,7 +3334,7 @@ struct BurnDriver BurnDrvkovqhsgs = { "Knights of Valour: Quan Huang San Guo Special / Sangoku Senki: Quan Huang San Guo Special (ver. 303CN)\0", NULL, "IGS", "PolyGameMaster", L"Knights of Valour: Quan Huang San Guo Special\0\u4E09\u56FD\u6218\u7EAA\0\u62F3\u7687\u4E09\u56FD\u7279\u522B\u7248 (ver. 303CN)\0", NULL, NULL, NULL, BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_IGS_PGM | HARDWARE_IGS_USE_ARM_CPU, GBF_SCRFIGHT, 0, - NULL, kovqhsgsRomInfo, kovqhsgsRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovqhsgsRomInfo, kovqhsgsRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovqhsgsInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -3426,7 +3343,7 @@ struct BurnDriver BurnDrvkovqhsgs = { // Knights of Valour: Luan Shi Quan Huang 2 / Sangoku Senki: Luan Shi Quan Huang 2 (ver. 200CN) static struct BurnRomInfo kovlsqh2RomDesc[] = { - { "lsqh2_prg.rom", 0x0400000, 0xd71e3d50, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "lsqh2_prg.rom", 0x0400000, 0xd71e3d50, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "lsqh2_t01.rom", 0x1000000, 0xd498d97f, 2 | BRF_GRA }, // 1 Tile data @@ -3438,7 +3355,11 @@ static struct BurnRomInfo kovlsqh2RomDesc[] = { { "lsqh2_m01.rom", 0x1000000, 0x01af1b65, 5 | BRF_SND }, // 6 Samples - { "lsqh2_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 7 Internal ARM7 Rom +#if !defined ROM_VERIFY + { "lsqh2_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 7 Internal ARM7 Rom +#else + { "kovsh_v100_china.asic", 0x0004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 7 Internal ARM7 Rom +#endif }; STDROMPICKEXT(kovlsqh2, kovlsqh2, pgm) @@ -3461,7 +3382,7 @@ struct BurnDriverD BurnDrvkovlsqh2 = { "Knights of Valour: Luan Shi Quan Huang 2 / Sangoku Senki: Luan Shi Quan Huang 2 (ver. 200CN)\0", "Incomplete dump", "IGS", "PolyGameMaster", NULL, NULL, NULL, NULL, BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU */, GBF_SCRFIGHT, 0, - NULL, kovlsqh2RomInfo, kovlsqh2RomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovlsqh2RomInfo, kovlsqh2RomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovlsqh2Init, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -3470,7 +3391,7 @@ struct BurnDriverD BurnDrvkovlsqh2 = { // Knights of Valour: Luan Shi Quan Huang 2 / Sangoku Senki: Luan Shi Quan Huang (ver. 200CN) static struct BurnRomInfo kovlsqhRomDesc[] = { - { "lsqh_v200cn.rom", 0x0400000, 0x9935a27a, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "lsqh_v200cn.rom", 0x0400000, 0x9935a27a, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "lsqh2_t01.rom", 0x1000000, 0xd498d97f, 2 | BRF_GRA }, // 1 Tile data @@ -3482,7 +3403,11 @@ static struct BurnRomInfo kovlsqhRomDesc[] = { { "lsqh2_m01.rom", 0x1000000, 0x01af1b65, 5 | BRF_SND }, // 6 Samples - { "lsqh_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 7 Internal ARM7 Rom +#if !defined ROM_VERIFY + { "lsqh_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 7 Internal ARM7 Rom +#else + { "kovsh_v100_china.asic", 0x0004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 7 Internal ARM7 Rom +#endif }; STDROMPICKEXT(kovlsqh, kovlsqh, pgm) @@ -3505,7 +3430,7 @@ struct BurnDriverD BurnDrvkovlsqh = { "Knights of Valour: Luan Shi Quan Huang / Sangoku Senki: Luan Shi Quan Huang (ver. 200CN)\0", "Incomplete dump", "IGS", "PolyGameMaster", NULL, NULL, NULL, NULL, BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU */, GBF_SCRFIGHT, 0, - NULL, kovlsqhRomInfo, kovlsqhRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovlsqhRomInfo, kovlsqhRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovlsqhInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -3514,7 +3439,7 @@ struct BurnDriverD BurnDrvkovlsqh = { // Knights of Valour: Luan Shi Jie Ba / Sangoku Senki: Luan Shi Jie Ba (ver. 200CN) static struct BurnRomInfo kovlsjbRomDesc[] = { - { "lsjb_prg.rom", 0x0400000, 0xadf06b37, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "lsjb_prg.rom", 0x0400000, 0xadf06b37, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "lsqh2_t01.rom", 0x1000000, 0xd498d97f, 2 | BRF_GRA }, // 1 Tile data @@ -3526,7 +3451,11 @@ static struct BurnRomInfo kovlsjbRomDesc[] = { { "lsqh2_m01.rom", 0x1000000, 0x01af1b65, 5 | BRF_SND }, // 6 Samples - { "lsjb_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 7 Internal ARM7 Rom +#if !defined ROM_VERIFY + { "lsjb_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 7 Internal ARM7 Rom +#else + { "kovsh_v100_china.asic", 0x0004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 7 Internal ARM7 Rom +#endif }; STDROMPICKEXT(kovlsjb, kovlsjb, pgm) @@ -3537,7 +3466,7 @@ struct BurnDriverD BurnDrvkovlsjb = { "Knights of Valour: Luan Shi Jie Ba / Sangoku Senki: Luan Shi Jie Ba (ver. 200CN)\0", NULL, "IGS", "PolyGameMaster", NULL, NULL, NULL, NULL, BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, kovlsjbRomInfo, kovlsjbRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovlsjbRomInfo, kovlsjbRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovlsqh2Init, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -3546,7 +3475,7 @@ struct BurnDriverD BurnDrvkovlsjb = { // Knights of Valour: Luan Shi Jie Ba / Sangoku Senki: Luan Shi Jie Ba (alt ver. 200CN) static struct BurnRomInfo kovlsjbaRomDesc[] = { - { "lsjba_prg.rom", 0x0400000, 0x8b42f456, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "lsjba_prg.rom", 0x0400000, 0x8b42f456, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "lsqh2_t01.rom", 0x1000000, 0xd498d97f, 2 | BRF_GRA }, // 1 Tile data @@ -3558,7 +3487,11 @@ static struct BurnRomInfo kovlsjbaRomDesc[] = { { "lsqh2_m01.rom", 0x1000000, 0x01af1b65, 5 | BRF_SND }, // 6 Samples - { "lsjba_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 7 Internal ARM7 Rom +#if !defined ROM_VERIFY + { "lsjba_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 7 Internal ARM7 Rom +#else + { "kovsh_v100_china.asic", 0x0004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 7 Internal ARM7 Rom +#endif }; STDROMPICKEXT(kovlsjba, kovlsjba, pgm) @@ -3569,7 +3502,7 @@ struct BurnDriverD BurnDrvkovlsjba = { "Knights of Valour: Luan Shi Jie Ba / Sangoku Senki: Luan Shi Jie Ba (alt ver. 200CN)\0", "Incomplete dump", "IGS", "PolyGameMaster", NULL, NULL, NULL, NULL, BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_IGS_PGM/* | HARDWARE_IGS_USE_ARM_CPU*/, GBF_SCRFIGHT, 0, - NULL, kovlsjbaRomInfo, kovlsjbaRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovlsjbaRomInfo, kovlsjbaRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovlsqh2Init, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -3578,7 +3511,7 @@ struct BurnDriverD BurnDrvkovlsjba = { // Knights of Valour: Ao Shi San Guo / Sangoku Senki: Ao Shi San Guo (ver. 315CN) static struct BurnRomInfo kovassgRomDesc[] = { - { "assg_v315cn.rom", 0x0400000, 0xb9885d5c, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "assg_v315cn.rom", 0x0400000, 0xb9885d5c, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "lsqh2_t01.rom", 0x1000000, 0xd498d97f, 2 | BRF_GRA }, // 1 Tile data @@ -3590,7 +3523,7 @@ static struct BurnRomInfo kovassgRomDesc[] = { { "lsqh2_m01.rom", 0x1000000, 0x01af1b65, 5 | BRF_SND }, // 6 Samples - { "assg_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 7 Internal ARM7 Rom + { "assg_prot.c51", 0x0010000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 7 Internal ARM7 Rom }; STDROMPICKEXT(kovassg, kovassg, pgm) @@ -3613,7 +3546,7 @@ struct BurnDriverD BurnDrvkovassg = { "Knights of Valour: Ao Shi San Guo / Sangoku Senki: Ao Shi San Guo (ver. 315CN)\0", "Incomplete dump", "IGS", "PolyGameMaster", NULL, NULL, NULL, NULL, BDF_CLONE | BDF_BOOTLEG, 4, HARDWARE_IGS_PGM /* | HARDWARE_IGS_USE_ARM_CPU */, GBF_SCRFIGHT, 0, - NULL, kovassgRomInfo, kovassgRomName, NULL, NULL, pgmInputInfo, sangoDIPInfo, + NULL, kovassgRomInfo, kovassgRomName, NULL, NULL, pgmInputInfo, kovDIPInfo, kovassgInit, pgmExit, pgmFrame, pgmDraw, pgmScan, &nPgmPalRecalc, 0x900, 448, 224, 4, 3 }; @@ -3622,21 +3555,21 @@ struct BurnDriverD BurnDrvkovassg = { // Knights of Valour: Ao Shi San Guo / Sangoku Senki: Ao Shi San Guo (ver. 202CN) static struct BurnRomInfo kovassgaRomDesc[] = { - { "assg_v202cn.rom", 0x400000, 0x3b7b627f, 1 | BRF_ESS | BRF_PRG }, // 0 68K Code + { "assg_v202cn.rom", 0x400000, 0x3b7b627f, 1 | BRF_PRG | BRF_ESS }, // 0 68K Code { "t0600.rom", 0x800000, 0x4acc1ad6, 2 | BRF_GRA }, // 1 Tile data { "a0600.rom", 0x800000, 0xd8167834, 3 | BRF_GRA }, // 2 Sprite Color Data { "a0601.rom", 0x800000, 0xff7a4373, 3 | BRF_GRA }, // 3 { "a0602.rom", 0x800000, 0xe7a32959, 3 | BRF_GRA }, // 4 - { "a0603as.rom", 0x800000, 0x7057b37e, 3 | BRF_GRA }, // 5 + { "a0603as.rom", 0x800000, 0x7057b37e, 3 | BRF_GRA }, // 5 { "b0600.rom", 0x800000, 0x7d3cd059, 4 | BRF_GRA }, // 6 Sprite Masks & Color Indexes - { "b0601as.rom", 0x800000, 0x3784fb49, 4 | BRF_GRA }, // 7 + { "b0601as.rom", 0x800000, 0x3784fb49, 4 | BRF_GRA }, // 7 { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 8 Samples - { "kovassga_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_ESS | BRF_PRG }, // 9 Internal ARM7 Rom + { "kovassga_v100_china.asic", 0x004000, 0x0f09a5c1, 7 | BRF_PRG | BRF_ESS }, // 9 Internal ARM7 Rom }; STDROMPICKEXT(kovassga, kovassga, pgm) @@ -3682,7 +3615,7 @@ static struct BurnRomInfo kovsgqyzRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 12 Samples - { "kovsgqyz_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 13 Internal ARM7 Rom + { "kovsgqyz_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 13 Internal ARM7 Rom }; STDROMPICKEXT(kovsgqyz, kovsgqyz, pgm) @@ -3723,7 +3656,7 @@ static struct BurnRomInfo kovsgqyzaRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 12 Samples - { "kovsgqyza_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 13 Internal ARM7 Rom + { "kovsgqyza_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 13 Internal ARM7 Rom }; STDROMPICKEXT(kovsgqyza, kovsgqyza, pgm) @@ -3757,7 +3690,7 @@ static struct BurnRomInfo kovsgqyzbRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 12 Samples - { "kovsgqyzb_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 13 Internal ARM7 Rom + { "kovsgqyzb_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 13 Internal ARM7 Rom }; STDROMPICKEXT(kovsgqyzb, kovsgqyzb, pgm) @@ -3791,7 +3724,7 @@ static struct BurnRomInfo kovsgqyzcRomDesc[] = { { "m0600.rom", 0x400000, 0x3ada4fd6, 5 | BRF_SND }, // 12 Samples - { "kovsgqyzb_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_NODUMP }, // 13 Internal ARM7 Rom + { "kovsgqyzb_igs027a.bin", 0x004000, 0x00000000, 7 | BRF_PRG | BRF_ESS | BRF_NODUMP }, // 13 Internal ARM7 Rom }; STDROMPICKEXT(kovsgqyzc, kovsgqyzc, pgm) diff --git a/src/burn/drv/pgm/pgm.h b/src/burn/drv/pgm/pgm.h index 98f1371eb..754761cd3 100644 --- a/src/burn/drv/pgm/pgm.h +++ b/src/burn/drv/pgm/pgm.h @@ -77,6 +77,7 @@ void install_protection_asic27a_ketsui(); void install_protection_asic27a_ddp3(); void install_protection_asic27a_puzzli2(); void install_protection_asic27a_kovshp(); +void install_protection_asic27a_py2k2(); // pgm_crypt void pgm_decrypt_kov(); diff --git a/src/burn/drv/pgm/pgm_crypt.cpp b/src/burn/drv/pgm/pgm_crypt.cpp index 69979da11..3f5ca65b0 100644 --- a/src/burn/drv/pgm/pgm_crypt.cpp +++ b/src/burn/drv/pgm/pgm_crypt.cpp @@ -1,4 +1,4 @@ -/* IGS PGM System Encryptions */ +// IGS PGM System Encryptions #include "pgm.h" #include "bitswap.h" @@ -134,7 +134,7 @@ void pgm_decrypt_kovsh() } } -static const UINT8 kovshp_tab[256] = { // IGS0009rd1040219 +static const UINT8 kovshp_tab[256] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x30, 0x39, 0x72, 0x64, 0x31, 0x30, 0x34, 0x30, 0x32, 0x31, 0x39, 0xf9, 0x8c, 0xbd, 0x87, 0x16, 0x07, 0x39, 0xeb, 0x29, 0x9e, 0x17, 0xef, 0x4f, 0x64, 0x7c, 0xe0, 0x5f, 0x73, 0x5b, 0xa1, 0x5e, 0x95, 0x0d, 0xf1, 0x40, 0x36, 0x2f, 0x00, 0xe2, 0x8a, 0xbc, 0x32, @@ -297,7 +297,7 @@ void pgm_decrypt_puzzli2() } } -static const UINT8 oldsplus_tab[256] = { // IGS0013RD1040727 +static const UINT8 oldsplus_tab[256] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x31, 0x33, 0x52, 0x44, 0x31, 0x30, 0x34, 0x30, 0x37, 0x32, 0x37, 0xf5, 0x79, 0x6d, 0xab, 0x04, 0x22, 0x51, 0x96, 0xf2, 0x72, 0xe8, 0x3a, 0x96, 0xd2, 0x9a, 0xcc, 0x3f, 0x47, 0x3c, 0x09, 0xf2, 0xd9, 0x72, 0x41, 0xe6, 0x44, 0x43, 0xa7, 0x3e, 0xe2, 0xfd, 0xd8, @@ -379,7 +379,7 @@ void pgm_decrypt_py2k2() // and ddp3 } } -static const UINT8 ketsui_tab[256] = { // IGS0004RD1021015 +static const UINT8 ketsui_tab[256] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x30, 0x34, 0x52, 0x44, 0x31, 0x30, 0x32, 0x31, 0x30, 0x31, 0x35, 0x7c, 0x49, 0x27, 0xa5, 0xff, 0xf6, 0x98, 0x2d, 0x0f, 0x3d, 0x12, 0x23, 0xe2, 0x30, 0x50, 0xcf, 0xf1, 0x82, 0xf0, 0xce, 0x48, 0x44, 0x5b, 0xf3, 0x0d, 0xdf, 0xf8, 0x5d, 0x50, 0x53, 0x91, 0xd9, @@ -407,7 +407,7 @@ void pgm_decrypt_ketsui() if ((i & 0x040480) != 0x000080) x ^= 0x0001; if ((i & 0x004008) == 0x004008) x ^= 0x0002; - if ((i & 0x080030) == 0x000010) x ^= 0x0004; // due to address starting at 0 and not 100000/2! + if ((i & 0x080030) == 0x000010) x ^= 0x0004; // address starts at 0 and not 100000/2! if ((i & 0x000042) != 0x000042) x ^= 0x0008; if ((i & 0x008100) == 0x008000) x ^= 0x0010; if ((i & 0x002004) != 0x000004) x ^= 0x0020; @@ -420,7 +420,7 @@ void pgm_decrypt_ketsui() } } -static const UINT8 espgal_tab[256] = { // IGS0007RD1030909 +static const UINT8 espgal_tab[256] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x30, 0x37, 0x52, 0x44, 0x31, 0x30, 0x33, 0x30, 0x39, 0x30, 0x39, 0xa7, 0xf1, 0x0a, 0xca, 0x69, 0xb2, 0xce, 0x86, 0xec, 0x3d, 0xa2, 0x5a, 0x03, 0xe9, 0xbf, 0xba, 0xf7, 0xd5, 0xec, 0x68, 0x03, 0x90, 0x15, 0xcc, 0x0d, 0x08, 0x2d, 0x76, 0xa5, 0xb5, 0x41, 0xf1, @@ -508,12 +508,12 @@ void pgm_decrypt_svgpcb() UINT16 x = BURN_ENDIAN_SWAP_INT16(src[i]); // preliminary! - if ((i & 0x040080) != 0x000080) x ^= 0x0001; // ok? + if ((i & 0x040080) != 0x000080) x ^= 0x0001; if ((i & 0x084008) == 0x084008) x ^= 0x0002; if ((i & 0x080030) == 0x080010) x ^= 0x0004; - if ((i & 0x000242) != 0x000042) x ^= 0x0008; // ok? - if ((i & 0x048100) == 0x048000) x ^= 0x0010; // - if ((i & 0x022004) != 0x000004) x ^= 0x0020; // ok? + if ((i & 0x000242) != 0x000042) x ^= 0x0008; + if ((i & 0x048100) == 0x048000) x ^= 0x0010; + if ((i & 0x022004) != 0x000004) x ^= 0x0020; if ((i & 0x011800) != 0x010000) x ^= 0x0040; if ((i & 0x000820) == 0x000820) x ^= 0x0080; @@ -725,7 +725,7 @@ void pgm_decrypt_kov2p() } } -static const UINT8 theglad_tab[256] = { // IGS0005RD1021203 +static const UINT8 theglad_tab[256] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x30, 0x35, 0x52, 0x44, 0x31, 0x30, 0x32, 0x31, 0x32, 0x30, 0x33, 0xc4, 0xa3, 0x46, 0x78, 0x30, 0xb3, 0x8b, 0xd5, 0x2f, 0xc4, 0x44, 0xbf, 0xdb, 0x76, 0xdb, 0xea, 0xb4, 0xeb, 0x95, 0x4d, 0x15, 0x21, 0x99, 0xa1, 0xd7, 0x8c, 0x40, 0x1d, 0x43, 0xf3, 0x9f, 0x71, @@ -766,7 +766,7 @@ void pgm_decrypt_theglad() } } -static const UINT8 killbldp_tab[] = { // IGS0024RD1050908 +static const UINT8 killbldp_tab[] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x32, 0x34, 0x52, 0x44, 0x31, 0x30, 0x35, 0x30, 0x39, 0x30, 0x38, 0x12, 0xa0, 0xd1, 0x9e, 0xb1, 0x8a, 0xfb, 0x1f, 0x50, 0x51, 0x4b, 0x81, 0x28, 0xda, 0x5f, 0x41, 0x78, 0x6c, 0x7a, 0xf0, 0xcd, 0x6b, 0x69, 0x14, 0x94, 0x55, 0xb6, 0x42, 0xdf, 0xfe, 0x10, 0x79, @@ -807,7 +807,7 @@ void pgm_decrypt_killbldp() } } -static const UINT8 happy6in1_tab[256] = { // IGS0008RD1031215 +static const UINT8 happy6in1_tab[256] = { 0x49, 0x47, 0x53, 0x30, 0x30, 0x30, 0x38, 0x52, 0x44, 0x31, 0x30, 0x33, 0x31, 0x32, 0x31, 0x35, 0x14, 0xd6, 0x37, 0x5c, 0x5e, 0xc3, 0xd3, 0x62, 0x96, 0x3d, 0xfb, 0x47, 0xf0, 0xcb, 0xbf, 0xb0, 0x60, 0xa1, 0xc2, 0x3d, 0x90, 0xd0, 0x58, 0x56, 0x22, 0xac, 0xdd, 0x39, 0x27, 0x7e, 0x58, 0x44, diff --git a/src/burn/drv/pgm/pgm_prot.cpp b/src/burn/drv/pgm/pgm_prot.cpp index a051036e8..d2a7f900f 100644 --- a/src/burn/drv/pgm/pgm_prot.cpp +++ b/src/burn/drv/pgm/pgm_prot.cpp @@ -2,26 +2,661 @@ #include "pgm.h" #include "bitswap.h" -static UINT8 *USER1; -static UINT16 *sharedprotram; +//------------------------------------------------------------------------------------------------------------------- +// Proper emulation +//------------------------------------------------------------------------------------------------------------------- -static INT32 ptr; +//----------------------------------- +// kov2, kov2p, Martmast, ddp2, dw2001, dwpc -INT32 pstarsScan(INT32 nAction,INT32 *); -INT32 killbldScan(INT32 nAction,INT32 *); -INT32 kov_asic27Scan(INT32 nAction,INT32 *); -INT32 asic3Scan(INT32 nAction,INT32 *); -INT32 asic27aScan(INT32 nAction,INT32 *); -INT32 oldsScan(INT32 nAction, INT32 *); -INT32 oldsplus_asic27aScan(INT32 nAction, INT32 *); -INT32 kovsh_asic27aScan(INT32 nAction,INT32 *); -INT32 svg_asic27aScan(INT32 nAction,INT32 *); -INT32 ddp3Scan(INT32 nAction, INT32 *); +static UINT8 asic27a_to_arm = 0; +static UINT8 asic27a_to_68k = 0; -//----------------------------------------------------------------------------------------------------- -// ASIC3 - Oriental Legends +static inline void pgm_cpu_sync() +{ + INT32 nCycles = SekTotalCycles() - Arm7TotalCycles(); -static UINT8 asic3_reg, asic3_latch[3], asic3_x, asic3_y, asic3_z, asic3_h1, asic3_h2; + if (nCycles > 0) { + Arm7Run(nCycles); + } +} + +static void __fastcall asic27a_write_byte(UINT32 address, UINT8 data) +{ + if ((address & 0xfffffe) == 0xd10000) { // ddp2 + pgm_cpu_sync(); + asic27a_to_arm = data; + Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_ASSERT_LINE); + return; + } +} + +static void __fastcall asic27a_write_word(UINT32 address, UINT16 data) +{ + if ((address & 0xfffffe) == 0xd10000) { + pgm_cpu_sync(); + asic27a_to_arm = data & 0xff; + Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_ASSERT_LINE); + return; + } +} + +static UINT8 __fastcall asic27a_read_byte(UINT32 address) +{ + if ((address & 0xfffffc) == 0xd10000) { + pgm_cpu_sync(); + return asic27a_to_68k; + } + + return 0; +} + +static UINT16 __fastcall asic27a_read_word(UINT32 address) +{ + if ((address & 0xfffffc) == 0xd10000) { + pgm_cpu_sync(); + return asic27a_to_68k; + } + + return 0; +} + +static void asic27a_arm7_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x38000000: + asic27a_to_68k = data; + return; + } +} + +static UINT8 asic27a_arm7_read_byte(UINT32 address) +{ + switch (address) + { + case 0x38000000: + Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_CLEAR_LINE); + return asic27a_to_arm; + } + + return 0; +} + +static INT32 asic27aScan(INT32 nAction,INT32 *) +{ + struct BurnArea ba; + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = PGMARMShareRAM; + ba.nLen = 0x0010000; + ba.nAddress = 0xd00000; + ba.szName = "ARM SHARE RAM"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM0; + ba.nLen = 0x0000400; + ba.nAddress = 0; + ba.szName = "ARM RAM 0"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM1; + ba.nLen = 0x0010000; + ba.nAddress = 0; + ba.szName = "ARM RAM 1"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM2; + ba.nLen = 0x0000400; + ba.nAddress = 0; + ba.szName = "ARM RAM 2"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + Arm7Scan(nAction); + + SCAN_VAR(asic27a_to_arm); + SCAN_VAR(asic27a_to_68k); + } + + return 0; +} + +void install_protection_asic27a_martmast() +{ + nPGMArm7Type = 2; + pPgmScanCallback = asic27aScan; + + SekOpen(0); + + SekMapMemory(PGMARMShareRAM, 0xd00000, 0xd0ffff, SM_RAM); + + SekMapHandler(4, 0xd10000, 0xd10003, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_read_word); + SekSetReadByteHandler(4, asic27a_read_byte); + SekSetWriteWordHandler(4, asic27a_write_word); + SekSetWriteByteHandler(4, asic27a_write_byte); + SekClose(); + + Arm7Init(1); + Arm7Open(0); + Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); + Arm7MapMemory(PGMUSER0, 0x08000000, 0x08000000+(nPGMExternalARMLen-1), ARM7_ROM); + Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); + Arm7MapMemory(PGMARMRAM1, 0x18000000, 0x1800ffff, ARM7_RAM); + Arm7MapMemory(PGMARMShareRAM, 0x48000000, 0x4800ffff, ARM7_RAM); + Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); + Arm7SetWriteByteHandler(asic27a_arm7_write_byte); + Arm7SetReadByteHandler(asic27a_arm7_read_byte); + Arm7Close(); +} + + +//--------------------------------------------------------------- +// kovsh / photoy2k / photoy2k2 (XingXing) + +static UINT16 kovsh_highlatch_arm_w; +static UINT16 kovsh_lowlatch_arm_w; +static UINT16 kovsh_highlatch_68k_w; +static UINT16 kovsh_lowlatch_68k_w ; +static UINT32 kovsh_counter; + +static void __fastcall kovsh_asic27a_write_word(UINT32 address, UINT16 data) +{ + switch (address) + { + case 0x500000: + case 0x600000: + kovsh_lowlatch_68k_w = data; + return; + + case 0x500002: + case 0x600002: + kovsh_highlatch_68k_w = data; + return; + } +} + +static UINT16 __fastcall kovsh_asic27a_read_word(UINT32 address) +{ + if ((address & 0xffffc0) == 0x4f0000) { + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(PGMARMShareRAM + (address & 0x3e)))); + } + + switch (address) + { + case 0x500000: + case 0x600000: + pgm_cpu_sync(); + return kovsh_lowlatch_arm_w; + + case 0x500002: + case 0x600002: + pgm_cpu_sync(); + return kovsh_highlatch_arm_w; + } + + return 0; +} + +static void kovsh_asic27a_arm7_write_word(UINT32 address, UINT16 data) +{ + // written... but never read? + if ((address & 0xffffff80) == 0x50800000) { + *((UINT16*)(PGMARMShareRAM + ((address>>1) & 0x3e))) = BURN_ENDIAN_SWAP_INT16(data); + return; + } +} + +static void kovsh_asic27a_arm7_write_long(UINT32 address, UINT32 data) +{ + switch (address) + { + case 0x40000000: + { + kovsh_highlatch_arm_w = data >> 16; + kovsh_lowlatch_arm_w = data; + + kovsh_highlatch_68k_w = 0; + kovsh_lowlatch_68k_w = 0; + } + return; + } +} + +static UINT32 kovsh_asic27a_arm7_read_long(UINT32 address) +{ + switch (address) + { + case 0x40000000: + return (kovsh_highlatch_68k_w << 16) | (kovsh_lowlatch_68k_w); + + case 0x4000000c: + return kovsh_counter++; + } + + return 0; +} + +static void reset_kovsh_asic27a() +{ + kovsh_highlatch_arm_w = 0; + kovsh_lowlatch_arm_w = 0; + kovsh_highlatch_68k_w = 0; + kovsh_lowlatch_68k_w = 0; + kovsh_counter = 1; +} + +static INT32 kovsh_asic27aScan(INT32 nAction, INT32 *) +{ + struct BurnArea ba; + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = PGMARMShareRAM; + ba.nLen = 0x0000040; + ba.nAddress = 0x400000; + ba.szName = "ARM SHARE RAM"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM0; + ba.nLen = 0x0000400; + ba.nAddress = 0; + ba.szName = "ARM RAM 0"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM2; + ba.nLen = 0x0000400; + ba.nAddress = 0; + ba.szName = "ARM RAM 1"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + Arm7Scan(nAction); + + SCAN_VAR(kovsh_highlatch_arm_w); + SCAN_VAR(kovsh_lowlatch_arm_w); + SCAN_VAR(kovsh_highlatch_68k_w); + SCAN_VAR(kovsh_lowlatch_68k_w); + SCAN_VAR(kovsh_counter); + } + + return 0; +} + +void install_protection_asic27a_kovsh() +{ + nPGMArm7Type = 1; + pPgmScanCallback = kovsh_asic27aScan; + pPgmResetCallback = reset_kovsh_asic27a; + + SekOpen(0); + SekMapMemory(PGMARMShareRAM, 0x4f0000, 0x4f003f, SM_RAM); + + SekMapHandler(4, 0x500000, 0x600005, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, kovsh_asic27a_read_word); + SekSetWriteWordHandler(4, kovsh_asic27a_write_word); + SekClose(); + + Arm7Init(1); + Arm7Open(0); + Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); + Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); + Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); + Arm7SetWriteWordHandler(kovsh_asic27a_arm7_write_word); + Arm7SetWriteLongHandler(kovsh_asic27a_arm7_write_long); + Arm7SetReadLongHandler(kovsh_asic27a_arm7_read_long); + Arm7Close(); +} + +//------------------------------- +// Kovshp hack + +void __fastcall kovshp_asic27a_write_word(UINT32 address, UINT16 data) +{ + switch (address & 6) + { + case 0: + kovsh_lowlatch_68k_w = data; + return; + + case 2: + { + unsigned char asic_key = data >> 8; + unsigned char asic_cmd = (data & 0xff) ^ asic_key; + + switch (asic_cmd) // Intercept commands and translate them to those used by kovsh + { + case 0x9a: asic_cmd = 0x99; break; // kovassga + case 0xa6: asic_cmd = 0xa9; break; // kovassga + case 0xaa: asic_cmd = 0x56; break; // kovassga + case 0xf8: asic_cmd = 0xf3; break; // kovassga + + case 0x38: asic_cmd = 0xad; break; + case 0x43: asic_cmd = 0xca; break; + case 0x56: asic_cmd = 0xac; break; + case 0x73: asic_cmd = 0x93; break; + case 0x84: asic_cmd = 0xb3; break; + case 0x87: asic_cmd = 0xb1; break; + case 0x89: asic_cmd = 0xb6; break; + case 0x93: asic_cmd = 0x73; break; + case 0xa5: asic_cmd = 0xa9; break; + case 0xac: asic_cmd = 0x56; break; + case 0xad: asic_cmd = 0x38; break; + case 0xb1: asic_cmd = 0x87; break; + case 0xb3: asic_cmd = 0x84; break; + case 0xb4: asic_cmd = 0x90; break; + case 0xb6: asic_cmd = 0x89; break; + case 0xc5: asic_cmd = 0x8c; break; + case 0xca: asic_cmd = 0x43; break; + case 0xcc: asic_cmd = 0xf0; break; + case 0xd0: asic_cmd = 0xe0; break; + case 0xe0: asic_cmd = 0xd0; break; + case 0xe7: asic_cmd = 0x70; break; + case 0xed: asic_cmd = 0xcb; break; + case 0xf0: asic_cmd = 0xcc; break; + case 0xf1: asic_cmd = 0xf5; break; + case 0xf2: asic_cmd = 0xf1; break; + case 0xf4: asic_cmd = 0xf2; break; + case 0xf5: asic_cmd = 0xf4; break; + case 0xfc: asic_cmd = 0xc0; break; + case 0xfe: asic_cmd = 0xc3; break; + } + + kovsh_highlatch_68k_w = asic_cmd ^ (asic_key | (asic_key << 8)); + } + return; + } +} + +void install_protection_asic27a_kovshp() +{ + nPGMArm7Type = 1; + pPgmScanCallback = kovsh_asic27aScan; + + SekOpen(0); + SekMapMemory(PGMARMShareRAM, 0x4f0000, 0x4f003f, SM_RAM); + + SekMapHandler(4, 0x500000, 0x600005, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, kovsh_asic27a_read_word); + SekSetWriteWordHandler(4, kovshp_asic27a_write_word); + SekClose(); + + Arm7Init(1); + Arm7Open(0); + Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); + Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); + Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); + Arm7SetWriteWordHandler(kovsh_asic27a_arm7_write_word); + Arm7SetWriteLongHandler(kovsh_asic27a_arm7_write_long); + Arm7SetReadLongHandler(kovsh_asic27a_arm7_read_long); + Arm7Close(); +} + +//------------------------------------------------------------------------------------------- +// svg / dmnfrnt / theglad / killbld / Happy6 + +static UINT8 svg_ram_sel = 0; +static UINT8 *svg_ram[2]; + +static void svg_set_ram_bank(INT32 data) +{ + svg_ram_sel = data & 1; + Arm7MapMemory(svg_ram[svg_ram_sel], 0x38000000, 0x3801ffff, ARM7_RAM); + SekMapMemory(svg_ram[svg_ram_sel^1], 0x500000, 0x51ffff, SM_FETCH); +} + +static void __fastcall svg_write_byte(UINT32 address, UINT8 data) +{ + pgm_cpu_sync(); + + if ((address & 0xffe0000) == 0x0500000) { + svg_ram[svg_ram_sel^1][(address & 0x1ffff)^1] = data; + return; + } + + switch (address) + { + case 0x5c0000: + case 0x5c0001: + Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_HOLD_LINE); + return; + } +} + +static void __fastcall svg_write_word(UINT32 address, UINT16 data) +{ + pgm_cpu_sync(); + + if ((address & 0xffe0000) == 0x0500000) { + *((UINT16*)(svg_ram[svg_ram_sel^1] + (address & 0x1fffe))) = BURN_ENDIAN_SWAP_INT16(data); + + return; + } + + switch (address) + { + case 0x5c0000: + Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_HOLD_LINE); + return; + + case 0x5c0300: + asic27a_to_arm = data; + return; + } +} + +static UINT8 __fastcall svg_read_byte(UINT32 address) +{ + if ((address & 0xffe0000) == 0x0500000) { + pgm_cpu_sync(); + + INT32 d = svg_ram[svg_ram_sel^1][(address & 0x1ffff)^1]; + return d; + } + + switch (address) + { + case 0x5c0000: + case 0x5c0001: + return 0; + } + + return 0; +} + +static UINT16 __fastcall svg_read_word(UINT32 address) +{ + if ((address & 0xffe0000) == 0x0500000) { + pgm_cpu_sync(); + + return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(svg_ram[svg_ram_sel^1] + (address & 0x1fffe)))); + } + + switch (address) + { + case 0x5c0000: + case 0x5c0001: + return 0; + + case 0x5c0300: + pgm_cpu_sync(); + return asic27a_to_68k; + } + + return 0; +} + +static void svg_arm7_write_byte(UINT32 address, UINT8 data) +{ + switch (address) + { + case 0x40000018: + svg_set_ram_bank(data); + return; + + case 0x48000000: + asic27a_to_68k = data; + return; + } +} + +static void svg_arm7_write_word(UINT32 /*address*/, UINT16 /*data*/) +{ + +} + +static void svg_arm7_write_long(UINT32 address, UINT32 data) +{ + switch (address) + { + case 0x40000018: + svg_set_ram_bank(data); + return; + + case 0x48000000: + asic27a_to_68k = data; + return; + } +} + +static UINT8 svg_arm7_read_byte(UINT32 address) +{ + switch (address) + { + case 0x48000000: + case 0x48000001: + case 0x48000002: + case 0x48000003: + return asic27a_to_arm; + } + + return 0; +} + +static UINT16 svg_arm7_read_word(UINT32 address) +{ + switch (address) + { + case 0x48000000: + case 0x48000002: + return asic27a_to_arm; + } + + return 0; +} + +static UINT32 svg_arm7_read_long(UINT32 address) +{ + switch (address) + { + case 0x48000000: + return asic27a_to_arm; + } + + return 0; +} + +static INT32 svg_asic27aScan(INT32 nAction,INT32 *) +{ + struct BurnArea ba; + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = PGMARMShareRAM; + ba.nLen = 0x0020000; + ba.nAddress = 0x400000; + ba.szName = "ARM SHARE RAM #0 (address 500000)"; + BurnAcb(&ba); + + ba.Data = PGMARMShareRAM2; + ba.nLen = 0x0020000; + ba.nAddress = 0x500000; + ba.szName = "ARM SHARE RAM #1"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM0; + ba.nLen = 0x0000400; + ba.nAddress = 0; + ba.szName = "ARM RAM 0"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM1; + ba.nLen = 0x0040000; + ba.nAddress = 0; + ba.szName = "ARM RAM 1"; + BurnAcb(&ba); + + ba.Data = PGMARMRAM2; + ba.nLen = 0x0000400; + ba.nAddress = 0; + ba.szName = "ARM RAM 2"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + Arm7Scan(nAction); + SCAN_VAR(asic27a_to_arm); + SCAN_VAR(asic27a_to_68k); + + SCAN_VAR(svg_ram_sel); + svg_set_ram_bank(svg_ram_sel); + } + + return 0; +} + +void install_protection_asic27a_svg() +{ + nPGMArm7Type = 3; + + pPgmScanCallback = svg_asic27aScan; + + svg_ram_sel = 0; + svg_ram[0] = PGMARMShareRAM; + svg_ram[1] = PGMARMShareRAM2; + + SekOpen(0); + SekMapHandler(5, 0x500000, 0x5fffff, SM_RAM); + SekSetReadWordHandler(5, svg_read_word); + SekSetReadByteHandler(5, svg_read_byte); + SekSetWriteWordHandler(5, svg_write_word); + SekSetWriteByteHandler(5, svg_write_byte); + SekClose(); + + Arm7Init(1); + Arm7Open(0); + Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); + Arm7MapMemory(PGMUSER0, 0x08000000, 0x08000000 | (nPGMExternalARMLen-1), ARM7_ROM); + Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); + Arm7MapMemory(PGMARMRAM1, 0x18000000, 0x1803ffff, ARM7_RAM); + Arm7MapMemory(svg_ram[1], 0x38000000, 0x3801ffff, ARM7_RAM); + Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); + Arm7SetWriteByteHandler(svg_arm7_write_byte); + Arm7SetWriteWordHandler(svg_arm7_write_word); + Arm7SetWriteLongHandler(svg_arm7_write_long); + Arm7SetReadByteHandler(svg_arm7_read_byte); + Arm7SetReadWordHandler(svg_arm7_read_word); + Arm7SetReadLongHandler(svg_arm7_read_long); + Arm7Close(); +} + + +//------------------------------------------------------------------------------------------------------------------- +// Simulations +//------------------------------------------------------------------------------------------------------------------- + + +//--------------------- +// Oriental Legends + +static UINT8 asic3_latch[3]; +static UINT8 asic3_x; +static UINT8 asic3_y; +static UINT8 asic3_z; +static UINT8 asic3_h1; +static UINT8 asic3_h2; +static UINT8 asic3_reg; static UINT16 asic3_hold; static UINT32 bt(UINT32 v, INT32 bit) @@ -66,40 +701,36 @@ static void asic3_compute_hold() static UINT8 pgm_asic3_r() { UINT8 res = 0; - /* region is supplied by the protection device */ - switch(asic3_reg) { - case 0x00: res = (asic3_latch[0] & 0xf7) | ((PgmInput[7] << 3) & 0x08); break; - case 0x01: res = asic3_latch[1]; break; - case 0x02: res = (asic3_latch[2] & 0x7f) | ((PgmInput[7] << 6) & 0x80); break; - case 0x03: - res = (bt(asic3_hold, 15) << 0) - | (bt(asic3_hold, 12) << 1) - | (bt(asic3_hold, 13) << 2) - | (bt(asic3_hold, 10) << 3) - | (bt(asic3_hold, 7) << 4) - | (bt(asic3_hold, 9) << 5) - | (bt(asic3_hold, 2) << 6) - | (bt(asic3_hold, 5) << 7); - break; - case 0x20: res = 0x49; break; - case 0x21: res = 0x47; break; - case 0x22: res = 0x53; break; - case 0x24: res = 0x41; break; - case 0x25: res = 0x41; break; - case 0x26: res = 0x7f; break; - case 0x27: res = 0x41; break; - case 0x28: res = 0x41; break; - case 0x2a: res = 0x3e; break; - case 0x2b: res = 0x41; break; - case 0x2c: res = 0x49; break; - case 0x2d: res = 0xf9; break; - case 0x2e: res = 0x0a; break; - case 0x30: res = 0x26; break; - case 0x31: res = 0x49; break; - case 0x32: res = 0x49; break; - case 0x33: res = 0x49; break; - case 0x34: res = 0x32; break; + + switch(asic3_reg) + { + case 0x00: res = (asic3_latch[0] & 0xf7) | ((PgmInput[7] << 3) & 0x08); break; + case 0x01: res = asic3_latch[1]; break; + case 0x02: res = (asic3_latch[2] & 0x7f) | ((PgmInput[7] << 6) & 0x80); break; + case 0x03: + res = (bt(asic3_hold, 15) << 0) | (bt(asic3_hold, 12) << 1) | (bt(asic3_hold, 13) << 2) | (bt(asic3_hold, 10) << 3) | + (bt(asic3_hold, 7) << 4) | (bt(asic3_hold, 9) << 5) | (bt(asic3_hold, 2) << 6) | (bt(asic3_hold, 5) << 7); + break; + case 0x20: res = 0x49; break; + case 0x21: res = 0x47; break; + case 0x22: res = 0x53; break; + case 0x24: res = 0x41; break; + case 0x25: res = 0x41; break; + case 0x26: res = 0x7f; break; + case 0x27: res = 0x41; break; + case 0x28: res = 0x41; break; + case 0x2a: res = 0x3e; break; + case 0x2b: res = 0x41; break; + case 0x2c: res = 0x49; break; + case 0x2d: res = 0xf9; break; + case 0x2e: res = 0x0a; break; + case 0x30: res = 0x26; break; + case 0x31: res = 0x49; break; + case 0x32: res = 0x49; break; + case 0x33: res = 0x49; break; + case 0x34: res = 0x32; break; } + return res; } @@ -156,8 +787,33 @@ static UINT16 __fastcall asic3_read_word(UINT32 address) static void reset_asic3() { - asic3_latch[0] = asic3_latch[1] = asic3_latch[2] = 0; - asic3_hold = asic3_reg = asic3_x = asic3_y, asic3_z = asic3_h1 = asic3_h2 = 0; + memset (asic3_latch, 0, 3 * sizeof(UINT8)); + + asic3_hold = 0; + asic3_reg = 0; + asic3_x = 0; + asic3_y = 0; + asic3_z = 0; + asic3_h1 = 0; + asic3_h2 = 0; +} + +static INT32 asic3Scan(INT32 nAction, INT32 *) +{ + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(asic3_reg); + SCAN_VAR(asic3_latch[0]); + SCAN_VAR(asic3_latch[1]); + SCAN_VAR(asic3_latch[2]); + SCAN_VAR(asic3_x); + SCAN_VAR(asic3_y); + SCAN_VAR(asic3_z); + SCAN_VAR(asic3_h1); + SCAN_VAR(asic3_h2); + SCAN_VAR(asic3_hold); + } + + return 0; } void install_protection_asic3_orlegend() @@ -174,380 +830,19 @@ void install_protection_asic3_orlegend() } -//----------------------------------------------------------------------------------------------------- -// ASIC27 - Knights of Valour - -static const UINT8 BATABLE[0x40] = { - 0x00,0x29,0x2c,0x35,0x3a,0x41,0x4a,0x4e,0x57,0x5e,0x77,0x79,0x7a,0x7b,0x7c,0x7d, - 0x7e,0x7f,0x80,0x81,0x82,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x90, - 0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9e,0xa3,0xd4,0xa9,0xaf,0xb5,0xbb,0xc1 -}; - -static const UINT8 B0TABLE[16] = { 2, 0, 1, 4, 3 }; // Maps char portraits to tables - -static UINT32 kov_slots[16]; -static UINT16 kov_internal_slot; -static UINT16 kov_key; -static UINT32 kov_response; -static UINT16 kov_value; - -static UINT16 kov_c0_value; -static UINT16 kov_cb_value; -static UINT16 kov_fe_value; - -void __fastcall kov_asic27_write(UINT32 offset, UINT16 data) -{ - switch (offset & 0x06) - { - case 0: kov_value = data; return; - - case 2: - { - if ((data >> 8) == 0xff) kov_key = 0xffff; - - kov_value ^= kov_key; - - // bprintf (PRINT_NORMAL, _T("ASIC27 command: %2.2x data: %4.4x\n"), (data ^ kov_key) & 0xff, kov_value); - - switch ((data ^ kov_key) & 0xff) - { - case 0x67: // unknown or status check? - case 0x8e: - case 0xa3: - case 0x33: // kovsgqyz (a3) - case 0x3a: // kovplus - case 0xc5: // kovplus - kov_response = 0x880000; - break; - - case 0x99: // Reset - kov_response = 0x880000; - kov_key = 0; - break; - - case 0x9d: // Sprite palette offset - kov_response = 0xa00000 + ((kov_value & 0x1f) * 0x40); - break; - - case 0xb0: // Read from data table - kov_response = B0TABLE[kov_value & 0x0f]; - break; - - case 0xb4: // Copy slot 'a' to slot 'b' - case 0xb7: // kovsgqyz (b4) - { - kov_response = 0x880000; - - if (kov_value == 0x0102) kov_value = 0x0100; // why? - - kov_slots[(kov_value >> 8) & 0x0f] = kov_slots[(kov_value >> 0) & 0x0f]; - } - break; - - case 0xba: // Read from data table - kov_response = BATABLE[kov_value & 0x3f]; - break; - - case 0xc0: // Text layer 'x' select - kov_response = 0x880000; - kov_c0_value = kov_value; - break; - - case 0xc3: // Text layer offset - kov_response = 0x904000 + ((kov_c0_value + (kov_value * 0x40)) * 4); - break; - - case 0xcb: // Background layer 'x' select - kov_response = 0x880000; - kov_cb_value = kov_value; - break; - - case 0xcc: // Background layer offset - if (kov_value & 0x400) kov_value = -(0x400 - (kov_value & 0x3ff)); - kov_response = 0x900000 + ((kov_cb_value + (kov_value * 0x40)) * 4); - break; - - case 0xd0: // Text palette offset - case 0xcd: // kovsgqyz (d0) - kov_response = 0xa01000 + (kov_value * 0x20); - break; - - case 0xd6: // Copy slot to slot 0 - kov_response = 0x880000; - kov_slots[0] = kov_slots[kov_value & 0x0f]; - break; - - case 0xdc: // Background palette offset - case 0x11: // kovsgqyz (dc) - kov_response = 0xa00800 + (kov_value * 0x40); - break; - - case 0xe0: // Sprite palette offset - case 0x9e: // kovsgqyz (e0) - kov_response = 0xa00000 + ((kov_value & 0x1f) * 0x40); - break; - - case 0xe5: // Write slot (low) - { - kov_response = 0x880000; - - INT32 sel = (kov_internal_slot >> 12) & 0x0f; - kov_slots[sel] = (kov_slots[sel] & 0x00ff0000) | ((kov_value & 0xffff) << 0); - } - break; - - case 0xe7: // Write slot (and slot select) (high) - { - kov_response = 0x880000; - kov_internal_slot = kov_value; - - INT32 sel = (kov_internal_slot >> 12) & 0x0f; - kov_slots[sel] = (kov_slots[sel] & 0x0000ffff) | ((kov_value & 0x00ff) << 16); - } - break; - - case 0xf0: // Some sort of status read? - kov_response = 0x00c000; - break; - - case 0xf8: // Read slot - case 0xab: // kovsgqyz (f8) - kov_response = kov_slots[kov_value & 0x0f] & 0x00ffffff; - break; - - case 0xfc: // Adjust damage level to char experience level - kov_response = (kov_value * kov_fe_value) >> 6; - break; - - case 0xfe: // Damage level adjust - kov_response = 0x880000; - kov_fe_value = kov_value; - break; - - default: - kov_response = 0x880000; - // bprintf (PRINT_NORMAL, _T("Unknown ASIC27 command: %2.2x data: %4.4x\n"), (data ^ kov_key) & 0xff, kov_value); - break; - } - - kov_key = (kov_key + 0x0100) & 0xff00; - if (kov_key == 0xff00) kov_key = 0x0100; - kov_key |= kov_key >> 8; - } - return; - - case 4: return; - } -} - -static UINT16 __fastcall kov_asic27_read(UINT32 offset) -{ - switch (offset & 0x02) - { - case 0: return (kov_response >> 0) ^ kov_key; - case 2: return (kov_response >> 16) ^ kov_key; - } - - return 0; -} - -static void kov_asic27_reset() -{ -// memset(kov_slots, 0, 16 * sizeof(INT32)); - - kov_internal_slot = 0; - kov_key = 0; - kov_response = 0; - kov_value = 0; - - kov_c0_value = 0; - kov_cb_value = 0; - kov_fe_value = 0; - - memset (PGMUSER0, 0, 0x400); - - *((UINT16*)(PGMUSER0 + 0x00008)) = PgmInput[7]; // region -} - -void install_protection_asic27_kov() -{ - pPgmScanCallback = kov_asic27Scan; - pPgmResetCallback = kov_asic27_reset; - - SekOpen(0); - SekMapMemory(PGMUSER0, 0x4f0000, 0x4f003f | 0x3ff, SM_READ); - - SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, kov_asic27_read); - SekSetWriteWordHandler(4, kov_asic27_write); - SekClose(); -} - - -// preliminary - -static INT32 puzzli_54_trigger = 0; - -static void __fastcall puzzli2_asic_write(UINT32 offset, UINT16 data) -{ - switch (offset & 0x06) - { - case 0: kov_value = data; return; - - case 2: - { - if ((data >> 8) == 0xff) kov_key = 0xffff; - - kov_value ^= kov_key; - - // bprintf (0, _T("ASIC Command: %2.2x, Value: %4.4x,\n"), (data ^ kov_key) & 0xff, kov_value); - - switch ((data ^ kov_key) & 0xff) - { - case 0x13: // ASIC status? - kov_response = 0x74<<16; // 2d or 74! (based on?) - break; - - case 0x31: - { - // how is this selected? command 54? - - // just a wild guess - if (puzzli_54_trigger) { - // pc == 1387de - kov_response = 0x63<<16; // ? - } else { - // pc == 14cf58 - kov_response = 0xd2<<16; - } - - puzzli_54_trigger = 0; - } - break; - - case 0x38: // Reset - kov_response = 0x78<<16; - kov_key = 0; - puzzli_54_trigger = 0; - break; - - case 0x41: // ASIC status? - kov_response = 0x74<<16; - break; - - case 0x47: // ASIC status? - kov_response = 0x74<<16; - break; - - case 0x52: // ASIC status? - { - // how is this selected? - - //if (kov_value == 6) { - kov_response = (0x74<<16)|1; // |1? - //} else { - // kov_response = 0x74<<16; - //} - } - break; - - case 0x54: // ?? - puzzli_54_trigger = 1; - kov_response = 0x36<<16; - break; - - case 0x61: // ?? - kov_response = 0x36<<16; - break; - - case 0x63: // probably read from a data table? - kov_response = 0; // wrong... - break; - - case 0x67: // probably read from a data table? - kov_response = 0; - break; - - default: - // bprintf (0, _T("ASIC Command %2.2x unknown!\n"), (data ^ kov_key) & 0xff); - kov_response = 0x74<<16; - break; - } - - kov_key = (kov_key + 0x0100) & 0xff00; - if (kov_key == 0xff00) kov_key = 0x0100; - kov_key |= kov_key >> 8; - } - return; - - case 4: return; - } -} - -void install_protection_asic27a_puzzli2() -{ - pPgmScanCallback = kov_asic27Scan; - pPgmResetCallback = kov_asic27_reset; - - SekOpen(0); - SekMapMemory(PGMUSER0, 0x4f0000, 0x4f003f | 0x3ff, SM_READ); - - SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, kov_asic27_read); - SekSetWriteWordHandler(4, puzzli2_asic_write); - SekClose(); -} - - -//----------------------------------------------------------------------------------------------------- -// Dragon World 2 - -#define DW2BITSWAP(s,d,bs,bd) d=((d&(~(1<>bs)&1)<>8)|(d<<8); - DW2BITSWAP(d,d2,7 ,0); - DW2BITSWAP(d,d2,4 ,1); - DW2BITSWAP(d,d2,5 ,2); - DW2BITSWAP(d,d2,2 ,3); - DW2BITSWAP(d,d2,15,4); - DW2BITSWAP(d,d2,1 ,5); - DW2BITSWAP(d,d2,10,6); - DW2BITSWAP(d,d2,13,7); - - // ... missing bitswaps here (8-15) there is not enough data to know them - // the code only checks the lowest 8 bits - - return d2; -} - -void install_protection_asic25_asic12_dw2() -{ - SekOpen(0); - SekMapHandler(4, 0xd80000, 0xd80003, SM_READ); - SekSetReadWordHandler(4, dw2_read_word); - SekClose(); -} - - -//----------------------------------------------------------------------------------------------------- -// Killing Blade +//-------------------- +// killblad static UINT16 kb_cmd; static UINT16 kb_reg; static UINT16 kb_ptr; -static UINT32 kb_regs[0x100]; //? +static UINT32 kb_regs[0x100]; +static UINT16 *sharedprotram; static void IGS022_do_dma(UINT16 src, UINT16 dst, UINT16 size, UINT16 mode) { UINT16 param = mode >> 8; - UINT16 *PROTROM = (UINT16*)USER1; + UINT16 *PROTROM = (UINT16*)(PGMUSER0 + 0x10000); mode &= 0x0f; @@ -722,7 +1017,7 @@ static UINT16 __fastcall killbld_read_word(UINT32 address) static void IGS022Reset() { sharedprotram = (UINT16*)PGMUSER0; - USER1 = PGMUSER0 + 0x10000; + UINT8 *USER1 = PGMUSER0 + 0x10000; if (strcmp(BurnDrvGetTextA(DRV_NAME), "killbld") == 0) { BurnLoadRom(USER1, 11, 1); // load protection data @@ -759,6 +1054,33 @@ static void IGS022Reset() memset (kb_regs, 0, 0x100 * sizeof(INT32)); } +static INT32 killbldScan(INT32 nAction, INT32 *) +{ + struct BurnArea ba; + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = PGMUSER0 + 0x000000; + ba.nLen = 0x0004000; + ba.nAddress = 0x300000; + ba.szName = "ProtRAM"; + BurnAcb(&ba); + + ba.Data = (UINT8*)kb_regs; + ba.nLen = 0x00100 * sizeof(INT32); + ba.nAddress = 0xfffffc00; + ba.szName = "Protection Registers"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(kb_cmd); + SCAN_VAR(kb_reg); + SCAN_VAR(kb_ptr); + } + + return 0; +} + void install_protection_asic25_asic22_killbld() { pPgmScanCallback = killbldScan; @@ -774,694 +1096,955 @@ void install_protection_asic25_asic22_killbld() SekClose(); } +//------------------------------------------ +// Common asic27a simulation functions + + +static UINT16 asic27a_sim_value; +static UINT16 asic27a_sim_key; +static UINT32 asic27a_sim_response; +static UINT32 asic27a_sim_slots[0x100]; +static UINT16 asic27a_sim_regs[0x100]; +static UINT8 asic27a_sim_internal_slot; + +static void (*asic27a_sim_command)(UINT8); + +void __fastcall asic27a_sim_write(UINT32 offset, UINT16 data) +{ + switch (offset & 0x06) + { + case 0: asic27a_sim_value = data; return; + + case 2: + { + if ((data >> 8) == 0xff) asic27a_sim_key = 0xffff; + + asic27a_sim_value ^= asic27a_sim_key; + + UINT8 command = (data ^ asic27a_sim_key) & 0xff; + + asic27a_sim_regs[command] = asic27a_sim_value; + + // bprintf (0, _T("Command: %2.2x, Data: %2.2x\n"), command, asic27a_sim_value); + + asic27a_sim_command(command); + + asic27a_sim_key = (asic27a_sim_key + 0x0100) & 0xff00; + if (asic27a_sim_key == 0xff00) asic27a_sim_key = 0x0100; + asic27a_sim_key |= asic27a_sim_key >> 8; + } + return; + + case 4: return; + } +} + +static UINT16 __fastcall asic27a_sim_read(UINT32 offset) +{ + switch (offset & 0x02) + { + case 0: return (asic27a_sim_response >> 0) ^ asic27a_sim_key; + case 2: return (asic27a_sim_response >> 16) ^ asic27a_sim_key; + } + + return 0; +} + +static void asic27a_sim_reset() +{ + // The ASIC27a writes this to shared RAM + UINT8 ram_string[16] = { + 'I', 'G', 'S', 'P', 'G', 'M', 0, 0, 0, 0/*REGION*/, 'C', 'H', 'I', 'N', 'A', 0 + }; + + memset (PGMUSER0, 0, 0x400); + + ram_string[9] = PgmInput[7]; // region + + memcpy (PGMUSER0, ram_string, 16); + + BurnByteswap(PGMUSER0, 0x10); + + memset (asic27a_sim_slots, 0, 0x100 * sizeof(INT32)); + memset (asic27a_sim_regs, 0, 0x100 * sizeof(INT16)); + + asic27a_sim_value = 0; + asic27a_sim_key = 0; + asic27a_sim_response = 0; + asic27a_sim_internal_slot = 0; +} + +static INT32 asic27a_sim_scan(INT32 nAction, INT32 *) +{ + struct BurnArea ba; + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = (UINT8*)asic27a_sim_slots; + ba.nLen = 0x0000100 * sizeof(INT32); + ba.nAddress = 0xff00000; + ba.szName = "ASIC27a Slots"; + BurnAcb(&ba); + + ba.Data = (UINT8*)asic27a_sim_regs; + ba.nLen = 0x0000100 * sizeof(INT16); + ba.nAddress = 0xff01000; + ba.szName = "ASIC27a Regs"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(asic27a_sim_value); + SCAN_VAR(asic27a_sim_key); + SCAN_VAR(asic27a_sim_response); + SCAN_VAR(asic27a_sim_internal_slot); + } + + return 0; +} + + +//--------------------------------- +// ketsui / espgaluda / ddp3 + +static void ddp3_asic27a_sim_command(UINT8 command) +{ + switch (command) + { + case 0x40: // Combine slot values + asic27a_sim_slots[(asic27a_sim_value >> 10) & 0x1f] = (asic27a_sim_slots[(asic27a_sim_value >> 5) & 0x1f] + asic27a_sim_slots[(asic27a_sim_value >> 0) & 0x1f]) & 0xffffff; + asic27a_sim_response = 0x880000; + break; + + case 0x67: // Select slot & write (high) + asic27a_sim_internal_slot = asic27a_sim_value >> 8; + asic27a_sim_slots[asic27a_sim_internal_slot] = (asic27a_sim_value & 0x00ff) << 16; + asic27a_sim_response = 0x880000; + break; + + case 0xe5: // Write slot (low) + asic27a_sim_slots[asic27a_sim_internal_slot] |= asic27a_sim_value; + asic27a_sim_response = 0x880000; + break; + + case 0x8e: // Read slot + asic27a_sim_response = asic27a_sim_slots[asic27a_sim_value & 0xff]; + break; + + case 0x99: // Reset? + asic27a_sim_key = 0; + asic27a_sim_response = 0x880000; + break; + + default: + asic27a_sim_response = 0x880000; + break; + } +} + +void install_protection_asic27a_ketsui() +{ + pPgmResetCallback = asic27a_sim_reset; + pPgmScanCallback = asic27a_sim_scan; + asic27a_sim_command = ddp3_asic27a_sim_command; + + SekOpen(0); + SekMapHandler(4, 0x400000, 0x400005, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_sim_read); + SekSetWriteWordHandler(4, asic27a_sim_write); + SekClose(); +} + +void install_protection_asic27a_ddp3() +{ + pPgmResetCallback = asic27a_sim_reset; + pPgmScanCallback = asic27a_sim_scan; + asic27a_sim_command = ddp3_asic27a_sim_command; + + SekOpen(0); + SekMapHandler(4, 0x500000, 0x500005, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_sim_read); + SekSetWriteWordHandler(4, asic27a_sim_write); + SekClose(); +} + + +//-------------------------- +// oldsplus + +static const UINT8 oldsplus_fc[0x20]={ + 0x00,0x00,0x0a,0x3a,0x4e,0x2e,0x03,0x40,0x33,0x43,0x26,0x2c,0x00,0x00,0x00,0x00, + 0x00,0x00,0x44,0x4d,0x0b,0x27,0x3d,0x0f,0x37,0x2b,0x02,0x2f,0x15,0x45,0x0e,0x30 +}; + +static const UINT16 oldsplus_90[0x7]={ + 0x50,0xa0,0xc8,0xf0,0x190,0x1f4,0x258 +}; + +static const UINT8 oldsplus_5e[0x20]={ + 0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +}; + +static const UINT8 oldsplus_b0[0xe0]={ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04, + 0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08, + 0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, + 0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c, + 0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c, + 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, + 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, + 0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, + 0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f +}; + +static const UINT8 oldsplus_ae[0xe0]={ + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, + 0x1E,0x1F,0x20,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x1F,0x20,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x20,0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, + 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23 +}; + +static const UINT16 oldsplus_ba[0x4]={ + 0x3138,0x2328,0x1C20,0x1518 +}; + +static const UINT16 oldsplus_8c[0x20]={ + 0x0032,0x0032,0x0064,0x0096,0x0096,0x00fa,0x012c,0x015e,0x0032,0x0064,0x0096,0x00c8,0x00c8,0x012c,0x015e,0x0190, + 0x0064,0x0096,0x00c8,0x00fa,0x00fa,0x015e,0x0190,0x01c2,0x0096,0x00c8,0x00fa,0x012c,0x012c,0x0190,0x01c2,0x01f4 +}; + +static inline UINT16 oldsplus_9d(UINT16 a) +{ + const UINT8 tab[8] = { 0x3c, 0x46, 0x5a, 0x6e, 0x8c, 0xc8, 0x50, }; + + if ((a % 0x27) <= 0x07) return (a % 0x27) * 0x64; + if ((a % 0x27) >= 0x17) return 0x6bc; + + return 0x2bc + (tab[a / 0x27] * ((a % 0x27) - 7)); +} + +static void oldsplus_asic27a_sim_command(UINT8 command) +{ + switch (command) + { + case 0x88: // Reset? + asic27a_sim_key = 0; + asic27a_sim_response = 0x990000; + break; + + case 0xa0: + asic27a_sim_response = ((asic27a_sim_value >= 0x0f) ? 0x0f : asic27a_sim_value) * 0x23; + break; + + case 0xd0: // Text palette offset + asic27a_sim_response = 0xa01000 + (asic27a_sim_value << 5); + break; + + case 0xc0: // Sprite palette offset + asic27a_sim_response = 0xa00000 + (asic27a_sim_value << 6); + break; + + case 0xc3: // Background palette offset + asic27a_sim_response = 0xa00800 + (asic27a_sim_value << 6); + break; + + case 0x33: // Store regs + asic27a_sim_response = 0x990000; + break; + + case 0x35: // Add '36' reg + asic27a_sim_regs[0x36] += asic27a_sim_value; + asic27a_sim_response = 0x990000; + break; + + case 0x36: // Store regs + asic27a_sim_response = 0x990000; + break; + + case 0x37: // Add '33' reg + asic27a_sim_regs[0x33] += asic27a_sim_value; + asic27a_sim_response = 0x990000; + break; + + case 0x34: // Read '36' reg + asic27a_sim_response = asic27a_sim_regs[0x36]; + break; + + case 0x38: // Read '33' reg + asic27a_sim_response = asic27a_sim_regs[0x33]; + break; + + case 0xe7: // Select slot + { + asic27a_sim_response = 0x990000; + + asic27a_sim_internal_slot = (asic27a_sim_value >> 12) & 0x0f; + } + break; + + case 0xe5: // Write slot + { + asic27a_sim_response = 0x990000; + + asic27a_sim_slots[asic27a_sim_internal_slot] = asic27a_sim_value; + + if (asic27a_sim_internal_slot == 0x0b) asic27a_sim_slots[0xc] = 0; // ?? + } + break; + + case 0xf8: // Read slot + asic27a_sim_response = asic27a_sim_slots[asic27a_sim_value]; + break; + + case 0xc5: // Increment slot 'd' + asic27a_sim_slots[0xd]--; + asic27a_sim_response = 0x990000; + break; + + case 0xd6: // Increment slot 'b' + asic27a_sim_slots[0xb]++; + asic27a_sim_response = 0x990000; + break; + + case 0x3a: // Clear slot 'f' + asic27a_sim_slots[0xf] = 0; + asic27a_sim_response = 0x990000; + break; + + case 0xf0: // Background layer 'x' select + asic27a_sim_response = 0x990000; + break; + + case 0xed: // Background layer offset + if (asic27a_sim_value & 0x400) asic27a_sim_value = -(0x400 - (asic27a_sim_value & 0x3ff)); + asic27a_sim_response = 0x900000 + ((asic27a_sim_regs[0xf0] + (asic27a_sim_value * 0x40)) * 4); + break; + + case 0xe0: // Text layer 'x' select + asic27a_sim_response = 0x990000; + break; + + case 0xdc: // Text layer offset + asic27a_sim_response = 0x904000 + ((asic27a_sim_regs[0xe0] + (asic27a_sim_value * 0x40)) * 4); + break; + + case 0xcb: // Some sort of status read? + asic27a_sim_response = 0x00c000; + break; + + case 0x5e: // Read from data table + asic27a_sim_response = oldsplus_5e[asic27a_sim_value]; + break; + + case 0x80: // Read from data table + asic27a_sim_response = (asic27a_sim_value < 4) ? ((asic27a_sim_value + 1) * 0xbb8) : 0xf4240; + break; + + case 0x8c: // Read from data table + asic27a_sim_response = oldsplus_8c[asic27a_sim_value]; + break; + + case 0x90: // Read from data table + asic27a_sim_response = oldsplus_90[asic27a_sim_value]; + break; + + case 0x9d: // Read from data table + asic27a_sim_response = oldsplus_9d(asic27a_sim_value); + break; + + case 0xae: // Read from data table + asic27a_sim_response = oldsplus_ae[asic27a_sim_value]; + break; + + case 0xb0: // Read from data table + asic27a_sim_response = oldsplus_b0[asic27a_sim_value]; + break; + + case 0xba: // Read from data table + asic27a_sim_response = oldsplus_ba[asic27a_sim_value]; + break; + + case 0xfc: // Read from data table + asic27a_sim_response = oldsplus_fc[asic27a_sim_value]; + break; + + default: + asic27a_sim_response = 0x990000; + break; + } +} + +void install_protection_asic27a_oldsplus() +{ + pPgmResetCallback = asic27a_sim_reset; + pPgmScanCallback = asic27a_sim_scan; + asic27a_sim_command = oldsplus_asic27a_sim_command; + + SekOpen(0); + SekMapMemory(PGMUSER0, 0x4f0000, 0x4f003f | 0x3ff, SM_READ); // ram + + SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_sim_read); + SekSetWriteWordHandler(4, asic27a_sim_write); + SekClose(); +} + + +//------------------------------------- +// Knights of Valour + +static const UINT8 B0TABLE[8] = { 2, 0, 1, 4, 3 }; // Maps char portraits to tables + +static const UINT8 BATABLE[0x40] = { + 0x00,0x29,0x2c,0x35,0x3a,0x41,0x4a,0x4e,0x57,0x5e,0x77,0x79,0x7a,0x7b,0x7c,0x7d, + 0x7e,0x7f,0x80,0x81,0x82,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x90, + 0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9e,0xa3,0xd4,0xa9,0xaf,0xb5,0xbb,0xc1 +}; + +static void kov_asic27a_sim_command(UINT8 command) +{ + switch (command) + { + case 0x67: // unknown or status check? + case 0x8e: + case 0xa3: + case 0x33: // kovsgqyz (a3) + case 0x3a: // kovplus + case 0xc5: // kovplus + asic27a_sim_response = 0x880000; + break; + + case 0x99: // Reset + asic27a_sim_response = 0x880000; + asic27a_sim_key = 0; + break; + + case 0x9d: // Sprite palette offset + asic27a_sim_response = 0xa00000 + ((asic27a_sim_value & 0x1f) * 0x40); + break; + + case 0xb0: // Read from data table + asic27a_sim_response = B0TABLE[asic27a_sim_value & 0x07]; + break; + + case 0xb4: // Copy slot 'a' to slot 'b' + case 0xb7: // kovsgqyz (b4) + { + asic27a_sim_response = 0x880000; + + if (asic27a_sim_value == 0x0102) asic27a_sim_value = 0x0100; // why? + + asic27a_sim_slots[(asic27a_sim_value >> 8) & 0x0f] = asic27a_sim_slots[(asic27a_sim_value >> 0) & 0x0f]; + } + break; + + case 0xba: // Read from data table + asic27a_sim_response = BATABLE[asic27a_sim_value & 0x3f]; + break; + + case 0xc0: // Text layer 'x' select + asic27a_sim_response = 0x880000; + break; + + case 0xc3: // Text layer offset + asic27a_sim_response = 0x904000 + ((asic27a_sim_regs[0xc0] + (asic27a_sim_value * 0x40)) * 4); + break; + + case 0xcb: // Background layer 'x' select + asic27a_sim_response = 0x880000; + break; + + case 0xcc: // Background layer offset + if (asic27a_sim_value & 0x400) asic27a_sim_value = -(0x400 - (asic27a_sim_value & 0x3ff)); + asic27a_sim_response = 0x900000 + ((asic27a_sim_regs[0xcb] + (asic27a_sim_value * 0x40)) * 4); + break; + + case 0xd0: // Text palette offset + case 0xcd: // kovsgqyz (d0) + asic27a_sim_response = 0xa01000 + (asic27a_sim_value * 0x20); + break; + + case 0xd6: // Copy slot to slot 0 + asic27a_sim_response = 0x880000; + asic27a_sim_slots[0] = asic27a_sim_slots[asic27a_sim_value & 0x0f]; + break; + + case 0xdc: // Background palette offset + case 0x11: // kovsgqyz (dc) + asic27a_sim_response = 0xa00800 + (asic27a_sim_value * 0x40); + break; + + case 0xe0: // Sprite palette offset + case 0x9e: // kovsgqyz (e0) + asic27a_sim_response = 0xa00000 + ((asic27a_sim_value & 0x1f) * 0x40); + break; + + case 0xe5: // Write slot (low) + { + asic27a_sim_response = 0x880000; + + asic27a_sim_slots[asic27a_sim_internal_slot] = (asic27a_sim_slots[asic27a_sim_internal_slot] & 0x00ff0000) | ((asic27a_sim_value & 0xffff) << 0); + } + break; + + case 0xe7: // Write slot (and slot select) (high) + { + asic27a_sim_response = 0x880000; + asic27a_sim_internal_slot = (asic27a_sim_value >> 12) & 0x0f; + + asic27a_sim_slots[asic27a_sim_internal_slot] = (asic27a_sim_slots[asic27a_sim_internal_slot] & 0x0000ffff) | ((asic27a_sim_value & 0x00ff) << 16); + } + break; + + case 0xf0: // Some sort of status read? + asic27a_sim_response = 0x00c000; + break; + + case 0xf8: // Read slot + case 0xab: // kovsgqyz (f8) + asic27a_sim_response = asic27a_sim_slots[asic27a_sim_value & 0x0f] & 0x00ffffff; + break; + + case 0xfc: // Adjust damage level to char experience level + asic27a_sim_response = (asic27a_sim_value * asic27a_sim_regs[0xfe]) >> 6; + break; + + case 0xfe: // Damage level adjust + asic27a_sim_response = 0x880000; + break; + + default: + asic27a_sim_response = 0x880000; + break; + } +} + +void install_protection_asic27_kov() +{ + pPgmResetCallback = asic27a_sim_reset; + pPgmScanCallback = asic27a_sim_scan; + asic27a_sim_command = kov_asic27a_sim_command; + + SekOpen(0); + SekMapMemory(PGMUSER0, 0x4f0000, 0x4f003f | 0x3ff, SM_READ); + + SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_sim_read); + SekSetWriteWordHandler(4, asic27a_sim_write); + SekClose(); +} + //------------------------------------------------------------------------- -// Puzzle Stars +// puzlstar - -static UINT16 PSTARSKEY; -static UINT16 PSTARSINT[2]; -static UINT32 PSTARS_REGS[16]; -static UINT32 PSTARS_VAL; - -static UINT16 pstar_e7,pstar_b1,pstar_ce; -static UINT16 pstar_ram[3]; - -static INT32 Pstar_ba[0x1E]={ - 0x02,0x00,0x00,0x01,0x00,0x03,0x00,0x00, //0 - 0x02,0x00,0x06,0x00,0x22,0x04,0x00,0x03, //8 - 0x00,0x00,0x06,0x00,0x20,0x07,0x00,0x03, //10 - 0x00,0x21,0x01,0x00,0x00,0x63 +static const UINT8 Pstar_ba[0x1e]={ + 0x02,0x00,0x00,0x01,0x00,0x03,0x00,0x00,0x02,0x00,0x06,0x00,0x22,0x04,0x00,0x03, + 0x00,0x00,0x06,0x00,0x20,0x07,0x00,0x03,0x00,0x21,0x01,0x00,0x00,0x63 }; -static INT32 Pstar_b0[0x10]={ - 0x09,0x0A,0x0B,0x00,0x01,0x02,0x03,0x04, - 0x05,0x06,0x07,0x08,0x00,0x00,0x00,0x00 +static const UINT8 Pstar_b0[0x10]={ + 0x09,0x0A,0x0B,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x00,0x00,0x00,0x00 }; -static INT32 Pstar_ae[0x10]={ - 0x5D,0x86,0x8C ,0x8B,0xE0,0x8B,0x62,0xAF, - 0xB6,0xAF,0x10A,0xAF,0x00,0x00,0x00,0x00 +static const UINT16 Pstar_ae[0x10]={ + 0x5D,0x86,0x8C,0x8B,0xE0,0x8B,0x62,0xAF,0xB6,0xAF,0x10A,0xAF,0x00,0x00,0x00,0x00 }; -static INT32 Pstar_a0[0x10]={ - 0x02,0x03,0x04,0x05,0x06,0x01,0x0A,0x0B, - 0x0C,0x0D,0x0E,0x09,0x00,0x00,0x00,0x00, +static const UINT8 Pstar_a0[0x10]={ + 0x02,0x03,0x04,0x05,0x06,0x01,0x0A,0x0B,0x0C,0x0D,0x0E,0x09,0x00,0x00,0x00,0x00 }; -static INT32 Pstar_9d[0x10]={ - 0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const UINT8 Pstar_9d[0x10]={ + 0x05,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -static INT32 Pstar_90[0x10]={ - 0x0C,0x10,0x0E,0x0C,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 +static const UINT8 Pstar_90[0x10]={ + 0x0C,0x10,0x0E,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; -static INT32 Pstar_8c[0x23]={ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, - 0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02, - 0x02,0x02,0x03,0x03,0x03,0x04,0x04,0x04, + +static const UINT8 Pstar_8c[0x23]={ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, + 0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,0x03,0x04,0x04,0x04, 0x03,0x03,0x03 }; -static INT32 Pstar_80[0x1a3]={ - 0x03,0x03,0x04,0x04,0x04,0x04,0x05,0x05, - 0x05,0x05,0x06,0x06,0x03,0x03,0x04,0x04, - 0x05,0x05,0x05,0x05,0x06,0x06,0x07,0x07, - 0x03,0x03,0x04,0x04,0x05,0x05,0x05,0x05, - 0x06,0x06,0x07,0x07,0x06,0x06,0x06,0x06, - 0x06,0x06,0x06,0x07,0x07,0x07,0x07,0x07, - 0x06,0x06,0x06,0x06,0x06,0x06,0x07,0x07, - 0x07,0x07,0x08,0x08,0x05,0x05,0x05,0x05, - 0x05,0x05,0x05,0x06,0x06,0x06,0x07,0x07, - 0x06,0x06,0x06,0x07,0x07,0x07,0x08,0x08, - 0x09,0x09,0x09,0x09,0x07,0x07,0x07,0x07, - 0x07,0x08,0x08,0x08,0x08,0x09,0x09,0x09, - 0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08, - 0x08,0x08,0x09,0x09,0x05,0x05,0x06,0x06, - 0x06,0x07,0x07,0x08,0x08,0x08,0x08,0x09, - 0x07,0x07,0x07,0x07,0x07,0x08,0x08,0x08, - 0x08,0x09,0x09,0x09,0x06,0x06,0x07,0x03, - 0x07,0x06,0x07,0x07,0x08,0x07,0x05,0x04, - 0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06, - 0x06,0x06,0x06,0x06,0x03,0x04,0x04,0x04, - 0x04,0x05,0x05,0x06,0x06,0x06,0x06,0x07, - 0x04,0x04,0x05,0x05,0x06,0x06,0x06,0x06, - 0x06,0x07,0x07,0x08,0x05,0x05,0x06,0x07, - 0x07,0x08,0x08,0x08,0x08,0x08,0x08,0x08, - 0x05,0x05,0x05,0x07,0x07,0x07,0x07,0x07, - 0x07,0x08,0x08,0x08,0x08,0x08,0x09,0x09, - 0x09,0x09,0x03,0x04,0x04,0x05,0x05,0x05, - 0x06,0x06,0x07,0x07,0x07,0x07,0x08,0x08, - 0x08,0x09,0x09,0x09,0x03,0x04,0x05,0x05, - 0x04,0x03,0x04,0x04,0x04,0x05,0x05,0x04, - 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03, - 0x03,0x03,0x03,0x04,0x04,0x04,0x04,0x04, - 0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03, - 0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, - 0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +static const UINT8 Pstar_80[0x1a3]={ + 0x03,0x03,0x04,0x04,0x04,0x04,0x05,0x05,0x05,0x05,0x06,0x06,0x03,0x03,0x04,0x04, + 0x05,0x05,0x05,0x05,0x06,0x06,0x07,0x07,0x03,0x03,0x04,0x04,0x05,0x05,0x05,0x05, + 0x06,0x06,0x07,0x07,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x07,0x07,0x07,0x07,0x07, + 0x06,0x06,0x06,0x06,0x06,0x06,0x07,0x07,0x07,0x07,0x08,0x08,0x05,0x05,0x05,0x05, + 0x05,0x05,0x05,0x06,0x06,0x06,0x07,0x07,0x06,0x06,0x06,0x07,0x07,0x07,0x08,0x08, + 0x09,0x09,0x09,0x09,0x07,0x07,0x07,0x07,0x07,0x08,0x08,0x08,0x08,0x09,0x09,0x09, + 0x06,0x06,0x07,0x07,0x07,0x08,0x08,0x08,0x08,0x08,0x09,0x09,0x05,0x05,0x06,0x06, + 0x06,0x07,0x07,0x08,0x08,0x08,0x08,0x09,0x07,0x07,0x07,0x07,0x07,0x08,0x08,0x08, + 0x08,0x09,0x09,0x09,0x06,0x06,0x07,0x03,0x07,0x06,0x07,0x07,0x08,0x07,0x05,0x04, + 0x03,0x03,0x04,0x04,0x05,0x05,0x06,0x06,0x06,0x06,0x06,0x06,0x03,0x04,0x04,0x04, + 0x04,0x05,0x05,0x06,0x06,0x06,0x06,0x07,0x04,0x04,0x05,0x05,0x06,0x06,0x06,0x06, + 0x06,0x07,0x07,0x08,0x05,0x05,0x06,0x07,0x07,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x05,0x05,0x05,0x07,0x07,0x07,0x07,0x07,0x07,0x08,0x08,0x08,0x08,0x08,0x09,0x09, + 0x09,0x09,0x03,0x04,0x04,0x05,0x05,0x05,0x06,0x06,0x07,0x07,0x07,0x07,0x08,0x08, + 0x08,0x09,0x09,0x09,0x03,0x04,0x05,0x05,0x04,0x03,0x04,0x04,0x04,0x05,0x05,0x04, + 0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x04,0x04,0x04,0x04,0x04, + 0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,0x03,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, + 0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00 }; -static UINT16 PSTARS_protram_r(UINT32 offset) +static UINT16 __fastcall puzlstar_protram_read_word(UINT32 offset) { - offset >>= 1; + if ((offset & 0x3e) == 0x08) return PgmInput[7]; // Region + if ((offset & 0x38) == 0x20) return asic27a_sim_slots[((offset & 0x06)/2)+0x10]--; // Timer - if (offset == 4) //region - return PgmInput[7]; - else if (offset >= 0x10) //timer - { - return pstar_ram[offset-0x10]--; - } - return 0x0000; + return 0; } -static UINT16 PSTARS_r16(UINT32 offset) +static UINT8 __fastcall puzlstar_protram_read_byte(UINT32 offset) { - offset >>= 1; + if ((offset & 0x3e) == 0x08) return PgmInput[7]; // Region - if(offset==0) - { - UINT16 d=PSTARS_VAL&0xffff; - UINT16 realkey; - realkey=PSTARSKEY>>8; - realkey|=PSTARSKEY; - d^=realkey; - return d; - } - else if(offset==1) - { - UINT16 d=PSTARS_VAL>>16; - UINT16 realkey; - realkey=PSTARSKEY>>8; - realkey|=PSTARSKEY; - d^=realkey; - return d; - - } - return 0xff; + return 0; } -static void PSTARS_w16(UINT32 offset, UINT16 data) +static void puzlstar_asic27a_sim_command(UINT8 command) { - offset >>= 1; - - if(offset==0) + switch (command) { - PSTARSINT[0]=data; - return; - } + case 0x99: // Reset? + asic27a_sim_key = 0; + asic27a_sim_response = 0x890000; + break; - if(offset==1) - { - UINT16 realkey; - if((data>>8)==0xff) PSTARSKEY=0xff00; - realkey=PSTARSKEY>>8; - realkey|=PSTARSKEY; + case 0xb1: + asic27a_sim_response = 0x890000; + break; + + case 0xbf: + asic27a_sim_response = asic27a_sim_regs[0xb1] * asic27a_sim_value; + break; + + case 0xc1: // TODO: TIMER 0,1,2,FIX TO 0 should be OK? + asic27a_sim_response = 0; + break; + + case 0xce: // TODO: TIMER 0,1,2 + asic27a_sim_response = 0x890000; + break; + + case 0xcf: // TODO:TIMER 0,1,2 + asic27a_sim_slots[asic27a_sim_regs[0xce] + 0x10] = asic27a_sim_value; + asic27a_sim_response = 0x890000; + break; + + case 0xd0: // Text palette offset + asic27a_sim_response = 0xa01000 + (asic27a_sim_value << 5); + break; + + case 0xdc: // Background palette offset + asic27a_sim_response = 0xa00800 + (asic27a_sim_value << 6); + break; + + case 0xe0: // Sprite palette offset + asic27a_sim_response = 0xa00000 + (asic27a_sim_value << 6); + break; + + case 0xe5: // Write slot (low) { - PSTARSKEY+=0x100; - PSTARSKEY&=0xff00; - if(PSTARSKEY==0xff00)PSTARSKEY=0x100; + asic27a_sim_response = 0x890000; + + asic27a_sim_slots[asic27a_sim_internal_slot] = (asic27a_sim_slots[asic27a_sim_internal_slot] & 0xff0000) | (asic27a_sim_value); } - data^=realkey; - PSTARSINT[1]=data; - PSTARSINT[0]^=realkey; + break; - switch(PSTARSINT[1]&0xff) - { - case 0x99: - { - PSTARSKEY=0x100; - PSTARS_VAL=0x880000; - } - break; + case 0xe7: // Write slot (and slot select) (high) + { + asic27a_sim_response = 0x890000; - case 0xE0: - { - PSTARS_VAL=0xa00000+(PSTARSINT[0]<<6); - } - break; - case 0xDC: - { - PSTARS_VAL=0xa00800+(PSTARSINT[0]<<6); - } - break; - case 0xD0: - { - PSTARS_VAL=0xa01000+(PSTARSINT[0]<<5); - } - break; - - case 0xb1: - { - pstar_b1=PSTARSINT[0]; - PSTARS_VAL=0x890000; - } - break; - case 0xbf: - { - PSTARS_VAL=pstar_b1*PSTARSINT[0]; - } - break; - - case 0xc1: //TODO:TIMER 0,1,2,FIX TO 0 should be OK? - { - PSTARS_VAL=0; - } - break; - case 0xce: //TODO:TIMER 0,1,2 - { - pstar_ce=PSTARSINT[0]; - PSTARS_VAL=0x890000; - } - break; - case 0xcf: //TODO:TIMER 0,1,2 - { - pstar_ram[pstar_ce]=PSTARSINT[0]; - PSTARS_VAL=0x890000; - } - break; - - - case 0xe7: - { - pstar_e7=(PSTARSINT[0]>>12)&0xf; - PSTARS_REGS[pstar_e7]&=0xffff; - PSTARS_REGS[pstar_e7]|=(PSTARSINT[0]&0xff)<<16; - PSTARS_VAL=0x890000; - } - break; - case 0xe5: - { - - PSTARS_REGS[pstar_e7]&=0xff0000; - PSTARS_REGS[pstar_e7]|=PSTARSINT[0]; - PSTARS_VAL=0x890000; - } - break; - case 0xf8: //@73C - { - PSTARS_VAL=PSTARS_REGS[PSTARSINT[0]&0xf]&0xffffff; - } - break; - - - case 0xba: - { - PSTARS_VAL=Pstar_ba[PSTARSINT[0]]; - } - break; - case 0xb0: - { - PSTARS_VAL=Pstar_b0[PSTARSINT[0]]; - } - break; - case 0xae: - { - PSTARS_VAL=Pstar_ae[PSTARSINT[0]]; - } - break; - case 0xa0: - { - PSTARS_VAL=Pstar_a0[PSTARSINT[0]]; - } - break; - case 0x9d: - { - PSTARS_VAL=Pstar_9d[PSTARSINT[0]]; - } - break; - case 0x90: - { - PSTARS_VAL=Pstar_90[PSTARSINT[0]]; - } - break; - case 0x8c: - { - PSTARS_VAL=Pstar_8c[PSTARSINT[0]]; - } - break; - case 0x80: - { - PSTARS_VAL=Pstar_80[PSTARSINT[0]]; - } - break; - default: - PSTARS_VAL=0x890000; + asic27a_sim_internal_slot = (asic27a_sim_value >> 12) & 0xf; + asic27a_sim_slots[asic27a_sim_internal_slot] = (asic27a_sim_slots[asic27a_sim_internal_slot] & 0x00ffff) | ((asic27a_sim_value & 0xff) << 16); } + break; + + case 0xf8: // Read slot + asic27a_sim_response = asic27a_sim_slots[asic27a_sim_value]; + break; + + case 0x80: // Read from data table + asic27a_sim_response = Pstar_80[asic27a_sim_value]; + break; + + case 0x8c: // Read from data table + asic27a_sim_response = Pstar_8c[asic27a_sim_value]; + break; + + case 0x90: // Read from data table + asic27a_sim_response = Pstar_90[asic27a_sim_value]; + break; + + case 0x9d: // Read from data table + asic27a_sim_response = Pstar_9d[asic27a_sim_value]; + break; + + case 0xa0: // Read from data table + asic27a_sim_response = Pstar_a0[asic27a_sim_value]; + break; + + case 0xae: // Read from data table + asic27a_sim_response = Pstar_ae[asic27a_sim_value]; + break; + + case 0xb0: // Read from data table + asic27a_sim_response = Pstar_b0[asic27a_sim_value]; + break; + + case 0xba: // Read from data table + asic27a_sim_response = Pstar_ba[asic27a_sim_value]; + break; + + default: + asic27a_sim_response = 0x890000; + break; } } -void __fastcall pstars_write_word(UINT32 address, UINT16 data) -{ - if ((address & 0xfffffc) == 0x500000) { - PSTARS_w16(address & 3, data); - } -} - -UINT8 __fastcall pstars_read_byte(UINT32 address) -{ - if ((address & 0xff0000) == 0x4f0000) { - return PSTARS_protram_r(address & 0xffff); - } - - if ((address & 0xfffffc) == 0x500000) { - return PSTARS_r16(address & 3); - } - - return 0; -} - -UINT16 __fastcall pstars_read_word(UINT32 address) -{ - if ((address & 0xff0000) == 0x4f0000) { - return PSTARS_protram_r(address & 0xffff); - } - - if ((address & 0xfffffc) == 0x500000) { - return PSTARS_r16(address & 3); - } - - return 0; -} - -static void reset_puzlstar() -{ - PSTARSKEY = 0; - PSTARS_VAL = 0; - PSTARSINT[0] = PSTARSINT[1] = 0; - pstar_e7 = pstar_b1 = pstar_ce = 0; - - memset(PSTARS_REGS, 0, 16); - memset(pstar_ram, 0, 3); -} - void install_protection_asic27a_puzlstar() { - pPgmScanCallback = pstarsScan; - pPgmResetCallback = reset_puzlstar; + pPgmResetCallback = asic27a_sim_reset; + pPgmScanCallback = asic27a_sim_scan; + + asic27a_sim_command = puzlstar_asic27a_sim_command; SekOpen(0); - SekMapHandler(4, 0x4f0000, 0x500003, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, pstars_read_word); - SekSetReadByteHandler(4, pstars_read_byte); - SekSetWriteWordHandler(4, pstars_write_word); + SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_sim_read); + SekSetWriteWordHandler(4, asic27a_sim_write); + + SekMapHandler(5, 0x4f0000, 0x4f03ff, SM_READ); + SekSetReadWordHandler(5, puzlstar_protram_read_word); + SekSetReadByteHandler(5, puzlstar_protram_read_byte); SekClose(); } -//----------------------------------------------------------------------------------------------------- -// ASIC27A - Kov2, Martmast, etc +//-------------------- +// puzzli2 -static UINT8 asic27a_to_arm = 0; -static UINT8 asic27a_to_68k = 0; - -static inline void pgm_cpu_sync() +static void puzzli2_asic27a_sim_command(UINT8 command) { - INT32 nCycles = SekTotalCycles() - Arm7TotalCycles(); - - if (nCycles > 0) { - Arm7Run(nCycles); - } -} - -static void __fastcall asic27a_write_byte(UINT32 address, UINT8 data) -{ -#if 0 - if ((address & 0xff0000) == 0xd00000) { - //pgm_cpu_sync(); - PGMARMShareRAM[(address & 0xffff)^1] = data; - return; - } -#endif - - if ((address & 0xfffffe) == 0xd10000) { // ddp2 - pgm_cpu_sync(); - asic27a_to_arm = data; - Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_ASSERT_LINE); - return; - } -} - -static void __fastcall asic27a_write_word(UINT32 address, UINT16 data) -{ -#if 0 - if ((address & 0xff0000) == 0xd00000) { - //pgm_cpu_sync(); - *((UINT16*)(PGMARMShareRAM + (address & 0xfffe))) = BURN_ENDIAN_SWAP_INT16(data); - return; - } -#endif - - if ((address & 0xfffffe) == 0xd10000) { - pgm_cpu_sync(); - asic27a_to_arm = data & 0xff; - Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_ASSERT_LINE); - return; - } -} - -static UINT8 __fastcall asic27a_read_byte(UINT32 address) -{ -#if 0 - if ((address & 0xff0000) == 0xd00000) { - //pgm_cpu_sync(); - return PGMARMShareRAM[(address & 0xffff)^1]; - } -#endif - - if ((address & 0xfffffc) == 0xd10000) { - pgm_cpu_sync(); - return asic27a_to_68k; - } - - return 0; -} - -static UINT16 __fastcall asic27a_read_word(UINT32 address) -{ -#if 0 - if ((address & 0xff0000) == 0xd00000) { - //pgm_cpu_sync(); - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(PGMARMShareRAM + (address & 0xfffe)))); - } -#endif - - if ((address & 0xfffffc) == 0xd10000) { - pgm_cpu_sync(); - return asic27a_to_68k; - } - - return 0; -} - -static void asic27a_arm7_write_byte(UINT32 address, UINT8 data) -{ - switch (address) + switch (command) { - case 0x38000000: - asic27a_to_68k = data; - return; - } -} + case 0x13: // ASIC status? + asic27a_sim_response = 0x74<<16; // 2d or 74! (based on?) + break; -static UINT8 asic27a_arm7_read_byte(UINT32 address) -{ - switch (address) - { - case 0x38000000: - Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_CLEAR_LINE); - return asic27a_to_arm; - } - - return 0; -} - -void install_protection_asic27a_martmast() -{ - nPGMArm7Type = 2; - pPgmScanCallback = asic27aScan; - - SekOpen(0); - - SekMapMemory(PGMARMShareRAM, 0xd00000, 0xd0ffff, SM_RAM); - - SekMapHandler(4, 0xd10000, 0xd10003, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, asic27a_read_word); - SekSetReadByteHandler(4, asic27a_read_byte); - SekSetWriteWordHandler(4, asic27a_write_word); - SekSetWriteByteHandler(4, asic27a_write_byte); - SekClose(); - - Arm7Init(1); - Arm7Open(0); - Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); - Arm7MapMemory(PGMUSER0, 0x08000000, 0x08000000+(nPGMExternalARMLen-1), ARM7_ROM); - Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); - Arm7MapMemory(PGMARMRAM1, 0x18000000, 0x1800ffff, ARM7_RAM); - Arm7MapMemory(PGMARMShareRAM, 0x48000000, 0x4800ffff, ARM7_RAM); - Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); - Arm7SetWriteByteHandler(asic27a_arm7_write_byte); - Arm7SetReadByteHandler(asic27a_arm7_read_byte); - Arm7Close(); -} - - -//---------------------------------------------------------------------------------------------------------- -// Kovsh/Photoy2k/Photoy2k2 asic27a emulation... (thanks to XingXing!) - -static UINT16 kovsh_highlatch_arm_w = 0; -static UINT16 kovsh_lowlatch_arm_w = 0; -static UINT16 kovsh_highlatch_68k_w = 0; -static UINT16 kovsh_lowlatch_68k_w = 0; -static UINT32 kovsh_counter = 1; - -static void __fastcall kovsh_asic27a_write_word(UINT32 address, UINT16 data) -{ - switch (address) - { - case 0x500000: - case 0x600000: - kovsh_lowlatch_68k_w = data; - return; - - case 0x500002: - case 0x600002: - kovsh_highlatch_68k_w = data; - return; - } -} - -static UINT16 __fastcall kovsh_asic27a_read_word(UINT32 address) -{ - if ((address & 0xffffc0) == 0x4f0000) { - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(PGMARMShareRAM + (address & 0x3e)))); - } - - switch (address) - { - case 0x500000: - case 0x600000: - pgm_cpu_sync(); - return kovsh_lowlatch_arm_w; - - case 0x500002: - case 0x600002: - pgm_cpu_sync(); - return kovsh_highlatch_arm_w; - } - - return 0; -} - -static void kovsh_asic27a_arm7_write_word(UINT32 address, UINT16 data) -{ - // written... but never read? - if ((address & 0xffffff80) == 0x50800000) { - *((UINT16*)(PGMARMShareRAM + ((address>>1) & 0x3e))) = BURN_ENDIAN_SWAP_INT16(data); - return; - } -} - -static void kovsh_asic27a_arm7_write_long(UINT32 address, UINT32 data) -{ - switch (address) - { - case 0x40000000: + case 0x31: { - kovsh_highlatch_arm_w = data >> 16; - kovsh_lowlatch_arm_w = data; + // how is this selected? command 54? - kovsh_highlatch_68k_w = 0; - kovsh_lowlatch_68k_w = 0; + // just a wild guess + if (asic27a_sim_regs[0x54]) { + // pc == 1387de + asic27a_sim_response = 0x63<<16; // ? + } else { + // pc == 14cf58 + asic27a_sim_response = 0xd2<<16; + } + + asic27a_sim_regs[0x54] = 0; } - return; + break; + + case 0x38: // Reset + asic27a_sim_response = 0x78<<16; + asic27a_sim_key = 0; + asic27a_sim_regs[0x54] = 0; + break; + + case 0x41: // ASIC status? + asic27a_sim_response = 0x74<<16; + break; + + case 0x47: // ASIC status? + asic27a_sim_response = 0x74<<16; + break; + + case 0x52: // ASIC status? + { + // how is this selected? + + //if (kov_value == 6) { + asic27a_sim_response = (0x74<<16)|1; // |1? + //} else { + // asic27a_sim_response = 0x74<<16; + //} + } + break; + + case 0x54: // ?? + asic27a_sim_regs[0x54] = 1; + asic27a_sim_response = 0x36<<16; + break; + + case 0x61: // ?? + asic27a_sim_response = 0x36<<16; + break; + + case 0x63: // probably read from a data table? + asic27a_sim_response = 0; // wrong... + break; + + case 0x67: // probably read from a data table? + asic27a_sim_response = 0; + break; + + default: + // bprintf (0, _T("ASIC Command %2.2x unknown!\n"), (data ^ asic27a_sim_key) & 0xff); + asic27a_sim_response = 0x74<<16; + break; } } -static UINT32 kovsh_asic27a_arm7_read_long(UINT32 address) +void install_protection_asic27a_puzzli2() { - switch (address) - { - case 0x40000000: - return (kovsh_highlatch_68k_w << 16) | (kovsh_lowlatch_68k_w); - - case 0x4000000c: - return kovsh_counter++; - } - - return 0; -} - -void install_protection_asic27a_kovsh() -{ - nPGMArm7Type = 1; - pPgmScanCallback = kovsh_asic27aScan; + pPgmResetCallback = asic27a_sim_reset; + pPgmScanCallback = asic27a_sim_scan; + asic27a_sim_command = puzzli2_asic27a_sim_command; SekOpen(0); - SekMapMemory(PGMARMShareRAM, 0x4f0000, 0x4f003f, SM_RAM); + SekMapMemory(PGMUSER0, 0x4f0000, 0x4f003f | 0x3ff, SM_READ); - SekMapHandler(4, 0x500000, 0x600005, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, kovsh_asic27a_read_word); - SekSetWriteWordHandler(4, kovsh_asic27a_write_word); + SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_sim_read); + SekSetWriteWordHandler(4, asic27a_sim_write); SekClose(); - - Arm7Init(1); - Arm7Open(0); - Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); - Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); - Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); - Arm7SetWriteWordHandler(kovsh_asic27a_arm7_write_word); - Arm7SetWriteLongHandler(kovsh_asic27a_arm7_write_long); - Arm7SetReadLongHandler(kovsh_asic27a_arm7_read_long); - Arm7Close(); } //------------------------------------------------------------------------------------------- -// Kovshp hack -- Intercept commands and translate them to those used by kovsh +// py2k2 -void __fastcall kovshp_asic27a_write_word(UINT32 address, UINT16 data) +static void py2k2_asic27a_sim_command(UINT8 command) { - switch (address & 6) + switch (command) { - case 0: - kovsh_lowlatch_68k_w = data; - return; + case 0x99: // Reset? + asic27a_sim_key = 0x100; + asic27a_sim_response = 0x880000; + break; - case 2: - { - unsigned char asic_key = data >> 8; - unsigned char asic_cmd = (data & 0xff) ^ asic_key; + case 0x38: // ? + asic27a_sim_response = 0x880000; + break; - switch (asic_cmd) - { - case 0x9a: asic_cmd = 0x99; break; // kovassga - case 0xa6: asic_cmd = 0xa9; break; // kovassga - case 0xaa: asic_cmd = 0x56; break; // kovassga - case 0xf8: asic_cmd = 0xf3; break; // kovassga + case 0xc0: + asic27a_sim_response = 0x880000; + break; - case 0x38: asic_cmd = 0xad; break; - case 0x43: asic_cmd = 0xca; break; - case 0x56: asic_cmd = 0xac; break; - case 0x73: asic_cmd = 0x93; break; - case 0x84: asic_cmd = 0xb3; break; - case 0x87: asic_cmd = 0xb1; break; - case 0x89: asic_cmd = 0xb6; break; - case 0x93: asic_cmd = 0x73; break; - case 0xa5: asic_cmd = 0xa9; break; - case 0xac: asic_cmd = 0x56; break; - case 0xad: asic_cmd = 0x38; break; - case 0xb1: asic_cmd = 0x87; break; - case 0xb3: asic_cmd = 0x84; break; - case 0xb4: asic_cmd = 0x90; break; - case 0xb6: asic_cmd = 0x89; break; - case 0xc5: asic_cmd = 0x8c; break; - case 0xca: asic_cmd = 0x43; break; - case 0xcc: asic_cmd = 0xf0; break; - case 0xd0: asic_cmd = 0xe0; break; - case 0xe0: asic_cmd = 0xd0; break; - case 0xe7: asic_cmd = 0x70; break; - case 0xed: asic_cmd = 0xcb; break; - case 0xf0: asic_cmd = 0xcc; break; - case 0xf1: asic_cmd = 0xf5; break; - case 0xf2: asic_cmd = 0xf1; break; - case 0xf4: asic_cmd = 0xf2; break; - case 0xf5: asic_cmd = 0xf4; break; - case 0xfc: asic_cmd = 0xc0; break; - case 0xfe: asic_cmd = 0xc3; break; - } + case 0xc3: + asic27a_sim_response = 0x904000 + ((asic27a_sim_regs[0xc0] + (asic27a_sim_value * 0x40)) * 4); + break; - kovsh_highlatch_68k_w = asic_cmd ^ (asic_key | (asic_key << 8)); - } - return; + case 0xd0: + asic27a_sim_response = 0xa01000 + (asic27a_sim_value * 0x20); + break; + + case 0xdc: + asic27a_sim_response = 0xa00800 + (asic27a_sim_value * 0x40); + break; + + case 0xe0: + asic27a_sim_response = 0xa00000 + ((asic27a_sim_value & 0x1f) * 0x40); + break; + + // case 0x32: // ? + // break; + + // case 0xba: // almost definitely a table... + // break; + + default: + asic27a_sim_response = 0x880000; + bprintf (0, _T("Uknown ASIC Command %2.2x Value: %4.4x\n"), command, asic27a_sim_value); + break; } } -void install_protection_asic27a_kovshp() +void install_protection_asic27a_py2k2() { - nPGMArm7Type = 1; - pPgmScanCallback = kovsh_asic27aScan; + pPgmResetCallback = asic27a_sim_reset; + pPgmScanCallback = asic27a_sim_scan; + asic27a_sim_command = py2k2_asic27a_sim_command; SekOpen(0); - SekMapMemory(PGMARMShareRAM, 0x4f0000, 0x4f003f, SM_RAM); + SekMapMemory(PGMUSER0, 0x4f0000, 0x4f003f | 0x3ff, SM_READ); - SekMapHandler(4, 0x500000, 0x600005, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, kovsh_asic27a_read_word); - SekSetWriteWordHandler(4, kovshp_asic27a_write_word); + SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); + SekSetReadWordHandler(4, asic27a_sim_read); + SekSetWriteWordHandler(4, asic27a_sim_write); SekClose(); - - Arm7Init(1); - Arm7Open(0); - Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); - Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); - Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); - Arm7SetWriteWordHandler(kovsh_asic27a_arm7_write_word); - Arm7SetWriteLongHandler(kovsh_asic27a_arm7_write_long); - Arm7SetReadLongHandler(kovsh_asic27a_arm7_read_long); - Arm7Close(); } -//---------------------------------------------------------------------------------------------------------- +//-------------------------- +// drgw2 + +#define DW2BITSWAP(s,d,bs,bd) d=((d&(~(1<>bs)&1)<>8)|(d<<8); + DW2BITSWAP(d,d2,7 ,0); + DW2BITSWAP(d,d2,4 ,1); + DW2BITSWAP(d,d2,5 ,2); + DW2BITSWAP(d,d2,2 ,3); + DW2BITSWAP(d,d2,15,4); + DW2BITSWAP(d,d2,1 ,5); + DW2BITSWAP(d,d2,10,6); + DW2BITSWAP(d,d2,13,7); + + // ... missing bitswaps here (8-15) there is not enough data to know them + // the code only checks the lowest 8 bits + + return d2; +} + +void install_protection_asic25_asic12_dw2() +{ + SekOpen(0); + SekMapHandler(4, 0xd80000, 0xd80003, SM_READ); + SekSetReadWordHandler(4, dw2_read_word); + SekClose(); +} + + +//------------------------- // olds static INT32 rego; @@ -1513,6 +2096,7 @@ static UINT32 olds_prot_addr( UINT16 addr ) default: realaddr = 0; } + return realaddr; } @@ -1591,12 +2175,13 @@ void __fastcall olds_protection_write(UINT32 address, UINT16 data) default: break; } + olds_cmd3 = ((data >> 4) + 1) & 0x3; } else if (kb_cmd == 4) kb_ptr = data; else if(kb_cmd == 0x20) - kb_ptr++; + kb_ptr++; } } @@ -1614,10 +2199,33 @@ static UINT8 __fastcall olds_mainram_read_byte(UINT32 address) static void reset_olds() { - olds_bs = olds_cmd3 = kb_cmd = ptr = rego = 0; + olds_bs = olds_cmd3 = kb_cmd = kb_ptr = rego = 0; memcpy (PGMUSER0, PGMUSER0 + 0x10000, 0x04000); } +static INT32 oldsScan(INT32 nAction, INT32 *) +{ + struct BurnArea ba; + + if (nAction & ACB_MEMORY_RAM) { + ba.Data = PGMUSER0 + 0x000000; + ba.nLen = 0x0004000; + ba.nAddress = 0x400000; + ba.szName = "ProtRAM"; + BurnAcb(&ba); + } + + if (nAction & ACB_DRIVER_DATA) { + SCAN_VAR(olds_cmd3); + SCAN_VAR(rego); + SCAN_VAR(olds_bs); + SCAN_VAR(kb_ptr); + SCAN_VAR(kb_cmd); + } + + return 0; +} + void install_protection_asic25_asic28_olds() { pPgmScanCallback = oldsScan; @@ -1659,1015 +2267,3 @@ void install_protection_asic25_asic28_olds() SekClose(); } - -//------------------------------------------------------------------------------------------- -// Oriental Legends Special Plus! (Creamy Mami) - -static UINT16 m_oldsplus_key; -static UINT16 m_oldsplus_int[2]; -static UINT32 m_oldsplus_val; -static UINT32 m_oldsplus_regs[0x100]; -static UINT32 m_oldsplus_ram[0x100]; - -static const INT32 oldsplus_80[0x5]={ - 0xbb8,0x1770,0x2328,0x2ee0,0xf4240 -}; - -static const UINT8 oldsplus_fc[0x20]={ - 0x00,0x00,0x0a,0x3a,0x4e,0x2e,0x03,0x40, - 0x33,0x43,0x26,0x2c,0x00,0x00,0x00,0x00, - 0x00,0x00,0x44,0x4d,0x0b,0x27,0x3d,0x0f, - 0x37,0x2b,0x02,0x2f,0x15,0x45,0x0e,0x30 -}; - -static const UINT16 oldsplus_a0[0x20]={ - 0x000,0x023,0x046,0x069,0x08c,0x0af,0x0d2,0x0f5, - 0x118,0x13b,0x15e,0x181,0x1a4,0x1c7,0x1ea,0x20d, - 0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d, - 0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d,0x20d, -}; - -static const UINT16 oldsplus_90[0x7]={ - 0x50,0xa0,0xc8,0xf0,0x190,0x1f4,0x258 -}; - -static const UINT8 oldsplus_5e[0x20]={ - 0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03, - 0x02,0x02,0x02,0x01,0x01,0x01,0x01,0x01, - 0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; - -static const UINT8 oldsplus_b0[0xe0]={ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04, - 0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c, - 0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08, - 0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,0x10, - 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18, - - 0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04, - 0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c, - 0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13,0x14, - 0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c, - - 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, - 0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f, - 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, - 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f, - - 0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b, - 0x0c,0x0d,0x0e,0x0f,0x10,0x11,0x12,0x13, - 0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b, - 0x1c,0x1d,0x1e,0x1f,0x1f,0x1f,0x1f,0x1f -}; - -static const UINT8 oldsplus_ae[0xe0]={ - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - 0x50,0x50,0x50,0x50,0x50,0x50,0x50,0x50, - - 0x1E,0x1F,0x20,0x21,0x22,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - - 0x1F,0x20,0x21,0x22,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - - 0x20,0x21,0x22,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - - 0x21,0x22,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23, - 0x23,0x23,0x23,0x23,0x23,0x23,0x23,0x23 -}; - -static const UINT16 oldsplus_ba[0x4]={ - 0x3138,0x2328,0x1C20,0x1518 -}; - -static const UINT16 oldsplus_9d[0x111]={ - 0x0000,0x0064,0x00c8,0x012c,0x0190,0x01f4,0x0258,0x02bc, - 0x02f8,0x0334,0x0370,0x03ac,0x03e8,0x0424,0x0460,0x049c, - 0x04d8,0x0514,0x0550,0x058c,0x05c8,0x0604,0x0640,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x0000, - 0x0064,0x00c8,0x012c,0x0190,0x01f4,0x0258,0x02bc,0x0302, - 0x0348,0x038e,0x03d4,0x041a,0x0460,0x04a6,0x04ec,0x0532, - 0x0578,0x05be,0x0604,0x064a,0x0690,0x06d6,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x0000,0x0064, - 0x00c8,0x012c,0x0190,0x01f4,0x0258,0x02bc,0x0316,0x0370, - 0x03ca,0x0424,0x047e,0x04d8,0x0532,0x058c,0x05e6,0x0640, - 0x069a,0x06f4,0x074e,0x07a8,0x0802,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x0000,0x0064,0x00c8, - 0x012c,0x0190,0x01f4,0x0258,0x02bc,0x032a,0x0398,0x0406, - 0x0474,0x04e2,0x0550,0x05be,0x062c,0x069a,0x0708,0x0776, - 0x07e4,0x0852,0x08c0,0x092e,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x0000,0x0064,0x00c8,0x012c, - 0x0190,0x01f4,0x0258,0x02bc,0x0348,0x03d4,0x0460,0x04ec, - 0x0578,0x0604,0x0690,0x071c,0x07a8,0x0834,0x08c0,0x094c, - 0x09d8,0x0a64,0x0af0,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x0000,0x0064,0x00c8,0x012c,0x0190, - 0x01f4,0x0258,0x02bc,0x0384,0x044c,0x0514,0x05dc,0x06a4, - 0x076c,0x0834,0x08fc,0x09c4,0x0a8c,0x0b54,0x0c1c,0x0ce4, - 0x0dac,0x0e74,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x0000,0x0064,0x00c8,0x012c,0x0190,0x01f4, - 0x0258,0x02bc,0x030c,0x035c,0x03ac,0x03fc,0x044c,0x049c, - 0x04ec,0x053c,0x058c,0x05dc,0x062c,0x067c,0x06cc,0x071c, - 0x076c,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc,0x06bc, - 0x06bc -}; - -static const UINT16 oldsplus_8c[0x20]={ - 0x0032,0x0032,0x0064,0x0096,0x0096,0x00fa,0x012c,0x015e, - 0x0032,0x0064,0x0096,0x00c8,0x00c8,0x012c,0x015e,0x0190, - 0x0064,0x0096,0x00c8,0x00fa,0x00fa,0x015e,0x0190,0x01c2, - 0x0096,0x00c8,0x00fa,0x012c,0x012c,0x0190,0x01c2,0x01f4 -}; - -UINT16 __fastcall oldsplus_prot_read(UINT32 address) -{ - if (address == 0x500000) - { - UINT16 d = m_oldsplus_val & 0xffff; - UINT16 realkey = m_oldsplus_key >> 8; - realkey |= m_oldsplus_key; - d ^= realkey; - return d; - } - else if (address == 0x500002) - { - UINT16 d = m_oldsplus_val >> 16; - UINT16 realkey = m_oldsplus_key >> 8; - realkey |= m_oldsplus_key; - d ^= realkey; - return d; - - } - return 0xff; -} - -void __fastcall oldsplus_prot_write(UINT32 address, UINT16 data) -{ - if (address == 0x500000) - { - m_oldsplus_int[0] = data; - return; - } - - if (address == 0x500002) - { - UINT16 realkey; - if ((data >> 8) == 0xff) m_oldsplus_key = 0xff00; - realkey = m_oldsplus_key >> 8; - realkey |= m_oldsplus_key; - { - m_oldsplus_key += 0x100; - m_oldsplus_key &= 0xff00; - if (m_oldsplus_key == 0xff00) m_oldsplus_key = 0x100; - } - data ^= realkey; - m_oldsplus_int[1] = data; - m_oldsplus_int[0] ^= realkey; - - switch (m_oldsplus_int[1] & 0xff) - { - case 0x88: - m_oldsplus_key = 0x100; - m_oldsplus_val = 0x990000; - break; - - case 0xd0: - m_oldsplus_val = 0xa01000 + (m_oldsplus_int[0] << 5); - break; - - case 0xc0: - m_oldsplus_val = 0xa00000 + (m_oldsplus_int[0] << 6); - break; - - case 0xc3: - m_oldsplus_val = 0xa00800 + (m_oldsplus_int[0] << 6); - break; - - case 0x36: - m_oldsplus_ram[0x36] = m_oldsplus_int[0]; - m_oldsplus_val = 0x990000; - break; - - case 0x33: - m_oldsplus_ram[0x33] = m_oldsplus_int[0]; - m_oldsplus_val = 0x990000; - break; - - case 0x35: - m_oldsplus_ram[0x36] += m_oldsplus_int[0]; - m_oldsplus_val = 0x990000; - break; - - case 0x37: - m_oldsplus_ram[0x33] += m_oldsplus_int[0]; - m_oldsplus_val = 0x990000; - break; - - case 0x34: - m_oldsplus_val = m_oldsplus_ram[0x36]; - break; - - case 0x38: - m_oldsplus_val = m_oldsplus_ram[0x33]; - break; - - case 0x80: - m_oldsplus_val = oldsplus_80[m_oldsplus_int[0]]; - break; - - case 0xe7: - m_oldsplus_ram[0xe7] = m_oldsplus_int[0]; - m_oldsplus_val = 0x990000; - break; - - case 0xe5: - switch (m_oldsplus_ram[0xe7]) - { - case 0xb000: - m_oldsplus_regs[0xb] = m_oldsplus_int[0]; - m_oldsplus_regs[0xc] = 0; - break; - - case 0xc000: - m_oldsplus_regs[0xc] = m_oldsplus_int[0]; - break; - - case 0xd000: - m_oldsplus_regs[0xd] = m_oldsplus_int[0]; - break; - - case 0xf000: - m_oldsplus_regs[0xf] = m_oldsplus_int[0]; - break; - } - m_oldsplus_val = 0x990000; - break; - - case 0xf8: - m_oldsplus_val = m_oldsplus_regs[m_oldsplus_int[0]]; - break; - - case 0xfc: - m_oldsplus_val = oldsplus_fc[m_oldsplus_int[0]]; - break; - - case 0xc5: - m_oldsplus_regs[0xd] --; - m_oldsplus_val = 0x990000; - break; - - case 0xd6: - m_oldsplus_regs[0xb] ++; - m_oldsplus_val = 0x990000; - break; - - case 0x3a: - m_oldsplus_regs[0xf] = 0; - m_oldsplus_val = 0x990000; - break; - - case 0xf0: - m_oldsplus_ram[0xf0] = m_oldsplus_int[0]; - m_oldsplus_val = 0x990000; - break; - - case 0xed: - m_oldsplus_val = m_oldsplus_int[0] << 0x6; - m_oldsplus_val += m_oldsplus_ram[0xf0]; - m_oldsplus_val = m_oldsplus_val << 0x2; - m_oldsplus_val += 0x900000; - break; - - case 0xe0: - m_oldsplus_ram[0xe0] = m_oldsplus_int[0]; - m_oldsplus_val = 0x990000; - break; - - case 0xdc: - m_oldsplus_val = m_oldsplus_int[0] << 0x6; - m_oldsplus_val += m_oldsplus_ram[0xe0]; - m_oldsplus_val = m_oldsplus_val << 2; - m_oldsplus_val += 0x904000; - break; - - case 0xcb: - m_oldsplus_val = 0xc000; - break; - - case 0xa0: - m_oldsplus_val = oldsplus_a0[m_oldsplus_int[0]]; - break; - - case 0xba: - m_oldsplus_val = oldsplus_ba[m_oldsplus_int[0]]; - break; - - case 0x5e: - m_oldsplus_val = oldsplus_5e[m_oldsplus_int[0]]; - break; - - case 0xb0: - m_oldsplus_val = oldsplus_b0[m_oldsplus_int[0]]; - break; - - case 0xae: - m_oldsplus_val = oldsplus_ae[m_oldsplus_int[0]]; - break; - - case 0x9d: - m_oldsplus_val = oldsplus_9d[m_oldsplus_int[0]]; - break; - - case 0x90: - m_oldsplus_val = oldsplus_90[m_oldsplus_int[0]]; - break; - - case 0x8c: - m_oldsplus_val = oldsplus_8c[m_oldsplus_int[0]]; - break; - - default: - m_oldsplus_val = 0x990000; - break; - } - } -} - -static void reset_asic27a_oldsplus() -{ - m_oldsplus_key = 0; - m_oldsplus_val = 0; - memset (m_oldsplus_int, 0, sizeof(INT16) * 2); - memset (m_oldsplus_regs, 0, sizeof(INT32) * 0x100); - memset (m_oldsplus_ram, 0, sizeof(INT32) * 0x100); - - memset (PGMUSER0, 0, 0x400); - - *((UINT16*)(PGMUSER0 + 0x00008)) = PgmInput[7]; // region -} - -void install_protection_asic27a_oldsplus() -{ - pPgmScanCallback = oldsplus_asic27aScan; - pPgmResetCallback = reset_asic27a_oldsplus; - - SekOpen(0); - SekMapMemory(PGMUSER0, 0x4f0000, 0x4f003f | 0x3ff, SM_READ); // ram - - SekMapHandler(4, 0x500000, 0x500003, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, oldsplus_prot_read); - SekSetWriteWordHandler(4, oldsplus_prot_write); - SekClose(); -} - - - -// add this to the bottom of pgm_prot.cpp (i added it after the oldsScan function) - - -INT32 oldsplus_asic27aScan(INT32 nAction, INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = (UINT8*)m_oldsplus_ram; - ba.nLen = 0x0000100 * sizeof(INT32); - ba.nAddress = 0xfffc00; - ba.szName = "Prot RAM"; - BurnAcb(&ba); - - ba.Data = (UINT8*)m_oldsplus_regs; - ba.nLen = 0x0000100 * sizeof(INT32); - ba.nAddress = 0xfff800; - ba.szName = "Prot REGs"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(m_oldsplus_key); - SCAN_VAR(m_oldsplus_val); - SCAN_VAR(m_oldsplus_int[0]); - SCAN_VAR(m_oldsplus_int[1]); - } - - return 0; -} - -//------------------------------------------------------------------------------------------- -// S.V.G. - Spectral vs Generation / Demon Front / The Gladiator / The Killing Blade EX / Happy 6in1 - -static UINT8 svg_ram_sel = 0; -static UINT8 *svg_ram[2]; - -static void svg_set_ram_bank(INT32 data) -{ - svg_ram_sel = data & 1; - Arm7MapMemory(svg_ram[svg_ram_sel], 0x38000000, 0x3801ffff, ARM7_RAM); - SekMapMemory(svg_ram[svg_ram_sel^1], 0x500000, 0x51ffff, SM_FETCH); -} - -static void __fastcall svg_write_byte(UINT32 address, UINT8 data) -{ - pgm_cpu_sync(); - - if ((address & 0xffe0000) == 0x0500000) { - svg_ram[svg_ram_sel^1][(address & 0x1ffff)^1] = data; - return; - } - - switch (address) - { - case 0x5c0000: - case 0x5c0001: - Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_HOLD_LINE); - return; - } -} - -static void __fastcall svg_write_word(UINT32 address, UINT16 data) -{ - pgm_cpu_sync(); - - if ((address & 0xffe0000) == 0x0500000) { - *((UINT16*)(svg_ram[svg_ram_sel^1] + (address & 0x1fffe))) = BURN_ENDIAN_SWAP_INT16(data); - - return; - } - - switch (address) - { - case 0x5c0000: - Arm7SetIRQLine(ARM7_FIRQ_LINE, ARM7_HOLD_LINE); - return; - - case 0x5c0300: - asic27a_to_arm = data; - return; - } -} - -static UINT8 __fastcall svg_read_byte(UINT32 address) -{ - if ((address & 0xffe0000) == 0x0500000) { - pgm_cpu_sync(); - - INT32 d = svg_ram[svg_ram_sel^1][(address & 0x1ffff)^1]; - return d; - } - - switch (address) - { - case 0x5c0000: - case 0x5c0001: - return 0; - } - - return 0; -} - -static UINT16 __fastcall svg_read_word(UINT32 address) -{ - if ((address & 0xffe0000) == 0x0500000) { - pgm_cpu_sync(); - - return BURN_ENDIAN_SWAP_INT16(*((UINT16*)(svg_ram[svg_ram_sel^1] + (address & 0x1fffe)))); - } - - switch (address) - { - case 0x5c0000: - case 0x5c0001: - return 0; - - case 0x5c0300: - pgm_cpu_sync(); - return asic27a_to_68k; - } - - return 0; -} - -static void svg_arm7_write_byte(UINT32 address, UINT8 data) -{ - switch (address) - { - case 0x40000018: - svg_set_ram_bank(data); - return; - - case 0x48000000: - asic27a_to_68k = data; - return; - } -} - -static void svg_arm7_write_word(UINT32 /*address*/, UINT16 /*data*/) -{ - -} - -static void svg_arm7_write_long(UINT32 address, UINT32 data) -{ - switch (address) - { - case 0x40000018: - svg_set_ram_bank(data); - return; - - case 0x48000000: - asic27a_to_68k = data; - return; - } -} - -static UINT8 svg_arm7_read_byte(UINT32 address) -{ - switch (address) - { - case 0x48000000: - case 0x48000001: - case 0x48000002: - case 0x48000003: - return asic27a_to_arm; - } - - return 0; -} - -static UINT16 svg_arm7_read_word(UINT32 address) -{ - switch (address) - { - case 0x48000000: - case 0x48000002: - return asic27a_to_arm; - } - - return 0; -} - -static UINT32 svg_arm7_read_long(UINT32 address) -{ - switch (address) - { - case 0x48000000: - return asic27a_to_arm; - } - - return 0; -} - -void install_protection_asic27a_svg() -{ - nPGMArm7Type = 3; - - pPgmScanCallback = svg_asic27aScan; - - svg_ram_sel = 0; - svg_ram[0] = PGMARMShareRAM; - svg_ram[1] = PGMARMShareRAM2; - - SekOpen(0); - SekMapHandler(5, 0x500000, 0x5fffff, SM_RAM); - SekSetReadWordHandler(5, svg_read_word); - SekSetReadByteHandler(5, svg_read_byte); - SekSetWriteWordHandler(5, svg_write_word); - SekSetWriteByteHandler(5, svg_write_byte); - SekClose(); - - Arm7Init(1); - Arm7Open(0); - Arm7MapMemory(PGMARMROM, 0x00000000, 0x00003fff, ARM7_ROM); - Arm7MapMemory(PGMUSER0, 0x08000000, 0x08000000 | (nPGMExternalARMLen-1), ARM7_ROM); - Arm7MapMemory(PGMARMRAM0, 0x10000000, 0x100003ff, ARM7_RAM); - Arm7MapMemory(PGMARMRAM1, 0x18000000, 0x1803ffff, ARM7_RAM); - Arm7MapMemory(svg_ram[1], 0x38000000, 0x3801ffff, ARM7_RAM); - Arm7MapMemory(PGMARMRAM2, 0x50000000, 0x500003ff, ARM7_RAM); - Arm7SetWriteByteHandler(svg_arm7_write_byte); - Arm7SetWriteWordHandler(svg_arm7_write_word); - Arm7SetWriteLongHandler(svg_arm7_write_long); - Arm7SetReadByteHandler(svg_arm7_read_byte); - Arm7SetReadWordHandler(svg_arm7_read_word); - Arm7SetReadLongHandler(svg_arm7_read_long); - Arm7Close(); -} - - -//------------------------------------------------------------------------------------------- -// ketsui / espgaluda / ddp3 - -static UINT16 ddp3value; -static UINT16 ddp3key; -static UINT32 ddp3response; -static UINT8 ddp3internal_slot; -static UINT32 ddp3slots[0x100]; - -void __fastcall ddp3_asic_write(UINT32 offset, UINT16 data) -{ - switch (offset & 0x06) - { - case 0: ddp3value = data; return; - - case 2: - { - if ((data >> 8) == 0xff) ddp3key = 0xffff; - - ddp3value ^= ddp3key; - ddp3response = 0x880000; - - switch ((data ^ ddp3key) & 0xff) - { - case 0x40: - ddp3slots[(ddp3value >> 10) & 0x1f] = (ddp3slots[(ddp3value >> 5) & 0x1f] + ddp3slots[(ddp3value >> 0) & 0x1f]) & 0xffffff; - break; - - case 0x67: - ddp3internal_slot = ddp3value >> 8; - ddp3slots[ddp3internal_slot] = (ddp3value & 0x00ff) << 16; - break; - - case 0xe5: - ddp3slots[ddp3internal_slot] |= ddp3value; - break; - - case 0x8e: - ddp3response = ddp3slots[ddp3value & 0xff]; - break; - - case 0x99: // reset? - ddp3key = 0; - break; - } - - ddp3key = (ddp3key + 0x0100) & 0xff00; - if (ddp3key == 0xff00) ddp3key = 0x0100; - ddp3key |= ddp3key >> 8; - } - return; - - case 4: return; - } -} - -static UINT16 __fastcall ddp3_asic_read(UINT32 offset) -{ - switch (offset & 0x02) - { - case 0: return (ddp3response >> 0) ^ ddp3key; - case 2: return (ddp3response >> 16) ^ ddp3key; - } - - return 0; -} - -static void reset_ddp3() -{ - ddp3value = 0; - ddp3key = 0; - ddp3response = 0; - ddp3internal_slot = 0; - - memset (ddp3slots, 0, 0x100 * sizeof(INT32)); -} - -void install_protection_asic27a_ketsui() -{ - pPgmResetCallback = reset_ddp3; - pPgmScanCallback = ddp3Scan; - - SekOpen(0); - SekMapHandler(4, 0x400000, 0x400005, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, ddp3_asic_read); - SekSetWriteWordHandler(4, ddp3_asic_write); - SekClose(); -} - -void install_protection_asic27a_ddp3() -{ - pPgmResetCallback = reset_ddp3; - pPgmScanCallback = ddp3Scan; - - SekOpen(0); - SekMapHandler(4, 0x500000, 0x500005, SM_READ | SM_WRITE); - SekSetReadWordHandler(4, ddp3_asic_read); - SekSetWriteWordHandler(4, ddp3_asic_write); - SekClose(); -} - - -//----------------------------------------------------------------------------------------------------- -// Save states - -INT32 kov_asic27Scan(INT32 nAction, INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = (UINT8*)kov_slots; - ba.nLen = 0x0000010 * sizeof(INT32); - ba.nAddress = 0xff0000; - ba.szName = "Asic Slot Registers"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(kov_internal_slot); - SCAN_VAR(kov_key); - SCAN_VAR(kov_response); - SCAN_VAR(kov_value); - - SCAN_VAR(kov_c0_value); - SCAN_VAR(kov_cb_value); - SCAN_VAR(kov_fe_value); - } - - return 0; -} - -INT32 asic3Scan(INT32 nAction, INT32 *) -{ - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(asic3_reg); - SCAN_VAR(asic3_latch[0]); - SCAN_VAR(asic3_latch[1]); - SCAN_VAR(asic3_latch[2]); - SCAN_VAR(asic3_x); - SCAN_VAR(asic3_y); - SCAN_VAR(asic3_z); - SCAN_VAR(asic3_h1); - SCAN_VAR(asic3_h2); - SCAN_VAR(asic3_hold); - } - - return 0; -} - -INT32 killbldScan(INT32 nAction, INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = PGMUSER0 + 0x000000; - ba.nLen = 0x0004000; - ba.nAddress = 0x300000; - ba.szName = "ProtRAM"; - BurnAcb(&ba); - - ba.Data = (UINT8*)kb_regs; - ba.nLen = 0x00100 * sizeof(INT32); - ba.nAddress = 0xfffffc00; - ba.szName = "Protection Registers"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(kb_cmd); - SCAN_VAR(kb_reg); - SCAN_VAR(kb_ptr); - } - - return 0; -} - -INT32 pstarsScan(INT32 nAction, INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = (UINT8*)PSTARS_REGS; - ba.nLen = 0x0000010 * sizeof(INT32); - ba.nAddress = 0xff1000; - ba.szName = "Asic Register"; - BurnAcb(&ba); - - ba.Data = (UINT8*)pstar_ram; - ba.nLen = 0x0000003 * sizeof(INT16); - ba.nAddress = 0xff2000; - ba.szName = "Asic RAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(PSTARSKEY); - SCAN_VAR(PSTARS_VAL); - SCAN_VAR(PSTARSINT[0]); - SCAN_VAR(PSTARSINT[1]); - SCAN_VAR(pstar_e7); - SCAN_VAR(pstar_b1); - SCAN_VAR(pstar_ce); - } - - return 0; -} - -INT32 asic27aScan(INT32 nAction,INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = PGMARMShareRAM; - ba.nLen = 0x0010000; - ba.nAddress = 0xd00000; - ba.szName = "ARM SHARE RAM"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM0; - ba.nLen = 0x0000400; - ba.nAddress = 0; - ba.szName = "ARM RAM 0"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM1; - ba.nLen = 0x0010000; - ba.nAddress = 0; - ba.szName = "ARM RAM 1"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM2; - ba.nLen = 0x0000400; - ba.nAddress = 0; - ba.szName = "ARM RAM 2"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - Arm7Scan(nAction); - - SCAN_VAR(asic27a_to_arm); - SCAN_VAR(asic27a_to_68k); - } - - return 0; -} - -INT32 oldsScan(INT32 nAction, INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = PGMUSER0 + 0x000000; - ba.nLen = 0x0004000; - ba.nAddress = 0x400000; - ba.szName = "ProtRAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(olds_cmd3); - SCAN_VAR(rego); - SCAN_VAR(olds_bs); - SCAN_VAR(ptr); - SCAN_VAR(kb_cmd); - } - - return 0; -} - -INT32 kovsh_asic27aScan(INT32 nAction,INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = PGMARMShareRAM; - ba.nLen = 0x0000040; - ba.nAddress = 0x400000; - ba.szName = "ARM SHARE RAM"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM0; - ba.nLen = 0x0000400; - ba.nAddress = 0; - ba.szName = "ARM RAM 0"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM2; - ba.nLen = 0x0000400; - ba.nAddress = 0; - ba.szName = "ARM RAM 1"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - Arm7Scan(nAction); - - SCAN_VAR(kovsh_highlatch_arm_w); - SCAN_VAR(kovsh_lowlatch_arm_w); - SCAN_VAR(kovsh_highlatch_68k_w); - SCAN_VAR(kovsh_lowlatch_68k_w); - SCAN_VAR(kovsh_counter); - } - - return 0; -} - -INT32 svg_asic27aScan(INT32 nAction,INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = PGMARMShareRAM; - ba.nLen = 0x0020000; - ba.nAddress = 0x400000; - ba.szName = "ARM SHARE RAM #0 (address 500000)"; - BurnAcb(&ba); - - ba.Data = PGMARMShareRAM2; - ba.nLen = 0x0020000; - ba.nAddress = 0x500000; - ba.szName = "ARM SHARE RAM #1"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM0; - ba.nLen = 0x0000400; - ba.nAddress = 0; - ba.szName = "ARM RAM 0"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM1; - ba.nLen = 0x0040000; - ba.nAddress = 0; - ba.szName = "ARM RAM 1"; - BurnAcb(&ba); - - ba.Data = PGMARMRAM2; - ba.nLen = 0x0000400; - ba.nAddress = 0; - ba.szName = "ARM RAM 2"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - Arm7Scan(nAction); - SCAN_VAR(asic27a_to_arm); - SCAN_VAR(asic27a_to_68k); - - SCAN_VAR(svg_ram_sel); - svg_set_ram_bank(svg_ram_sel); - } - - return 0; -} - -INT32 ddp3Scan(INT32 nAction, INT32 *) -{ - struct BurnArea ba; - - if (nAction & ACB_MEMORY_RAM) { - ba.Data = (UINT8*)ddp3slots; - ba.nLen = 0x0000100 * sizeof(INT32); - ba.nAddress = 0xff00000; - ba.szName = "ProtRAM"; - BurnAcb(&ba); - } - - if (nAction & ACB_DRIVER_DATA) { - SCAN_VAR(ddp3value); - SCAN_VAR(ddp3key); - SCAN_VAR(ddp3response); - SCAN_VAR(ddp3internal_slot); - } - - return 0; -}