add driver and soundcore for Wiping
This commit is contained in:
parent
b8aebc6595
commit
d5e6cf72db
|
@ -57,7 +57,7 @@ drvobj = d_dodonpachi.o d_donpachi.o d_esprade.o d_feversos.o d_gaia.o d_guwang
|
|||
d_route16.o d_rpunch.o d_safarir.o d_sauro.o d_scregg.o d_seicross.o d_sf.o d_sidearms.o d_skyarmy.o d_skyfox.o d_skykid.o d_snk.o \
|
||||
d_snk68.o d_solomon.o d_sonson.o d_srumbler.o d_ssozumo.o d_sub.o d_suna8.o d_tail2nose.o d_tbowl.o d_tecmo.o d_terracre.o d_thedeep.o \
|
||||
d_tigeroad.o d_timelimt.o d_toki.o d_toypop.o d_travrusa.o d_tsamurai.o d_twincobr.o d_usgames.o d_vastar.o d_vulgus.o d_wallc.o d_warpwarp.o d_wc90.o \
|
||||
d_wc90b.o d_wiz.o d_wrally.o d_wwfsstar.o d_xain.o d_xxmissio.o d_zodiack.o \
|
||||
d_wc90b.o d_wiping.o d_wiz.o d_wrally.o d_wwfsstar.o d_xain.o d_xxmissio.o d_zodiack.o \
|
||||
\
|
||||
d_1945kiii.o d_aerofgt.o d_airbustr.o d_aquarium.o d_bestleag.o d_bigstrkb.o d_blmbycar.o d_bloodbro.o d_crospang.o d_crshrace.o d_dcon.o \
|
||||
d_ddragon3.o d_deniam.o d_diverboy.o d_dooyong.o d_dreamwld.o d_drgnmst.o d_drtomy.o d_egghunt.o d_esd16.o d_f1gp.o d_funybubl.o d_fuukifg2.o \
|
||||
|
@ -99,7 +99,7 @@ depobj := $(drvobj) \
|
|||
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 gaelco.o ics2115.o iremga20.o \
|
||||
k005289.o k007232.o k051649.o k053260.o k054539.o msm5205.o msm5232.o msm6295.o namco_snd.o c140.o nes_apu.o tms36xx.o phoenixsound.o \
|
||||
pleiadssound.o pokey.o rf5c68.o saa1099.o samples.o segapcm.o sn76477.o sn76496.o upd7759.o vlm5030.o x1010.o ym2151.o ym2413.o \
|
||||
pleiadssound.o pokey.o rf5c68.o saa1099.o samples.o segapcm.o sn76477.o sn76496.o upd7759.o vlm5030.o wiping.o x1010.o ym2151.o ym2413.o \
|
||||
ymdeltat.o ymf278b.o ymz280b.o \
|
||||
\
|
||||
arm7_intf.o arm_intf.o h6280_intf.o hd6309_intf.o konami_intf.o m6502_intf.o m6800_intf.o m6805_intf.o m6809_intf.o \
|
||||
|
|
|
@ -0,0 +1,652 @@
|
|||
// FB Alpha Wiping driver module
|
||||
// Based on MAME driver by Allard van der Bas
|
||||
|
||||
#include "tiles_generic.h"
|
||||
#include "z80_intf.h"
|
||||
#include "watchdog.h"
|
||||
#include "resnet.h"
|
||||
#include "wiping.h"
|
||||
|
||||
// to do
|
||||
// bug fix
|
||||
|
||||
static UINT8 *AllMem;
|
||||
static UINT8 *MemEnd;
|
||||
static UINT8 *AllRam;
|
||||
static UINT8 *RamEnd;
|
||||
static UINT8 *DrvZ80ROM0;
|
||||
static UINT8 *DrvZ80ROM1;
|
||||
static UINT8 *DrvGfxROM0;
|
||||
static UINT8 *DrvGfxROM1;
|
||||
static UINT8 *DrvColPROM;
|
||||
static UINT8 *DrvSndROM;
|
||||
static UINT8 *DrvSndPROM;
|
||||
static UINT8 *DrvTransTab;
|
||||
static UINT8 *DrvZ80RAM0;
|
||||
static UINT8 *DrvVidRAM;
|
||||
static UINT8 *DrvColRAM;
|
||||
static UINT8 *DrvSprRAM;
|
||||
static UINT8 *DrvShareRAM0;
|
||||
static UINT8 *DrvShareRAM1;
|
||||
|
||||
static UINT32 *DrvPalette;
|
||||
static UINT8 DrvRecalc;
|
||||
|
||||
static UINT8 sound_irq_mask;
|
||||
static UINT8 main_irq_mask;
|
||||
static UINT8 flipscreen;
|
||||
|
||||
static INT32 sub_cpu_in_reset;
|
||||
static INT32 skip_tile_enable = 0;
|
||||
|
||||
static UINT8 DrvJoy1[8];
|
||||
static UINT8 DrvJoy2[8];
|
||||
static UINT8 DrvJoy3[8];
|
||||
static UINT8 DrvDips[2];
|
||||
static UINT8 DrvInputs[8];
|
||||
static UINT8 DrvReset;
|
||||
|
||||
static struct BurnInputInfo WipingInputList[] = {
|
||||
{"P1 Coin", BIT_DIGITAL, DrvJoy3 + 1, "p1 coin" },
|
||||
{"P1 Start", BIT_DIGITAL, DrvJoy3 + 3, "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" },
|
||||
|
||||
{"P2 Coin", BIT_DIGITAL, DrvJoy3 + 0, "p2 coin" },
|
||||
{"P2 Start", BIT_DIGITAL, DrvJoy3 + 4, "p2 start" },
|
||||
{"P2 Up", BIT_DIGITAL, DrvJoy2 + 0, "p2 up" },
|
||||
{"P2 Down", BIT_DIGITAL, DrvJoy2 + 1, "p2 down" },
|
||||
{"P2 Left", BIT_DIGITAL, DrvJoy2 + 3, "p2 left" },
|
||||
{"P2 Right", BIT_DIGITAL, DrvJoy2 + 2, "p2 right" },
|
||||
{"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 1" },
|
||||
|
||||
{"Reset", BIT_DIGITAL, &DrvReset, "reset" },
|
||||
{"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
|
||||
{"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" },
|
||||
};
|
||||
|
||||
STDINPUTINFO(Wiping)
|
||||
|
||||
static struct BurnDIPInfo WipingDIPList[]=
|
||||
{
|
||||
{0x0f, 0xff, 0xff, 0x20, NULL },
|
||||
{0x10, 0xff, 0xff, 0x49, NULL },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Cabinet" },
|
||||
{0x0f, 0x01, 0x20, 0x20, "Upright" },
|
||||
{0x0f, 0x01, 0x20, 0x00, "Cocktail" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Service Mode" },
|
||||
{0x0f, 0x01, 0x40, 0x40, "On" },
|
||||
{0x0f, 0x01, 0x40, 0x00, "Off" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Bonus Life" },
|
||||
{0x0f, 0x01, 0x80, 0x00, "30000 70000" },
|
||||
{0x0f, 0x01, 0x80, 0x80, "50000 150000" },
|
||||
|
||||
{0 , 0xfe, 0 , 7, "Coin B" },
|
||||
{0x10, 0x01, 0x07, 0x01, "1 Coin 1 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x02, "1 Coin 2 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x03, "1 Coin 3 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x04, "1 Coin 4 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x05, "1 Coin 5 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x06, "1 Coin 6 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x07, "1 Coin 7 Credits" },
|
||||
|
||||
{0 , 0xfe, 0 , 8, "Coin A" },
|
||||
{0x10, 0x01, 0x38, 0x38, "7 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x30, "6 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x28, "5 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x20, "4 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x18, "3 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x10, "2 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x08, "1 Coin 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x00, "Free Play" },
|
||||
|
||||
{0 , 0xfe, 0 , 4, "Lives" },
|
||||
{0x10, 0x01, 0xc0, 0x00, "2" },
|
||||
{0x10, 0x01, 0xc0, 0x40, "3" },
|
||||
{0x10, 0x01, 0xc0, 0x80, "4" },
|
||||
{0x10, 0x01, 0xc0, 0xc0, "5" },
|
||||
};
|
||||
|
||||
STDDIPINFO(Wiping)
|
||||
|
||||
static struct BurnDIPInfo RugratsDIPList[]=
|
||||
{
|
||||
{0x0f, 0xff, 0xff, 0x20, NULL },
|
||||
{0x10, 0xff, 0xff, 0x49, NULL },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Cabinet" },
|
||||
{0x0f, 0x01, 0x20, 0x20, "Upright" },
|
||||
{0x0f, 0x01, 0x20, 0x00, "Cocktail" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Service Mode" },
|
||||
{0x0f, 0x01, 0x40, 0x40, "On" },
|
||||
{0x0f, 0x01, 0x40, 0x00, "Off" },
|
||||
|
||||
{0 , 0xfe, 0 , 2, "Bonus Life" },
|
||||
{0x0f, 0x01, 0x80, 0x00, "100000 200000" },
|
||||
{0x0f, 0x01, 0x80, 0x80, "150000 300000" },
|
||||
|
||||
{0 , 0xfe, 0 , 7, "Coin B" },
|
||||
{0x10, 0x01, 0x07, 0x01, "1 Coin 1 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x02, "1 Coin 2 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x03, "1 Coin 3 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x04, "1 Coin 4 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x05, "1 Coin 5 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x06, "1 Coin 6 Credits" },
|
||||
{0x10, 0x01, 0x07, 0x07, "1 Coin 7 Credits" },
|
||||
|
||||
{0 , 0xfe, 0 , 8, "Coin A" },
|
||||
{0x10, 0x01, 0x38, 0x38, "7 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x30, "6 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x28, "5 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x20, "4 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x18, "3 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x10, "2 Coins 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x08, "1 Coin 1 Credits" },
|
||||
{0x10, 0x01, 0x38, 0x00, "Free Play" },
|
||||
|
||||
{0 , 0xfe, 0 , 4, "Lives" },
|
||||
{0x10, 0x01, 0xc0, 0x00, "2" },
|
||||
{0x10, 0x01, 0xc0, 0x40, "3" },
|
||||
{0x10, 0x01, 0xc0, 0x80, "4" },
|
||||
{0x10, 0x01, 0xc0, 0xc0, "5" },
|
||||
};
|
||||
|
||||
STDDIPINFO(Rugrats)
|
||||
|
||||
static void __fastcall wiping_main_write(UINT16 address, UINT8 data)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
case 0xa000:
|
||||
main_irq_mask = data & 1;
|
||||
return;
|
||||
|
||||
case 0xa002:
|
||||
flipscreen = data & 1;
|
||||
return;
|
||||
|
||||
case 0xa003:
|
||||
sub_cpu_in_reset = ~data & 1;
|
||||
if (sub_cpu_in_reset)
|
||||
{
|
||||
ZetClose();
|
||||
ZetOpen(1);
|
||||
ZetReset();
|
||||
ZetClose();
|
||||
ZetOpen(0);
|
||||
}
|
||||
return;
|
||||
|
||||
case 0xb800:
|
||||
BurnWatchogWrite();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 __fastcall wiping_main_read(UINT16 address)
|
||||
{
|
||||
switch (address)
|
||||
{
|
||||
case 0xa800:
|
||||
case 0xa801:
|
||||
case 0xa802:
|
||||
case 0xa803:
|
||||
case 0xa804:
|
||||
case 0xa805:
|
||||
case 0xa806:
|
||||
case 0xa807:
|
||||
return DrvInputs[address & 7];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __fastcall wiping_sound_write(UINT16 address, UINT8 data)
|
||||
{
|
||||
if ((address & 0xc000) == 0x4000) {
|
||||
wipingsnd_write(address&0x3fff, data);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (address)
|
||||
{
|
||||
case 0xa001:
|
||||
sound_irq_mask = data & 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static tilemap_scan( background )
|
||||
{
|
||||
if (col <= 0x01) return row + (col + 0x1e) * 0x20;
|
||||
if (col >= 0x22) return row + (col - 0x22) * 0x20;
|
||||
|
||||
return (col - 2) + (row + 2) * 0x20;
|
||||
}
|
||||
|
||||
static tilemap_callback( background )
|
||||
{
|
||||
TILE_SET_INFO(0, DrvVidRAM[offs], DrvColRAM[offs], (~DrvColRAM[offs] & skip_tile_enable) ? TILE_SKIP : 0);
|
||||
}
|
||||
|
||||
static INT32 DrvDoReset(INT32 clear_mem)
|
||||
{
|
||||
if (clear_mem) {
|
||||
memset (AllRam, 0, RamEnd - AllRam);
|
||||
}
|
||||
|
||||
ZetOpen(0);
|
||||
ZetReset();
|
||||
ZetClose();
|
||||
|
||||
ZetOpen(1);
|
||||
ZetReset();
|
||||
ZetClose();
|
||||
|
||||
wipingsnd_reset();
|
||||
|
||||
BurnWatchdogReset();
|
||||
|
||||
sub_cpu_in_reset = 1;
|
||||
main_irq_mask = 0;
|
||||
sound_irq_mask = 0;
|
||||
flipscreen = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 MemIndex()
|
||||
{
|
||||
UINT8 *Next; Next = AllMem;
|
||||
|
||||
DrvZ80ROM0 = Next; Next += 0x006000;
|
||||
DrvZ80ROM1 = Next; Next += 0x002000;
|
||||
|
||||
DrvGfxROM0 = Next; Next += 0x004000;
|
||||
DrvGfxROM1 = Next; Next += 0x008000;
|
||||
|
||||
DrvColPROM = Next; Next += 0x000220;
|
||||
|
||||
DrvSndROM = Next; Next += 0x004000;
|
||||
|
||||
DrvSndPROM = Next; Next += 0x000200;
|
||||
|
||||
DrvTransTab = Next; Next += 0x000200;
|
||||
|
||||
DrvPalette = (UINT32*)Next; Next += 0x200 * sizeof(UINT32);
|
||||
|
||||
AllRam = Next;
|
||||
|
||||
DrvZ80RAM0 = Next; Next += 0x000800;
|
||||
DrvVidRAM = Next; Next += 0x000400;
|
||||
DrvColRAM = Next; Next += 0x000400;
|
||||
DrvSprRAM = Next; Next += 0x000400;
|
||||
DrvShareRAM0 = Next; Next += 0x000400;
|
||||
DrvShareRAM1 = Next; Next += 0x000400;
|
||||
|
||||
RamEnd = Next;
|
||||
|
||||
MemEnd = Next;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 DrvGfxDecode()
|
||||
{
|
||||
INT32 Plane[2] = { 0, 4 };
|
||||
INT32 XOffs[16] = { STEP4(0,1), STEP4(8,1), STEP4(128,1), STEP4(136,1) };
|
||||
INT32 YOffs[16] = { STEP8(0,16), STEP8(256,16) };
|
||||
|
||||
UINT8 *tmp = (UINT8*)BurnMalloc(0x2000);
|
||||
if (tmp == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
memcpy (tmp, DrvGfxROM0, 0x1000);
|
||||
|
||||
GfxDecode(0x0100, 2, 8, 8, Plane, XOffs, YOffs, 0x080, tmp, DrvGfxROM0);
|
||||
|
||||
memcpy (tmp, DrvGfxROM1, 0x2000);
|
||||
|
||||
GfxDecode(0x0080, 2, 16, 16, Plane, XOffs, YOffs, 0x200, tmp, DrvGfxROM1);
|
||||
|
||||
BurnFree(tmp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 DrvInit()
|
||||
{
|
||||
AllMem = NULL;
|
||||
MemIndex();
|
||||
INT32 nLen = MemEnd - (UINT8 *)0;
|
||||
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
|
||||
memset(AllMem, 0, nLen);
|
||||
MemIndex();
|
||||
|
||||
{
|
||||
if (BurnLoadRom(DrvZ80ROM0 + 0x00000, 0, 1)) return 1;
|
||||
if (BurnLoadRom(DrvZ80ROM0 + 0x02000, 1, 1)) return 1;
|
||||
if (BurnLoadRom(DrvZ80ROM0 + 0x04000, 2, 1)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvZ80ROM1 + 0x00000, 3, 1)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvGfxROM0 + 0x00000, 4, 1)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvGfxROM1 + 0x00000, 5, 1)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvColPROM + 0x00000, 6, 1)) return 1;
|
||||
if (BurnLoadRom(DrvColPROM + 0x00020, 7, 1)) return 1;
|
||||
if (BurnLoadRom(DrvColPROM + 0x00120, 8, 1)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvSndROM + 0x00000, 9, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndROM + 0x02000, 10, 1)) return 1;
|
||||
|
||||
if (BurnLoadRom(DrvSndPROM + 0x00000, 11, 1)) return 1;
|
||||
if (BurnLoadRom(DrvSndPROM + 0x00100, 12, 1)) return 1;
|
||||
|
||||
DrvGfxDecode();
|
||||
}
|
||||
|
||||
ZetInit(0);
|
||||
ZetOpen(0);
|
||||
ZetMapMemory(DrvZ80ROM0, 0x0000, 0x5fff, MAP_ROM);
|
||||
ZetMapMemory(DrvVidRAM, 0x8000, 0x83ff, MAP_RAM);
|
||||
ZetMapMemory(DrvColRAM, 0x8400, 0x87ff, MAP_RAM);
|
||||
ZetMapMemory(DrvSprRAM, 0x8800, 0x8bff, MAP_RAM);
|
||||
ZetMapMemory(DrvShareRAM0, 0x9000, 0x93ff, MAP_RAM);
|
||||
ZetMapMemory(DrvShareRAM1, 0x9800, 0x9bff, MAP_RAM);
|
||||
ZetMapMemory(DrvZ80RAM0, 0xb000, 0xb7ff, MAP_RAM);
|
||||
ZetSetWriteHandler(wiping_main_write);
|
||||
ZetSetReadHandler(wiping_main_read);
|
||||
ZetClose();
|
||||
|
||||
ZetInit(1);
|
||||
ZetOpen(1);
|
||||
ZetMapMemory(DrvZ80ROM1, 0x0000, 0x1fff, MAP_RAM);
|
||||
ZetMapMemory(DrvShareRAM0, 0x9000, 0x93ff, MAP_RAM);
|
||||
ZetMapMemory(DrvShareRAM1, 0x9800, 0x9bff, MAP_RAM);
|
||||
ZetSetWriteHandler(wiping_sound_write);
|
||||
ZetClose();
|
||||
|
||||
BurnWatchdogInit(DrvDoReset, 180);
|
||||
|
||||
wipingsnd_init(DrvSndROM, DrvSndPROM);
|
||||
|
||||
GenericTilesInit();
|
||||
GenericTilemapInit(0, background_map_scan, background_map_callback, 8, 8, 36, 32);
|
||||
GenericTilemapSetGfx(0, DrvGfxROM0, 2, 8, 8, 0x4000, 0, 0x3f);
|
||||
|
||||
DrvDoReset(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 DrvExit()
|
||||
{
|
||||
GenericTilesExit();
|
||||
|
||||
ZetExit();
|
||||
|
||||
wipingsnd_exit();
|
||||
|
||||
BurnFree(AllMem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void DrvPaletteInit()
|
||||
{
|
||||
static const int resistances_rg[3] = { 1000, 470, 220 };
|
||||
static const int resistances_b [2] = { 470, 220 };
|
||||
double rweights[3], gweights[3], bweights[2];
|
||||
UINT32 pal[32];
|
||||
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
3, &resistances_rg[0], rweights, 470, 0,
|
||||
3, &resistances_rg[0], gweights, 470, 0,
|
||||
2, &resistances_b[0], bweights, 470, 0);
|
||||
|
||||
for (INT32 i = 0; i < 0x20; i++)
|
||||
{
|
||||
INT32 bit0 = (DrvColPROM[i] >> 0) & 0x01;
|
||||
INT32 bit1 = (DrvColPROM[i] >> 1) & 0x01;
|
||||
INT32 bit2 = (DrvColPROM[i] >> 2) & 0x01;
|
||||
INT32 r = combine_3_weights(rweights, bit0, bit1, bit2);
|
||||
|
||||
bit0 = (DrvColPROM[i] >> 3) & 0x01;
|
||||
bit1 = (DrvColPROM[i] >> 4) & 0x01;
|
||||
bit2 = (DrvColPROM[i] >> 5) & 0x01;
|
||||
INT32 g = combine_3_weights(gweights, bit0, bit1, bit2);
|
||||
|
||||
bit0 = (DrvColPROM[i] >> 6) & 0x01;
|
||||
bit1 = (DrvColPROM[i] >> 7) & 0x01;
|
||||
INT32 b = combine_2_weights(bweights, bit0, bit1);
|
||||
|
||||
pal[i] = BurnHighCol(r,g,b, 0);
|
||||
}
|
||||
|
||||
for (INT32 i = 0; i < 0x200; i++)
|
||||
{
|
||||
INT32 entry = (DrvColPROM[0x020 + (i ^ 0x03)] & 0xf) | ((i >> 4) & 0x10);
|
||||
DrvPalette[i] = pal[entry];
|
||||
DrvTransTab[i] = entry;
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_sprites()
|
||||
{
|
||||
for (INT32 offs = 0; offs < 128; offs += 2)
|
||||
{
|
||||
INT32 attr = DrvSprRAM[offs + 0x000];
|
||||
INT32 color = DrvSprRAM[offs + 0x001] & 0x3f;
|
||||
INT32 sx = DrvSprRAM[offs + 0x101] + ((DrvSprRAM[offs + 0x081] & 1) << 8);
|
||||
INT32 sy = 224 - DrvSprRAM[offs + 0x100];
|
||||
INT32 code = (attr & 0x3f) | ((DrvSprRAM[offs + 0x080] & 1) << 6);
|
||||
INT32 flipy = attr & 0x40;
|
||||
INT32 flipx = attr & 0x80;
|
||||
|
||||
if (flipscreen)
|
||||
{
|
||||
sy = (nScreenHeight - 16) - sy;
|
||||
flipy ^= 0x40;
|
||||
flipx ^= 0x80;
|
||||
}
|
||||
|
||||
RenderTileTranstab(pTransDraw, DrvGfxROM1, code, 0x100 + (color << 2), 0x1f, sx - 40, sy, flipx, flipy, 16, 16, DrvTransTab);
|
||||
}
|
||||
}
|
||||
|
||||
static INT32 DrvDraw()
|
||||
{
|
||||
if (DrvRecalc) {
|
||||
DrvPaletteInit();
|
||||
DrvRecalc = 0;
|
||||
}
|
||||
|
||||
GenericTilemapSetFlip(TMAP_GLOBAL, flipscreen ? TMAP_FLIPXY : 0);
|
||||
|
||||
BurnTransferClear();
|
||||
|
||||
skip_tile_enable = 0;
|
||||
if (nBurnLayer & 1) GenericTilemapDraw(0, pTransDraw, TMAP_FORCEOPAQUE);
|
||||
|
||||
if (nBurnLayer & 4) draw_sprites();
|
||||
|
||||
skip_tile_enable = 0x80;
|
||||
if (nBurnLayer & 2) GenericTilemapDraw(0, pTransDraw, 0);
|
||||
|
||||
BurnTransferCopy(DrvPalette);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 DrvFrame()
|
||||
{
|
||||
BurnWatchdogUpdate();
|
||||
|
||||
if (DrvReset) {
|
||||
DrvDoReset(1);
|
||||
}
|
||||
|
||||
ZetNewFrame();
|
||||
|
||||
{
|
||||
memset (DrvInputs, 0, 8);
|
||||
|
||||
for (INT32 i = 0; i < 8; i++) {
|
||||
DrvInputs[i] ^= (DrvJoy1[i] & 1) << 0;
|
||||
DrvInputs[i] ^= (DrvJoy2[i] & 1) << 1;
|
||||
DrvInputs[i] ^= (DrvJoy3[i] & 1) << 6;
|
||||
DrvInputs[i] ^= ((DrvDips[0] >> i) & 1) << 6;
|
||||
DrvInputs[i] ^= ((DrvDips[1] >> i) & 1) << 7;
|
||||
}
|
||||
}
|
||||
|
||||
INT32 nInterleave = 10;
|
||||
INT32 nCyclesTotal[2] = { 3072000 / 60, 3072000 / 60 };
|
||||
INT32 nCyclesDone[2] = { 0, 0 };
|
||||
|
||||
for (INT32 i = 0; i < nInterleave; i++)
|
||||
{
|
||||
ZetOpen(0);
|
||||
nCyclesDone[0] += ZetRun(nCyclesTotal[0] / nInterleave);
|
||||
if (i == (nInterleave - 1))
|
||||
if (main_irq_mask) ZetSetIRQLine(0, CPU_IRQSTATUS_AUTO);
|
||||
ZetClose();
|
||||
|
||||
ZetOpen(1);
|
||||
if (sub_cpu_in_reset) {
|
||||
nCyclesDone[1] += nCyclesTotal[1] / nInterleave;
|
||||
} else {
|
||||
nCyclesDone[1] += ZetRun(nCyclesTotal[1] / nInterleave);
|
||||
}
|
||||
if (i == (nInterleave - 1) || i == (nInterleave / 2) - 1)
|
||||
if (sound_irq_mask) ZetSetIRQLine(0, CPU_IRQSTATUS_AUTO);
|
||||
ZetClose();
|
||||
}
|
||||
|
||||
if (pBurnSoundOut) {
|
||||
wipingsnd_update(pBurnSoundOut, nBurnSoundLen);
|
||||
}
|
||||
|
||||
if (pBurnDraw) {
|
||||
DrvDraw();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
||||
{
|
||||
struct BurnArea ba;
|
||||
|
||||
if (pnMin) {
|
||||
*pnMin = 0x029702;
|
||||
}
|
||||
|
||||
if (nAction & ACB_VOLATILE) {
|
||||
memset(&ba, 0, sizeof(ba));
|
||||
|
||||
ba.Data = AllRam;
|
||||
ba.nLen = RamEnd - AllRam;
|
||||
ba.szName = "All Ram";
|
||||
BurnAcb(&ba);
|
||||
|
||||
ZetScan(nAction);
|
||||
|
||||
BurnWatchdogScan(nAction);
|
||||
|
||||
wipingsnd_scan();
|
||||
|
||||
SCAN_VAR(sound_irq_mask);
|
||||
SCAN_VAR(main_irq_mask);
|
||||
SCAN_VAR(flipscreen);
|
||||
SCAN_VAR(sub_cpu_in_reset);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Wiping
|
||||
|
||||
static struct BurnRomInfo wipingRomDesc[] = {
|
||||
{ "1", 0x2000, 0xb55d0d19, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code
|
||||
{ "2", 0x2000, 0xb1f96e47, 1 | BRF_PRG | BRF_ESS }, // 1
|
||||
{ "3", 0x2000, 0xc67bab5a, 1 | BRF_PRG | BRF_ESS }, // 2
|
||||
|
||||
{ "4", 0x1000, 0xa1547e18, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code
|
||||
|
||||
{ "8", 0x1000, 0x601160f6, 3 | BRF_GRA }, // 4 Characters
|
||||
|
||||
{ "7", 0x2000, 0x2c2cc054, 4 | BRF_GRA }, // 5 Sprites
|
||||
|
||||
{ "wip-g13.bin", 0x0020, 0xb858b897, 5 | BRF_GRA }, // 6 Color data
|
||||
{ "wip-f4.bin", 0x0100, 0x3f56c8d5, 5 | BRF_GRA }, // 7
|
||||
{ "wip-e11.bin", 0x0100, 0xe7400715, 5 | BRF_GRA }, // 8
|
||||
|
||||
{ "rugr5c8", 0x2000, 0x67bafbbf, 6 | BRF_SND }, // 9 Samples
|
||||
{ "rugr6c9", 0x2000, 0xcac84a87, 6 | BRF_SND }, // 10
|
||||
|
||||
{ "wip-e8.bin", 0x0100, 0xbd2c080b, 7 | BRF_SND }, // 11 Sound Proms
|
||||
{ "wip-e9.bin", 0x0100, 0x4017a2a6, 7 | BRF_SND }, // 12
|
||||
};
|
||||
|
||||
STD_ROM_PICK(wiping)
|
||||
STD_ROM_FN(wiping)
|
||||
|
||||
struct BurnDriver BurnDrvWiping = {
|
||||
"wiping", NULL, NULL, NULL, "1982",
|
||||
"Wiping\0", NULL, "Nichibutsu", "Miscellaneous",
|
||||
NULL, NULL, NULL, NULL,
|
||||
BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0,
|
||||
NULL, wipingRomInfo, wipingRomName, NULL, NULL, WipingInputInfo, WipingDIPInfo,
|
||||
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
|
||||
224, 288, 3, 4
|
||||
};
|
||||
|
||||
|
||||
// Rug Rats
|
||||
|
||||
static struct BurnRomInfo rugratsRomDesc[] = {
|
||||
{ "rugr1d1", 0x2000, 0xe7e1bd6d, 1 | BRF_PRG | BRF_ESS }, // 0 Z80 #0 Code
|
||||
{ "rugr2d2", 0x2000, 0x5f47b9ad, 1 | BRF_PRG | BRF_ESS }, // 1
|
||||
{ "rugr3d3", 0x2000, 0x3d748d1a, 1 | BRF_PRG | BRF_ESS }, // 2
|
||||
|
||||
{ "rugr4c4", 0x2000, 0xd4a92c38, 2 | BRF_PRG | BRF_ESS }, // 3 Z80 #1 Code
|
||||
|
||||
{ "rugr8d2", 0x1000, 0xa3dcaca5, 3 | BRF_GRA }, // 4 Characters
|
||||
|
||||
{ "rugr7c13", 0x2000, 0xfe1191dd, 4 | BRF_GRA }, // 5 Sprites
|
||||
|
||||
{ "prom.13g", 0x0020, 0xf21238f0, 5 | BRF_GRA }, // 6 Color data
|
||||
{ "prom.4f", 0x0100, 0xcfc90f3d, 5 | BRF_GRA }, // 7
|
||||
{ "prom.11e", 0x0100, 0xcfc90f3d, 5 | BRF_GRA }, // 8
|
||||
|
||||
{ "rugr5c8", 0x2000, 0x67bafbbf, 6 | BRF_SND }, // 9 Samples
|
||||
{ "rugr6c9", 0x2000, 0xcac84a87, 6 | BRF_SND }, // 10
|
||||
|
||||
{ "wip-e8.bin", 0x0100, 0xbd2c080b, 7 | BRF_SND }, // 11 Sound Proms
|
||||
{ "wip-e9.bin", 0x0100, 0x4017a2a6, 7 | BRF_SND }, // 12
|
||||
};
|
||||
|
||||
STD_ROM_PICK(rugrats)
|
||||
STD_ROM_FN(rugrats)
|
||||
|
||||
struct BurnDriver BurnDrvRugrats = {
|
||||
"rugrats", "wiping", NULL, NULL, "1983",
|
||||
"Rug Rats\0", NULL, "Nichibutsu", "Miscellaneous",
|
||||
NULL, NULL, NULL, NULL,
|
||||
BDF_GAME_WORKING | BDF_CLONE | BDF_ORIENTATION_VERTICAL | BDF_ORIENTATION_FLIPPED, 2, HARDWARE_MISC_PRE90S, GBF_MAZE, 0,
|
||||
NULL, rugratsRomInfo, rugratsRomName, NULL, NULL, WipingInputInfo, RugratsDIPInfo,
|
||||
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 0x200,
|
||||
224, 288, 3, 4
|
||||
};
|
|
@ -0,0 +1,239 @@
|
|||
/***************************************************************************
|
||||
|
||||
Wiping sound driver (quick hack of the Namco sound driver)
|
||||
|
||||
used by wiping and clshroad
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "burnint.h"
|
||||
#include "wiping.h"
|
||||
|
||||
static const INT32 samplerate = 48000;
|
||||
static const INT32 defgain = 48;
|
||||
|
||||
/* 8 voices max */
|
||||
#define MAX_VOICES 8
|
||||
|
||||
/* this structure defines the parameters for a channel */
|
||||
struct sound_channel
|
||||
{
|
||||
INT32 frequency;
|
||||
INT32 counter;
|
||||
INT32 volume;
|
||||
const UINT8 *wave;
|
||||
INT32 oneshot;
|
||||
INT32 oneshotplaying;
|
||||
};
|
||||
|
||||
/* data about the sound system */
|
||||
static sound_channel m_channel_list[MAX_VOICES];
|
||||
static sound_channel *m_last_channel;
|
||||
|
||||
/* global sound parameters */
|
||||
static UINT8 *m_sound_prom;
|
||||
static UINT8 *m_sound_rom;
|
||||
static INT32 m_num_voices;
|
||||
|
||||
/* mixer tables and internal buffers */
|
||||
static INT16 *m_mixer_table;
|
||||
static INT16 *m_mixer_lookup;
|
||||
static INT16 *m_mixer_buffer;
|
||||
|
||||
static UINT8 m_soundregs[0x4000];
|
||||
|
||||
static void make_mixer_table(INT32 voices, INT32 gain);
|
||||
|
||||
void wipingsnd_scan()
|
||||
{
|
||||
SCAN_VAR(m_channel_list);
|
||||
SCAN_VAR(m_soundregs);
|
||||
}
|
||||
|
||||
void wipingsnd_init(UINT8 *rom, UINT8 *prom)
|
||||
{
|
||||
m_sound_prom = prom;
|
||||
m_sound_rom = rom;
|
||||
|
||||
m_mixer_buffer = (INT16 *)BurnMalloc(sizeof(INT16) * 2 * samplerate);
|
||||
|
||||
/* build the mixer table */
|
||||
make_mixer_table(8, defgain);
|
||||
wipingsnd_reset();
|
||||
}
|
||||
|
||||
void wipingsnd_exit()
|
||||
{
|
||||
BurnFree(m_mixer_buffer);
|
||||
BurnFree(m_mixer_table);
|
||||
}
|
||||
|
||||
void wipingsnd_reset()
|
||||
{
|
||||
memset(m_channel_list, 0, sizeof(sound_channel)*MAX_VOICES);
|
||||
memset(m_soundregs, 0, sizeof(UINT8)*0x4000);
|
||||
|
||||
sound_channel *voice;
|
||||
|
||||
m_num_voices = 8;
|
||||
m_last_channel = m_channel_list + m_num_voices;
|
||||
|
||||
/* reset all the voices */
|
||||
for (voice = m_channel_list; voice < m_last_channel; voice++)
|
||||
{
|
||||
voice->frequency = 0;
|
||||
voice->volume = 0;
|
||||
voice->wave = &m_sound_prom[0];
|
||||
voice->counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* build a table to divide by the number of voices; gain is specified as gain*16 */
|
||||
static void make_mixer_table(INT32 voices, INT32 gain)
|
||||
{
|
||||
INT32 count = voices * 128;
|
||||
|
||||
/* allocate memory */
|
||||
m_mixer_table = (INT16 *)BurnMalloc(sizeof(INT16) * 256 * voices);
|
||||
|
||||
/* find the middle of the table */
|
||||
m_mixer_lookup = m_mixer_table + (128 * voices);
|
||||
|
||||
/* fill in the table - 16 bit case */
|
||||
for (INT32 i = 0; i < count; i++)
|
||||
{
|
||||
int val = i * gain * 16 / voices;
|
||||
if (val > 32767) val = 32767;
|
||||
m_mixer_lookup[ i] = val;
|
||||
m_mixer_lookup[-i] = -val;
|
||||
}
|
||||
}
|
||||
|
||||
void wipingsnd_write(INT32 offset, UINT8 data)
|
||||
{
|
||||
sound_channel *voice;
|
||||
INT32 base;
|
||||
|
||||
offset &= 0x3fff;
|
||||
|
||||
/* set the register */
|
||||
m_soundregs[offset] = data;
|
||||
|
||||
/* recompute all the voice parameters */
|
||||
if (offset <= 0x3f)
|
||||
{
|
||||
for (base = 0, voice = m_channel_list; voice < m_last_channel; voice++, base += 8)
|
||||
{
|
||||
voice->frequency = m_soundregs[0x02 + base] & 0x0f;
|
||||
voice->frequency = voice->frequency * 16 + ((m_soundregs[0x01 + base]) & 0x0f);
|
||||
voice->frequency = voice->frequency * 16 + ((m_soundregs[0x00 + base]) & 0x0f);
|
||||
|
||||
voice->volume = m_soundregs[0x07 + base] & 0x0f;
|
||||
if (m_soundregs[0x5 + base] & 0x0f)
|
||||
{
|
||||
voice->wave = &m_sound_rom[128 * (16 * (m_soundregs[0x5 + base] & 0x0f)
|
||||
+ (m_soundregs[0x2005 + base] & 0x0f))];
|
||||
voice->oneshot = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
voice->wave = &m_sound_rom[16 * (m_soundregs[0x3 + base] & 0x0f)];
|
||||
voice->oneshot = 0;
|
||||
voice->oneshotplaying = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (offset >= 0x2000)
|
||||
{
|
||||
voice = &m_channel_list[(offset & 0x3f)/8];
|
||||
if (voice->oneshot)
|
||||
{
|
||||
voice->counter = 0;
|
||||
voice->oneshotplaying = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wipingsnd_update(INT16 *outputs, INT32 samples_len)
|
||||
{
|
||||
sound_channel *voice;
|
||||
|
||||
// compute # of samples @ soundcore native (48khz) rate
|
||||
INT32 samples = (((((samplerate*1000) / nBurnFPS) * samples_len) / nBurnSoundLen)) / 10;
|
||||
|
||||
if (samples > samplerate) samples = samplerate;
|
||||
|
||||
/* zap the contents of the mixer buffer */
|
||||
memset(m_mixer_buffer, 0, sizeof(INT16) * 2 * samplerate);
|
||||
|
||||
/* loop over each voice and add its contribution */
|
||||
for (voice = m_channel_list; voice < m_last_channel; voice++)
|
||||
{
|
||||
INT32 f = 16*voice->frequency;
|
||||
INT32 v = voice->volume;
|
||||
|
||||
/* only update if we have non-zero volume and frequency */
|
||||
if (v && f)
|
||||
{
|
||||
const UINT8 *w = voice->wave;
|
||||
INT32 c = voice->counter;
|
||||
|
||||
INT16 *mix = m_mixer_buffer;
|
||||
|
||||
/* add our contribution */
|
||||
for (INT32 i = 0; i < samples; i++)
|
||||
{
|
||||
INT32 offs;
|
||||
|
||||
c += f;
|
||||
|
||||
if (voice->oneshot)
|
||||
{
|
||||
if (voice->oneshotplaying)
|
||||
{
|
||||
offs = (c >> 15);
|
||||
if (w[offs>>1] == 0xff)
|
||||
{
|
||||
voice->oneshotplaying = 0;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* use full byte, first the high 4 bits, then the low 4 bits */
|
||||
if (offs & 1)
|
||||
*mix++ += ((w[offs>>1] & 0x0f) - 8) * v;
|
||||
else
|
||||
*mix++ += (((w[offs>>1]>>4) & 0x0f) - 8) * v;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
offs = (c >> 15) & 0x1f;
|
||||
|
||||
/* use full byte, first the high 4 bits, then the low 4 bits */
|
||||
if (offs & 1)
|
||||
*mix++ += ((w[offs>>1] & 0x0f) - 8) * v;
|
||||
else
|
||||
*mix++ += (((w[offs>>1]>>4) & 0x0f) - 8) * v;
|
||||
}
|
||||
}
|
||||
|
||||
/* update the counter for this voice */
|
||||
voice->counter = c;
|
||||
}
|
||||
}
|
||||
|
||||
// resample native (48khz) -> our rate
|
||||
for (INT32 j = 0; j < samples_len; j++)
|
||||
{
|
||||
INT32 k = (((((samplerate*1000) / nBurnFPS) * (j & ~2)) / nBurnSoundLen)) / 10;
|
||||
|
||||
INT32 lr = (INT32)(m_mixer_lookup[m_mixer_buffer[k]] * 0.50);
|
||||
|
||||
outputs[0] = BURN_SND_CLIP(lr);
|
||||
outputs[1] = BURN_SND_CLIP(lr);
|
||||
outputs += 2;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// wiping sound core
|
||||
void wipingsnd_scan();
|
||||
void wipingsnd_reset();
|
||||
void wipingsnd_init(UINT8 *rom, UINT8 *prom);
|
||||
void wipingsnd_exit();
|
||||
void wipingsnd_write(INT32 offset, UINT8 data);
|
||||
void wipingsnd_update(INT16 *outputs, INT32 samples_len);
|
||||
|
Loading…
Reference in New Issue