Add driver for Sand Scorpion

Add device for kaneko tilemap
Fix crash in pandora.cpp
Make d_jchan.cpp use new tilemap system

Will someone please take a look at why the z80 is acting strangely? I'm stuck. :(
This commit is contained in:
iq_132 2014-08-10 01:24:45 +00:00
parent 53ee0b57c1
commit 950bcbd554
8 changed files with 1124 additions and 164 deletions

View File

@ -56,9 +56,9 @@ drvobj = d_dodonpachi.o d_donpachi.o d_esprade.o d_feversos.o d_gaia.o d_guwang
d_deniam.o d_ddragon3.o d_diverboy.o d_drgnmst.o d_drtomy.o d_egghunt.o d_esd16.o d_f1gp.o d_fstarfrc.o d_funybubl.o \
d_fuukifg3.o d_gaelco.o d_gaiden.o d_galpanic.o d_galspnbl.o d_gotcha.o d_gumbo.o d_hyperpac.o d_jchan.o d_kaneko16.o \
d_lordgun.o d_mcatadv.o d_midas.o d_mugsmash.o d_mwarr.o d_news.o d_nmg5.o d_nmk16.o d_ohmygod.o d_pass.o d_pirates.o \
d_playmark.o d_powerins.o d_pushman.o d_raiden.o d_seta.o d_seta2.o d_shadfrce.o d_silkroad.o d_silvmil.o d_speedspn.o \
d_suna16.o d_taotaido.o d_tecmosys.o d_tumbleb.o d_unico.o d_vmetal.o d_welltris.o d_wwfwfest.o d_xorworld.o d_yunsun16.o \
d_zerozone.o \
d_playmark.o d_powerins.o d_pushman.o d_raiden.o d_sandscrp.o d_seta.o d_seta2.o d_shadfrce.o d_silkroad.o d_silvmil.o \
d_speedspn.o d_suna16.o d_taotaido.o d_tecmosys.o d_tumbleb.o d_unico.o d_vmetal.o d_welltris.o d_wwfwfest.o d_xorworld.o \
d_yunsun16.o d_zerozone.o \
\
d_parent.o \
\
@ -75,7 +75,8 @@ depobj := $(drvobj) \
burn.o burn_gun.o burn_led.o burn_memory.o burn_sound.o burn_sound_c.o cheat.o debug_track.o hiscore.o load.o \
tiles_generic.o timer.o vector.o \
\
8255ppi.o 8257dma.o eeprom.o nmk004.o pandora.o seibusnd.o sknsspr.o slapstic.o t5182.o timekpr.o tms34061.o v3021.o vdc.o \
8255ppi.o 8257dma.o eeprom.o nmk004.o kaneko_tmap.o pandora.o seibusnd.o sknsspr.o slapstic.o t5182.o timekpr.o tms34061.o \
v3021.o vdc.o \
\
ay8910.o burn_y8950.o burn_ym2151.o burn_ym2203.o burn_ym2413.o burn_ym2608.o burn_ym2610.o burn_ym2612.o \
burn_ym3526.o burn_ym3812.o burn_ymf278b.o c6280.o dac.o es5506.o es8712.o flt_rc.o fm.o fmopl.o ics2115.o iremga20.o \

View File

@ -0,0 +1,175 @@
#include "tiles_generic.h"
static INT32 kaneko_view2_xoff = 0;
static INT32 kaneko_view2_yoff = 0;
static UINT8 *kaneko_view2_vram = NULL;
static UINT8 *kaneko_view2_regs = NULL;
static UINT8 *kaneko_view2_gfx = NULL;
static UINT8 *kaneko_view2_gfx_trans = NULL;
static INT32 kaneko_color_offset = 0;
void kaneko_view2_init(UINT8 *video_ram, UINT8 *reg_ram, UINT8 *gfx_rom, INT32 color_offset, UINT8 *gfx_trans, INT32 global_x, INT32 global_y)
{
kaneko_view2_vram = video_ram;
kaneko_view2_regs = reg_ram;
kaneko_view2_gfx = gfx_rom;
kaneko_color_offset = color_offset;
kaneko_view2_gfx_trans = gfx_trans;
kaneko_view2_xoff = global_x;
kaneko_view2_yoff = global_y;
}
void kaneko_view2_exit()
{
kaneko_view2_vram = NULL;
kaneko_view2_regs = NULL;
kaneko_view2_gfx = NULL;
kaneko_color_offset = 0;
kaneko_view2_gfx_trans = NULL;
kaneko_view2_xoff = 0;
kaneko_view2_yoff = 0;
}
void kaneko_view2_draw_layer(INT32 layer, INT32 priority)
{
UINT16 *vram = (UINT16*)(kaneko_view2_vram + (layer ? 0x0000 : 0x1000));
UINT16 *sram = (UINT16*)(kaneko_view2_vram + (layer ? 0x2000 : 0x3000));
UINT16 *regs = (UINT16*)kaneko_view2_regs;
INT32 tmflip = BURN_ENDIAN_SWAP_INT16(regs[4]);
INT32 enable = ~tmflip & (layer ? 0x0010 : 0x1000);
if (enable == 0) return; // disable!
INT32 tmflipx = tmflip & 0x0200; // flip whole tilemap x
INT32 tmflipy = tmflip & 0x0100; // flip whole tilemap y
INT32 lsenable = tmflip & (layer ? 0x0008 : 0x0800); // linescroll
INT32 xscroll = BURN_ENDIAN_SWAP_INT16(regs[2 - (layer * 2)]);
INT32 yscroll = BURN_ENDIAN_SWAP_INT16(regs[3 - (layer * 2)]) >> 6;
xscroll += (tmflipx) ? -((344 + (layer * 2)) * 64) : ((kaneko_view2_xoff + (layer * 2)) * 64);
yscroll += ((tmflipy) ? -260 : 11) + kaneko_view2_yoff;
yscroll &= 0x1ff;
if (lsenable)
{
UINT16 *dest = pTransDraw;
for (INT32 y = 0; y < nScreenHeight; y++, dest += nScreenWidth) // line by line
{
INT32 scrollyy = (yscroll + y) & 0x1ff;
INT32 scrollxx = ((xscroll + BURN_ENDIAN_SWAP_INT16(sram[y])) >> 6) & 0x1ff;
INT32 srcy = (scrollyy & 0x1ff) >> 4;
INT32 srcx = (scrollxx & 0x1ff) >> 4;
for (INT32 x = 0; x < nScreenWidth + 16; x+=16)
{
INT32 offs = ((srcy << 5) | ((srcx + (x >> 4)) & 0x1f));
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]);
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff;
INT32 color = ((attr & 0x00fc) << 2) + kaneko_color_offset;
INT32 flipx = (attr & 0x0002) ? 0x0f : 0;
INT32 flipy = (attr & 0x0001) ? 0xf0 : 0;
INT32 group = (attr & 0x0700) >> 8;
if (kaneko_view2_gfx_trans) {
if (kaneko_view2_gfx_trans[code]) continue;
}
if (group != priority) continue;
UINT8 *gfxsrc = kaneko_view2_gfx + (code << 8) + (((scrollyy & 0x0f) << 4) ^ flipy);
for (INT32 dx = 0; dx < 16; dx++)
{
INT32 dst = (x + dx) - (scrollxx & 0x0f);
if (dst < 0 || dst >= nScreenWidth) continue;
if (gfxsrc[dx^flipx]) {
dest[dst] = color + gfxsrc[dx^flipx];
}
}
}
}
}
else
{
INT32 scrollx = (xscroll >> 6) & 0x1ff;
for (INT32 offs = 0; offs < 32 * 32; offs++)
{
INT32 sx = (offs & 0x1f) * 16;
INT32 sy = (offs / 0x20) * 16;
sy -= yscroll;
if (sy < -15) sy += 512;
sx -= scrollx;
if (sx < -15) sx += 512;
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]);
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff;
INT32 color = ((attr & 0x00fc) >> 2) + (0x400 >> 4);
INT32 flipx = (attr & 0x0002);
INT32 flipy = (attr & 0x0001);
INT32 group = (attr & 0x0700) >> 8;
if (kaneko_view2_gfx_trans) {
if (kaneko_view2_gfx_trans[code]) continue;
}
if (tmflipy) {
flipy ^= 1;
sy = 224 - sy; // fix later
}
if (tmflipx) {
flipx ^= 2;
sx = 304 - sx; // fix later!
}
if (group != priority) continue;
if (sx >= 0 && sy >=0 && sx <= (nScreenWidth - 16) && sy <= (nScreenHeight-16)) // non-clipped
{
if (flipy) {
if (flipx) {
Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
} else {
Render16x16Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
}
} else {
if (flipx) {
Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
} else {
Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
}
}
}
else // clipped
{
if (flipy) {
if (flipx) {
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
} else {
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
}
} else {
if (flipx) {
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
} else {
Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, kaneko_view2_gfx);
}
}
}
}
}
}

