Add World Rally 2 [Morten Shearman Kirkegaard, Peter Wilhelmsen, iq_132]
This commit is contained in:
parent
37b9c89a69
commit
5719ba4073
|
@ -6,6 +6,7 @@
|
|||
#include "eeprom.h"
|
||||
#include "gaelco.h"
|
||||
#include "burn_gun.h"
|
||||
#include "mcs51.h"
|
||||
|
||||
// Todo/tofix:
|
||||
// EEPROM save doesn't seem to work in Snowboard
|
||||
|
@ -22,6 +23,9 @@ static UINT8 *DrvSprBuf;
|
|||
static UINT8 *DrvPalRAM;
|
||||
static UINT8 *Drv68KRAM;
|
||||
static UINT8 *Drv68KRAM2;
|
||||
static UINT8 *DrvMCUROM;
|
||||
static UINT8 *DrvMCURAM;
|
||||
static UINT8 *DrvShareRAM;
|
||||
|
||||
static UINT32 *DrvPalette;
|
||||
static UINT8 DrvRecalc;
|
||||
|
@ -215,6 +219,42 @@ static struct BurnInputInfo BangInputList[] = {
|
|||
STDINPUTINFO(Bang)
|
||||
#undef A
|
||||
|
||||
|
||||
|
||||
|
||||
static struct BurnInputInfo Wrally2InputList[] = {
|
||||
{"P1 Coin", BIT_DIGITAL, DrvJoy3 + 8, "p1 coin" },
|
||||
{"P1 Start", BIT_DIGITAL, DrvJoy1 + 7, "p1 start" },
|
||||
{"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" },
|
||||
{"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" },
|
||||
{"P1 Left", BIT_DIGITAL, DrvJoy1 + 3, "p1 left" },
|
||||
{"P1 Right", BIT_DIGITAL, DrvJoy1 + 2, "p1 right" },
|
||||
{"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" },
|
||||
{"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" },
|
||||
// placeholder for analog inputs
|
||||
{"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 11, "p1 fire 3" },
|
||||
|
||||
{"P2 Coin", BIT_DIGITAL, DrvJoy3 + 10, "p2 coin" },
|
||||
{"P2 Start", BIT_DIGITAL, DrvJoy3 + 7, "p2 start" },
|
||||
{"P2 Up", BIT_DIGITAL, DrvJoy3 + 0, "p2 up" },
|
||||
{"P2 Down", BIT_DIGITAL, DrvJoy3 + 1, "p2 down" },
|
||||
{"P2 Left", BIT_DIGITAL, DrvJoy3 + 3, "p2 left" },
|
||||
{"P2 Right", BIT_DIGITAL, DrvJoy3 + 2, "p2 right" },
|
||||
{"P2 Button 1", BIT_DIGITAL, DrvJoy3 + 4, "p2 fire 1" },
|
||||
{"P2 Button 2", BIT_DIGITAL, DrvJoy3 + 5, "p2 fire 2" },
|
||||
// placeholder for analog inputs
|
||||
{"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 11, "p2 fire 3" },
|
||||
|
||||
{"Reset", BIT_DIGITAL, &DrvReset, "reset" },
|
||||
{"Service", BIT_DIGITAL, DrvJoy4 + 8, "service" },
|
||||
{"Service", BIT_DIGITAL, DrvJoy4 + 10, "service" },
|
||||
{"Service", BIT_DIGITAL, DrvJoy4 + 9, "service" },
|
||||
{"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
|
||||
{"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" },
|
||||
};
|
||||
|
||||
STDINPUTINFO(Wrally2)
|
||||
|
||||
static struct BurnDIPInfo TouchgoDIPList[]=
|
||||
{
|
||||
{0x28, 0xff, 0xff, 0xff, NULL },
|
||||
|
@ -404,6 +444,72 @@ static struct BurnDIPInfo ManiacsqDIPList[]=
|
|||
|
||||
STDDIPINFO(Maniacsq)
|
||||
|
||||
static struct BurnDIPInfo Wrally2DIPList[]=
|
||||
{
|
||||
{0x16, 0xff, 0xff, 0xfd, NULL },
|
||||
{0x17, 0xff, 0xff, 0xff, NULL },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Service Mode" },
|
||||
{0x16, 0x01, 0x01, 0x01, "Off" },
|
||||
{0x16, 0x01, 0x01, 0x00, "On" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Coin mechanism" },
|
||||
{0x16, 0x01, 0x02, 0x00, "Common" },
|
||||
{0x16, 0x01, 0x02, 0x02, "Independent" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Demo Sounds" },
|
||||
{0x16, 0x01, 0x04, 0x00, "Off" },
|
||||
{0x16, 0x01, 0x04, 0x04, "On" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Cabinet 1 Controls" },
|
||||
{0x16, 0x01, 0x08, 0x00, "Pot Wheel" },
|
||||
{0x16, 0x01, 0x08, 0x08, "Joystick" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Cabinet 2 Controls" },
|
||||
{0x16, 0x01, 0x10, 0x00, "Pot Wheel" },
|
||||
{0x16, 0x01, 0x10, 0x10, "Joystick" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Monitors" },
|
||||
{0x16, 0x01, 0x20, 0x00, "One" },
|
||||
{0x16, 0x01, 0x20, 0x20, "Two" },
|
||||
|
||||
{0 , 0xfe, 0 , 4, "Difficulty" },
|
||||
{0x16, 0x01, 0xc0, 0x40, "Easy" },
|
||||
{0x16, 0x01, 0xc0, 0xc0, "Normal" },
|
||||
{0x16, 0x01, 0xc0, 0x80, "Hard" },
|
||||
{0x16, 0x01, 0xc0, 0x00, "Hardest" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Free Play" },
|
||||
{0x17, 0x01, 0x01, 0x01, "Off" },
|
||||
{0x17, 0x01, 0x01, 0x00, "On" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Credit configuration" },
|
||||
{0x17, 0x01, 0x02, 0x00, "Start 2C/Continue 1C" },
|
||||
{0x17, 0x01, 0x02, 0x02, "Start 1C/Continue 1C" },
|
||||
|
||||
{0 , 0xfe, 0 , 8, "Coin B" },
|
||||
{0x17, 0x01, 0x1c, 0x18, "4 Coins 1 Credits" },
|
||||
{0x17, 0x01, 0x1c, 0x10, "3 Coins 1 Credits" },
|
||||
{0x17, 0x01, 0x1c, 0x08, "2 Coins 1 Credits" },
|
||||
{0x17, 0x01, 0x1c, 0x1c, "1 Coin 1 Credits" },
|
||||
{0x17, 0x01, 0x1c, 0x00, "2 Coins 3 Credits" },
|
||||
{0x17, 0x01, 0x1c, 0x0c, "1 Coin 2 Credits" },
|
||||
{0x17, 0x01, 0x1c, 0x14, "1 Coin 3 Credits" },
|
||||
{0x17, 0x01, 0x1c, 0x04, "1 Coin 4 Credits" },
|
||||
|
||||
{0 , 0xfe, 0 , 8, "Coin A" },
|
||||
{0x17, 0x01, 0xe0, 0xc0, "4 Coins 1 Credits" },
|
||||
{0x17, 0x01, 0xe0, 0x80, "3 Coins 1 Credits" },
|
||||
{0x17, 0x01, 0xe0, 0x40, "2 Coins 1 Credits" },
|
||||
{0x17, 0x01, 0xe0, 0xe0, "1 Coin 1 Credits" },
|
||||
{0x17, 0x01, 0xe0, 0x00, "2 Coins 3 Credits" },
|
||||
{0x17, 0x01, 0xe0, 0x60, "1 Coin 2 Credits" },
|
||||
{0x17, 0x01, 0xe0, 0xa0, "1 Coin 3 Credits" },
|
||||
{0x17, 0x01, 0xe0, 0x20, "1 Coin 4 Credits" },
|
||||
};
|
||||
|
||||
STDDIPINFO(Wrally2)
|
||||
|
||||
// Snowboard protection sim. engineered by Samuel Neves & Peter Wilhelmsen
|
||||
|
||||
static UINT16 get_lo(UINT32 x)
|
||||
|
@ -668,6 +774,87 @@ static UINT16 __fastcall gaelco2_main_read_word(UINT32 address)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void __fastcall wrally2_main_write_word(UINT32 address, UINT16 data)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
case 0x218004:
|
||||
case 0x218006:
|
||||
case 0x218008:
|
||||
DrvVidRegs[(address - 0x218004) / 2] = data;
|
||||
return;
|
||||
|
||||
case 0x400000:
|
||||
case 0x400002:
|
||||
case 0x400004:
|
||||
case 0x400006:
|
||||
case 0x400008:
|
||||
case 0x40000a:
|
||||
case 0x40000c:
|
||||
case 0x40000e:
|
||||
case 0x400010:
|
||||
// coin counter (ignore for now)
|
||||
return;
|
||||
|
||||
case 0x400028:
|
||||
// wrally2_adc_clk
|
||||
return;
|
||||
|
||||
case 0x400030:
|
||||
// wrally2_adc_cs
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void __fastcall wrally2_main_write_byte(UINT32 address, UINT8 data)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
case 0x400029:
|
||||
// adc_clk
|
||||
return;
|
||||
|
||||
case 0x400031:
|
||||
// adc_cs
|
||||
return;
|
||||
}
|
||||
|
||||
bprintf (0, _T("WB: %5.5x, %2.2x\n"), address, data);
|
||||
}
|
||||
|
||||
static UINT16 __fastcall wrally2_main_read_word(UINT32 address)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
case 0x300000: // in0,1,2,3
|
||||
case 0x300002:
|
||||
case 0x300004:
|
||||
case 0x300006:
|
||||
return DrvInputs[(address/2) & 3];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static UINT8 __fastcall wrally2_main_read_byte(UINT32 address)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
case 0x300000:
|
||||
case 0x300001:
|
||||
case 0x300002:
|
||||
case 0x300003:
|
||||
case 0x300004:
|
||||
case 0x300005:
|
||||
case 0x300006:
|
||||
return DrvInputs[(address/2) & 3] >> ((~address & 1) * 8);
|
||||
}
|
||||
|
||||
bprintf (0, _T("RB: %5.5x\n"), address);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __fastcall gaelco2_sound_write_byte(UINT32 address, UINT8 data)
|
||||
{
|
||||
DrvSprRAM[(address & 0xffff) ^ 1] = data;
|
||||
|
@ -704,6 +891,30 @@ static UINT16 __fastcall gaelco2_sound_read_word(UINT32 address)
|
|||
return *((UINT16*)(DrvSprRAM + (address & 0xfffe)));
|
||||
}
|
||||
|
||||
static void dallas_sharedram_write(INT32 address, UINT8 data)
|
||||
{
|
||||
if (address >= MCS51_PORT_P0) return;
|
||||
|
||||
if (address >= 0x8000 && address <= 0xffff)
|
||||
DrvShareRAM[(address & 0x7fff) ^ 1] = data;
|
||||
|
||||
if (address >= 0x10000 && address <= 0x17fff)
|
||||
DrvMCURAM[address & 0x7fff] = data;
|
||||
}
|
||||
|
||||
static UINT8 dallas_sharedram_read(INT32 address)
|
||||
{
|
||||
if (address >= MCS51_PORT_P0) return 0;
|
||||
|
||||
if (address >= 0x8000 && address <= 0xffff)
|
||||
return DrvShareRAM[(address & 0x7fff) ^ 1];
|
||||
|
||||
if (address >= 0x10000 && address <= 0x17fff)
|
||||
return DrvMCURAM[address & 0x7fff];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void palette_update(INT32 offset)
|
||||
{
|
||||
static const int pen_color_adjust[16] = {
|
||||
|
@ -724,7 +935,7 @@ static void palette_update(INT32 offset)
|
|||
|
||||
DrvPalette[offset/2] = BurnHighCol(r,g,b,0);
|
||||
|
||||
if (offset >= 0x211fe0) return;
|
||||
// if (offset >= 0x211fe0) return;
|
||||
|
||||
#define ADJUST_COLOR(c) ((c < 0) ? 0 : ((c > 255) ? 255 : c))
|
||||
|
||||
|
@ -733,7 +944,7 @@ static void palette_update(INT32 offset)
|
|||
INT32 auxg = ADJUST_COLOR(g + pen_color_adjust[i]);
|
||||
INT32 auxb = ADJUST_COLOR(b + pen_color_adjust[i]);
|
||||
|
||||
DrvPalette[0x1000 + (offset/2) * i] = BurnHighCol(auxr,auxg,auxb,0);
|
||||
DrvPalette[0x1000 * i + (offset/2)] = BurnHighCol(auxr,auxg,auxb,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,6 +989,8 @@ static INT32 DrvDoReset()
|
|||
SekReset();
|
||||
SekClose();
|
||||
|
||||
if (game_select == 7) mcs51_reset();
|
||||
|
||||
EEPROMReset();
|
||||
|
||||
HiscoreReset();
|
||||
|
@ -796,6 +1009,8 @@ static INT32 MemIndex()
|
|||
|
||||
Drv68KROM = Next; Next += 0x0100000;
|
||||
|
||||
DrvMCUROM = Next; Next += 0x0008000;
|
||||
|
||||
DrvGfxROM0 = Next; Next += 0x1400000;
|
||||
DrvGfxROM = Next; Next += 0x2000000;
|
||||
|
||||
|
@ -809,6 +1024,9 @@ static INT32 MemIndex()
|
|||
Drv68KRAM = Next; Next += 0x0020000;
|
||||
Drv68KRAM2 = Next; Next += 0x0002000;
|
||||
|
||||
DrvShareRAM = Next; Next += 0x0008000;
|
||||
DrvMCURAM = Next; Next += 0x0008000;
|
||||
|
||||
DrvVidRegs = (UINT16*)Next; Next += 0x00003 * sizeof(UINT16);
|
||||
|
||||
RamEnd = Next;
|
||||
|
@ -1033,6 +1251,8 @@ static INT32 DrvInit(INT32 game_selector)
|
|||
gaelcosnd_start(DrvGfxROM0, 0 * 0x0200000, 1 * 0x0200000, 2 * 0x0200000, 3 * 0x0200000);
|
||||
}
|
||||
break;
|
||||
|
||||
// 7 - wrally2
|
||||
}
|
||||
|
||||
SekInit(0, 0x68000);
|
||||
|
@ -1069,12 +1289,96 @@ static INT32 DrvInit(INT32 game_selector)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static INT32 Wrally2Init()
|
||||
{
|
||||
AllMem = NULL;
|
||||
MemIndex();
|
||||
INT32 nLen = MemEnd - (UINT8 *)0;
|
||||
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
|
||||
memset(AllMem, 0, nLen);
|
||||
MemIndex();
|
||||
|
||||
game_select = 7;
|
||||
|
||||
{
|
||||
if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1;
|
||||
if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvMCUROM + 0x000000, 2, 1)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x080000, 4, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x100000, 5, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x180000, 6, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x200000, 7, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x280000, 8, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x300000, 9, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x380000, 10, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x400000, 11, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x480000, 12, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x600000, 13, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x680000, 14, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x800000, 15, 1)) return 1;
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x880000, 16, 1)) return 1;
|
||||
|
||||
DrvGfxDecode(0x0a00000);
|
||||
|
||||
DrvGfxDecode(0xa00000);
|
||||
|
||||
nCPUClockSpeed = 13000000;
|
||||
pIRQCallback = pIRQLine6Callback;
|
||||
m_dual_monitor = 1;
|
||||
|
||||
gaelcosnd_start(DrvGfxROM0, 0 * 0x0200000, 1 * 0x0200000, 0, 0);
|
||||
}
|
||||
|
||||
SekInit(0, 0x68000);
|
||||
SekOpen(0);
|
||||
SekMapMemory(Drv68KROM, 0x000000, 0x0fffff, MAP_ROM);
|
||||
SekMapMemory(DrvSprRAM, 0x200000, 0x20ffff, MAP_RAM);
|
||||
SekMapMemory(DrvPalRAM, 0x210000, 0x211fff, MAP_RAM);
|
||||
SekMapMemory(Drv68KRAM2, 0x212000, 0x213fff, MAP_RAM);
|
||||
SekMapMemory(Drv68KRAM, 0xfe0000, 0xfe7fff, MAP_RAM);
|
||||
SekMapMemory(DrvShareRAM, 0xfe8000, 0xfeffff, MAP_RAM);
|
||||
SekSetWriteWordHandler(0, wrally2_main_write_word);
|
||||
SekSetWriteByteHandler(0, wrally2_main_write_byte);
|
||||
SekSetReadWordHandler(0, wrally2_main_read_word);
|
||||
SekSetReadByteHandler(0, wrally2_main_read_byte);
|
||||
|
||||
SekMapHandler(1, 0x202800, 0x202bff, MAP_WRITE | MAP_READ);
|
||||
SekSetWriteWordHandler(1, gaelco2_sound_write_word);
|
||||
SekSetWriteByteHandler(1, gaelco2_sound_write_byte);
|
||||
SekSetReadWordHandler(1, gaelco2_sound_read_word);
|
||||
SekSetReadByteHandler(1, gaelco2_sound_read_byte);
|
||||
|
||||
SekMapHandler(2, 0x210000, 0x211fff, MAP_WRITE);
|
||||
SekSetWriteWordHandler(2, gaelco2_palette_write_word);
|
||||
SekSetWriteByteHandler(2, gaelco2_palette_write_byte);
|
||||
SekClose();
|
||||
|
||||
mcs51_program_data = DrvMCUROM;
|
||||
ds5002fp_init(0x69, 0x00, 0x80);
|
||||
mcs51_set_write_handler(dallas_sharedram_write);
|
||||
mcs51_set_read_handler(dallas_sharedram_read);
|
||||
|
||||
EEPROMInit(&gaelco2_eeprom_interface); // not used for wrally2
|
||||
|
||||
GenericTilesInit();
|
||||
|
||||
DrvDoReset();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 DrvExit()
|
||||
{
|
||||
GenericTilesExit();
|
||||
|
||||
SekExit();
|
||||
|
||||
if (game_select == 7) mcs51_exit();
|
||||
|
||||
EEPROMExit();
|
||||
|
||||
if (game_select == 6)
|
||||
|
@ -1084,6 +1388,7 @@ static INT32 DrvExit()
|
|||
|
||||
gaelcosnd_exit();
|
||||
game_select = 0;
|
||||
m_dual_monitor = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1096,6 +1401,10 @@ static void draw_layer(INT32 layer)
|
|||
|
||||
INT32 scrolly = (ram[(0x2800 + (layer * 4))/2] + 0x01 - global_y_offset) & 0x1ff;
|
||||
|
||||
INT32 xoffset = 0;
|
||||
|
||||
if (layer && m_dual_monitor) xoffset = 384;
|
||||
|
||||
if ((DrvVidRegs[layer] & 0x8000) == 0)
|
||||
{
|
||||
INT32 scrollx = (ram[(0x2802 + (layer * 4))/2] + 0x10 + (layer ? 0 : 4)) & 0x3ff;
|
||||
|
@ -1110,6 +1419,8 @@ static void draw_layer(INT32 layer)
|
|||
sy -= scrolly;
|
||||
if (sy < -15) sy += 512;
|
||||
|
||||
sx += xoffset;
|
||||
|
||||
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
|
||||
|
||||
INT32 attr0 = ram[offset + (offs * 2) + 0];
|
||||
|
@ -1117,7 +1428,8 @@ static void draw_layer(INT32 layer)
|
|||
|
||||
INT32 code = (attr1 + ((attr0 & 0x07) << 16)) & gfxmask;
|
||||
|
||||
INT32 color = (attr0 & 0xfe00) >> 9;
|
||||
INT32 color = ((attr0 & 0xfe00) >> 9);
|
||||
if (m_dual_monitor) color = (color & 0x3f) | (layer ? 0x40 : 0);
|
||||
INT32 flipx = (attr0 & 0x0080) ? 0xf : 0;
|
||||
INT32 flipy = (attr0 & 0x0040) ? 0xf : 0;
|
||||
|
||||
|
@ -1155,6 +1467,8 @@ static void draw_layer(INT32 layer)
|
|||
}
|
||||
}
|
||||
|
||||
scrollx -= xoffset;
|
||||
|
||||
UINT16 *dst = pTransDraw + sy * nScreenWidth;
|
||||
|
||||
for (INT32 sx = 0; sx < nScreenWidth + 16; sx += 16)
|
||||
|
@ -1169,7 +1483,9 @@ static void draw_layer(INT32 layer)
|
|||
|
||||
INT32 code = (attr1 + ((attr0 & 0x07) << 16)) & gfxmask;
|
||||
|
||||
INT32 color = ((attr0 >> 9) & 0x7f) * 0x20;
|
||||
INT32 color = ((attr0 >> 9) & 0x7f);
|
||||
if (m_dual_monitor) color = (color & 0x3f) | (layer ? 0x40 : 0);
|
||||
color *= 0x20;
|
||||
INT32 flipx = (attr0 & 0x80) ? 0xf : 0;
|
||||
INT32 flipy = (attr0 & 0x40) ? 0xf : 0;
|
||||
|
||||
|
@ -1188,7 +1504,7 @@ static void draw_layer(INT32 layer)
|
|||
}
|
||||
}
|
||||
|
||||
static void draw_sprites(INT32 mask, INT32 xoffs)
|
||||
static void draw_sprites(INT32 xoffs)
|
||||
{
|
||||
UINT16 *buffered_spriteram16 = (UINT16*)DrvSprBuf;
|
||||
int j, x, y, ex, ey, px, py;
|
||||
|
@ -1196,7 +1512,9 @@ static void draw_sprites(INT32 mask, INT32 xoffs)
|
|||
INT32 start_offset = (DrvVidRegs[1] & 0x10)*0x100;
|
||||
INT32 end_offset = start_offset + 0x1000;
|
||||
|
||||
INT32 spr_x_adjust = ((nScreenWidth-1) - 320 + 1) - (511 - 320 - 1) - ((DrvVidRegs[0] >> 4) & 0x01) + xoffs;
|
||||
INT32 width = (nScreenWidth > 512) ? (nScreenWidth/2) : nScreenWidth;
|
||||
|
||||
INT32 spr_x_adjust = ((width-1) - 320 + 1) - (511 - 320 - 1) - ((DrvVidRegs[0] >> 4) & 0x01) + xoffs;
|
||||
|
||||
for (j = start_offset; j < end_offset; j += 8)
|
||||
{
|
||||
|
@ -1214,7 +1532,8 @@ static void draw_sprites(INT32 mask, INT32 xoffs)
|
|||
int xsize = ((data3 >> 12) & 0x0f) + 1;
|
||||
int ysize = ((data2 >> 12) & 0x0f) + 1;
|
||||
|
||||
if (m_dual_monitor && ((data & 0x8000) != mask)) continue;
|
||||
INT32 screen = data >> 15;
|
||||
if (screen) sx += 384;
|
||||
|
||||
if ((data2 & 0x0200) != 0)
|
||||
{
|
||||
|
@ -1232,19 +1551,35 @@ static void draw_sprites(INT32 mask, INT32 xoffs)
|
|||
|
||||
if (color_effect == 0) // iq_132
|
||||
{
|
||||
// clip
|
||||
INT32 xx = ((sx + ex*16) & 0x3ff) + spr_x_adjust;
|
||||
|
||||
if (m_dual_monitor) {
|
||||
if (screen) {
|
||||
if (xx < ((nScreenWidth/2)-15) || xx >= nScreenWidth) continue;
|
||||
GenericTilesSetClip(nScreenWidth/2, nScreenWidth, 0, nScreenHeight);
|
||||
} else {
|
||||
if (xx >= (nScreenWidth/2) || xx < -15) continue;
|
||||
GenericTilesSetClip(0, nScreenWidth/2, 0, nScreenHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if (yflip) {
|
||||
if (xflip) {
|
||||
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, number, ((sx + ex*16) & 0x3ff) + spr_x_adjust, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, number, xx, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
} else {
|
||||
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, number, ((sx + ex*16) & 0x3ff) + spr_x_adjust, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, number, xx, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
}
|
||||
} else {
|
||||
if (xflip) {
|
||||
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, number, ((sx + ex*16) & 0x3ff) + spr_x_adjust, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, number, xx, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
} else {
|
||||
Render16x16Tile_Mask_Clip(pTransDraw, number, ((sx + ex*16) & 0x3ff) + spr_x_adjust, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
Render16x16Tile_Mask_Clip(pTransDraw, number, xx, ((sy + ey*16) & 0x1ff) + global_y_offset, color, 5, 0, 0, DrvGfxROM);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_dual_monitor) GenericTilesClearClip();
|
||||
|
||||
} else {
|
||||
const UINT8 *gfx_src = DrvGfxROM + number * 0x100;
|
||||
|
||||
|
@ -1281,6 +1616,38 @@ static void draw_sprites(INT32 mask, INT32 xoffs)
|
|||
}
|
||||
}
|
||||
|
||||
static INT32 DualDraw()
|
||||
{
|
||||
if (DrvRecalc) {
|
||||
for (INT32 i = 0; i < 0x2000; i+=2) {
|
||||
palette_update(i);
|
||||
}
|
||||
DrvRecalc = 0;
|
||||
}
|
||||
|
||||
BurnTransferClear();
|
||||
|
||||
if (nBurnLayer & 1) draw_layer(1);
|
||||
|
||||
GenericTilesSetClip(0, nScreenWidth/2, 0, nScreenHeight);
|
||||
|
||||
if (nBurnLayer & 2) draw_layer(0);
|
||||
|
||||
GenericTilesClearClip();
|
||||
|
||||
if (nBurnLayer & 4) draw_sprites(0);
|
||||
|
||||
BurnTransferCopy(DrvPalette);
|
||||
|
||||
if (game_select == 6) {
|
||||
for (INT32 i = 0; i < nBurnGunNumPlayers; i++) {
|
||||
BurnGunDrawTarget(i, BurnGunX[i] >> 8, BurnGunY[i] >> 8);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 DrvDraw()
|
||||
{
|
||||
if (DrvRecalc) {
|
||||
|
@ -1294,7 +1661,7 @@ static INT32 DrvDraw()
|
|||
|
||||
if (nBurnLayer & 1) draw_layer(1);
|
||||
if (nBurnLayer & 2) draw_layer(0);
|
||||
if (nBurnLayer & 4) draw_sprites(0,0);
|
||||
if (nBurnLayer & 4) draw_sprites(0);
|
||||
|
||||
BurnTransferCopy(DrvPalette);
|
||||
|
||||
|
@ -1304,10 +1671,10 @@ static INT32 DrvDraw()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static INT32 DrvFrame()
|
||||
{
|
||||
if (DrvReset) {
|
||||
|
@ -1336,8 +1703,8 @@ static INT32 DrvFrame()
|
|||
}
|
||||
|
||||
INT32 nInterleave = 256;
|
||||
INT32 nCyclesTotal[1] = { (nCPUClockSpeed * 10) / 591 }; // ?? MHZ @ 59.1 HZ
|
||||
INT32 nCyclesDone[1] = { 0 };
|
||||
INT32 nCyclesTotal[2] = { (nCPUClockSpeed * 10) / 591, (12000000 * 10) / 591 }; // ?? MHZ @ 59.1 HZ
|
||||
INT32 nCyclesDone[2] = { 0, 0 };
|
||||
INT32 nSegment = 0;
|
||||
|
||||
SekOpen(0);
|
||||
|
@ -1347,8 +1714,13 @@ static INT32 DrvFrame()
|
|||
nSegment = (nCyclesTotal[0] - nCyclesDone[0]) / (nInterleave - i);
|
||||
nCyclesDone[0] += SekRun(nSegment);
|
||||
|
||||
pIRQCallback(i);
|
||||
// pIRQCallback(i);
|
||||
if (i == (nInterleave - 1)) SekSetIRQLine(6, CPU_IRQSTATUS_AUTO);
|
||||
|
||||
if (game_select == 7)
|
||||
{
|
||||
nCyclesDone[1] += mcs51Run(((SekTotalCycles() * 12) / 13) - nCyclesDone[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (pBurnSoundOut) {
|
||||
|
@ -1358,7 +1730,7 @@ static INT32 DrvFrame()
|
|||
SekClose();
|
||||
|
||||
if (pBurnDraw) {
|
||||
DrvDraw();
|
||||
BurnDrvRedraw();
|
||||
}
|
||||
|
||||
memcpy (DrvSprBuf, DrvSprRAM, 0x10000);
|
||||
|
@ -1391,6 +1763,9 @@ static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
|||
if (game_select == 6)
|
||||
BurnGunScan();
|
||||
|
||||
if (game_select == 7)
|
||||
mcs51_scan(nAction);
|
||||
|
||||
SCAN_VAR(snowboar_latch);
|
||||
SCAN_VAR(gun_interrupt);
|
||||
gaelcosnd_scan();
|
||||
|
@ -1770,3 +2145,41 @@ struct BurnDriver BurnDrvBangj = {
|
|||
bangInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x10000,
|
||||
320, 240, 4, 3
|
||||
};
|
||||
|
||||
|
||||
// World Rally 2: Twin Racing
|
||||
|
||||
static struct BurnRomInfo wrally2RomDesc[] = {
|
||||
{ "wr2.64", 0x80000, 0x4cdf4e1e, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code
|
||||
{ "wr2.63", 0x80000, 0x94887c9f, 1 | BRF_PRG | BRF_ESS }, // 1
|
||||
|
||||
{ "wr2_dallas.bin", 0x08000, 0xe22328c5, 2 | BRF_PRG | BRF_ESS }, // 2 DS5002FP MCU
|
||||
|
||||
{ "wr2.16d", 0x80000, 0xad26086b, 3 | BRF_GRA }, // 3 Graphics & Samples
|
||||
{ "wr2.17d", 0x80000, 0xc1ec0745, 3 | BRF_GRA }, // 4
|
||||
{ "wr2.18d", 0x80000, 0xe3617814, 3 | BRF_GRA }, // 5
|
||||
{ "wr2.19d", 0x80000, 0x2dae988c, 3 | BRF_GRA }, // 6
|
||||
{ "wr2.09d", 0x80000, 0x372d70c8, 3 | BRF_GRA }, // 7
|
||||
{ "wr2.10d", 0x80000, 0x5db67eb3, 3 | BRF_GRA }, // 8
|
||||
{ "wr2.11d", 0x80000, 0xae66b97c, 3 | BRF_GRA }, // 9
|
||||
{ "wr2.12d", 0x80000, 0x6dbdaa95, 3 | BRF_GRA }, // 10
|
||||
{ "wr2.01d", 0x80000, 0x753a138d, 3 | BRF_GRA }, // 11
|
||||
{ "wr2.02d", 0x80000, 0x9c2a723c, 3 | BRF_GRA }, // 12
|
||||
{ "wr2.20d", 0x80000, 0x4f7ade84, 3 | BRF_GRA }, // 13
|
||||
{ "wr2.13d", 0x80000, 0xa4cd32f8, 3 | BRF_GRA }, // 14
|
||||
{ "wr2.21d", 0x80000, 0x899b0583, 3 | BRF_GRA }, // 15
|
||||
{ "wr2.14d", 0x80000, 0x6eb781d5, 3 | BRF_GRA }, // 16
|
||||
};
|
||||
|
||||
STD_ROM_PICK(wrally2)
|
||||
STD_ROM_FN(wrally2)
|
||||
|
||||
struct BurnDriver BurnDrvWrally2 = {
|
||||
"wrally2", NULL, NULL, NULL, "1995",
|
||||
"World Rally 2: Twin Racing\0", NULL, "Gaelco", "Miscellaneous",
|
||||
NULL, NULL, NULL, NULL,
|
||||
BDF_GAME_WORKING, 2, HARDWARE_MISC_POST90S, GBF_RACING, 0,
|
||||
NULL, wrally2RomInfo, wrally2RomName, NULL, NULL, Wrally2InputInfo, Wrally2DIPInfo,
|
||||
Wrally2Init, DrvExit, DrvFrame, DualDraw, DrvScan, &DrvRecalc, 0x10000,
|
||||
384*2, 240, 8, 3
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue