Re-write d_mole.cpp. Only 2 of the old nasty drivers left.
This commit is contained in:
parent
221fa9f2eb
commit
c3a1b39d0a
|
@ -1,481 +1,413 @@
|
||||||
// Mole Attack FB Driver Module
|
// FB Alpha driver module
|
||||||
// Based on MAME driver by Jason Nelson and Phil Stroffolino
|
// Based on MAME driver by Phil Stroffolino
|
||||||
|
|
||||||
#include "burnint.h"
|
#include "tiles_generic.h"
|
||||||
#include "m6502_intf.h"
|
#include "m6502_intf.h"
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "ay8910.h"
|
#include "ay8910.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UINT8 *AllMem;
|
||||||
//--------------------------------------------------------------------------------------
|
static UINT8 *MemEnd;
|
||||||
// Variables
|
static UINT8 *AllRam;
|
||||||
|
static UINT8 *RamEnd;
|
||||||
|
static UINT8 *DrvM6502ROM;
|
||||||
static UINT8 *Mem, *Rom, *Gfx, *BankRam;
|
static UINT8 *DrvGfxROM;
|
||||||
static UINT8 DrvJoy1[12], DrvJoy2[12], DrvReset, DrvDips;
|
static UINT8 *DrvM6502RAM;
|
||||||
static INT32 *Palette;
|
static UINT16 *DrvVidRAM;
|
||||||
static INT16 *pAY8910Buffer[3], *pFMBuffer = NULL;
|
|
||||||
|
static UINT32 *DrvPalette;
|
||||||
static INT32 tile_bank, flipscreen;
|
static UINT8 DrvRecalc;
|
||||||
|
|
||||||
|
static INT16 *pAY8910Buffer[3];
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Inputs
|
static UINT16 tile_bank;
|
||||||
|
static UINT8 flipscreen;
|
||||||
// buttons are laid out as follows:
|
|
||||||
// 7 8 9
|
static UINT8 DrvJoy1[8];
|
||||||
// 4 5 6
|
static UINT8 DrvJoy2[8];
|
||||||
// 1 2 3
|
static UINT8 DrvJoy3[8];
|
||||||
|
static UINT8 DrvDips[2];
|
||||||
|
static UINT8 DrvInputs[3];
|
||||||
static struct BurnInputInfo DrvInputList[] = {
|
static UINT8 DrvReset;
|
||||||
{"Coin 1" , BIT_DIGITAL, DrvJoy1 + 9, "p1 coin" },
|
|
||||||
{"Start 1" , BIT_DIGITAL, DrvJoy1 + 10, "p1 start" },
|
// buttons are laid out as follows:
|
||||||
{"Start 2" , BIT_DIGITAL, DrvJoy2 + 10, "p2 start" },
|
// 7 8 9
|
||||||
{"P1 button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1", },
|
// 4 5 6
|
||||||
{"P1 button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2", },
|
// 1 2 3
|
||||||
{"P1 button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3", },
|
|
||||||
{"P1 button 4", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 4", },
|
static struct BurnInputInfo MoleInputList[] = {
|
||||||
{"P1 button 5", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 5", },
|
{"P1 Coin", BIT_DIGITAL, DrvJoy2 + 7, "p1 coin" },
|
||||||
{"P1 button 6", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 6", },
|
{"P1 Start", BIT_DIGITAL, DrvJoy2 + 6, "p1 start" },
|
||||||
{"P1 button 7", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 7", },
|
{"P1 Button 1", BIT_DIGITAL, DrvJoy1 + 0, "p1 fire 1" },
|
||||||
{"P1 button 8", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 8", },
|
{"P1 Button 2", BIT_DIGITAL, DrvJoy1 + 1, "p1 fire 2" },
|
||||||
{"P1 button 9", BIT_DIGITAL, DrvJoy1 + 8, "p1 fire 9", },
|
{"P1 Button 3", BIT_DIGITAL, DrvJoy1 + 2, "p1 fire 3" },
|
||||||
|
{"P1 Button 4", BIT_DIGITAL, DrvJoy1 + 3, "p1 fire 4" },
|
||||||
{"P2 button 1", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 1", },
|
{"P1 Button 5", BIT_DIGITAL, DrvJoy1 + 4, "p1 fire 5" },
|
||||||
{"P2 button 2", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 2", },
|
{"P1 Button 6", BIT_DIGITAL, DrvJoy1 + 5, "p1 fire 6" },
|
||||||
{"P2 button 3", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 3", },
|
{"P1 Button 7", BIT_DIGITAL, DrvJoy1 + 6, "p1 fire 7" },
|
||||||
{"P2 button 4", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 4", },
|
{"P1 Button 8", BIT_DIGITAL, DrvJoy1 + 7, "p1 fire 8" },
|
||||||
{"P2 button 5", BIT_DIGITAL, DrvJoy2 + 4, "p2 fire 5", },
|
{"P1 Button 9", BIT_DIGITAL, DrvJoy2 + 0, "p1 fire 9" },
|
||||||
{"P2 button 6", BIT_DIGITAL, DrvJoy2 + 5, "p2 fire 6", },
|
|
||||||
{"P2 button 7", BIT_DIGITAL, DrvJoy2 + 6, "p2 fire 7", },
|
{"P2 Start", BIT_DIGITAL, DrvJoy2 + 5, "p2 start" },
|
||||||
{"P2 button 8", BIT_DIGITAL, DrvJoy2 + 7, "p2 fire 8", },
|
{"P2 Button 1", BIT_DIGITAL, DrvJoy2 + 1, "p2 fire 1" },
|
||||||
{"P2 button 9", BIT_DIGITAL, DrvJoy2 + 8, "p2 fire 9", },
|
{"P2 Button 2", BIT_DIGITAL, DrvJoy2 + 2, "p2 fire 2" },
|
||||||
|
{"P2 Button 3", BIT_DIGITAL, DrvJoy2 + 3, "p2 fire 3" },
|
||||||
{"Reset", BIT_DIGITAL , &DrvReset, "reset" },
|
{"P2 Button 4", BIT_DIGITAL, DrvJoy3 + 0, "p2 fire 4" },
|
||||||
{"Dip 1", BIT_DIPSWITCH, &DrvDips, "dip" },
|
{"P2 Button 5", BIT_DIGITAL, DrvJoy3 + 1, "p2 fire 5" },
|
||||||
};
|
{"P2 Button 6", BIT_DIGITAL, DrvJoy3 + 2, "p2 fire 6" },
|
||||||
|
{"P2 Button 7", BIT_DIGITAL, DrvJoy1 + 6, "p2 fire 7" },
|
||||||
STDINPUTINFO(Drv)
|
{"P2 Button 8", BIT_DIGITAL, DrvJoy1 + 7, "p2 fire 8" },
|
||||||
|
{"P2 Button 9", BIT_DIGITAL, DrvJoy2 + 0, "p2 fire 9" },
|
||||||
|
|
||||||
static struct BurnDIPInfo DrvDIPList[]=
|
{"Reset", BIT_DIGITAL, &DrvReset, "reset" },
|
||||||
{
|
{"Dip A", BIT_DIPSWITCH, DrvDips + 0, "dip" },
|
||||||
// Default Values
|
{"Dip B", BIT_DIPSWITCH, DrvDips + 1, "dip" },
|
||||||
{0x16, 0xff, 0xff, 0x00, NULL },
|
};
|
||||||
|
|
||||||
{0 , 0xfe, 0 , 2 , "Passing Points" },
|
STDINPUTINFO(Mole)
|
||||||
{0x16, 0x01, 0x01, 0x00, "300" },
|
|
||||||
{0x16, 0x01, 0x01, 0x01, "400" },
|
static struct BurnDIPInfo MoleDIPList[]=
|
||||||
|
{
|
||||||
{0 , 0xfe, 0 , 2 , "Coinage" },
|
{0x16, 0xff, 0xff, 0x00, NULL },
|
||||||
{0x16, 0x01, 0x02, 0x00, "1 Coin 1 Play" },
|
{0x17, 0xff, 0xff, 0x00, NULL },
|
||||||
{0x16, 0x01, 0x02, 0x02, "1 Coin 2 Plays" },
|
|
||||||
|
{0 , 0xfe, 0 , 2, "Cabinet" },
|
||||||
{0 , 0xfe, 0 , 2 , "Cabinet" },
|
{0x16, 0x01, 0x10, 0x00, "Upright" },
|
||||||
{0x16, 0x01, 0x10, 0x00, "Upright" },
|
{0x16, 0x01, 0x10, 0x10, "Cocktail" },
|
||||||
{0x16, 0x01, 0x10, 0x10, "Cocktail" },
|
|
||||||
};
|
{0 , 0xfe, 0 , 2, "Round Points" },
|
||||||
|
{0x17, 0x01, 0x01, 0x00, "Off" },
|
||||||
STDDIPINFO(Drv)
|
{0x17, 0x01, 0x01, 0x01, "On" },
|
||||||
|
|
||||||
|
{0 , 0xfe, 0 , 2, "Coinage" },
|
||||||
//--------------------------------------------------------------------------------------
|
{0x17, 0x01, 0x02, 0x00, "1 Coin 1 Credits" },
|
||||||
// Memory handling
|
{0x17, 0x01, 0x02, 0x02, "1 Coin 2 Credits" },
|
||||||
|
};
|
||||||
|
|
||||||
static UINT8 mole_protection_r(UINT8 offset)
|
STDDIPINFO(Mole)
|
||||||
{
|
|
||||||
switch (offset)
|
static UINT8 mole_protection_read(UINT8 offset)
|
||||||
{
|
{
|
||||||
case 0x08: // random mole placement
|
switch (offset)
|
||||||
return 0xb0;
|
{
|
||||||
|
case 0x08: return 0xb0;
|
||||||
case 0x26:
|
case 0x26:
|
||||||
if (M6502GetPC(0) == 0x53d7)
|
if (M6502GetPC(0) == 0x53d7)
|
||||||
{
|
{
|
||||||
return 0x06; // bonus round
|
return 0x06;
|
||||||
}
|
}
|
||||||
else // pc == 0x515b, 0x5162
|
else
|
||||||
{
|
{
|
||||||
return 0xc6; // game start
|
return 0xc6;
|
||||||
}
|
}
|
||||||
|
case 0x86: return 0x91;
|
||||||
case 0x86: // game over
|
case 0xae: return 0x32;
|
||||||
return 0x91;
|
}
|
||||||
|
|
||||||
case 0xae: // coinage
|
return 0;
|
||||||
return 0x32;
|
}
|
||||||
}
|
|
||||||
|
static UINT8 mole_read(UINT16 address)
|
||||||
return 0x00;
|
{
|
||||||
}
|
if ((address & 0xff00) == 0x0800) {
|
||||||
|
return mole_protection_read(address);
|
||||||
void mole_write_byte(UINT16 address, UINT8 data)
|
}
|
||||||
{
|
|
||||||
// Tile RAM
|
if ((address & 0xfc00) == 0x8000) {
|
||||||
if (address >= 0x8000 && address <= 0x83ff)
|
return 0;
|
||||||
{
|
}
|
||||||
BankRam[address & 0x3ff] = tile_bank;
|
|
||||||
Rom[address] = data;
|
switch (address)
|
||||||
return;
|
{
|
||||||
}
|
case 0x8d00:
|
||||||
|
return DrvDips[1];
|
||||||
switch (address)
|
|
||||||
{
|
case 0x8d40:
|
||||||
case 0x0800: // ?
|
return DrvInputs[0];
|
||||||
case 0x0820:
|
|
||||||
case 0x8c40:
|
case 0x8d80:
|
||||||
case 0x8c80:
|
return DrvInputs[1];
|
||||||
case 0x8c81:
|
|
||||||
break;
|
case 0x8dc0:
|
||||||
|
return DrvInputs[2];
|
||||||
case 0x8400:
|
}
|
||||||
tile_bank = data;
|
|
||||||
break;
|
return 0;
|
||||||
|
}
|
||||||
case 0x8c00: // ay8910_write_port
|
|
||||||
case 0x8c01: // ay8910_control_port
|
static void mole_write(UINT16 address, UINT8 data)
|
||||||
AY8910Write(0, ~address & 1, data);
|
{
|
||||||
break;
|
if ((address & 0xfc00) == 0x8000) {
|
||||||
|
DrvVidRAM[(address & 0x3ff)] = data + tile_bank;
|
||||||
case 0x8d00: // watchdog
|
return;
|
||||||
break;
|
}
|
||||||
|
|
||||||
case 0x8dc0: // flipscreen
|
switch (address)
|
||||||
flipscreen = data & 1;
|
{
|
||||||
break;
|
case 0x0800:
|
||||||
}
|
case 0x0820:
|
||||||
|
case 0x8c40:
|
||||||
if (address <= 0x3ff) {
|
case 0x8c80:
|
||||||
Rom[address] = data;
|
case 0x8c81:
|
||||||
}
|
return; // nop
|
||||||
}
|
|
||||||
|
case 0x8400:
|
||||||
UINT8 mole_read_byte(UINT16 address)
|
tile_bank = data * 256;
|
||||||
{
|
return;
|
||||||
UINT8 ret = 0;
|
|
||||||
|
case 0x8c00:
|
||||||
switch (address)
|
AY8910Write(0, 1, data);
|
||||||
{
|
return;
|
||||||
case 0x8d00: // input port 0
|
|
||||||
return DrvDips & 0x03;
|
case 0x8c01:
|
||||||
|
AY8910Write(0, 0, data);
|
||||||
case 0x8d40: // input port 1
|
return;
|
||||||
{
|
|
||||||
for (INT32 i = 0; i < 8; i++)
|
case 0x8d00:
|
||||||
ret |= DrvJoy1[i] << i;
|
M6502SetIRQLine(0, CPU_IRQSTATUS_NONE);
|
||||||
|
return;
|
||||||
return ret;
|
|
||||||
}
|
case 0x8dc0:
|
||||||
|
flipscreen = data & 1;
|
||||||
case 0x8d80: // input port 2
|
return;
|
||||||
{
|
}
|
||||||
ret |= DrvJoy1[8];
|
}
|
||||||
ret |= DrvJoy2[0] << 1;
|
|
||||||
ret |= DrvJoy2[1] << 2;
|
static tilemap_callback( background )
|
||||||
ret |= DrvJoy2[2] << 3;
|
{
|
||||||
ret |= DrvDips & 0x10;
|
TILE_SET_INFO(0, DrvVidRAM[offs], 0, 0);
|
||||||
ret |= DrvJoy2[10] << 5;
|
}
|
||||||
ret |= DrvJoy1[10] << 6;
|
|
||||||
ret |= DrvJoy1[ 9] << 7;
|
static INT32 DrvDoReset()
|
||||||
|
{
|
||||||
return ret;
|
memset (AllRam, 0, RamEnd - AllRam);
|
||||||
}
|
|
||||||
|
M6502Open(0);
|
||||||
case 0x8dc0: // input port 3
|
M6502Reset();
|
||||||
{
|
M6502Close();
|
||||||
ret |= DrvJoy2[7];
|
|
||||||
ret |= DrvJoy2[6] << 1;
|
AY8910Reset(0);
|
||||||
ret |= DrvJoy2[3] << 2;
|
|
||||||
ret |= DrvJoy2[8] << 3;
|
HiscoreReset();
|
||||||
ret |= DrvJoy2[5] << 4;
|
|
||||||
ret |= DrvJoy2[4] << 5;
|
tile_bank = 0;
|
||||||
|
flipscreen = 0;
|
||||||
return ret;
|
|
||||||
}
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Protection read
|
static INT32 MemIndex()
|
||||||
if (address >= 0x800 && address <= 0x8ff)
|
{
|
||||||
{
|
UINT8 *Next; Next = AllMem;
|
||||||
return mole_protection_r(address & 0xff);
|
|
||||||
}
|
DrvM6502ROM = Next; Next += 0x003000;
|
||||||
|
|
||||||
if (address <= 0x3ff) {
|
DrvGfxROM = Next; Next += 0x010000;
|
||||||
return Rom[address];
|
|
||||||
}
|
DrvPalette = (UINT32*)Next; Next += 0x0008 * sizeof(UINT32);
|
||||||
|
|
||||||
return 0;
|
AllRam = Next;
|
||||||
}
|
|
||||||
|
DrvM6502RAM = Next; Next += 0x000400;
|
||||||
|
DrvVidRAM = (UINT16*)Next; Next += 0x000400 * sizeof(UINT16);
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Initilizing functions
|
RamEnd = Next;
|
||||||
|
|
||||||
|
pAY8910Buffer[0] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16);
|
||||||
static INT32 DrvDoReset()
|
pAY8910Buffer[1] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16);
|
||||||
{
|
pAY8910Buffer[2] = (INT16*)Next; Next += nBurnSoundLen * sizeof(INT16);
|
||||||
DrvReset = 0;
|
|
||||||
|
MemEnd = Next;
|
||||||
memset (Rom + 0x0000, 0, 0x0400);
|
|
||||||
memset (Rom + 0x8000, 0, 0x0400);
|
return 0;
|
||||||
memset (BankRam, 0, 0x0400);
|
}
|
||||||
|
|
||||||
tile_bank = 0;
|
static INT32 DrvGfxDecode()
|
||||||
flipscreen = 0;
|
{
|
||||||
|
INT32 Plane[3] = { 0, 0x2000*8, 0x2000*8*2 };
|
||||||
M6502Open(0);
|
INT32 XOffs[8] = { STEP8(0,1) };
|
||||||
M6502Reset();
|
INT32 YOffs[8] = { STEP8(0,8) };
|
||||||
M6502Close();
|
|
||||||
|
UINT8 *tmp = (UINT8*)BurnMalloc(0x6000);
|
||||||
AY8910Reset(0);
|
if (tmp == NULL) {
|
||||||
|
return 1;
|
||||||
return 0;
|
}
|
||||||
}
|
|
||||||
|
memcpy (tmp, DrvGfxROM, 0x6000);
|
||||||
static void mole_palette_init()
|
|
||||||
{
|
GfxDecode(0x0400, 3, 8, 8, Plane, XOffs, YOffs, 0x040, tmp, DrvGfxROM);
|
||||||
for (INT32 i = 0; i < 8; i++) {
|
|
||||||
Palette[i] |= (i & 1) ? 0xff0000 : 0;
|
BurnFree(tmp);
|
||||||
Palette[i] |= (i & 4) ? 0x00ff00 : 0;
|
|
||||||
Palette[i] |= (i & 2) ? 0x0000ff : 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
static INT32 DrvInit()
|
||||||
|
{
|
||||||
static INT32 mole_gfx_convert()
|
AllMem = NULL;
|
||||||
{
|
MemIndex();
|
||||||
UINT8 a, b, c;
|
INT32 nLen = MemEnd - (UINT8 *)0;
|
||||||
UINT8 *tmp = (UINT8*)BurnMalloc(0x6000);
|
if ((AllMem = (UINT8 *)BurnMalloc(nLen)) == NULL) return 1;
|
||||||
if (tmp == NULL) {
|
memset(AllMem, 0, nLen);
|
||||||
return 1;
|
MemIndex();
|
||||||
}
|
|
||||||
|
{
|
||||||
memcpy (tmp, Gfx, 0x6000);
|
if (BurnLoadRom(DrvM6502ROM + 0x0000, 0, 1)) return 1;
|
||||||
|
if (BurnLoadRom(DrvM6502ROM + 0x1000, 1, 1)) return 1;
|
||||||
for (INT32 i = 0; i < 0x8000; i++)
|
if (BurnLoadRom(DrvM6502ROM + 0x2000, 2, 1)) return 1;
|
||||||
{
|
|
||||||
a = (tmp[0x0000 + (i >> 3)] >> (i & 7)) & 1;
|
if (BurnLoadRom(DrvGfxROM + 0x0000, 3, 1)) return 1;
|
||||||
b = (tmp[0x1000 + (i >> 3)] >> (i & 7)) & 1;
|
if (BurnLoadRom(DrvGfxROM + 0x1000, 6, 1)) return 1;
|
||||||
c = (tmp[0x2000 + (i >> 3)] >> (i & 7)) & 1;
|
if (BurnLoadRom(DrvGfxROM + 0x2000, 4, 1)) return 1;
|
||||||
|
if (BurnLoadRom(DrvGfxROM + 0x3000, 7, 1)) return 1;
|
||||||
Gfx[0x0007 ^ i] = (a << 2) | (b << 1) | c;
|
if (BurnLoadRom(DrvGfxROM + 0x4000, 5, 1)) return 1;
|
||||||
|
if (BurnLoadRom(DrvGfxROM + 0x5000, 8, 1)) return 1;
|
||||||
a = (tmp[0x3000 + (i >> 3)] >> (i & 7)) & 1;
|
|
||||||
b = (tmp[0x4000 + (i >> 3)] >> (i & 7)) & 1;
|
DrvGfxDecode();
|
||||||
c = (tmp[0x5000 + (i >> 3)] >> (i & 7)) & 1;
|
}
|
||||||
|
|
||||||
Gfx[0x8007 ^ i] = (a << 2) | (b << 1) | c;
|
M6502Init(0, TYPE_M6502);
|
||||||
}
|
M6502Open(0);
|
||||||
|
M6502MapMemory(DrvM6502RAM, 0x0000, 0x03ff, MAP_RAM);
|
||||||
BurnFree (tmp);
|
M6502MapMemory(DrvM6502ROM, 0x5000, 0x7fff, MAP_ROM); // mirror
|
||||||
|
M6502MapMemory(DrvM6502ROM, 0xd000, 0xffff, MAP_ROM);
|
||||||
return 0;
|
M6502SetWriteHandler(mole_write);
|
||||||
}
|
M6502SetReadHandler(mole_read);
|
||||||
|
M6502Close();
|
||||||
static INT32 DrvInit()
|
|
||||||
{
|
AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL);
|
||||||
Mem = (UINT8*)BurnMalloc(0x10000 + 0x10000 + 0x400 + (0x20 * sizeof(INT32)));
|
AY8910SetAllRoutes(0, 0.30, BURN_SND_ROUTE_BOTH);
|
||||||
if (Mem == NULL) {
|
|
||||||
return 1;
|
GenericTilesInit();
|
||||||
}
|
GenericTilemapInit(0, TILEMAP_SCAN_ROWS, background_map_callback, 8, 8, 40, 25);
|
||||||
|
GenericTilemapSetGfx(0, DrvGfxROM, 3, 8, 8, 0x10000, 0, 0);
|
||||||
pFMBuffer = (INT16 *)BurnMalloc(nBurnSoundLen * 3 * sizeof(INT16));
|
|
||||||
if (pFMBuffer == NULL) {
|
DrvDoReset();
|
||||||
return 1;
|
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
memset (Mem, 0, 0x20420);
|
|
||||||
|
static INT32 DrvExit()
|
||||||
Rom = Mem + 0x00000;
|
{
|
||||||
Gfx = Mem + 0x10000;
|
GenericTilesExit();
|
||||||
BankRam = Mem + 0x20000;
|
|
||||||
Palette = (INT32 *)(Mem + 0x20400);
|
M6502Exit();
|
||||||
|
AY8910Exit(0);
|
||||||
{
|
|
||||||
BurnLoadRom(Rom + 0x5000, 0, 1);
|
BurnFree(AllMem);
|
||||||
BurnLoadRom(Rom + 0x6000, 1, 1);
|
|
||||||
BurnLoadRom(Rom + 0x7000, 2, 1);
|
return 0;
|
||||||
|
}
|
||||||
BurnLoadRom(Gfx + 0x0000, 3, 1);
|
|
||||||
BurnLoadRom(Gfx + 0x1000, 4, 1);
|
static void DrvPaletteInit()
|
||||||
BurnLoadRom(Gfx + 0x2000, 5, 1);
|
{
|
||||||
BurnLoadRom(Gfx + 0x3000, 6, 1);
|
for (INT32 i = 0; i < 8; i++) {
|
||||||
BurnLoadRom(Gfx + 0x4000, 7, 1);
|
DrvPalette[i] = BurnHighCol((i&1)?0xff:0, (i&4)?0xff:0, (i&2)?0xff:0, 0);
|
||||||
BurnLoadRom(Gfx + 0x5000, 8, 1);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mole_gfx_convert();
|
static INT32 DrvDraw()
|
||||||
mole_palette_init();
|
{
|
||||||
|
if (DrvRecalc) {
|
||||||
M6502Init(0, TYPE_M6502);
|
DrvPaletteInit();
|
||||||
M6502Open(0);
|
DrvRecalc = 0;
|
||||||
M6502MapMemory(Rom + 0x0000, 0x0000, 0x03ff, MAP_RAM); // Rom
|
}
|
||||||
M6502MapMemory(Rom + 0x5000, 0x5000, 0x7fff, MAP_ROM); // Rom
|
|
||||||
M6502MapMemory(Rom + 0x5000, 0xd000, 0xffff, MAP_ROM); // Rom Mirror
|
GenericTilemapSetFlip(TMAP_GLOBAL, flipscreen ? TMAP_FLIPXY : 0);
|
||||||
M6502SetReadHandler(mole_read_byte);
|
|
||||||
M6502SetWriteHandler(mole_write_byte);
|
GenericTilemapDraw(0, pTransDraw, 0);
|
||||||
M6502SetReadOpHandler(mole_read_byte);
|
|
||||||
M6502SetReadOpArgHandler(mole_read_byte);
|
BurnTransferCopy(DrvPalette);
|
||||||
M6502Close();
|
|
||||||
|
return 0;
|
||||||
pAY8910Buffer[0] = pFMBuffer + nBurnSoundLen * 0;
|
}
|
||||||
pAY8910Buffer[1] = pFMBuffer + nBurnSoundLen * 1;
|
|
||||||
pAY8910Buffer[2] = pFMBuffer + nBurnSoundLen * 2;
|
static INT32 DrvFrame()
|
||||||
|
{
|
||||||
AY8910Init(0, 2000000, nBurnSoundRate, NULL, NULL, NULL, NULL);
|
if (DrvReset) {
|
||||||
AY8910SetAllRoutes(0, 1.00, BURN_SND_ROUTE_BOTH);
|
DrvDoReset();
|
||||||
|
}
|
||||||
DrvDoReset();
|
|
||||||
|
{
|
||||||
return 0;
|
memset (DrvInputs, 0, 3);
|
||||||
}
|
DrvInputs[1] = DrvDips[0];
|
||||||
|
|
||||||
static INT32 DrvExit()
|
for (INT32 i = 0; i < 8; i++) {
|
||||||
{
|
DrvInputs[0] ^= (DrvJoy1[i] & 1) << i;
|
||||||
M6502Exit();
|
DrvInputs[1] ^= (DrvJoy2[i] & 1) << i;
|
||||||
AY8910Exit(0);
|
DrvInputs[2] ^= (DrvJoy3[i] & 1) << i;
|
||||||
|
}
|
||||||
BurnFree (Mem);
|
}
|
||||||
BurnFree (pFMBuffer);
|
|
||||||
|
M6502Open(0);
|
||||||
return 0;
|
M6502Run(62500); // 4mhz / 60hz / (240/256)
|
||||||
}
|
M6502SetIRQLine(0, CPU_IRQSTATUS_ACK);
|
||||||
|
M6502Run(4166); // 4mhz / 60hz / (16/256)
|
||||||
|
M6502Close();
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Drawing functions
|
if (pBurnSoundOut) {
|
||||||
|
AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0);
|
||||||
|
}
|
||||||
static INT32 DrvDraw()
|
|
||||||
{
|
if (pBurnDraw) {
|
||||||
for (INT32 offs = 0; offs < 0x400; offs++)
|
DrvDraw();
|
||||||
{
|
}
|
||||||
INT32 sy = ((offs / 40) % 25) << 3;
|
|
||||||
INT32 sx = (offs % 40) << 3;
|
return 0;
|
||||||
|
}
|
||||||
INT32 code = ((BankRam[offs] & 3) << 14) | ((Rom[0x8000 + offs]) << 6);
|
|
||||||
|
static INT32 DrvScan(INT32 nAction, INT32 *pnMin)
|
||||||
UINT8 *gfxsrc = Gfx + code;
|
{
|
||||||
|
struct BurnArea ba;
|
||||||
for (INT32 y = sy; y < sy + 8; y++)
|
|
||||||
{
|
if (pnMin) {
|
||||||
for (INT32 x = sx; x < sx + 8; x++, gfxsrc++)
|
*pnMin = 0x029702;
|
||||||
{
|
}
|
||||||
INT32 pxl = Palette[*gfxsrc];
|
|
||||||
|
if (nAction & ACB_VOLATILE) {
|
||||||
INT32 pos;
|
memset(&ba, 0, sizeof(ba));
|
||||||
|
|
||||||
if (flipscreen)
|
ba.Data = AllRam;
|
||||||
pos = (199 - y) * 320 + (319 - x);
|
ba.nLen = RamEnd - AllRam;
|
||||||
else
|
ba.szName = "All Ram";
|
||||||
pos = y * 320 + x;
|
BurnAcb(&ba);
|
||||||
|
|
||||||
PutPix(pBurnDraw + pos * nBurnBpp, BurnHighCol((pxl >> 16)&0xff, (pxl >> 8)&0xff, pxl&0xff, 0));
|
M6502Scan(nAction);
|
||||||
}
|
AY8910Scan(nAction, pnMin);
|
||||||
}
|
|
||||||
}
|
SCAN_VAR(tile_bank);
|
||||||
|
SCAN_VAR(flipscreen);
|
||||||
return 0;
|
}
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static INT32 DrvFrame()
|
|
||||||
{
|
// Mole Attack
|
||||||
if (DrvReset) {
|
|
||||||
DrvDoReset();
|
static struct BurnRomInfo moleRomDesc[] = {
|
||||||
}
|
{ "m3a.5h", 0x1000, 0x5fbbdfef, 1 | BRF_PRG | BRF_ESS }, // 0 M6502 Code
|
||||||
|
{ "m2a.7h", 0x1000, 0xf2a90642, 1 | BRF_PRG | BRF_ESS }, // 1
|
||||||
M6502Open(0);
|
{ "m1a.8h", 0x1000, 0xcff0119a, 1 | BRF_PRG | BRF_ESS }, // 2
|
||||||
M6502Run(4000000 / 60);
|
|
||||||
M6502SetIRQLine(M6502_IRQ_LINE, CPU_IRQSTATUS_AUTO);
|
{ "mea.4a", 0x1000, 0x49d89116, 2 | BRF_GRA }, // 3 Graphics
|
||||||
M6502Close();
|
{ "mca.6a", 0x1000, 0x04e90300, 2 | BRF_GRA }, // 4
|
||||||
|
{ "maa.9a", 0x1000, 0x6ce9442b, 2 | BRF_GRA }, // 5
|
||||||
if (pBurnSoundOut) {
|
{ "mfa.3a", 0x1000, 0x0d0c7d13, 2 | BRF_GRA }, // 6
|
||||||
AY8910Render(&pAY8910Buffer[0], pBurnSoundOut, nBurnSoundLen, 0);
|
{ "mda.5a", 0x1000, 0x41ae1842, 2 | BRF_GRA }, // 7
|
||||||
}
|
{ "mba.8a", 0x1000, 0x50c43fc9, 2 | BRF_GRA }, // 8
|
||||||
|
};
|
||||||
if (pBurnDraw) {
|
|
||||||
DrvDraw();
|
STD_ROM_PICK(mole)
|
||||||
}
|
STD_ROM_FN(mole)
|
||||||
|
|
||||||
return 0;
|
struct BurnDriver BurnDrvMole = {
|
||||||
}
|
"mole", NULL, NULL, NULL, "1982",
|
||||||
|
"Mole Attack\0", NULL, "Yachiyo Electronics, Ltd.", "Miscellaneous",
|
||||||
|
NULL, NULL, NULL, NULL,
|
||||||
//--------------------------------------------------------------------------------------
|
BDF_GAME_WORKING | BDF_HISCORE_SUPPORTED, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
|
||||||
// Savestates
|
NULL, moleRomInfo, moleRomName, NULL, NULL, MoleInputInfo, MoleDIPInfo,
|
||||||
|
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, &DrvRecalc, 8,
|
||||||
|
320, 200, 4, 3
|
||||||
static INT32 DrvScan(INT32 nAction,INT32 *pnMin)
|
};
|
||||||
{
|
|
||||||
struct BurnArea ba;
|
|
||||||
|
|
||||||
if (pnMin) { // Return minimum compatible version
|
|
||||||
*pnMin = 0x029521;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nAction & ACB_VOLATILE) { // Scan volatile ram
|
|
||||||
memset(&ba, 0, sizeof(ba));
|
|
||||||
|
|
||||||
ba.Data = Rom + 0x0000;
|
|
||||||
ba.nLen = 0x0400;
|
|
||||||
ba.szName = "Work Ram";
|
|
||||||
BurnAcb(&ba);
|
|
||||||
|
|
||||||
ba.Data = Rom + 0x8000;
|
|
||||||
ba.nLen = 0x0400;
|
|
||||||
ba.szName = "Video Ram";
|
|
||||||
BurnAcb(&ba);
|
|
||||||
|
|
||||||
ba.Data = BankRam;
|
|
||||||
ba.nLen = 0x0400;
|
|
||||||
ba.szName = "Bank Ram";
|
|
||||||
BurnAcb(&ba);
|
|
||||||
|
|
||||||
M6502Scan(nAction); // Scan m6502
|
|
||||||
AY8910Scan(nAction, pnMin); // Scan AY8910
|
|
||||||
|
|
||||||
// Scan critical driver variables
|
|
||||||
SCAN_VAR(tile_bank);
|
|
||||||
SCAN_VAR(flipscreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------
|
|
||||||
// Game drivers
|
|
||||||
|
|
||||||
|
|
||||||
// Mole Attack
|
|
||||||
|
|
||||||
static struct BurnRomInfo moleRomDesc[] = {
|
|
||||||
{ "m3a.5h", 0x1000, 0x5fbbdfef, 1 | BRF_ESS | BRF_PRG }, // 0 M6502 Code
|
|
||||||
{ "m2a.7h", 0x1000, 0xf2a90642, 1 | BRF_ESS | BRF_PRG }, // 1
|
|
||||||
{ "m1a.8h", 0x1000, 0xcff0119a, 1 | BRF_ESS | BRF_PRG }, // 2
|
|
||||||
|
|
||||||
{ "mea.4a", 0x1000, 0x49d89116, 2 | BRF_GRA }, // 3 Graphics tiles
|
|
||||||
{ "mca.6a", 0x1000, 0x04e90300, 2 | BRF_GRA }, // 4
|
|
||||||
{ "maa.9a", 0x1000, 0x6ce9442b, 2 | BRF_GRA }, // 5
|
|
||||||
{ "mfa.3a", 0x1000, 0x0d0c7d13, 2 | BRF_GRA }, // 6
|
|
||||||
{ "mda.5a", 0x1000, 0x41ae1842, 2 | BRF_GRA }, // 7
|
|
||||||
{ "mba.8a", 0x1000, 0x50c43fc9, 2 | BRF_GRA }, // 8
|
|
||||||
};
|
|
||||||
|
|
||||||
STD_ROM_PICK(mole)
|
|
||||||
STD_ROM_FN(mole)
|
|
||||||
|
|
||||||
struct BurnDriver BurnDrvMole = {
|
|
||||||
"mole", NULL, NULL, NULL, "1982",
|
|
||||||
"Mole Attack\0", NULL, "Yachiyo Electronics, Ltd.", "Miscellaneous",
|
|
||||||
NULL, NULL, NULL, NULL,
|
|
||||||
BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
|
|
||||||
NULL, moleRomInfo, moleRomName, NULL, NULL, DrvInputInfo, DrvDIPInfo,
|
|
||||||
DrvInit, DrvExit, DrvFrame, DrvDraw, DrvScan, NULL, 0x08,
|
|
||||||
320, 200, 4, 3
|
|
||||||
};
|
|
||||||
|
|
Loading…
Reference in New Issue