From 80ce03e40a519c1ec7947c2e79cb2c1d41801a74 Mon Sep 17 00:00:00 2001 From: dinkc64 Date: Thu, 20 Jul 2023 20:48:31 -0400 Subject: [PATCH] taito darius2 & ninjaw gets a little cleanup --- src/burn/drv/taito/d_darius2.cpp | 776 +++++++++++++------------------ 1 file changed, 336 insertions(+), 440 deletions(-) diff --git a/src/burn/drv/taito/d_darius2.cpp b/src/burn/drv/taito/d_darius2.cpp index 7ef1832152..b1b4a95143 100644 --- a/src/burn/drv/taito/d_darius2.cpp +++ b/src/burn/drv/taito/d_darius2.cpp @@ -14,6 +14,8 @@ static INT32 Ninjaw = 0, Warriorb = 0; static double Darius2YM2610Route1MasterVol; static double Darius2YM2610Route2MasterVol; +static INT32 nCyclesExtra[2]; + static struct BurnInputInfo Darius2InputList[] = { {"P1 Coin" , BIT_DIGITAL , TC0220IOCInputPort0 + 2, "p1 coin" }, @@ -24,7 +26,7 @@ static struct BurnInputInfo Darius2InputList[] = {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 2, "p1 right" }, {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 1" }, {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 2" }, - + {"P2 Coin" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, {"P2 Start" , BIT_DIGITAL , TC0220IOCInputPort2 + 3, "p2 start" }, {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 up" }, @@ -33,7 +35,7 @@ static struct BurnInputInfo Darius2InputList[] = {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 6, "p2 right" }, {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 1" }, {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 2" }, - + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, {"Service" , BIT_DIGITAL , TC0220IOCInputPort2 + 0, "service" }, {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort2 + 1, "tilt" }, @@ -54,7 +56,7 @@ static struct BurnInputInfo Darius2dInputList[] = {"P1 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 3, "p1 right" }, {"P1 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 4, "p1 fire 1" }, {"P1 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 5, "p1 fire 2" }, - + {"P2 Coin" , BIT_DIGITAL , TC0220IOCInputPort0 + 3, "p2 coin" }, {"P2 Start" , BIT_DIGITAL , TC0220IOCInputPort0 + 5, "p2 start" }, {"P2 Up" , BIT_DIGITAL , TC0220IOCInputPort1 + 4, "p2 up" }, @@ -63,7 +65,7 @@ static struct BurnInputInfo Darius2dInputList[] = {"P2 Right" , BIT_DIGITAL , TC0220IOCInputPort1 + 7, "p2 right" }, {"P2 Fire 1" , BIT_DIGITAL , TC0220IOCInputPort2 + 6, "p2 fire 1" }, {"P2 Fire 2" , BIT_DIGITAL , TC0220IOCInputPort2 + 7, "p2 fire 2" }, - + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, {"Service" , BIT_DIGITAL , TC0220IOCInputPort0 + 0, "service" }, {"Tilt" , BIT_DIGITAL , TC0220IOCInputPort0 + 1, "tilt" }, @@ -85,7 +87,7 @@ static struct BurnInputInfo WarriorbInputList[] = {"P1 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 4, "p1 fire 1" }, {"P1 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 5, "p1 fire 2" }, {"P1 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 6, "p1 fire 3" }, - + {"P2 Coin" , BIT_DIGITAL , TC0510NIOInputPort0 + 3, "p2 coin" }, {"P2 Start" , BIT_DIGITAL , TC0510NIOInputPort0 + 5, "p2 start" }, {"P2 Up" , BIT_DIGITAL , TC0510NIOInputPort1 + 4, "p2 up" }, @@ -95,7 +97,7 @@ static struct BurnInputInfo WarriorbInputList[] = {"P2 Fire 1" , BIT_DIGITAL , TC0510NIOInputPort2 + 6, "p2 fire 1" }, {"P2 Fire 2" , BIT_DIGITAL , TC0510NIOInputPort2 + 7, "p2 fire 2" }, {"P2 Fire 3" , BIT_DIGITAL , TC0510NIOInputPort0 + 7, "p2 fire 3" }, - + {"Reset" , BIT_DIGITAL , &TaitoReset , "reset" }, {"Service" , BIT_DIGITAL , TC0510NIOInputPort0 + 0, "service" }, {"Tilt" , BIT_DIGITAL , TC0510NIOInputPort0 + 1, "tilt" }, @@ -108,65 +110,23 @@ STDINPUTINFO(Warriorb) static void Darius2MakeInputs() { - TC0220IOCInput[0] = 0xe2; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xff; - - if (TC0220IOCInputPort0[0]) TC0220IOCInput[0] |= 0x01; - if (TC0220IOCInputPort0[1]) TC0220IOCInput[0] -= 0x02; - if (TC0220IOCInputPort0[2]) TC0220IOCInput[0] |= 0x04; - if (TC0220IOCInputPort0[3]) TC0220IOCInput[0] |= 0x08; - if (TC0220IOCInputPort0[4]) TC0220IOCInput[0] |= 0x10; - if (TC0220IOCInputPort0[5]) TC0220IOCInput[0] -= 0x20; - if (TC0220IOCInputPort0[6]) TC0220IOCInput[0] -= 0x40; - if (TC0220IOCInputPort0[7]) TC0220IOCInput[0] -= 0x80; - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; - TC0220IOCInput[2] -= (TC0220IOCInputPort2[i] & 1) << i; - } + UINT32 DrvJoyInit[3] = { 0xe2, 0xff, 0xff }; + UINT8 *DrvJoy[3] = { TC0220IOCInputPort0, TC0220IOCInputPort1, TC0220IOCInputPort2 }; + CompileInput(DrvJoy, (void*)TC0220IOCInput, 3, 8, DrvJoyInit); } static void Darius2dMakeInputs() { - TC0220IOCInput[0] = 0xff; - TC0220IOCInput[1] = 0xff; - TC0220IOCInput[2] = 0xf7; - - if (TC0220IOCInputPort2[0]) TC0220IOCInput[2] -= 0x01; - if (TC0220IOCInputPort2[1]) TC0220IOCInput[2] -= 0x02; - if (TC0220IOCInputPort2[2]) TC0220IOCInput[2] -= 0x04; - if (TC0220IOCInputPort2[3]) TC0220IOCInput[2] |= 0x08; - if (TC0220IOCInputPort2[4]) TC0220IOCInput[2] -= 0x10; - if (TC0220IOCInputPort2[5]) TC0220IOCInput[2] -= 0x20; - if (TC0220IOCInputPort2[6]) TC0220IOCInput[2] -= 0x40; - if (TC0220IOCInputPort2[7]) TC0220IOCInput[2] -= 0x80; - - for (INT32 i = 0; i < 8; i++) { - TC0220IOCInput[0] -= (TC0220IOCInputPort0[i] & 1) << i; - TC0220IOCInput[1] -= (TC0220IOCInputPort1[i] & 1) << i; - } + UINT32 DrvJoyInit[3] = { 0xff, 0xff, 0xf7 }; + UINT8 *DrvJoy[3] = { TC0220IOCInputPort0, TC0220IOCInputPort1, TC0220IOCInputPort2 }; + CompileInput(DrvJoy, (void*)TC0220IOCInput, 3, 8, DrvJoyInit); } static void WarriorbMakeInputs() { - TC0510NIOInput[0] = 0xff; - TC0510NIOInput[1] = 0xff; - TC0510NIOInput[2] = 0xf7; - - if (TC0510NIOInputPort2[0]) TC0510NIOInput[2] -= 0x01; - if (TC0510NIOInputPort2[1]) TC0510NIOInput[2] -= 0x02; - if (TC0510NIOInputPort2[2]) TC0510NIOInput[2] -= 0x04; - if (TC0510NIOInputPort2[3]) TC0510NIOInput[2] |= 0x08; - if (TC0510NIOInputPort2[4]) TC0510NIOInput[2] -= 0x10; - if (TC0510NIOInputPort2[5]) TC0510NIOInput[2] -= 0x20; - if (TC0510NIOInputPort2[6]) TC0510NIOInput[2] -= 0x40; - if (TC0510NIOInputPort2[7]) TC0510NIOInput[2] -= 0x80; - - for (INT32 i = 0; i < 8; i++) { - TC0510NIOInput[0] -= (TC0510NIOInputPort0[i] & 1) << i; - TC0510NIOInput[1] -= (TC0510NIOInputPort1[i] & 1) << i; - } + UINT32 DrvJoyInit[3] = { 0xff, 0xff, 0xf7 }; + UINT8 *DrvJoy[3] = { TC0220IOCInputPort0, TC0220IOCInputPort1, TC0220IOCInputPort2 }; + CompileInput(DrvJoy, (void*)TC0220IOCInput, 3, 8, DrvJoyInit); } static struct BurnDIPInfo Darius2DIPList[]= @@ -174,55 +134,55 @@ static struct BurnDIPInfo Darius2DIPList[]= // Default Values {0x14, 0xff, 0xff, 0xfe, NULL }, {0x15, 0xff, 0xff, 0xff, NULL }, - + // Dip 1 {0 , 0xfe, 0 , 2 , "Auto Fire" }, {0x14, 0x01, 0x02, 0x02, "Normal" }, {0x14, 0x01, 0x02, 0x00, "Fast" }, - + {0 , 0xfe, 0 , 2 , "Service Mode" }, {0x14, 0x01, 0x04, 0x04, "Off" }, {0x14, 0x01, 0x04, 0x00, "On" }, - + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, {0x14, 0x01, 0x08, 0x00, "Off" }, {0x14, 0x01, 0x08, 0x08, "On" }, - + {0 , 0xfe, 0 , 4 , "Coin A" }, {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - + {0 , 0xfe, 0 , 4 , "Coin B" }, {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - + // Dip 2 {0 , 0xfe, 0 , 4 , "Difficulty" }, {0x15, 0x01, 0x03, 0x02, "Easy" }, {0x15, 0x01, 0x03, 0x03, "Medium" }, {0x15, 0x01, 0x03, 0x01, "Hard" }, {0x15, 0x01, 0x03, 0x00, "Hardest" }, - + {0 , 0xfe, 0 , 4 , "Bonus Life" }, {0x15, 0x01, 0x0c, 0x0c, "every 700k" }, {0x15, 0x01, 0x0c, 0x08, "every 800k" }, {0x15, 0x01, 0x0c, 0x04, "every 900k" }, {0x15, 0x01, 0x0c, 0x00, "every 1000K" }, - + {0 , 0xfe, 0 , 4 , "Lives" }, {0x15, 0x01, 0x30, 0x30, "3" }, {0x15, 0x01, 0x30, 0x20, "4" }, {0x15, 0x01, 0x30, 0x10, "5" }, {0x15, 0x01, 0x30, 0x00, "6" }, - + {0 , 0xfe, 0 , 2 , "Invulnerability" }, {0x15, 0x01, 0x40, 0x40, "Off" }, {0x15, 0x01, 0x40, 0x00, "On" }, - + {0 , 0xfe, 0 , 2 , "Allow Continue" }, {0x15, 0x01, 0x80, 0x00, "Off" }, {0x15, 0x01, 0x80, 0x80, "On" }, @@ -235,51 +195,51 @@ static struct BurnDIPInfo Darius2dDIPList[]= // Default Values {0x14, 0xff, 0xff, 0xfe, NULL }, {0x15, 0xff, 0xff, 0xff, NULL }, - + // Dip 1 {0 , 0xfe, 0 , 2 , "Auto Fire" }, {0x14, 0x01, 0x02, 0x02, "Normal" }, {0x14, 0x01, 0x02, 0x00, "Fast" }, - + {0 , 0xfe, 0 , 2 , "Service Mode" }, {0x14, 0x01, 0x04, 0x04, "Off" }, {0x14, 0x01, 0x04, 0x00, "On" }, - + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, {0x14, 0x01, 0x08, 0x00, "Off" }, {0x14, 0x01, 0x08, 0x08, "On" }, - + {0 , 0xfe, 0 , 4 , "Coin A" }, {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - + {0 , 0xfe, 0 , 4 , "Coin B" }, {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - + // Dip 2 {0 , 0xfe, 0 , 4 , "Difficulty" }, {0x15, 0x01, 0x03, 0x02, "Easy" }, {0x15, 0x01, 0x03, 0x03, "Medium" }, {0x15, 0x01, 0x03, 0x01, "Hard" }, {0x15, 0x01, 0x03, 0x00, "Hardest" }, - + {0 , 0xfe, 0 , 4 , "Bonus Life" }, {0x15, 0x01, 0x0c, 0x0c, "every 700k" }, {0x15, 0x01, 0x0c, 0x08, "every 800k" }, {0x15, 0x01, 0x0c, 0x04, "every 900k" }, {0x15, 0x01, 0x0c, 0x00, "every 1000K" }, - + {0 , 0xfe, 0 , 4 , "Lives" }, {0x15, 0x01, 0x30, 0x30, "3" }, {0x15, 0x01, 0x30, 0x20, "4" }, {0x15, 0x01, 0x30, 0x10, "5" }, {0x15, 0x01, 0x30, 0x00, "6" }, - + {0 , 0xfe, 0 , 2 , "Allow Continue" }, {0x15, 0x01, 0x80, 0x00, "Off" }, {0x15, 0x01, 0x80, 0x80, "On" }, @@ -292,42 +252,42 @@ static struct BurnDIPInfo NinjawDIPList[]= // Default Values {0x14, 0xff, 0xff, 0xff, NULL }, {0x15, 0xff, 0xff, 0xff, NULL }, - + // Dip 1 {0 , 0xfe, 0 , 2 , "Allow Continue" }, {0x14, 0x01, 0x01, 0x00, "Off" }, {0x14, 0x01, 0x01, 0x01, "On" }, - + {0 , 0xfe, 0 , 2 , "Auto Fire" }, {0x14, 0x01, 0x02, 0x02, "Normal" }, {0x14, 0x01, 0x02, 0x00, "Fast" }, - + {0 , 0xfe, 0 , 2 , "Service Mode" }, {0x14, 0x01, 0x04, 0x04, "Off" }, {0x14, 0x01, 0x04, 0x00, "On" }, - + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, {0x14, 0x01, 0x08, 0x00, "Off" }, {0x14, 0x01, 0x08, 0x08, "On" }, - + {0 , 0xfe, 0 , 4 , "Coin A" }, {0x14, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, {0x14, 0x01, 0x30, 0x00, "2 Coins 3 Credits" }, {0x14, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - + {0 , 0xfe, 0 , 4 , "Coin B" }, {0x14, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, {0x14, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, {0x14, 0x01, 0xc0, 0x00, "2 Coins 3 Credits" }, {0x14, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - + // Dip 2 {0 , 0xfe, 0 , 4 , "Difficulty" }, {0x15, 0x01, 0x03, 0x02, "Easy" }, {0x15, 0x01, 0x03, 0x03, "Medium" }, {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, }; STDDIPINFO(Ninjaw) @@ -337,42 +297,42 @@ static struct BurnDIPInfo NinjawjDIPList[]= // Default Values {0x14, 0xff, 0xff, 0xff, NULL }, {0x15, 0xff, 0xff, 0xff, NULL }, - + // Dip 1 {0 , 0xfe, 0 , 2 , "Allow Continue" }, {0x14, 0x01, 0x01, 0x00, "Off" }, {0x14, 0x01, 0x01, 0x01, "On" }, - + {0 , 0xfe, 0 , 2 , "Auto Fire" }, {0x14, 0x01, 0x02, 0x02, "Normal" }, {0x14, 0x01, 0x02, 0x00, "Fast" }, - + {0 , 0xfe, 0 , 2 , "Service Mode" }, {0x14, 0x01, 0x04, 0x04, "Off" }, {0x14, 0x01, 0x04, 0x00, "On" }, - + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, {0x14, 0x01, 0x08, 0x00, "Off" }, {0x14, 0x01, 0x08, 0x08, "On" }, - + {0 , 0xfe, 0 , 4 , "Coin A" }, {0x14, 0x01, 0x30, 0x00, "4 Coins 1 Credit" }, {0x14, 0x01, 0x30, 0x10, "3 Coins 1 Credit" }, {0x14, 0x01, 0x30, 0x20, "2 Coins 1 Credit" }, {0x14, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, - + {0 , 0xfe, 0 , 4 , "Coin B" }, {0x14, 0x01, 0xc0, 0xc0, "1 Coin 2 Credits" }, {0x14, 0x01, 0xc0, 0x80, "1 Coin 3 Credits" }, {0x14, 0x01, 0xc0, 0x40, "1 Coin 4 Credits" }, {0x14, 0x01, 0xc0, 0x00, "1 Coin 6 Credits" }, - + // Dip 2 {0 , 0xfe, 0 , 4 , "Difficulty" }, {0x15, 0x01, 0x03, 0x02, "Easy" }, {0x15, 0x01, 0x03, 0x03, "Medium" }, {0x15, 0x01, 0x03, 0x01, "Hard" }, - {0x15, 0x01, 0x03, 0x00, "Hardest" }, + {0x15, 0x01, 0x03, 0x00, "Hardest" }, }; STDDIPINFO(Ninjawj) @@ -382,61 +342,61 @@ static struct BurnDIPInfo WarriorbDIPList[]= // Default Values {0x16, 0xff, 0xff, 0xff, NULL }, {0x17, 0xff, 0xff, 0xff, NULL }, - + // Dip 1 {0 , 0xfe, 0 , 4 , "Vitality Recovery" }, {0x16, 0x01, 0x03, 0x02, "Less" }, {0x16, 0x01, 0x03, 0x03, "Normal" }, {0x16, 0x01, 0x03, 0x01, "More" }, {0x16, 0x01, 0x03, 0x00, "Most" }, - + {0 , 0xfe, 0 , 2 , "Service Mode" }, {0x16, 0x01, 0x04, 0x04, "Off" }, {0x16, 0x01, 0x04, 0x00, "On" }, - + {0 , 0xfe, 0 , 2 , "Demo Sounds" }, {0x16, 0x01, 0x08, 0x00, "Off" }, {0x16, 0x01, 0x08, 0x08, "On" }, - + {0 , 0xfe, 0 , 4 , "Coin A" }, {0x16, 0x01, 0x30, 0x00, "3 Coins 1 Credit" }, {0x16, 0x01, 0x30, 0x10, "2 Coins 1 Credit" }, {0x16, 0x01, 0x30, 0x30, "1 Coin 1 Credit" }, {0x16, 0x01, 0x30, 0x20, "1 Coin 2 Credits" }, - + {0 , 0xfe, 0 , 4 , "Coin B" }, {0x16, 0x01, 0xc0, 0x00, "3 Coins 1 Credit" }, {0x16, 0x01, 0xc0, 0x40, "2 Coins 1 Credit" }, {0x16, 0x01, 0xc0, 0xc0, "1 Coin 1 Credit" }, {0x16, 0x01, 0xc0, 0x80, "1 Coin 2 Credits" }, - + // Dip 2 {0 , 0xfe, 0 , 4 , "Difficulty" }, {0x17, 0x01, 0x03, 0x02, "Easy" }, {0x17, 0x01, 0x03, 0x03, "Medium" }, {0x17, 0x01, 0x03, 0x01, "Hard" }, {0x17, 0x01, 0x03, 0x00, "Hardest" }, - + {0 , 0xfe, 0 , 2 , "Gold Sheep at" }, {0x17, 0x01, 0x04, 0x04, "50k only" }, {0x17, 0x01, 0x04, 0x00, "50k, then every 70k" }, - + {0 , 0xfe, 0 , 2 , "Magic Energy Loss" }, {0x17, 0x01, 0x08, 0x08, "Always Player" }, {0x17, 0x01, 0x08, 0x00, "Player or Magician" }, - + {0 , 0xfe, 0 , 2 , "Player Starting Strength" }, {0x17, 0x01, 0x10, 0x10, "Normal" }, {0x17, 0x01, 0x10, 0x00, "Full" }, - + {0 , 0xfe, 0 , 2 , "Magician appears" }, {0x17, 0x01, 0x20, 0x20, "When you get a crystal" }, {0x17, 0x01, 0x20, 0x00, "Always" }, - + {0 , 0xfe, 0 , 2 , "Allow Continue" }, {0x17, 0x01, 0x40, 0x00, "Off" }, {0x17, 0x01, 0x40, 0x40, "On" }, - + {0 , 0xfe, 0 , 2 , "Rounds" }, {0x17, 0x01, 0x80, 0x80, "Normal (10-14, depends on skill"}, {0x17, 0x01, 0x80, 0x00, "Long (14)" }, @@ -453,7 +413,7 @@ static struct BurnRomInfo Darius2RomDesc[] = { { "c07-25", 0x20000, 0x059f40ce, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "c07-26", 0x20000, 0x1f411242, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "c07-24", 0x20000, 0x486c9c20, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - + { "c07-35-1", 0x10000, 0xdd8c4723, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "c07-38-1", 0x10000, 0x46afb85c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "c07-34-1", 0x10000, 0x296984b8, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, @@ -462,16 +422,16 @@ static struct BurnRomInfo Darius2RomDesc[] = { { "c07-36-1", 0x10000, 0x02cf2b1c, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "c07-28", 0x20000, 0xda304bc5, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, - + { "c07-01", 0x80000, 0x3cf0f050, BRF_GRA | TAITO_SPRITESA }, { "c07-02", 0x80000, 0x75d16d4b, BRF_GRA | TAITO_SPRITESA }, - + { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, - + { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, }; @@ -486,20 +446,20 @@ static struct BurnRomInfo Darius2dRomDesc[] = { { "c07-09.75", 0x80000, 0xcc69c2ce, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, { "c07_17.69", 0x20000, 0xae16c905, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, - + { "c07-06.27", 0x80000, 0x5eebbcd6, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-05.24", 0x80000, 0xfb6d0550, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-08.25", 0x80000, 0xa07dc846, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-07.26", 0x80000, 0xfd9f9e74, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - + { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, - + { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, - + { "c07-13.37", 0x00400, 0x3ca18eb3, BRF_OPT }, { "c07-14.38", 0x00400, 0xbaf2a193, BRF_OPT }, }; @@ -515,20 +475,20 @@ static struct BurnRomInfo Darius2doRomDesc[] = { { "c07-09.75", 0x80000, 0xcc69c2ce, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, { "c07_17.69", 0x20000, 0xae16c905, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, - + { "c07-06.27", 0x80000, 0x5eebbcd6, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-05.24", 0x80000, 0xfb6d0550, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-08.25", 0x80000, 0xa07dc846, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-07.26", 0x80000, 0xfd9f9e74, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - + { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, - + { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, - + { "c07-13.37", 0x00400, 0x3ca18eb3, BRF_OPT }, { "c07-14.38", 0x00400, 0xbaf2a193, BRF_OPT }, }; @@ -544,20 +504,20 @@ static struct BurnRomInfo SagaiaRomDesc[] = { { "c07-09.75", 0x80000, 0xcc69c2ce, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, { "c07_41.69", 0x20000, 0xb50256ea, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "c07-03.12", 0x80000, 0x189bafce, BRF_GRA | TAITO_CHARS }, { "c07-04.11", 0x80000, 0x50421e81, BRF_GRA | TAITO_CHARS }, - + { "c07-06.27", 0x80000, 0x5eebbcd6, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-05.24", 0x80000, 0xfb6d0550, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-08.25", 0x80000, 0xa07dc846, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "c07-07.26", 0x80000, 0xfd9f9e74, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - + { "c07-10.95", 0x80000, 0x4bbe0ed9, BRF_SND | TAITO_YM2610A }, { "c07-11.96", 0x80000, 0x3c815699, BRF_SND | TAITO_YM2610A }, - + { "c07-12.107", 0x80000, 0xe0b71258, BRF_SND | TAITO_YM2610B }, - + { "c07-13.37", 0x00400, 0x3ca18eb3, BRF_OPT }, { "c07-14.38", 0x00400, 0xbaf2a193, BRF_OPT }, }; @@ -574,7 +534,7 @@ static struct BurnRomInfo NinjawRomDesc[] = { { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - + { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, @@ -583,21 +543,21 @@ static struct BurnRomInfo NinjawRomDesc[] = { { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, - + { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, - + { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, - + { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, - + { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, }; @@ -614,7 +574,7 @@ static struct BurnRomInfo Ninjaw1RomDesc[] = { { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - + { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, @@ -623,21 +583,21 @@ static struct BurnRomInfo Ninjaw1RomDesc[] = { { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, - + { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, - + { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, - + { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, - + { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, }; @@ -654,7 +614,7 @@ static struct BurnRomInfo NinjawjRomDesc[] = { { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - + { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, @@ -663,21 +623,21 @@ static struct BurnRomInfo NinjawjRomDesc[] = { { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, - + { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, - + { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, - + { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, - + { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, }; @@ -694,7 +654,7 @@ static struct BurnRomInfo NinjawuRomDesc[] = { { "b31_39.2", 0x20000, 0xe9197c3c, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_40.6", 0x20000, 0x2ce0f24e, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "b31_38.3", 0x20000, 0xbc68cd99, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - + { "b31_33.87", 0x10000, 0x6ce9af44, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_36.97", 0x10000, 0xba20b0d4, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_32.86", 0x10000, 0xe6025fec, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, @@ -703,21 +663,21 @@ static struct BurnRomInfo NinjawuRomDesc[] = { { "b31_34.95", 0x10000, 0xd6b5fb2a, BRF_ESS | BRF_PRG | TAITO_68KROM2_BYTESWAP }, { "b31_37.11", 0x20000, 0x0ca5799d, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "b31-01.23", 0x80000, 0x8e8237a7, BRF_GRA | TAITO_CHARS }, { "b31-02.24", 0x80000, 0x4c3b4e33, BRF_GRA | TAITO_CHARS }, - + { "b31-07.176", 0x80000, 0x33568cdb, BRF_GRA | TAITO_SPRITESA }, { "b31-06.175", 0x80000, 0x0d59439e, BRF_GRA | TAITO_SPRITESA }, { "b31-05.174", 0x80000, 0x0a1fc9fb, BRF_GRA | TAITO_SPRITESA }, { "b31-04.173", 0x80000, 0x2e1e4cb5, BRF_GRA | TAITO_SPRITESA }, - + { "b31-09.18", 0x80000, 0x60a73382, BRF_SND | TAITO_YM2610A }, { "b31-10.17", 0x80000, 0xc6434aef, BRF_SND | TAITO_YM2610A }, { "b31-11.16", 0x80000, 0x8da531d4, BRF_SND | TAITO_YM2610A }, - + { "b31-08.19", 0x80000, 0xa0a1f87d, BRF_SND | TAITO_YM2610B }, - + { "b31-25.38", 0x00200, 0xa0b4ba48, BRF_OPT }, { "b31-26.58", 0x00200, 0x13e5fe15, BRF_OPT }, }; @@ -729,29 +689,29 @@ static struct BurnRomInfo WarriorbRomDesc[] = { { "d24_20-1.74", 0x040000, 0x4452dc25, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "d24_19-1.73", 0x040000, 0x15c16016, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "d24_21-1.76", 0x040000, 0x783ef8e1, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, - { "d24_18-1.71", 0x040000, 0x4502db60, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, + { "d24_18-1.71", 0x040000, 0x4502db60, BRF_ESS | BRF_PRG | TAITO_68KROM1_BYTESWAP }, { "d24-09.75", 0x100000, 0xece5cc59, BRF_ESS | BRF_PRG | TAITO_68KROM1 }, { "d24_17.69", 0x020000, 0xe41e4aae, BRF_ESS | BRF_PRG | TAITO_Z80ROM1 }, - + { "d24-02.12", 0x100000, 0x9f50c271, BRF_GRA | TAITO_CHARS }, { "d24-01.11", 0x100000, 0x326dcca9, BRF_GRA | TAITO_CHARS }, - + { "d24-07.47", 0x100000, 0x9f50c271, BRF_GRA | TAITO_CHARSB }, { "d24-08.48", 0x100000, 0x1e6d1528, BRF_GRA | TAITO_CHARSB }, - + { "d24-06.27", 0x100000, 0x918486fe, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "d24-03.24", 0x100000, 0x46db9fd7, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, { "d24-04.25", 0x100000, 0x148e0493, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - { "d24-05.26", 0x100000, 0x9f414317, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, - + { "d24-05.26", 0x100000, 0x9f414317, BRF_GRA | TAITO_SPRITESA_BYTESWAP32 }, + { "d24-12.107", 0x100000, 0x279203a1, BRF_SND | TAITO_YM2610A }, { "d24-10.95", 0x100000, 0x0e0c716d, BRF_SND | TAITO_YM2610A }, { "d24-11.118", 0x100000, 0x15362573, BRF_SND | TAITO_YM2610A }, - + { "d24-13.37", 0x000400, 0x3ca18eb3, BRF_OPT }, { "d24-14.38", 0x000400, 0xbaf2a193, BRF_OPT }, - + { "d24-15.78", 0x000144, 0x04992a7d, BRF_OPT }, { "d24-16.79", 0x000144, 0x92c59a8d, BRF_OPT }, }; @@ -768,15 +728,15 @@ static INT32 MemIndex() TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - + TaitoRamStart = Next; Taito68KRam1 = Next; Next += 0x010000; Taito68KRam2 = Next; Next += 0x010000; TaitoZ80Ram1 = Next; Next += 0x002000; TaitoSharedRam = Next; Next += 0x010000; - TaitoSpriteRam = Next; Next += 0x004000; - + TaitoSpriteRam = Next; Next += 0x004000; + TaitoRamEnd = Next; TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; @@ -795,13 +755,13 @@ static INT32 Darius2dMemIndex() TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - + TaitoRamStart = Next; Taito68KRam1 = Next; Next += 0x010000; TaitoZ80Ram1 = Next; Next += 0x002000; - TaitoSpriteRam = Next; Next += 0x001400; - + TaitoSpriteRam = Next; Next += 0x001400; + TaitoRamEnd = Next; TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; @@ -820,13 +780,13 @@ static INT32 WarriorbMemIndex() TaitoZ80Rom1 = Next; Next += TaitoZ80Rom1Size; TaitoYM2610ARom = Next; Next += TaitoYM2610ARomSize; TaitoYM2610BRom = Next; Next += TaitoYM2610BRomSize; - + TaitoRamStart = Next; Taito68KRam1 = Next; Next += 0x014000; TaitoZ80Ram1 = Next; Next += 0x002000; - TaitoSpriteRam = Next; Next += 0x001400; - + TaitoSpriteRam = Next; Next += 0x001400; + TaitoRamEnd = Next; TaitoChars = Next; Next += TaitoNumChar * TaitoCharWidth * TaitoCharHeight; @@ -841,9 +801,8 @@ static INT32 WarriorbMemIndex() static void Darius2CpuAReset(UINT16 d) { TaitoCpuACtrl = d; - if (!(TaitoCpuACtrl & 1)) { - SekReset(1); - } + + SekSetRESETLine(1, ~TaitoCpuACtrl & 1); } static UINT8 __fastcall Darius268K1ReadByte(UINT32 a) @@ -853,7 +812,7 @@ static UINT8 __fastcall Darius268K1ReadByte(UINT32 a) bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); } } - + return 0; } @@ -862,7 +821,7 @@ static void __fastcall Darius268K1WriteByte(UINT32 a, UINT8 d) TC0100SCNTripleScreenByteWrite_Map(0x280000, 0x293fff) TC0100SCN1ByteWrite_Map(0x2c0000, 0x2d3fff) TC0100SCN2ByteWrite_Map(0x300000, 0x313fff) - + switch (a) { default: { bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); @@ -876,32 +835,32 @@ static UINT16 __fastcall Darius268K1ReadWord(UINT32 a) case 0x200000: { return TC0220IOCPortRegRead(); } - + case 0x200002: { return TC0220IOCHalfWordPortRead(); } - + case 0x220002: { return TC0140SYTCommRead(); } - + case 0x340002: { return TC0110PCRWordRead(0); } - + case 0x350002: { return TC0110PCRWordRead(1); } - + case 0x360002: { return TC0110PCRWordRead(2); } - + default: { bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); } } - + return 0; } @@ -913,58 +872,58 @@ static void __fastcall Darius268K1WriteWord(UINT32 a, UINT16 d) TC0100SCNTripleScreenWordWrite_Map(0x280000, 0x293fff) TC0100SCN1WordWrite_Map(0x2c0000, 0x2d3fff) TC0100SCN2WordWrite_Map(0x300000, 0x313fff) - + switch (a) { case 0x200000: { TC0220IOCHalfWordPortRegWrite(d); return; } - + case 0x200002: { TC0220IOCHalfWordPortWrite(d); return; } - + case 0x210000: { Darius2CpuAReset(d); return; } - + case 0x220000: { TC0140SYTPortWrite(d); return; } - + case 0x220002: { TC0140SYTCommWrite(d); return; } - + case 0x340000: case 0x340002: { - TC0110PCRStep1WordWrite(0, (a - 0x340000) >> 1, d); + TC0110PCRStep1WordWrite(0, (a & 0x02) >> 1, d); return; } - + case 0x350000: case 0x350002: { - TC0110PCRStep1WordWrite(1, (a - 0x350000) >> 1, d); + TC0110PCRStep1WordWrite(1, (a & 0x02) >> 1, d); return; } - + case 0x360000: case 0x360002: { - TC0110PCRStep1WordWrite(2, (a - 0x360000) >> 1, d); + TC0110PCRStep1WordWrite(2, (a & 0x02) >> 1, d); return; } - + case 0x340004: case 0x350004: case 0x360004: { //nop return; } - + default: { bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); } @@ -973,12 +932,12 @@ static void __fastcall Darius268K1WriteWord(UINT32 a, UINT16 d) static UINT8 __fastcall Darius268K2ReadByte(UINT32 a) { - switch (a) { + switch (a) { default: { bprintf(PRINT_NORMAL, _T("68K #2 Read byte => %06X\n"), a); } } - + return 0; } @@ -997,50 +956,50 @@ static UINT16 __fastcall Darius268K2ReadWord(UINT32 a) case 0x200000: { return TC0220IOCPortRegRead(); } - + default: { bprintf(PRINT_NORMAL, _T("68K #2 Read word => %06X\n"), a); } } - + return 0; } static void __fastcall Darius268K2WriteWord(UINT32 a, UINT16 d) { TC0100SCNTripleScreenWordWrite_Map(0x280000, 0x293fff) - + switch (a) { case 0x210000: { //??? return; } - + case 0x340000: case 0x340002: { - TC0110PCRStep1WordWrite(0, (a - 0x340000) >> 1, d); + TC0110PCRStep1WordWrite(0, (a & 0x02) >> 1, d); return; } - + case 0x350000: case 0x350002: { - TC0110PCRStep1WordWrite(1, (a - 0x350000) >> 1, d); + TC0110PCRStep1WordWrite(1, (a & 0x02) >> 1, d); return; } - + case 0x360000: case 0x360002: { - TC0110PCRStep1WordWrite(2, (a - 0x360000) >> 1, d); + TC0110PCRStep1WordWrite(2, (a & 0x02) >> 1, d); return; } - + case 0x340004: case 0x350004: case 0x360004: { //nop return; } - + default: { bprintf(PRINT_NORMAL, _T("68K #2 Write word => %06X, %04X\n"), a, d); } @@ -1054,7 +1013,7 @@ static UINT8 __fastcall Darius2d68KReadByte(UINT32 a) bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); } } - + return 0; } @@ -1062,7 +1021,7 @@ static void __fastcall Darius2d68KWriteByte(UINT32 a, UINT8 d) { TC0100SCNDualScreenByteWrite_Map(0x200000, 0x213fff) TC0100SCN1ByteWrite_Map(0x240000, 0x25ffff) - + switch (a) { default: { bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); @@ -1076,11 +1035,11 @@ static UINT16 __fastcall Darius2d68KReadWord(UINT32 a) case 0x400002: { return TC0110PCRWordRead(0); } - + case 0x420002: { return TC0110PCRWordRead(1); } - + case 0x800000: case 0x800002: case 0x800004: @@ -1089,46 +1048,46 @@ static UINT16 __fastcall Darius2d68KReadWord(UINT32 a) case 0x80000a: case 0x80000c: case 0x80000e: { - return TC0220IOCRead((a - 0x800000) >> 1); + return TC0220IOCRead((a & 0x0e) >> 1); } - + case 0x830002: { return TC0140SYTCommRead(); } - + default: { bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); } } - + return 0; } static void __fastcall Darius2d68KWriteWord(UINT32 a, UINT16 d) { TC0100SCNDualScreenWordWrite_Map(0x200000, 0x213fff) - + if (a >= 0x214000 && a <= 0x2141ff) return; - + TC0100SCN0CtrlWordWrite_Map(0x220000) TC0100SCN1CtrlWordWrite_Map(0x260000) TC0100SCN1WordWrite_Map(0x240000, 0x25ffff) - + switch (a) { case 0x400000: case 0x400002: case 0x400004: { - TC0110PCRStep1WordWrite(0, (a - 0x400000) >> 1, d); + TC0110PCRStep1WordWrite(0, (a & 0x06) >> 1, d); return; } - + case 0x420000: case 0x420002: case 0x420004: { - TC0110PCRStep1WordWrite(1, (a - 0x420000) >> 1, d); + TC0110PCRStep1WordWrite(1, (a & 0x06) >> 1, d); return; } - + case 0x800000: case 0x800002: case 0x800004: @@ -1137,25 +1096,25 @@ static void __fastcall Darius2d68KWriteWord(UINT32 a, UINT16 d) case 0x80000a: case 0x80000c: case 0x80000e: { - TC0220IOCWrite((a - 0x800000) >> 1, d); + TC0220IOCWrite((a & 0x0e) >> 1, d); return; } - + case 0x820000: { // nop return; } - + case 0x830000: { TC0140SYTPortWrite(d); return; } - + case 0x830002: { TC0140SYTCommWrite(d); return; } - + default: { bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); } @@ -1171,7 +1130,7 @@ static UINT8 __fastcall Warriorb68KReadByte(UINT32 a) bprintf(PRINT_NORMAL, _T("68K #1 Read byte => %06X\n"), a); } } - + return 0; } @@ -1179,7 +1138,7 @@ static void __fastcall Warriorb68KWriteByte(UINT32 a, UINT8 d) { TC0100SCNDualScreenByteWrite_Map(0x300000, 0x313fff) TC0100SCN1ByteWrite_Map(0x340000, 0x35ffff) - + switch (a) { default: { bprintf(PRINT_NORMAL, _T("68K #1 Write byte => %06X, %02X\n"), a, d); @@ -1190,25 +1149,25 @@ static void __fastcall Warriorb68KWriteByte(UINT32 a, UINT8 d) static UINT16 __fastcall Warriorb68KReadWord(UINT32 a) { TC0510NIOHalfWordRead_Map(0x800000) - + switch (a) { case 0x400002: { return TC0110PCRWordRead(0); } - + case 0x420002: { return TC0110PCRWordRead(1); } - + case 0x830002: { return TC0140SYTCommRead(); } - + default: { bprintf(PRINT_NORMAL, _T("68K #1 Read word => %06X\n"), a); } } - + return 0; } @@ -1216,42 +1175,42 @@ static void __fastcall Warriorb68KWriteWord(UINT32 a, UINT16 d) { TC0100SCNDualScreenWordWrite_Map(0x300000, 0x313fff) TC0100SCN1WordWrite_Map(0x340000, 0x35ffff) - + TC0100SCN0CtrlWordWrite_Map(0x320000) TC0100SCN1CtrlWordWrite_Map(0x360000) - + TC0510NIOHalfWordWrite_Map(0x800000) - + switch (a) { case 0x400000: case 0x400002: case 0x400004: { - TC0110PCRStep1WordWrite(0, (a - 0x400000) >> 1, d); + TC0110PCRStep1WordWrite(0, (a & 0x06) >> 1, d); return; } - + case 0x420000: case 0x420002: case 0x420004: { - TC0110PCRStep1WordWrite(1, (a - 0x420000) >> 1, d); + TC0110PCRStep1WordWrite(1, (a & 0x06) >> 1, d); return; } - + case 0x820000: { // nop return; } - + case 0x830000: { TC0140SYTPortWrite(d); return; } - + case 0x830002: { TC0140SYTCommWrite(d); return; } - + default: { bprintf(PRINT_NORMAL, _T("68K #1 Write word => %06X, %04X\n"), a, d); } @@ -1264,20 +1223,20 @@ static UINT8 __fastcall Darius2Z80Read(UINT16 a) case 0xe000: { return BurnYM2610Read(0); } - + case 0xe002: { return BurnYM2610Read(2); } - + case 0xe201: { return TC0140SYTSlaveCommRead(); } - + case 0xea00: { // NOP return 0; } - + default: { bprintf(PRINT_NORMAL, _T("Z80 Read %04X\n"), a); } @@ -1300,72 +1259,72 @@ static void __fastcall Darius2Z80Write(UINT16 a, UINT8 d) BurnYM2610Write(0, d); return; } - + case 0xe001: { BurnYM2610Write(1, d); return; } - + case 0xe002: { BurnYM2610Write(2, d); return; } - + case 0xe003: { BurnYM2610Write(3, d); return; } - + case 0xe200: { TC0140SYTSlavePortWrite(d); return; } - + case 0xe201: { TC0140SYTSlaveCommWrite(d); return; } - + case 0xe400: { BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_1, Darius2YM2610Route1MasterVol * d / 255.0); return; } - + case 0xe401: { BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_1, Darius2YM2610Route1MasterVol * d / 255.0); return; } - + case 0xe402: { BurnYM2610SetLeftVolume(BURN_SND_YM2610_YM2610_ROUTE_2, Darius2YM2610Route1MasterVol * d / 255.0); return; } - + case 0xe403: { BurnYM2610SetRightVolume(BURN_SND_YM2610_YM2610_ROUTE_2, Darius2YM2610Route1MasterVol * d / 255.0); return; } - + case 0xe600: { //??? return; } - + case 0xee00: { //nop return; } - + case 0xf000: { //nop return; } - + case 0xf200: { bank_switch(d); return; } - + default: { bprintf(PRINT_NORMAL, _T("Z80 Write %04X, %02X\n"), a, d); } @@ -1387,10 +1346,19 @@ static void Darius2FMIRQHandler(INT32, INT32 nStatus) ZetSetIRQLine(0, (nStatus) ? CPU_IRQSTATUS_ACK : CPU_IRQSTATUS_NONE); } +static INT32 Darius2DoReset() +{ + TaitoDoReset(); + + nCyclesExtra[0] = nCyclesExtra[1] = 0; + + return 0; +} + static INT32 Darius2Init() { INT32 nLen; - + TaitoCharModulo = 0x100; TaitoCharNumPlanes = 4; TaitoCharWidth = 8; @@ -1399,7 +1367,7 @@ static INT32 Darius2Init() TaitoCharXOffsets = CharXOffsets; TaitoCharYOffsets = CharYOffsets; TaitoNumChar = 0x8000; - + TaitoSpriteAModulo = 0x400; TaitoSpriteANumPlanes = 4; TaitoSpriteAWidth = 16; @@ -1408,15 +1376,15 @@ static INT32 Darius2Init() TaitoSpriteAXOffsets = SpriteXOffsets; TaitoSpriteAYOffsets = SpriteYOffsets; TaitoNumSpriteA = 0x2000; - + if (Ninjaw) TaitoNumSpriteA = 0x4000; - + TaitoNum68Ks = 2; TaitoNumZ80s = 1; TaitoNumYM2610 = 1; - + TaitoLoadRoms(0); - + // Allocate and Blank all required memory TaitoMem = NULL; MemIndex(); @@ -1424,9 +1392,9 @@ static INT32 Darius2Init() if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; memset(TaitoMem, 0, nLen); MemIndex(); - + GenericTilesInit(); - + TC0100SCNInit(0, TaitoNumChar, 22, 16, 0, NULL); TC0100SCNSetClipArea(0, 288, nScreenHeight, 0); TC0100SCNInit(1, TaitoNumChar, 24, 16, 0, NULL); @@ -1438,9 +1406,9 @@ static INT32 Darius2Init() TC0110PCRInit(3, 0x3000); TC0140SYTInit(0); TC0220IOCInit(); - + if (TaitoLoadRoms(1)) return 1; - + SekInit(0, 0x68000); SekOpen(0); SekMapMemory(Taito68KRom1 , 0x000000, 0x0bffff, MAP_ROM); @@ -1452,10 +1420,10 @@ static INT32 Darius2Init() SekMapMemory(TC0100SCNRam[2] , 0x300000, 0x313fff, MAP_READ); SekSetReadByteHandler(0, Darius268K1ReadByte); SekSetWriteByteHandler(0, Darius268K1WriteByte); - SekSetReadWordHandler(0, Darius268K1ReadWord); + SekSetReadWordHandler(0, Darius268K1ReadWord); SekSetWriteWordHandler(0, Darius268K1WriteWord); SekClose(); - + SekInit(1, 0x68000); SekOpen(1); SekMapMemory(Taito68KRom2 , 0x000000, 0x05ffff, MAP_ROM); @@ -1465,10 +1433,10 @@ static INT32 Darius2Init() SekMapMemory(TC0100SCNRam[0] , 0x280000, 0x293fff, MAP_READ); SekSetReadByteHandler(0, Darius268K2ReadByte); SekSetWriteByteHandler(0, Darius268K2WriteByte); - SekSetReadWordHandler(0, Darius268K2ReadWord); + SekSetReadWordHandler(0, Darius268K2ReadWord); SekSetWriteWordHandler(0, Darius268K2WriteWord); SekClose(); - + ZetInit(0); ZetOpen(0); ZetSetReadHandler(Darius2Z80Read); @@ -1481,7 +1449,7 @@ static INT32 Darius2Init() ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); ZetClose(); - + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, 0); BurnTimerAttachZet(16000000 / 4); BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.03); @@ -1489,15 +1457,15 @@ static INT32 Darius2Init() Darius2YM2610Route1MasterVol = 1.00; Darius2YM2610Route2MasterVol = 1.00; bYM2610UseSeperateVolumes = 1; - + TaitoMakeInputsFunction = Darius2MakeInputs; TaitoIrqLine = 4; - + nTaitoCyclesTotal[0] = (16000000 / 2) / 60; nTaitoCyclesTotal[1] = (16000000 / 2) / 60; nTaitoCyclesTotal[2] = (16000000 / 4) / 60; - TaitoResetFunction = TaitoDoReset; + TaitoResetFunction = Darius2DoReset; TaitoResetFunction(); return 0; @@ -1506,7 +1474,7 @@ static INT32 Darius2Init() static INT32 Darius2dInit() { INT32 nLen; - + TaitoCharModulo = 0x100; TaitoCharNumPlanes = 4; TaitoCharWidth = 8; @@ -1515,7 +1483,7 @@ static INT32 Darius2dInit() TaitoCharXOffsets = CharXOffsets; TaitoCharYOffsets = CharYOffsets; TaitoNumChar = 0x8000; - + TaitoSpriteAModulo = 0x400; TaitoSpriteANumPlanes = 4; TaitoSpriteAWidth = 16; @@ -1524,13 +1492,13 @@ static INT32 Darius2dInit() TaitoSpriteAXOffsets = Darius2dSpriteXOffsets; TaitoSpriteAYOffsets = Darius2dSpriteYOffsets; TaitoNumSpriteA = 0x4000; - + TaitoNum68Ks = 1; TaitoNumZ80s = 1; TaitoNumYM2610 = 1; - + TaitoLoadRoms(0); - + // Allocate and Blank all required memory TaitoMem = NULL; Darius2dMemIndex(); @@ -1538,9 +1506,9 @@ static INT32 Darius2dInit() if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; memset(TaitoMem, 0, nLen); Darius2dMemIndex(); - + GenericTilesInit(); - + TC0100SCNInit(0, TaitoNumChar, 4, 24, 0, NULL); TC0100SCNSetClipArea(0, 320, nScreenHeight, 0); TC0100SCNInit(1, TaitoNumChar, 4, 24, 0, NULL); @@ -1549,9 +1517,9 @@ static INT32 Darius2dInit() TC0110PCRInit(2, 0x2000); TC0140SYTInit(0); TC0220IOCInit(); - + if (TaitoLoadRoms(1)) return 1; - + SekInit(0, 0x68000); SekOpen(0); SekMapMemory(Taito68KRom1 , 0x000000, 0x0fffff, MAP_ROM); @@ -1561,10 +1529,10 @@ static INT32 Darius2dInit() SekMapMemory(TaitoSpriteRam , 0x600000, 0x6013ff, MAP_RAM); SekSetReadByteHandler(0, Darius2d68KReadByte); SekSetWriteByteHandler(0, Darius2d68KWriteByte); - SekSetReadWordHandler(0, Darius2d68KReadWord); + SekSetReadWordHandler(0, Darius2d68KReadWord); SekSetWriteWordHandler(0, Darius2d68KWriteWord); SekClose(); - + ZetInit(0); ZetOpen(0); ZetSetReadHandler(Darius2Z80Read); @@ -1577,7 +1545,7 @@ static INT32 Darius2dInit() ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); ZetClose(); - + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, 0); BurnTimerAttachZet(16000000 / 4); BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.03); @@ -1585,14 +1553,14 @@ static INT32 Darius2dInit() Darius2YM2610Route1MasterVol = 12.00; Darius2YM2610Route2MasterVol = 12.00; bYM2610UseSeperateVolumes = 1; - + TaitoMakeInputsFunction = Darius2dMakeInputs; TaitoIrqLine = 4; - + nTaitoCyclesTotal[0] = 12000000 / 60; nTaitoCyclesTotal[1] = (16000000 / 4) / 60; - TaitoResetFunction = TaitoDoReset; + TaitoResetFunction = Darius2DoReset; TaitoResetFunction(); return 0; @@ -1617,7 +1585,7 @@ static INT32 WarriorbInit() TaitoCharXOffsets = CharXOffsets; TaitoCharYOffsets = CharYOffsets; TaitoNumChar = 0x10000; - + TaitoCharBModulo = 0x100; TaitoCharBNumPlanes = 4; TaitoCharBWidth = 8; @@ -1626,7 +1594,7 @@ static INT32 WarriorbInit() TaitoCharBXOffsets = CharXOffsets; TaitoCharBYOffsets = CharYOffsets; TaitoNumCharB = 0x10000; - + TaitoSpriteAModulo = 0x400; TaitoSpriteANumPlanes = 4; TaitoSpriteAWidth = 16; @@ -1635,13 +1603,13 @@ static INT32 WarriorbInit() TaitoSpriteAXOffsets = Darius2dSpriteXOffsets; TaitoSpriteAYOffsets = Darius2dSpriteYOffsets; TaitoNumSpriteA = 0x8000; - + TaitoNum68Ks = 1; TaitoNumZ80s = 1; TaitoNumYM2610 = 1; - + TaitoLoadRoms(0); - + // Allocate and Blank all required memory TaitoMem = NULL; WarriorbMemIndex(); @@ -1649,9 +1617,9 @@ static INT32 WarriorbInit() if ((TaitoMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1; memset(TaitoMem, 0, nLen); WarriorbMemIndex(); - + GenericTilesInit(); - + TC0100SCNInit(0, TaitoNumChar, 4, 8, 0, NULL); TC0100SCNSetClipArea(0, 320, nScreenHeight, 0); TC0100SCNInit(1, TaitoNumCharB, 5, 8, 0, NULL); @@ -1660,9 +1628,9 @@ static INT32 WarriorbInit() TC0110PCRInit(2, 0x2000); TC0140SYTInit(0); TC0510NIOInit(); - + if (TaitoLoadRoms(1)) return 1; - + SekInit(0, 0x68000); SekOpen(0); SekMapMemory(Taito68KRom1 , 0x000000, 0x1fffff, MAP_ROM); @@ -1672,10 +1640,10 @@ static INT32 WarriorbInit() SekMapMemory(TaitoSpriteRam , 0x600000, 0x6013ff, MAP_RAM); SekSetReadByteHandler(0, Warriorb68KReadByte); SekSetWriteByteHandler(0, Warriorb68KWriteByte); - SekSetReadWordHandler(0, Warriorb68KReadWord); + SekSetReadWordHandler(0, Warriorb68KReadWord); SekSetWriteWordHandler(0, Warriorb68KWriteWord); SekClose(); - + ZetInit(0); ZetOpen(0); ZetSetReadHandler(Darius2Z80Read); @@ -1688,7 +1656,7 @@ static INT32 WarriorbInit() ZetMapArea(0xc000, 0xdfff, 1, TaitoZ80Ram1 ); ZetMapArea(0xc000, 0xdfff, 2, TaitoZ80Ram1 ); ZetClose(); - + BurnYM2610Init(16000000 / 2, TaitoYM2610ARom, (INT32*)&TaitoYM2610ARomSize, TaitoYM2610BRom, (INT32*)&TaitoYM2610BRomSize, &Darius2FMIRQHandler, 0); BurnTimerAttachZet(16000000 / 4); BurnYM2610SetLeftVolume(BURN_SND_YM2610_AY8910_ROUTE, 0.25); @@ -1696,14 +1664,14 @@ static INT32 WarriorbInit() Darius2YM2610Route1MasterVol = 12.00; Darius2YM2610Route2MasterVol = 12.00; bYM2610UseSeperateVolumes = 1; - + TaitoMakeInputsFunction = WarriorbMakeInputs; TaitoIrqLine = 4; - + nTaitoCyclesTotal[0] = 16000000 / 60; nTaitoCyclesTotal[1] = (16000000 / 4) / 60; - TaitoResetFunction = TaitoDoReset; + TaitoResetFunction = Darius2DoReset; TaitoResetFunction(); return 0; @@ -1720,7 +1688,7 @@ static void Darius2RenderSprites(INT32 PriorityDraw) { INT32 Offset, Data, Code, Colour, xFlip, yFlip; INT32 x, y, Priority; - + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; for (Offset = 0x2000 - 4; Offset >=0; Offset -= 4) { @@ -1734,14 +1702,14 @@ static void Darius2RenderSprites(INT32 PriorityDraw) Data = SpriteRam[Offset + 1]; y = (Data - 0) & 0x1ff; - + Data = SpriteRam[Offset + 3]; xFlip = (Data & 0x1); yFlip = (Data & 0x2) >> 1; Priority = (Data & 0x4) >> 2; - + if (Priority != PriorityDraw) continue; - + Colour = (Data & 0x7f00) >> 8; y -= 16; @@ -1749,35 +1717,7 @@ static void Darius2RenderSprites(INT32 PriorityDraw) if (x > 0x3c0) x -= 0x400; if (y > 0x180) y -= 0x200; - if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } + Draw16x16MaskTile(pTransDraw, Code, x, y, xFlip, yFlip, Colour, 4, 0, 0, TaitoSpritesA); } } @@ -1785,10 +1725,9 @@ static void Darius2dRenderSprites(INT32 PriorityDraw) { INT32 Offset, Data, Code, Colour, xFlip, yFlip; INT32 x, y, Priority; - + UINT16 *SpriteRam = (UINT16*)TaitoSpriteRam; -// for (Offset = 0; Offset < 0x001400 / 2; Offset += 4) { for (Offset = (0x1400 / 2) - 4; Offset >= 0; Offset -= 4) { Data = SpriteRam[Offset + 1]; Code = Data & (TaitoNumSpriteA - 1); @@ -1800,47 +1739,19 @@ static void Darius2dRenderSprites(INT32 PriorityDraw) Data = SpriteRam[Offset + 2]; Priority = (Data & 0x100) >> 8; Colour = Data & 0x7f; - + Data = SpriteRam[Offset + 3]; x = Data & 0x3ff; xFlip = (Data & 0x400) >> 10; - + if (Priority != PriorityDraw) continue; y -= (Warriorb) ? 8 : 16+8; //darius2d (16+8) if (x > 0x3c0) x -= 0x400; if (y > 0x180) y -= 0x200; - - if (x > 16 && x < (nScreenWidth - 16) && y > 16 && y < (nScreenHeight - 16)) { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } else { - if (xFlip) { - if (yFlip) { - Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_FlipX_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } else { - if (yFlip) { - Render16x16Tile_Mask_FlipY_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } else { - Render16x16Tile_Mask_Clip(pTransDraw, Code, x, y, Colour, 4, 0, 0, TaitoSpritesA); - } - } - } + + Draw16x16MaskTile(pTransDraw, Code, x, y, xFlip, yFlip, Colour, 4, 0, 0, TaitoSpritesA); } } @@ -1849,9 +1760,9 @@ static INT32 Darius2Draw() INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; INT32 Disable3 = TC0100SCNCtrl[2][6] & 0xf7; - + BurnTransferClear(); - + if (TC0100SCNBottomLayer(0)) { if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); @@ -1869,9 +1780,9 @@ static INT32 Darius2Draw() if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); if (!(Disable3 & 0x02)) TC0100SCNRenderFgLayer(2, 0, TaitoChars); } - + Darius2RenderSprites(0); - + if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); if (!(Disable3 & 0x04)) TC0100SCNRenderCharLayer(2); @@ -1884,9 +1795,9 @@ static INT32 Darius2dDraw() { INT32 Disable = TC0100SCNCtrl[0][6] & 0xf7; INT32 Disable2 = TC0100SCNCtrl[1][6] & 0xf7; - + BurnTransferClear(); - + if (TC0100SCNBottomLayer(0)) { if (nBurnLayer & 2) if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); if (nBurnLayer & 2) if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); @@ -1900,9 +1811,9 @@ static INT32 Darius2dDraw() if (nBurnLayer & 2) if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); if (nBurnLayer & 2) if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoChars); } - + if (nSpriteEnable & 2) Darius2dRenderSprites(0); - + if (nBurnLayer & 4) if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); if (nBurnLayer & 8) if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); BurnTransferCopy(TC0110PCRPalette); @@ -1930,9 +1841,9 @@ static INT32 WarriorbDraw() if (nBurnLayer & 2) if (!(Disable & 0x02)) TC0100SCNRenderFgLayer(0, 0, TaitoChars); if (nBurnLayer & 2) if (!(Disable2 & 0x02)) TC0100SCNRenderFgLayer(1, 0, TaitoCharsB); } - + if (nSpriteEnable & 2) Darius2dRenderSprites(0); - + if (nBurnLayer & 4) if (!(Disable & 0x04)) TC0100SCNRenderCharLayer(0); if (nBurnLayer & 8) if (!(Disable2 & 0x04)) TC0100SCNRenderCharLayer(1); BurnTransferCopy(TC0110PCRPalette); @@ -1942,107 +1853,90 @@ static INT32 WarriorbDraw() static INT32 Darius2Frame() { - INT32 nInterleave = 100; - if (TaitoReset) TaitoResetFunction(); TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[1] = nTaitoCyclesDone[2] = 0; SekNewFrame(); ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - // Run 68000 # 1 - nCurrentCPU = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[3] = { nTaitoCyclesTotal[0], nTaitoCyclesTotal[1], nTaitoCyclesTotal[2]}; + INT32 nCyclesDone[3] = { nCyclesExtra[0], nCyclesExtra[1], 0}; + + for (INT32 i = 0; i < nInterleave; i++) { SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + CPU_RUN(0, Sek); + if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, CPU_IRQSTATUS_AUTO); + SekClose(); + + SekOpen(1); + CPU_RUN(1, Sek); if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, CPU_IRQSTATUS_AUTO); SekClose(); - - // Run 68000 # 2 - if ((TaitoCpuACtrl & 0x01)) { - nCurrentCPU = 1; - SekOpen(1); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); - if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, CPU_IRQSTATUS_AUTO); - SekClose(); - } - + ZetOpen(0); - BurnTimerUpdate((i + 1) * (nTaitoCyclesTotal[2] / nInterleave)); + CPU_RUN_TIMER(2); ZetClose(); } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[2]); + + nCyclesExtra[0] = nCyclesDone[0] - nCyclesTotal[0]; + nCyclesExtra[1] = nCyclesDone[1] - nCyclesTotal[1]; + // 2 - timer (BurnTimer keeps track) + if (pBurnSoundOut) { BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); } - ZetClose(); - + if (pBurnDraw) BurnDrvRedraw(); - + return 0; } static INT32 Darius2dFrame() { - INT32 nInterleave = 100; - if (TaitoReset) TaitoResetFunction(); TaitoMakeInputsFunction(); - - nTaitoCyclesDone[0] = nTaitoCyclesDone[2] = 0; SekNewFrame(); ZetNewFrame(); - - for (INT32 i = 0; i < nInterleave; i++) { - INT32 nCurrentCPU, nNext; - // Run 68000 # 1 - nCurrentCPU = 0; + INT32 nInterleave = 100; + INT32 nCyclesTotal[2] = { nTaitoCyclesTotal[0], nTaitoCyclesTotal[1]}; + INT32 nCyclesDone[2] = { nCyclesExtra[0], 0}; + + for (INT32 i = 0; i < nInterleave; i++) { SekOpen(0); - nNext = (i + 1) * nTaitoCyclesTotal[nCurrentCPU] / nInterleave; - nTaitoCyclesSegment = nNext - nTaitoCyclesDone[nCurrentCPU]; - nTaitoCyclesDone[nCurrentCPU] += SekRun(nTaitoCyclesSegment); + CPU_RUN(0, Sek); if (i == nInterleave - 1) SekSetIRQLine(TaitoIrqLine, CPU_IRQSTATUS_AUTO); SekClose(); - + ZetOpen(0); - BurnTimerUpdate((i + 1) * (nTaitoCyclesTotal[1] / nInterleave)); + CPU_RUN_TIMER(1); ZetClose(); } - - ZetOpen(0); - BurnTimerEndFrame(nTaitoCyclesTotal[1]); + + nCyclesExtra[0] = nCyclesDone[0] - nCyclesTotal[0]; + // 1 - timer (BurnTimer keeps track) + if (pBurnSoundOut) { BurnYM2610Update(pBurnSoundOut, nBurnSoundLen); } - ZetClose(); - + if (pBurnDraw) BurnDrvRedraw(); - + return 0; } static INT32 Darius2Scan(INT32 nAction, INT32 *pnMin) { struct BurnArea ba; - + if (pnMin != NULL) { // Return minimum compatible version *pnMin = 0x029684; } - + if (nAction & ACB_MEMORY_RAM) { memset(&ba, 0, sizeof(ba)); ba.Data = TaitoRamStart; @@ -2050,9 +1944,9 @@ static INT32 Darius2Scan(INT32 nAction, INT32 *pnMin) ba.szName = "All Ram"; BurnAcb(&ba); } - + TaitoICScan(nAction); - + if (nAction & ACB_DRIVER_DATA) { SekScan(nAction); ZetScan(nAction); @@ -2061,14 +1955,16 @@ static INT32 Darius2Scan(INT32 nAction, INT32 *pnMin) SCAN_VAR(TaitoCpuACtrl); SCAN_VAR(TaitoZ80Bank); + + SCAN_VAR(nCyclesExtra); } - + if (nAction & ACB_WRITE) { ZetOpen(0); bank_switch(TaitoZ80Bank); ZetClose(); } - + return 0; }