View File

@ -0,0 +1,3 @@
void kaneko_view2_init(UINT8 *video_ram, UINT8 *reg_ram, UINT8 *gfx_rom, INT32 color_offset, UINT8 *gfx_trans, INT32 global_x, INT32 global_y);
void kaneko_view2_exit();
void kaneko_view2_draw_layer(INT32 layer, INT32 priority);

View File

@ -9,6 +9,7 @@ static INT32 pandora_clear;
static INT32 pandora_xoffset;
static INT32 pandora_yoffset;
static INT32 pandora_color_offset;
static INT32 pandora_code_max;
INT32 pandora_flipscreen;
void pandora_set_clear(INT32 clear)
@ -67,6 +68,8 @@ void pandora_buffer_sprites()
y = dy;
}
code &= pandora_code_max;
if (pandora_flipscreen)
{
sx = 240 - x;
@ -105,7 +108,7 @@ void pandora_buffer_sprites()
}
// must be called after GenericTilesInit()
void pandora_init(UINT8 *ram, UINT8 *gfx, INT32 color_offset, INT32 x, INT32 y)
void pandora_init(UINT8 *ram, UINT8 *gfx, INT32 gfx_mod, INT32 color_offset, INT32 x, INT32 y)
{
DebugDev_PandoraInitted = 1;
@ -114,6 +117,7 @@ void pandora_init(UINT8 *ram, UINT8 *gfx, INT32 color_offset, INT32 x, INT32 y)
pandora_yoffset = y;
pandora_gfx = gfx;
pandora_color_offset = color_offset;
pandora_code_max = gfx_mod;
if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
BurnDrvGetVisibleSize(&nScreenHeight, &nScreenWidth);

View File

@ -3,5 +3,5 @@ extern INT32 pandora_flipscreen;
void pandora_set_clear(INT32 clear);
void pandora_update(UINT16 *dest);
void pandora_buffer_sprites();
void pandora_init(UINT8 *ram, UINT8 *gfx, INT32 color_offset, INT32 x, INT32 y);
void pandora_init(UINT8 *ram, UINT8 *gfx, INT32 gfx_mod, INT32 color_offset, INT32 x, INT32 y);
void pandora_exit();

View File

@ -393,12 +393,12 @@ UINT8 __fastcall airbustr_sound_in(UINT16 port)
return 0;
}
UINT8 DrvYM2203PortA(UINT32)
static UINT8 DrvYM2203PortA(UINT32)
{
return DrvDips[0];
}
UINT8 DrvYM2203PortB(UINT32)
static UINT8 DrvYM2203PortB(UINT32)
{
return DrvDips[1];
}
@ -637,7 +637,7 @@ static INT32 DrvInit()
GenericTilesInit();
pandora_init(DrvPandoraRAM, DrvGfxROM1, 0x200, 0, -16);
pandora_init(DrvPandoraRAM, DrvGfxROM1, (0x400000/0x100)-1, 0x200, 0, -16);
DrvDoReset(1);
@ -849,7 +849,7 @@ struct BurnDriver BurnDrvAirbustr = {
"airbustr", NULL, NULL, NULL, "1990",
"Air Buster: Trouble Specialty Raid Unit (World)\0", NULL, "Kaneko (Namco license)", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_KANEKO_MISC, GBF_HORSHOOT, 0,
BDF_GAME_WORKING, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0,
NULL, airbustrRomInfo, airbustrRomName, NULL, NULL, AirbustrInputInfo, AirbustrDIPInfo,
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300,
256, 224, 4, 3
@ -882,7 +882,7 @@ struct BurnDriver BurnDrvAirbustrj = {
"airbustrj", "airbustr", NULL, NULL, "1990",
"Air Buster: Trouble Specialty Raid Unit (Japan)\0", NULL, "Kaneko (Namco license)", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO_MISC, GBF_HORSHOOT, 0,
BDF_GAME_WORKING | BDF_CLONE, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0,
NULL, airbustrjRomInfo, airbustrjRomName, NULL, NULL, AirbustrInputInfo, AirbustjDIPInfo,
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300,
256, 224, 4, 3
@ -920,7 +920,7 @@ struct BurnDriver BurnDrvAirbustrb = {
"airbustrb", "airbustr", NULL, NULL, "1990",
"Air Buster: Trouble Specialty Raid Unit (bootleg)\0", NULL, "bootleg", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KANEKO_MISC, GBF_HORSHOOT, 0,
BDF_GAME_WORKING | BDF_CLONE | BDF_BOOTLEG, 2, HARDWARE_KANEKO_MISC, GBF_MISC, 0,
NULL, airbustrbRomInfo, airbustrbRomName, NULL, NULL, AirbustrInputInfo, AirbustjDIPInfo,
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x0300,
256, 224, 4, 3

View File

@ -4,6 +4,7 @@
#include "tiles_generic.h"
#include "m68000_intf.h"
#include "sknsspr.h"
#include "kaneko_tmap.h"
#include "ymz280b.h"
static UINT8 *AllMem;
@ -27,10 +28,7 @@ static UINT8 *DrvSprReg0;
static UINT8 *DrvSprRAM1;
static UINT8 *DrvSprReg1;
static UINT8 *DrvPalRAM;
static UINT8 *DrvVidRAM1;
static UINT8 *DrvVidRAM0;
static UINT8 *DrvScrRAM1;
static UINT8 *DrvScrRAM0;
static UINT8 *DrvVidRAM;
static UINT8 *DrvVidRegs;
static UINT32 *DrvPalette;
@ -396,10 +394,7 @@ static INT32 MemIndex()
DrvSprReg1 = Next; Next += 0x000400;
DrvPalRAM = Next; Next += 0x010000;
DrvVidRAM1 = Next; Next += 0x001000;
DrvVidRAM0 = Next; Next += 0x001000;
DrvScrRAM1 = Next; Next += 0x001000;
DrvScrRAM0 = Next; Next += 0x001000;
DrvVidRAM = Next; Next += 0x004000;
DrvVidRegs = Next; Next += 0x000400;
mcu_com = (UINT16*)Next; Next += 0x00004 * sizeof(UINT16);
@ -547,10 +542,7 @@ static INT32 DrvInit()
SekMapMemory(Drv68KROM1, 0x000000, 0x0fffff, SM_ROM);
SekMapMemory(Drv68KRAM1, 0x100000, 0x10ffff, SM_RAM);
SekMapMemory(DrvShareRAM, 0x400000, 0x403fff, SM_RAM);
SekMapMemory(DrvVidRAM1, 0x500000, 0x500fff, SM_RAM);
SekMapMemory(DrvVidRAM0, 0x501000, 0x501fff, SM_RAM);
SekMapMemory(DrvScrRAM1, 0x502000, 0x502fff, SM_RAM);
SekMapMemory(DrvScrRAM0, 0x503000, 0x503fff, SM_RAM);
SekMapMemory(DrvVidRAM, 0x500000, 0x503fff, SM_RAM);
SekMapMemory(DrvVidRegs, 0x600000, 0x60001f|0x3ff, SM_RAM);
SekMapMemory(DrvSprRAM1, 0x700000, 0x703fff, SM_RAM);
SekMapMemory(DrvSprReg1, 0x780000, 0x78003f|0x3ff, SM_RAM);
@ -569,6 +561,8 @@ static INT32 DrvInit()
YMZ280BSetRoute(BURN_SND_YMZ280B_YMZ280B_ROUTE_2, 1.00, BURN_SND_ROUTE_RIGHT);
skns_init();
kaneko_view2_init(DrvVidRAM, DrvVidRegs, DrvGfxROM0, 0, DrvTransTab, 25, 0);
GenericTilesInit();
DrvDoReset(1);
@ -584,7 +578,8 @@ static INT32 DrvExit()
YMZ280BExit();
YMZ280BROM = NULL;
kaneko_view2_exit();
skns_exit();
BurnFree(AllMem);
@ -592,143 +587,6 @@ static INT32 DrvExit()
return 0;
}
static void draw_layer(UINT8 *ram, UINT8 *scr, INT32 layer, INT32 priority)
{
UINT16 *vram = (UINT16*)ram;
UINT16 *sram = (UINT16*)scr;
UINT16 *regs = (UINT16*)DrvVidRegs;
INT32 tmflip = BURN_ENDIAN_SWAP_INT16(regs[4]);
INT32 enable = ~tmflip & (layer ? 0x0010 : 0x1000);
if (enable == 0) return; // disable!
INT32 tmflipx = tmflip & 0x0200; // flip whole tilemap x
INT32 tmflipy = tmflip & 0x0100; // flip whole tilemap y
INT32 lsenable = tmflip & (layer ? 0x0008 : 0x0800); // linescroll
INT32 xscroll = BURN_ENDIAN_SWAP_INT16(regs[2 - (layer * 2)]);
INT32 yscroll = BURN_ENDIAN_SWAP_INT16(regs[3 - (layer * 2)]) >> 6;
xscroll += (tmflipx) ? -((344 + (layer * 2)) * 64) : ((25 + (layer * 2)) * 64);
yscroll += (tmflipy) ? -260 : 11;
yscroll &= 0x1ff;
if (lsenable)
{
UINT16 *dest = pTransDraw;
for (INT32 y = 0; y < nScreenHeight; y++, dest += nScreenWidth) // line by line
{
INT32 scrollyy = (yscroll + y) & 0x1ff;
INT32 scrollxx = ((xscroll + BURN_ENDIAN_SWAP_INT16(sram[scrollyy])) >> 16) & 0x1ff;
INT32 srcy = (scrollyy & 0x1ff) >> 4;
INT32 srcx = (scrollxx & 0x1ff) >> 4;
for (INT32 x = 0; x < nScreenWidth + 16; x+=16)
{
INT32 offs = ((srcy << 5) | ((srcx + (x >> 4)) & 0x1f));
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]);
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff;
INT32 color = (attr & 0x00fc) << 2;
INT32 flipx = (attr & 0x0002) ? 0x0f : 0;
INT32 flipy = (attr & 0x0001) ? 0xf0 : 0;
INT32 group = (attr & 0x0700) >> 8;
if (DrvTransTab[code]) continue;
if (group != priority) continue;
UINT8 *gfxsrc = DrvGfxROM0 + (code << 8) + (((scrollyy & 0x0f) << 4) ^ flipy);
for (INT32 dx = 0; dx < 16; dx++)
{
INT32 dst = (x + dx) - (scrollxx & 0x0f);
if (dst < 0 || dst >= nScreenWidth) continue;
if (gfxsrc[dx^flipx]) {
dest[dst] = color + gfxsrc[dx^flipx];
}
}
}
}
}
else
{
INT32 scrollx = (xscroll >> 6) & 0x1ff;
for (INT32 offs = 0; offs < 32 * 32; offs++)
{
INT32 sx = (offs & 0x1f) * 16;
INT32 sy = (offs / 0x20) * 16;
sy -= yscroll;
if (sy < -15) sy += 512;
sx -= scrollx;
if (sx < -15) sx += 512;
if (sx >= nScreenWidth || sy >= nScreenHeight) continue;
INT32 attr = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 0]);
INT32 code = BURN_ENDIAN_SWAP_INT16(vram[offs * 2 + 1]) & 0x1fff;
INT32 color = (attr & 0x00fc) >> 2;
INT32 flipx = (attr & 0x0002);
INT32 flipy = (attr & 0x0001);
INT32 group = (attr & 0x0700) >> 8;
if (DrvTransTab[code]) continue;
if (tmflipy) {
flipy ^= 1;
sy = 224 - sy; // fix later
}
if (tmflipx) {
flipx ^= 2;
sx = 304 - sx; // fix later!
}
if (group != priority) continue;
if (sx >= 0 && sy >=0 && sx <= (nScreenWidth - 16) && sy <= (nScreenHeight-16)) // non-clipped
{
if (flipy) {
if (flipx) {
Render16x16Tile_Mask_FlipXY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
} else {
Render16x16Tile_Mask_FlipY(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
}
} else {
if (flipx) {
Render16x16Tile_Mask_FlipX(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
} else {
Render16x16Tile_Mask(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
}
}
}
else // clipped
{
if (flipy) {
if (flipx) {
Render16x16Tile_Mask_FlipXY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
} else {
Render16x16Tile_Mask_FlipY_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
}
} else {
if (flipx) {
Render16x16Tile_Mask_FlipX_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
} else {
Render16x16Tile_Mask_Clip(pTransDraw, code, sx, sy, color, 4, 0, 0, DrvGfxROM0);
}
}
}
}
}
}
static INT32 DrvDraw()
{
if (DrvRecalc)
@ -745,8 +603,8 @@ static INT32 DrvDraw()
}
for (INT32 i = 0; i < 8; i++) {
draw_layer(DrvVidRAM0, DrvScrRAM0, 0, i);
draw_layer(DrvVidRAM1, DrvScrRAM1, 1, i);
kaneko_view2_draw_layer(0, i);
kaneko_view2_draw_layer(1, i);
}
skns_draw_sprites(pTransDraw, (UINT32*)DrvSprRAM1, 0x4000, DrvGfxROM2, 0x1000000, (UINT32*)DrvSprReg1, 0x4000);

View File

@ -0,0 +1,919 @@
// FB Alpha Sand Scorpion driver module
// Based on MAME driver by
#include "tiles_generic.h"
#include "z80_intf.h"
#include "m68000_intf.h"
#include "msm6295.h"
#include "burn_ym2203.h"
#include "kaneko_tmap.h"
#include "pandora.h"
#define SOUND_BYPASS_HACK
static UINT8 *AllMem;
static UINT8 *MemEnd;
static UINT8 *AllRam;
static UINT8 *RamEnd;
static UINT8 *Drv68KROM;
static UINT8 *DrvZ80ROM;
static UINT8 *DrvGfxROM0;
static UINT8 *DrvGfxROM1;
static UINT8 *DrvTransTab;
static UINT8 *Drv68KRAM;
static UINT8 *DrvZ80RAM;
static UINT8 *DrvPandoraRAM;
static UINT8 *DrvSprRAM;
static UINT8 *DrvPalRAM;
static UINT8 *DrvVideoRAM;
static UINT8 *DrvVidRegs;
static UINT32 *DrvPalette;
static UINT8 DrvRecalc;
static UINT8 nDrvZ80Bank;
static UINT8 soundlatch;
static UINT8 soundlatch2;
static INT32 watchdog;
static INT32 vblank_irq;
static INT32 sprite_irq;
static INT32 unknown_irq;
static INT32 latch1_full;
static INT32 latch2_full;
typedef struct
{
UINT16 x1p, y1p, x1s, y1s;
UINT16 x2p, y2p, x2s, y2s;
INT16 x12, y12, x21, y21;
UINT16 mult_a, mult_b;
} calc1_hit_t;
static calc1_hit_t m_hit;
static UINT8 DrvJoy1[16];
static UINT8 DrvJoy2[16];
static UINT8 DrvJoy3[16];
static UINT8 DrvDips[2];
static UINT16 DrvInputs[3];
static UINT8 DrvReset;
#ifdef SOUND_BYPASS_HACK
static INT32 dip_counter_hack;
#endif
static struct BurnInputInfo SandscrpInputList[] = {
{"P1 Coin", BIT_DIGITAL, DrvJoy3 + 2, "p1 coin" },
{"P1 Start", BIT_DIGITAL, DrvJoy3 + 0, "p1 start" },
{"P1 Up", BIT_DIGITAL, DrvJoy1 + 0, "p1 up" },
{"P1 Down", BIT_DIGITAL, DrvJoy1 + 1, "p1 down" },
{"P1 Left", BIT_DIGITAL, DrvJoy1 + 2, "p1 left" },
{"P1 Right", BIT_DIGITAL, DrvJoy1 + 3, "p1 right" },
{"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 1" },
{"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 2" },
{"P2 Coin", BIT_DIGITAL, DrvJoy3 + 3, "p2 coin" },
{"P2 Start", BIT_DIGITAL, DrvJoy3 + 1, "p2 start" },
{"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" },
{"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" },
{"P2 Left", BIT_DIGITAL, DrvJoy2 + 2, "p2 left" },
{"P2 Right", BIT_DIGITAL, DrvJoy2 + 3, "p2 right" },
{"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" },
{"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 2" },
{"Reset", BIT_DIGITAL, &DrvReset, "reset" },
{"Service", BIT_DIGITAL, DrvJoy3 + 6, "service" },
{"Tilt", BIT_DIGITAL, DrvJoy3 + 4, "tilt" },
{"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
{"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" },
};
STDINPUTINFO(Sandscrp)
static struct BurnDIPInfo SandscrpDIPList[]=
{
{0x13, 0xff, 0xff, 0xff, NULL },
{0x14, 0xff, 0xff, 0xff, NULL },
{0 , 0xfe, 0 , 4, "Lives" },
{0x13, 0x01, 0x03, 0x02, "1" },
{0x13, 0x01, 0x03, 0x01, "2" },
{0x13, 0x01, 0x03, 0x03, "3" },
{0x13, 0x01, 0x03, 0x00, "5" },
{0 , 0xfe, 0 , 4, "Bombs" },
{0x13, 0x01, 0x0c, 0x08, "1" },
{0x13, 0x01, 0x0c, 0x04, "2" },
{0x13, 0x01, 0x0c, 0x0c, "3" },
{0x13, 0x01, 0x0c, 0x00, "5" },
{0 , 0xfe, 0 , 4, "Difficulty" },
{0x13, 0x01, 0x30, 0x30, "Easy" },
{0x13, 0x01, 0x30, 0x20, "Normal" },
{0x13, 0x01, 0x30, 0x10, "Hard" },
{0x13, 0x01, 0x30, 0x00, "Hardest" },
{0 , 0xfe, 0 , 4, "Bonus Life" },
{0x13, 0x01, 0xc0, 0x80, "100K, 300K" },
{0x13, 0x01, 0xc0, 0xc0, "200K, 500K" },
{0x13, 0x01, 0xc0, 0x40, "500K, 1000K" },
{0x13, 0x01, 0xc0, 0x00, "1000K, 3000K" },
{0 , 0xfe, 0 , 16, "Coinage" },
{0x14, 0x01, 0x0f, 0x0a, "6 Coins 1 Credits" },
{0x14, 0x01, 0x0f, 0x0b, "5 Coins 1 Credits" },
{0x14, 0x01, 0x0f, 0x0c, "4 Coins 1 Credits" },
{0x14, 0x01, 0x0f, 0x0d, "3 Coins 1 Credits" },
{0x14, 0x01, 0x0f, 0x01, "8 Coins 3 Credits" },
{0x14, 0x01, 0x0f, 0x0e, "2 Coins 1 Credits" },
{0x14, 0x01, 0x0f, 0x02, "5 Coins 3 Credits" },
{0x14, 0x01, 0x0f, 0x03, "3 Coins 2 Credits" },
{0x14, 0x01, 0x0f, 0x0f, "1 Coin 1 Credits" },
{0x14, 0x01, 0x0f, 0x04, "2 Coins 3 Credits" },
{0x14, 0x01, 0x0f, 0x09, "1 Coin 2 Credits" },
{0x14, 0x01, 0x0f, 0x08, "1 Coin 3 Credits" },
{0x14, 0x01, 0x0f, 0x07, "1 Coin 4 Credits" },
{0x14, 0x01, 0x0f, 0x06, "1 Coin 5 Credits" },
{0x14, 0x01, 0x0f, 0x05, "1 Coin 6 Credits" },
{0x14, 0x01, 0x0f, 0x00, "Free Play" },
{0 , 0xfe, 0 , 2, "Flip Screen" },
{0x14, 0x01, 0x10, 0x10, "Off" },
{0x14, 0x01, 0x10, 0x00, "On" },
{0 , 0xfe, 0 , 2, "Allow Continue" },
{0x14, 0x01, 0x20, 0x00, "Off" },
{0x14, 0x01, 0x20, 0x20, "On" },
{0 , 0xfe, 0 , 2, "Demo Sounds" },
{0x14, 0x01, 0x40, 0x00, "Off" },
{0x14, 0x01, 0x40, 0x40, "On" },
{0 , 0xfe, 0 , 2, "Service Mode" },
{0x14, 0x01, 0x80, 0x80, "Off" },
{0x14, 0x01, 0x80, 0x00, "On" },
};
STDDIPINFO(Sandscrp)
static inline void palette_update(UINT16 offset)
{
INT32 p = *((UINT16*)(DrvPalRAM + offset));
INT32 r = (p >> 5) & 0x1f;
INT32 g = (p >> 10) & 0x1f;
INT32 b = (p >> 0) & 0x1f;
r = (r << 3) | (r >> 2);
g = (g << 3) | (g >> 2);
b = (b << 3) | (b >> 2);
DrvPalette[offset/2] = BurnHighCol(r, g, b, 0);
}
static UINT16 galpanib_calc_read(UINT32 offset) /* Simulation of the CALC1 MCU */
{
calc1_hit_t &hit = m_hit;
switch (offset)
{
case 0x00/2: // watchdog
watchdog = 0;
return 0;
case 0x04/2: // similar to the hit detection from SuperNova, but much simpler
{
UINT16 data = 0;
// X Absolute Collision
if (hit.x1p > hit.x2p) data |= 0x0200;
else if (hit.x1p == hit.x2p) data |= 0x0400;
else if (hit.x1p < hit.x2p) data |= 0x0800;
// Y Absolute Collision
if (hit.y1p > hit.y2p) data |= 0x2000;
else if (hit.y1p == hit.y2p) data |= 0x4000;
else if (hit.y1p < hit.y2p) data |= 0x8000;
// XY Overlap Collision
hit.x12 = (hit.x1p) - (hit.x2p + hit.x2s);
hit.y12 = (hit.y1p) - (hit.y2p + hit.y2s);
hit.x21 = (hit.x1p + hit.x1s) - (hit.x2p);
hit.y21 = (hit.y1p + hit.y1s) - (hit.y2p);
if ((hit.x12 < 0) && (hit.y12 < 0) && (hit.x21 >= 0) && (hit.y21 >= 0))
data |= 0x0001;
return data;
}
case 0x10/2:
return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) >> 16);
case 0x12/2:
return (((UINT32)hit.mult_a * (UINT32)hit.mult_b) & 0xffff);
case 0x14/2:
return rand(); // really rand
}
return 0;
}
static void galpanib_calc_write(INT32 offset, UINT16 data)
{
calc1_hit_t &hit = m_hit;
switch (offset)
{
case 0x00/2: hit.x1p = data; break;
case 0x02/2: hit.x1s = data; break;
case 0x04/2: hit.y1p = data; break;
case 0x06/2: hit.y1s = data; break;
case 0x08/2: hit.x2p = data; break;
case 0x0a/2: hit.x2s = data; break;
case 0x0c/2: hit.y2p = data; break;
case 0x0e/2: hit.y2s = data; break;
case 0x10/2: hit.mult_a = data; break;
case 0x12/2: hit.mult_b = data; break;
}
}
static void update_irq_state()
{
int irq = (vblank_irq || sprite_irq || unknown_irq) ? 1 : 0;
SekSetIRQLine(1, irq ? SEK_IRQSTATUS_ACK : SEK_IRQSTATUS_NONE);
}
static void __fastcall sandscrp_main_write_word(UINT32 address, UINT16 data)
{
if ((address & 0xffffe0) == 0x200000) {
galpanib_calc_write((address & 0x1f) >> 1, data);
return;
}
switch (address)
{
case 0x100000:
if (data & 0x08) sprite_irq = 0;
if (data & 0x10) unknown_irq = 0;
if (data & 0x20) vblank_irq = 0;
update_irq_state();
return;
case 0xa00000:
return; // coin counter
case 0xe00000:
latch1_full = 1;
soundlatch = data & 0xff;
ZetNmi();
ZetRun(100); // ?
return;
case 0xe40000:
latch1_full = data & 0x80;
latch2_full = data & 0x40;
return;
}
}
static void __fastcall sandscrp_main_write_byte(UINT32 address, UINT8 data)
{
bprintf (0, _T("MWB %5.5x %2.2x\n"), address, data);
}
static UINT16 __fastcall sandscrp_main_read_word(UINT32 address)
{
if ((address & 0xffffe0) == 0x200000) {
return galpanib_calc_read((address & 0x1f) >> 1);
}
switch (address)
{
case 0x800000:
return ((sprite_irq << 3) | (unknown_irq << 4) | (vblank_irq << 5));
case 0xb00000:
return DrvInputs[0];
case 0xb00002:
return DrvInputs[1];
case 0xb00004:
return DrvInputs[2];
case 0xb00006:
return 0xffff;
case 0xe00000:
latch2_full = 0;
#ifdef SOUND_BYPASS_HACK // hack to bypass sound cpu failure
dip_counter_hack++;
if (dip_counter_hack < 3) return DrvDips[0];
if (dip_counter_hack < 5) return DrvDips[1];
#endif
return soundlatch2;
case 0xe40000:
#ifdef SOUND_BYPASS_HACK // hack to bypass sound cpu failure
return (latch1_full ? 0x80 : 0) | 0x40;
#endif
return (latch1_full ? 0x80 : 0) | (latch2_full ? 0x40 : 0);
case 0xec0000:
watchdog = 0;
return 0;
}
return 0;
}
static UINT8 __fastcall sandscrp_main_read_byte(UINT32 address)
{
bprintf (0, _T("MRB %5.5x\n"), address);
return 0;
}
static void __fastcall sandscrp_pandora_write_word(UINT32 address, UINT16 data)
{
address &= 0x1ffe;
data &= 0xff;
DrvSprRAM[address + 0] = data;
DrvSprRAM[address + 1] = data;
DrvPandoraRAM[address/2] = data;
}
static void __fastcall sandscrp_pandora_write_byte(UINT32 address, UINT8 data)
{
address &= 0x1ffe;
DrvSprRAM[address + 0] = data;
DrvSprRAM[address + 1] = data;
DrvPandoraRAM[address/2] = data;
}
static void __fastcall sandscrp_palette_write_word(UINT32 address, UINT16 data)
{
*((UINT16*)(DrvPalRAM + (address & 0xffe))) = data;
palette_update(address & 0xffe);
}
static void __fastcall sandscrp_palette_write_byte(UINT32 address, UINT8 data)
{
DrvPalRAM[(address & 0xfff) ^ 1] = data;
palette_update(address & 0xffe);
}
static void bankswitch(INT32 bank)
{
nDrvZ80Bank = bank & 7;
ZetMapMemory(DrvZ80ROM + ((bank & 0x07) * 0x4000), 0x8000, 0xbfff, ZET_ROM);
}
static void __fastcall sandscrp_sound_write_port(UINT16 port, UINT8 data)
{
switch (port & 0xff)
{
case 0x00:
bankswitch(data);
return;
case 0x02:
BurnYM2203Write(0, 0, data);
return;
case 0x03:
BurnYM2203Write(0, 1, data);
return;
case 0x04:
MSM6295Command(0, data);
return;
case 0x06:
latch2_full = 1;
soundlatch2 = data;
return;
}
}
static UINT8 __fastcall sandscrp_sound_read_port(UINT16 port)
{
switch (port & 0xff)
{
case 0x02:
return BurnYM2203Read(0, 0);
case 0x03:
return BurnYM2203Read(0, 1);
case 0x07:
latch1_full = 0;
return soundlatch;
case 0x08:
return (latch2_full ? 0x80 : 0) | (latch1_full ? 0x40 : 0);
}
return 0;
}
static UINT8 DrvYM2203PortA(UINT32)
{
return DrvDips[0];
}
static UINT8 DrvYM2203PortB(UINT32)
{
return DrvDips[1];
}
static void DrvFMIRQHandler(INT32, INT32 nStatus)
{
ZetSetIRQLine(0, (nStatus) ? ZET_IRQSTATUS_ACK : ZET_IRQSTATUS_NONE);
}
static INT32 DrvSynchroniseStream(INT32 nSoundRate)
{
return (INT64)ZetTotalCycles() * nSoundRate / 4000000;
}
static double DrvGetTime()
{
return (double)ZetTotalCycles() / 4000000;
}
static INT32 DrvDoReset(INT32 full_reset)
{
if (full_reset) {
memset (AllRam, 0, RamEnd - AllRam);
}
SekOpen(0);
SekReset();
SekClose();
ZetOpen(0);
ZetReset();
BurnYM2203Reset();
ZetClose();
MSM6295Reset(0);
nDrvZ80Bank = 0;
vblank_irq = 0;
sprite_irq = 0;
unknown_irq = 0;
soundlatch = 0;
soundlatch2 = 0;
latch1_full = 0;
latch2_full = 0;
watchdog = 0;
#ifdef SOUND_BYPASS_HACK
dip_counter_hack = 0;
#endif
return 0;
}
static INT32 MemIndex()
{
UINT8 *Next; Next = AllMem;
Drv68KROM = Next; Next += 0x080000;
DrvZ80ROM = Next; Next += 0x020000;
DrvGfxROM0 = Next; Next += 0x200000;
DrvGfxROM1 = Next; Next += 0x200000;
DrvTransTab = Next; Next += 0x400000 / 0x100;
MSM6295ROM = Next; Next += 0x040000;
AllRam = Next;
DrvZ80RAM = Next; Next += 0x002000;
Drv68KRAM = Next; Next += 0x010000;
DrvPandoraRAM = Next; Next += 0x002000;
DrvSprRAM = Next; Next += 0x002000;
DrvPalRAM = Next; Next += 0x001000;
DrvVideoRAM = Next; Next += 0x004000;
DrvVidRegs = Next; Next += 0x000400;
RamEnd = Next;
DrvPalette = (UINT32*)Next; Next += 0x0800 * sizeof(UINT32);
MemEnd = Next;
return 0;
}
static void DrvFillTransTable()
{
memset (DrvTransTab, 0, 0x4000);
for (INT32 i = 0; i < 0x400000; i+= 0x100) {
DrvTransTab[i/0x100] = 1; // transparent
for (INT32 j = 0; j < 0x100; j++) {
if (DrvGfxROM0[j + i]) {
DrvTransTab[i/0x100] = 0;
break;
}
}
}
}
static INT32 DrvGfxDecode()
{
static INT32 Plane[4] = { STEP4(0,1) };
static INT32 XOffs0[16] = { STEP4(12, -4), STEP4(28, -4), STEP4(268, -4),STEP4(284, -4) };
static INT32 XOffs1[16] = { STEP8(0,4), STEP8(256,4) };
static INT32 YOffs[16] = { STEP8(0, 32), STEP8(512, 32) };
UINT8 *tmp = (UINT8*)BurnMalloc(0x200000);
if (tmp == NULL) {
return 1;
}
memcpy (tmp, DrvGfxROM0, 0x200000);
GfxDecode(0x2000, 4, 16, 16, Plane, XOffs0, YOffs, 0x400, tmp, DrvGfxROM0);
memcpy (tmp, DrvGfxROM1, 0x200000);
GfxDecode(0x2000, 4, 16, 16, Plane, XOffs1, YOffs, 0x400, tmp, DrvGfxROM1);
BurnFree (tmp);
return 0;
}
static INT32 DrvInit(INT32 type)
{
AllMem = NULL;
MemIndex();
INT32 nLen = MemEnd - (UINT8 *)0;
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
memset(AllMem, 0, nLen);
MemIndex();
{
if (BurnLoadRom(Drv68KROM + 0x000001, 0, 2)) return 1;
if (BurnLoadRom(Drv68KROM + 0x000000, 1, 2)) return 1;
if (BurnLoadRom(DrvZ80ROM + 0x000000, 2, 1)) return 1;
if (type == 0) // early revisions
{
if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 2)) return 1;
if (BurnLoadRom(DrvGfxROM0 + 0x000001, 4, 2)) return 1;
if (BurnLoadRom(DrvGfxROM1 + 0x000000, 5, 1)) return 1;
if (BurnLoadRom(DrvGfxROM1 + 0x080000, 6, 1)) return 1;
if (BurnLoadRom(MSM6295ROM + 0x000000, 7, 1)) return 1;
}
else
{
if (BurnLoadRom(DrvGfxROM0 + 0x000000, 3, 1)) return 1;
BurnByteswap(DrvGfxROM0, 0x200000);
if (BurnLoadRom(DrvGfxROM1 + 0x000000, 4, 1)) return 1;
if (BurnLoadRom(MSM6295ROM + 0x000000, 5, 1)) return 1;
}
DrvGfxDecode();
DrvFillTransTable();
}
#if 0
*((UINT16*)(Drv68KROM + 0xc5a)) = 0x4e71; // skip sound check!
*((UINT16*)(Drv68KROM + 0xc8e)) = 0x4e71; // skip sound check!
*((UINT16*)(Drv68KROM + 0xcc4)) = 0x4e71; // skip sound check!
*((UINT16*)(Drv68KROM + 0xcfe)) = 0x4e71; // skip sound check!
#endif
SekInit(0, 0x68000);
SekOpen(0);
SekMapMemory(Drv68KROM, 0x000000, 0x07ffff, SM_ROM);
SekMapMemory(DrvVidRegs, 0x300000, 0x30000f|0x3ff, SM_RAM);
SekMapMemory(DrvVideoRAM, 0x400000, 0x403fff, SM_RAM);
SekMapMemory(DrvSprRAM, 0x500000, 0x501fff, SM_ROM);
SekMapMemory(DrvPalRAM, 0x600000, 0x600fff, SM_ROM);
SekMapMemory(Drv68KRAM, 0x700000, 0x70ffff, SM_RAM);
SekSetWriteWordHandler(0, sandscrp_main_write_word);
SekSetWriteByteHandler(0, sandscrp_main_write_byte);
SekSetReadWordHandler(0, sandscrp_main_read_word);
SekSetReadByteHandler(0, sandscrp_main_read_byte);
SekMapHandler(1, 0x500000, 0x501fff, SM_WRITE);
SekSetWriteWordHandler(1, sandscrp_pandora_write_word);
SekSetWriteByteHandler(1, sandscrp_pandora_write_byte);
SekMapHandler(2, 0x600000, 0x600fff, SM_WRITE);
SekSetWriteWordHandler(2, sandscrp_palette_write_word);
SekSetWriteByteHandler(2, sandscrp_palette_write_byte);
SekClose();
ZetInit(0);
ZetOpen(0);
ZetMapMemory(DrvZ80ROM, 0x0000, 0xbfff, ZET_ROM);
ZetMapMemory(DrvZ80RAM, 0xc000, 0xdfff, ZET_RAM);
ZetSetOutHandler(sandscrp_sound_write_port);
ZetSetInHandler(sandscrp_sound_read_port);
ZetClose();
BurnYM2203Init(1, 4000000, &DrvFMIRQHandler, DrvSynchroniseStream, DrvGetTime, 0);
BurnYM2203SetPorts(0, &DrvYM2203PortA, &DrvYM2203PortB, NULL, NULL);
BurnTimerAttachZet(4000000);
BurnYM2203SetRoute(0, BURN_SND_YM2203_YM2203_ROUTE, 0.50, BURN_SND_ROUTE_BOTH);
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_1, 0.25, BURN_SND_ROUTE_BOTH);
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_2, 0.25, BURN_SND_ROUTE_BOTH);
BurnYM2203SetRoute(0, BURN_SND_YM2203_AY8910_ROUTE_3, 0.25, BURN_SND_ROUTE_BOTH);
MSM6295Init(0, 2000000 / 132, 1);
MSM6295SetRoute(0, 0.80, BURN_SND_ROUTE_BOTH);
GenericTilesInit();
kaneko_view2_init(DrvVideoRAM, DrvVidRegs, DrvGfxROM0, 0x400, DrvTransTab, 91, 5);
pandora_init(DrvPandoraRAM, DrvGfxROM1, (0x200000/0x100)-1, 0x000, 0, -16);
DrvDoReset(1);
return 0;
}
static INT32 DrvExit()
{
BurnYM2203Exit();
MSM6295Exit(0);
MSM6295ROM = NULL;
SekExit();
ZetExit();
pandora_exit();
kaneko_view2_exit();
GenericTilesExit();
BurnFree (AllMem);
return 0;
}
static INT32 DrvDraw()
{
if (DrvRecalc)
{
for (INT32 i = 0; i < 0x1000; i+=2) {
palette_update(i);
}
DrvRecalc = 0;
}
BurnTransferClear();
for (INT32 i = 0; i < 8; i++) {
kaneko_view2_draw_layer(0, i);
kaneko_view2_draw_layer(1, i);
}
pandora_update(pTransDraw);
BurnTransferCopy(DrvPalette);
return 0;
}
static INT32 DrvFrame()
{
watchdog++;
if (watchdog > 180) {
DrvDoReset(0);
}
if (DrvReset) {
DrvDoReset(1);
}
SekNewFrame();
ZetNewFrame();
{
memset (DrvInputs, 0xff, 3 * sizeof(UINT16));
for (INT32 i = 0; i < 8; i++) {
DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
}
}
INT32 nInterleave = 256;
INT32 nCyclesTotal[2] = { 12000000 / 60, 4000000 / 60 };
INT32 nCyclesDone[2] = { 0, 0 };
SekOpen(0);
ZetOpen(0);
for (INT32 i = 0; i < nInterleave; i++) {
INT32 nSegment = nCyclesTotal[0] / nInterleave;
nCyclesDone[0] += SekRun(nSegment);
if (i == 224) {
vblank_irq = 1;
update_irq_state();
}
if (i == 255) {
sprite_irq = 1;
update_irq_state();
}
BurnTimerUpdate(SekTotalCycles()/3);
}
BurnTimerEndFrame(nCyclesTotal[1]);
if (pBurnSoundOut) {
BurnYM2203Update(pBurnSoundOut, nBurnSoundLen);
MSM6295Render(0, pBurnSoundOut, nBurnSoundLen);
}
ZetClose();
SekClose();
if (pBurnDraw) {
DrvDraw();
}
pandora_buffer_sprites();
return 0;
}
static INT32 DrvScan(INT32 nAction,INT32 *pnMin)
{
struct BurnArea ba;
if (pnMin) {
*pnMin = 0x029707;
}
if (nAction & ACB_VOLATILE) {
memset(&ba, 0, sizeof(ba));
ba.Data = AllRam;
ba.nLen = RamEnd - AllRam;
ba.szName = "All Ram";
BurnAcb(&ba);
ba.Data = &m_hit;
ba.nLen = sizeof(calc1_hit_t);
ba.szName = "hit calculation";
BurnAcb(&ba);
SekScan(nAction);
ZetScan(nAction);
BurnYM2203Scan(nAction, pnMin);
MSM6295Scan(0, nAction);
SCAN_VAR(vblank_irq);
SCAN_VAR(sprite_irq);
SCAN_VAR(unknown_irq);
SCAN_VAR(soundlatch);
SCAN_VAR(soundlatch2);
SCAN_VAR(latch1_full);
SCAN_VAR(latch2_full);
SCAN_VAR(nDrvZ80Bank);
}
if (nAction & ACB_WRITE) {
ZetOpen(0);
bankswitch(nDrvZ80Bank);
ZetClose();
}
return 0;
}
// Sand Scorpion
static struct BurnRomInfo sandscrpRomDesc[] = {
{ "11.bin", 0x40000, 0x9b24ab40, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code
{ "12.bin", 0x40000, 0xad12caee, 1 | BRF_PRG | BRF_ESS }, // 1
{ "8.ic51", 0x20000, 0x6f3e9db1, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code
{ "4.ic32", 0x80000, 0xb9222ff2, 3 | BRF_GRA }, // 3 Tiles
{ "3.ic33", 0x80000, 0xadf20fa0, 3 | BRF_GRA }, // 4
{ "5.ic16", 0x80000, 0x9bb675f6, 4 | BRF_GRA }, // 5 Sprites
{ "6.ic17", 0x80000, 0x7df2f219, 4 | BRF_GRA }, // 6
{ "7.ic55", 0x40000, 0x9870ab12, 5 | BRF_SND }, // 7 Samples
};
STD_ROM_PICK(sandscrp)
STD_ROM_FN(sandscrp)
static INT32 sandscrpInit()
{
return DrvInit(0);
}
struct BurnDriver BurnDrvSandscrp = {
"sandscrp", NULL, NULL, NULL, "1992",
"Sand Scorpion\0", NULL, "Face", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0,
NULL, sandscrpRomInfo, sandscrpRomName, NULL, NULL, SandscrpInputInfo, SandscrpDIPInfo,
sandscrpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
224, 256, 3, 4
};
// Sand Scorpion (Earlier)
static struct BurnRomInfo sandscrpaRomDesc[] = {
{ "1.ic4", 0x40000, 0xc0943ae2, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code
{ "2.ic5", 0x40000, 0x6a8e0012, 1 | BRF_PRG | BRF_ESS }, // 1
{ "8.ic51", 0x20000, 0x6f3e9db1, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code
{ "4.ic32", 0x80000, 0xb9222ff2, 3 | BRF_GRA }, // 3 Tiles
{ "3.ic33", 0x80000, 0xadf20fa0, 3 | BRF_GRA }, // 4
{ "5.ic16", 0x80000, 0x9bb675f6, 4 | BRF_GRA }, // 5 Sprites
{ "6.ic17", 0x80000, 0x7df2f219, 4 | BRF_GRA }, // 6
{ "7.ic55", 0x40000, 0x9870ab12, 5 | BRF_SND }, // 7 Samples
};
STD_ROM_PICK(sandscrpa)
STD_ROM_FN(sandscrpa)
struct BurnDriver BurnDrvSandscrpa = {
"sandscrpa", "sandscrp", NULL, NULL, "1992",
"Sand Scorpion (Earlier)\0", NULL, "Face", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0,
NULL, sandscrpaRomInfo, sandscrpaRomName, NULL, NULL, SandscrpInputInfo, SandscrpDIPInfo,
sandscrpInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
224, 256, 3, 4
};
// Sand Scorpion (Chinese Title Screen, Revised Hardware)
static struct BurnRomInfo sandscrpbRomDesc[] = {
{ "11.ic4", 0x040000, 0x80020cab, 1 | BRF_PRG | BRF_ESS }, // 0 68k Code
{ "12.ic5", 0x040000, 0x8df1d42f, 1 | BRF_PRG | BRF_ESS }, // 1
{ "8.ic51", 0x020000, 0x6f3e9db1, 2 | BRF_PRG | BRF_ESS }, // 2 Z80 Code
{ "ss501.ic30", 0x100000, 0x0cf9f99d, 3 | BRF_GRA }, // 3 Tiles
{ "ss502.ic16", 0x100000, 0xd8012ebb, 4 | BRF_GRA }, // 4 Sprites
{ "7.ic55", 0x040000, 0x9870ab12, 5 | BRF_SND }, // 5 Samples
};
STD_ROM_PICK(sandscrpb)
STD_ROM_FN(sandscrpb)
static INT32 sandscrpbInit()
{
return DrvInit(1);
}
struct BurnDriver BurnDrvSandscrpb = {
"sandscrpb", "sandscrp", NULL, NULL, "1992",
"Sand Scorpion (Chinese Title Screen, Revised Hardware)\0", NULL, "Face", "Miscellaneous",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_POST90S, GBF_VERSHOOT, 0,
NULL, sandscrpbRomInfo, sandscrpbRomName, NULL, NULL, SandscrpInputInfo, SandscrpDIPInfo,
sandscrpbInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x800,
224, 256, 3, 4
};