rendered paste body// FB Alpha Bank Panic Driver Module
// Based on MAME driver by Nicola Salmoria
#include "tiles_generic.h"
//#include "sn76496.h"
//#define CZ80 1
#define RAZE 1
#define USE_MAP 1
//#define USE_SPRITES 1
#define VBTLIB 1
//#include "tiles_generic.h"
//#include "burnint.h"
//#define _SPR3_
//#include "sega_spr.h"
#include "sega_scl2.h"
#include "sega_pcm.h"
static void DrvInitSaturn();
#ifdef USE_MAP
extern UINT16 *ss_font;
extern UINT16 *ss_map;
extern UINT16 *ss_map2;
// extern Fixed32 ls_tbl[SCL_MAXLINE];
// extern SclLineparam lp;
#else
unsigned char* pTransDraw;
unsigned char *pBurnDraw; // Pointer to correctly sized bitmap
static unsigned int *Palette, *DrvPalette;
#endif
#define RGB( r, g, b ) (0x8000U|((b) << 10)|((g) << 5 )|(r))
extern UINT16 *colBgAddr; // color
extern UINT16 *colBgAddr2;
//extern UINT16 *colAddr; // sprite color
//extern UINT8 *aVRAM;
//extern SprSpCmd smsSprite[64+3];
extern UINT8 *cache;
extern char *g_movie_buf;
extern PcmHn pcm;
//extern unsigned char hz;
extern unsigned int delta;
//unsigned int titi2=0;
//int nBurnFPS; // pas utile ?
//int nBurnBpp; // Bytes per pixel (2, 3, or 4)
//int nBurnPitch; // Pitch between each line
//unsigned int nBurnDrvSelect; // Which game driver is selected
//short* pBurnSoundOut; // Pointer to output buffer
extern int nBurnSoundRate; // sample rate of sound or zero for no sound
extern int nBurnSoundLen; // Length in samples per frame
//extern struct BurnDriver* pDriver[];
#define ACB_MEMORY_RAM (32)
#define ACB_DRIVER_DATA (64)
#define ACB_VOLATILE (ACB_MEMORY_RAM | ACB_DRIVER_DATA)
#ifdef CZ80
#define ZET_IRQSTATUS_NONE 0
#define ZET_IRQSTATUS_ACK 1
#define ZET_IRQSTATUS_AUTO 2
#define CZetRaiseIrq(n) CZetSetIRQLine(n, ZET_IRQSTATUS_AUTO)
#endif
static unsigned char *Mem, *Rom, *Gfx0, *Gfx1, *Prom;
static unsigned char DrvJoy1[8], DrvJoy2[8], DrvJoy3[8], DrvReset, DrvDips;
static int *Palette;
static unsigned char scroll_x, priority, flipscreen, interrupt_enable;
static struct BurnInputInfo bankpInputList[] = {
{"Coin 1" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" },
{"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" },
{"Coin 3" , BIT_DIGITAL , DrvJoy1 + 6, "p3 coin" },
{"P1 Start" , BIT_DIGITAL , DrvJoy2 + 5, "p1 start" },
{"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" },
{"P1 Left" , BIT_DIGITAL , DrvJoy1 + 3, "p1 left" },
{"P1 Right" , BIT_DIGITAL , DrvJoy1 + 1, "p1 right" },
{"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 7, "p1 fire 1"},
{"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 2"},
{"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 3"},
{"P2 Left" , BIT_DIGITAL , DrvJoy2 + 3, "p2 left" },
{"P2 Right" , BIT_DIGITAL , DrvJoy2 + 1, "p2 right" },
{"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 7, "p2 fire 1"},
{"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 2"},
{"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 3"},
{"Reset" , BIT_DIGITAL , &DrvReset , "reset" },
{"Dip 1" , BIT_DIPSWITCH, &DrvDips, "dip" },
};
STDINPUTINFO(bankp)
static struct BurnInputInfo combhInputList[] = {
{"Coin 1" , BIT_DIGITAL , DrvJoy1 + 5, "p1 coin" },
{"Coin 2" , BIT_DIGITAL , DrvJoy1 + 6, "p2 coin" },
{"Coin 3" , BIT_DIGITAL , DrvJoy1 + 6, "p3 coin" },
{"P1 Start" , BIT_DIGITAL , DrvJoy2 + 5, "p1 start" },
{"P2 Start" , BIT_DIGITAL , DrvJoy2 + 6, "p2 start" },
{"P1 Up" , BIT_DIGITAL , DrvJoy1 + 0, "p1 up" },
{"P1 Down" , BIT_DIGITAL , DrvJoy1 + 2, "p1 down" },
{"P1 Button 1" , BIT_DIGITAL , DrvJoy1 + 7, "p1 fire 1"},
{"P1 Button 2" , BIT_DIGITAL , DrvJoy1 + 4, "p1 fire 2"},
{"P1 Button 3" , BIT_DIGITAL , DrvJoy3 + 0, "p1 fire 3"},
{"P2 Up" , BIT_DIGITAL , DrvJoy2 + 0, "p2 up" },
{"P2 Down" , BIT_DIGITAL , DrvJoy2 + 2, "p2 down" },
{"P2 Button 1" , BIT_DIGITAL , DrvJoy2 + 7, "p2 fire 1"},
{"P2 Button 2" , BIT_DIGITAL , DrvJoy2 + 4, "p2 fire 2"},
{"P2 Button 3" , BIT_DIGITAL , DrvJoy3 + 1, "p2 fire 3"},
{"Reset" , BIT_DIGITAL , &DrvReset , "reset" },
{"Dip 1" , BIT_DIPSWITCH, &DrvDips, "dip" },
};
STDINPUTINFO(combh)
static struct BurnDIPInfo bankpDIPList[]=
{
// Default Values
{0x10, 0xff, 0xff, 0x41, NULL },
{0 , 0xfe, 0 , 4 , "Coin A/B" },
{0x10, 0x01, 0x03, 0x03, "3C 1C" },
{0x10, 0x01, 0x03, 0x02, "2C 1C" },
{0x10, 0x01, 0x03, 0x01, "1C 1C" },
{0x10, 0x01, 0x03, 0x00, "1C 2C" },
{0 , 0xfe, 0 , 2 , "Coin C" },
{0x10, 0x01, 0x04, 0x04, "2C 1C" },
{0x10, 0x01, 0x04, 0x00, "1C 1C" },
{0 , 0xfe, 0 , 2 , "Lives" },
{0x10, 0x01, 0x08, 0x00, "3" },
{0x10, 0x01, 0x08, 0x08, "4" },
{0 , 0xfe, 0 , 2 , "Bonus Life" },
{0x10, 0x01, 0x10, 0x00, "70K 200K 500K..." },
{0x10, 0x01, 0x10, 0x10, "100K 400K 800K..." },
{0 , 0xfe, 0 , 2 , "Difficulty" },
{0x10, 0x01, 0x20, 0x00, "Easy" },
{0x10, 0x01, 0x20, 0x20, "Hard" },
{0 , 0xfe, 0 , 2 , "Demo Sounds" },
{0x10, 0x01, 0x40, 0x00, "Off" },
{0x10, 0x01, 0x40, 0x40, "On" },
{0 , 0xfe, 0 , 2 , "Cabinet" },
{0x10, 0x01, 0x80, 0x80, "Upright" },
{0x10, 0x01, 0x80, 0x00, "Cocktail" },
};
STDDIPINFO(bankp)
static struct BurnDIPInfo combhDIPList[]=
{
// Default Values
{0x10, 0xff, 0xff, 0x40, NULL },
{0 , 0xfe, 0 , 2 , "Flip Screen" },
{0x10, 0x01, 0x01, 0x00, "Off" },
{0x10, 0x01, 0x01, 0x01, "On" },
{0 , 0xfe, 0 , 4 , "Coinage" },
{0x10, 0x01, 0x06, 0x06, "2C 1C" },
{0x10, 0x01, 0x06, 0x00, "1C 1C" },
{0x10, 0x01, 0x06, 0x02, "1C 2C" },
{0x10, 0x01, 0x06, 0x04, "1C 3C" },
{0 , 0xfe, 0 , 2 , "Lives" },
{0x10, 0x01, 0x08, 0x00, "3" },
{0x10, 0x01, 0x08, 0x08, "4" },
{0 , 0xfe, 0 , 2 , "Cabinet" },
{0x10, 0x01, 0x10, 0x10, "Upright" },
{0x10, 0x01, 0x10, 0x00, "Cocktail" },
{0 , 0xfe, 0 , 2 , "Difficulty" },
{0x10, 0x01, 0x40, 0x00, "Easy" },
{0x10, 0x01, 0x40, 0x40, "Hard" },
{0 , 0xfe, 0 , 2 , "Fuel" },
{0x10, 0x01, 0x80, 0x00, "120 Units" },
{0x10, 0x01, 0x80, 0x80, "90 Units" },
};
STDDIPINFO(combh)
unsigned char __fastcall bankp_in(unsigned short address)
{
unsigned char ret = 0;
switch (address & 0xff)
{
case 0x00:
{
unsigned int i;
for (i = 0; i < 8; i++) ret |= DrvJoy1[i] << i;
// limit controls to 2-way
if ((ret & 0x05) == 0x05) ret &= 0xfa;
if ((ret & 0x0a) == 0x0a) ret &= 0xf5;
return ret;
}
case 0x01:
{
unsigned int i;
for (i = 0; i < 8; i++) ret |= DrvJoy2[i] << i;
// limit controls to 2-way
if ((ret & 0x05) == 0x05) ret &= 0xfa;
if ((ret & 0x0a) == 0x0a) ret &= 0xf5;
return ret;
}
case 0x02:
{
unsigned int i;
for (i = 0; i < 8; i++) ret |= DrvJoy3[i] << i;
return ret;
}
case 0x04:
return DrvDips;
}
return 0;
}
void __fastcall bankp_out(unsigned short address, unsigned char data)
{
switch (address & 0xff)
{
case 0x00:
// SN76496Write(0, data);
break;
case 0x01:
// SN76496Write(1, data);
break;
case 0x02:
// SN76496Write(2, data);
break;
case 0x05:
scroll_x = data;
break;
case 0x07:
{
priority = data & 0x03;
interrupt_enable = (data >> 4) & 1;
flipscreen = data & 0x20;
}
break;
}
}
static int DrvDoReset()
{
DrvReset = 0;
memset (Mem + 0xe000, 0, 0x2000);
CZetOpen(0);
CZetReset();
CZetClose();
scroll_x = 0, priority = 0, flipscreen = 0;
interrupt_enable = 0;
return 0;
}
static int bankp_palette_init()
{
int i;
unsigned int t_pal[32];
unsigned char *color_prom = Prom;
for (i = 0;i < 32;i++)
{
int bit0,bit1,bit2,r,g,b;
bit0 = (*color_prom >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01;
r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (*color_prom >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01;
g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
bit1 = (*color_prom >> 6) & 0x01;
bit2 = (*color_prom >> 7) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
r = (r >>3);
g = (g >>3);
b = (b >>3);
t_pal[i] = RGB(r,g,b);//(r << 16) | (g << 8) | b;
color_prom++;
}
//nbg2 mauvais
int j=0,k=0,delta=0;
for (i = 0;i < 32 * 4;i++) {
// colAddr[i] =
colBgAddr2[delta] = colBgAddr2[delta+4] = Palette[i] = t_pal[*color_prom & 0x0f];
delta++; if ((delta & 3) == 0) delta += 12;
color_prom++;
}
color_prom += 128;
delta=0;
for (i = 0;i < 16 * 8;i++) {
colBgAddr[delta] = Palette[i+0x80] = t_pal[*color_prom & 0x0f];
delta++; if ((delta & 7) == 0) delta += 8;
color_prom++;
}
return 0;
}
static int bankp_gfx_decode()
{
/* unsigned char *tmp = (unsigned char*)malloc(0x10000);
if (tmp == NULL) {
return 1;
}
memcpy (tmp, Gfx0, 0x10000);
*/
static int Char1PlaneOffsets[2] = { 0x00, 0x04 };
static int Char2PlaneOffsets[3] = { 0x00, 0x20000, 0x40000 };
static int Char1XOffsets[8] = { 0x43, 0x42, 0x41, 0x40, 0x03, 0x02, 0x01, 0x00 };
static int Char2XOffsets[8] = { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
static int CharYOffsets[8] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38 };
// GfxDecode(0x400, 2, 8, 8, Char1PlaneOffsets, Char1XOffsets, CharYOffsets, 0x080, tmp, Gfx0);
// memcpy (tmp, Gfx1, 0x10000);
// GfxDecode(0x800, 3, 8, 8, Char2PlaneOffsets, Char2XOffsets, CharYOffsets, 0x040, tmp, Gfx1);
// GfxDecode4Bpp(0x400, 2, 8, 8, Char1PlaneOffsets, Char1XOffsets, CharYOffsets, 0x080, Gfx0, cache);
GfxDecode4Bpp(0x400, 2, 8, 8, Char1PlaneOffsets, Char1XOffsets, CharYOffsets, 0x080, Gfx0, cache+0x10000);
// GfxDecode4Bpp(0x800, 3, 8, 8, Char2PlaneOffsets, Char2XOffsets, CharYOffsets, 0x040, Gfx1, &aVRAM[0x880]);
GfxDecode4Bpp(0x800, 3, 8, 8, Char2PlaneOffsets, Char2XOffsets, CharYOffsets, 0x040, Gfx1, cache);
unsigned int i;
//60
for (i=0x10060;i<0x10AA0;i++ ) //2600
cache[i] = cache[i]+0x44;//& 0x0f)| ((cache[i]& 0xf0));
for (i=0x10BE0;i<0x12520;i++ ) //2600
cache[i] = cache[i]+0x44;//& 0x0f)| ((cache[i]& 0xf0));
/*
for (i=0x12520;i<0x14800;i++ ) //2600
cache[i] = cache[i]+0x44;//& 0x0f)| ((cache[i]& 0xf0));
*/
/*
for (i=0x14800;i<0x14DE0;i++ ) //2600
cache[i] = cache[i]+0x44;//& 0x0f)| ((cache[i]& 0xf0));
*/
for (i=0x15380;i<0x154E0;i++ ) //15600
cache[i] = cache[i]+0x44;//& 0x0f)| ((cache[i]& 0xf0));
for (i=0x154E0;i<0x16000;i++ ) //5800
cache[i] = cache[i]+0x44;
for (i=0x16600;i<0x20000;i++ )
cache[i] = cache[i]+0x44;
// if ((cache[i]& 0x0f) ==0x00)cache[i] = cache[i] & 0xf0 | 0x4;
// else if ((cache[0x880+i]& 0x0f)==0x0f) cache[i] = cache[i] & 0x40;
// if ((cache[i]& 0xf0) ==0x00)cache[i] = 0xf0 | cache[i] & 0x04;
// else if ((cache[i]& 0xf0)==0xf0) cache[i] = cache[i] & 0x04;
/*
unsigned int i;
for (i = 0; i < 0x20000; i++) {
Gfx1[i] |= 0x80;
}
free (tmp);
*/
return 0;
}
static int DrvInit()
{
DrvInitSaturn();
Mem = (unsigned char*)malloc(0x10000 + 0x10000 + 0x20000 + 0x300 + 0x800);
if (Mem == NULL) {
return 1;
}
Rom = Mem + 0x00000;
Gfx0 = Mem + 0x10000;
Gfx1 = Mem + 0x20000;
Prom = Mem + 0x40000;
Palette = (int*)(Mem + 0x40200);
{
unsigned int i;
for (i = 0; i < 4; i++)
if (BurnLoadRom(Rom + i * 0x4000, i + 0, 1)) return 1;
if (BurnLoadRom(Gfx0 + 0x0000, 4, 1)) return 1;
if (BurnLoadRom(Gfx0 + 0x2000, 5, 1)) return 1;
for (i = 0; i < 6; i++)
if (BurnLoadRom(Gfx1 + i * 0x2000, i + 6, 1)) return 1;
if (BurnLoadRom(Prom + 0x0000, 12, 1)) return 1;
if (BurnLoadRom(Prom + 0x0020, 13, 1)) return 1;
if (BurnLoadRom(Prom + 0x0120, 14, 1)) return 1;
if (bankp_gfx_decode()) return 1;
bankp_palette_init();
}
CZetInit(1);
CZetOpen(0);
CZetSetInHandler(bankp_in);
CZetSetOutHandler(bankp_out);
CZetMapArea(0x0000, 0xdfff, 0, Rom + 0x0000);
CZetMapArea(0x0000, 0xdfff, 2, Rom + 0x0000);
CZetMapArea(0xe000, 0xefff, 0, Rom + 0xe000);
CZetMapArea(0xe000, 0xefff, 1, Rom + 0xe000);
CZetMapArea(0xe000, 0xefff, 2, Rom + 0xe000);
CZetMapArea(0xf000, 0xffff, 0, Rom + 0xf000);
CZetMapArea(0xf000, 0xffff, 1, Rom + 0xf000);
CZetMemEnd();
CZetClose();
// SN76489Init(0, 15468000 / 6, 0);
// SN76489Init(1, 15468000 / 6, 1);
// SN76489Init(2, 15468000 / 6, 1);
DrvDoReset();
return 0;
}
//-------------------------------------------------------------------------------------------------------------------------------------
static void initLayers()
{
#ifdef USE_MAP
/*
Uint16 CycleTb[]={
0x4eff, 0x1fff, //A0
// 0x2f6f,0xf5ff, //B0
// 0xffff, 0xffff, //A1
0xffff, 0xffff, //A1
// 0x4eff, 0x1fff, //A0
0x2f6f,0xf5ff, //B0
0xffff, 0xffff //B1
// 0x4eff, 0x1fff, //B1
};
*/ /*
Uint16 CycleTb[]={
0x4eff, 0x1f2f, //A0
// 0x2f6f,0xf5ff, //B0
0xffff, 0xffff, //A1
// 0xffff, 0xffff, //A1
// 0x4eff, 0x1fff, //A0
0xffff,0xf5f6, //B0
0xffff, 0xffff //B1
// 0x4eff, 0x1fff, //B1
};
*/
Uint16 CycleTb[]={
0x1f56, 0xffff, //A0
0xffff, 0xffff, //A1
0xf5f2,0x4eff, //B0
0xffff, 0xffff //B1
// 0x4eff, 0x1fff, //B1
};
#else
Uint16 CycleTb[]={
//0x44ee, 0xff5e, //A1
0xff5e, 0x44ee, //A1
0xffff, 0xffff, //A0
0xffff, 0xffff, //B1
0xffff,0xffff //B0
};
#endif
/*
voir page 58 vdp2
voir plutot p355 vdp2
*/
SclConfig scfg;
//A0 0x0000 0000
//A1 0x0004 0x005
//B0 0x0008
//B1 0x000c 1100
/*******************TILE MODE A GARDER*/
cache = (Uint8 *)SCL_VDP2_VRAM_A0;
/*********************************************/
int i;
#ifdef USE_MAP
// 3 nbg
scfg.dispenbl = ON;
scfg.charsize = SCL_CHAR_SIZE_1X1;//OK du 1*1 surtout pas toucher
scfg.pnamesize = SCL_PN2WORD; //2word
// scfg.flip = SCL_PN_12BIT;
scfg.platesize = SCL_PL_SIZE_1X1; // ou 2X2 ?
scfg.coltype = SCL_COL_TYPE_16;//SCL_COL_TYPE_256;
scfg.datatype = SCL_CELL;
// scfg.mapover = SCL_OVER_2; //ajout
// scfg.patnamecontrl = 0x000c;// VRAM B1 ‚̃IƒtƒZƒbƒg
// for(i=0;i<4;i++)
scfg.plate_addr[0] = ss_map2;
scfg.plate_addr[1] = 0x00;
SCL_SetConfig(SCL_NBG1, &scfg);
// 3 nbg
scfg.dispenbl = ON;
scfg.charsize = SCL_CHAR_SIZE_1X1;//OK du 1*1 surtout pas toucher
scfg.pnamesize = SCL_PN2WORD;
// scfg.flip = SCL_PN_12BIT;
scfg.platesize = SCL_PL_SIZE_1X1; // ou 2X2 ?
scfg.coltype = SCL_COL_TYPE_16;//SCL_COL_TYPE_256;
scfg.datatype = SCL_CELL;
// scfg.mapover = SCL_OVER_0; //ajout
// scfg.patnamecontrl = 0x0008;// VRAM B1 ‚̃IƒtƒZƒbƒg
//for(i=0;i<4;i++)
scfg.plate_addr[0] = ss_map;
scfg.plate_addr[1] = 0x00;
SCL_SetConfig(SCL_NBG2, &scfg);
#endif
/********************************************/
// SCL_InitConfigTb(&scfg);
scfg.dispenbl = ON;
scfg.bmpsize = SCL_BMP_SIZE_512X256;
scfg.coltype = SCL_COL_TYPE_16;//SCL_COL_TYPE_16;//SCL_COL_TYPE_256;
scfg.datatype = SCL_BITMAP;
scfg.mapover = SCL_OVER_0;
scfg.plate_addr[0] = ss_font;
// 3 nbg
SCL_SetConfig(SCL_NBG0, &scfg);
SCL_SetCycleTable(CycleTb);
}
//-------------------------------------------------------------------------------------------------------------------------------------
static void initPosition()
{
#ifdef VBTLIB
SCL_Open();
// SCL_MoveTo(FIXED(0), FIXED(0),0);
//SCL_MoveTo(FIXED(0), FIXED(0),0);
// Scl_n_reg.n0_move_x = 0;
// Scl_n_reg.n0_move_y = -32;
// Scl_n_reg.n1_move_x = (-8<<16) ;
// Scl_n_reg.n1_move_y = (-32<<16) ;
// vbt à remettre
// Scl_n_reg.n2_move_x = (-8);
Scl_n_reg.n1_move_y = 16 <<16;
Scl_n_reg.n2_move_y = 16;//(0<<16) ;
SCL_Close();
#endif
}
//-------------------------------------------------------------------------------------------------------------------------------------
static void initColors()
{
// colAddr = (Uint16*)SCL_AllocColRam(SCL_SPR,OFF);
// Uint16* grey = SCL_AllocColRam(SCL_NBG0,OFF);
// colBgAddr = (Uint16*)SCL_COLRAM_ADDR;//(Uint16*)SCL_AllocColRam(SCL_NBG1,ON);
// SCL_Open();
colBgAddr = (Uint16*)SCL_AllocColRam(SCL_NBG1,ON); //ON
(Uint16*)SCL_AllocColRam(SCL_NBG3,ON);
(Uint16*)SCL_AllocColRam(SCL_NBG3,ON);
colBgAddr2 =(Uint16*)SCL_AllocColRam(SCL_NBG2,OFF);//OFF);
// (Uint16*)SCL_AllocColRam(SCL_NBG3,ON);
// (Uint16*)SCL_AllocColRam(SCL_NBG3,ON);
// SCL_Close();
// (Uint16*)SCL_AllocColRam(SCL_NBG0,ON);
// colBgAddr2 = (Uint16*)SCL_AllocColRam(SCL_NBG2,OFF);
// colAddr = (Uint16*)SCL_AllocColRam(SCL_SPR,OFF);
/*
unsigned short palette[4]=
{
RGB( 164>>3, 181>>3, 197>>3),RGB( 0,0,0 ),RGB( 164>>3, 181>>3, 197>>3),RGB( 214>>3, 230>>3, 247>>3 ),
// RGB( 0, 0, 0 ),RGB( 0,0,0 ),RGB( 164>>3, 247>>3, 197>>3 ),RGB( 99>>3, 197>>3, 148>>3 ),
// RGB( 0, 0, 0 ),RGB( 0,0,0 ),RGB( 247>>3, 132>>3, 132>>3 ),RGB( 247>>3, 230>>3, 132>>3 ),
// RGB( 0, 0, 0 ),RGB( 0>>3 , 73>>3 , 231>>3 ),RGB( 0>>3 , 182>>3, 231>>3 ),RGB( 148>>3, 219>>3, 247>>3 )
};
SCL_SetColRam(SCL_NBG0,8,4,palette);
*/
}
//-------------------------------------------------------------------------------------------------------------------------------------
static void drawGrey()
{
Uint16 *VRAM;
int x,j;
VRAM = (Uint16 *)SCL_VDP2_VRAM_B0;
for( x = 0; x < 224; x++ )
{
for( j = 0; j < 6; j++ ) //x
*VRAM++ = 0xaaaa;
VRAM += (56);
for( j = 0; j < 32; j++ ) //x
*VRAM++ = 0xaaaa;
VRAM += (34);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------
static void DrvInitSaturn()
{
ss_map =(Uint16 *)SCL_VDP2_VRAM_B1;
ss_map2 =(Uint16 *)SCL_VDP2_VRAM_A1;
ss_font =(Uint16 *)SCL_VDP2_VRAM_B0;
Scl_s_reg.tvmode &= 0xfff0;
Scl_s_reg.tvmode |= 0x0001;
if(SclProcess == 0) SclProcess = 1;
// SpTvMode = 0x0007 & SPR_TV_NORMAL;
// SPR_WRITE_REG(SPR_W_TVMR, 0x0007 & SPR_TV_NORMAL);
// SPR_SetEraseData( 0x0000, 0, 0, 352-1, 224-1 );
//3 nbg
// SCL_SetPriority(SCL_SPR,6);//6
SCL_SetPriority(SCL_NBG0,7);
SCL_SetPriority(SCL_NBG2,5);
SCL_SetPriority(SCL_NBG1,4);//5
/* Enable line and vertical cell scroll for NBG0 */
#ifdef VBTLIB
// (*(Uint16 *)0x25F8009A) = 0x0003;
// (*(Uint16 *)0x25F80020) = 0x0303;
#endif
// initSprites();
SetVblank();
initLayers();
initPosition();
initColors();
//initScrolling(); // utilisé ?
// memset(&aVRAM[0x880],0,0x40000);
// memset(cache,0,sizeof(cache));
//memset((Uint16 *)SCL_VDP2_VRAM_B0,0,0x10000);
// hz = get_hz();
// initScrolling(); // utilisé ?
drawGrey();
}
//-------------------------------------------------------------------------------------------------------------------------------------
static int DrvExit()
{
CZetExit();
// SN76496Exit();
free (Mem);
scroll_x = priority = flipscreen = interrupt_enable = 0;
Rom = Gfx0 = Gfx1 = Prom = NULL;
Palette = NULL;
return 0;
}
/*
static void bankp_plot_pixel(int x, int y, int color, unsigned char src, int transp)
{
if (x > 223 || x < 0 || y > 223 || y < 0) return;
int pxl = Palette[color | src];
if (transp && !pxl) return;
// PutPix(pBurnDraw + (y * 224 + x) * nBurnBpp, BurnHighCol(pxl >> 16, pxl >> 8, pxl, 0));
}
static void draw_8x8_tiles(unsigned char *gfx_base, int code, int color, int sx, int sy, int flipx, int flipy, int transp)
{
unsigned char *src = gfx_base + (code << 6);
if (flipy)
{
unsigned int y;
for (y = sy + 7; y >= sy; y--)
{
unsigned int x;
if (flipx)
{
for (x = sx + 7; x >= sx; x--, src++) {
bankp_plot_pixel(x, y, color, *src, transp);
}
} else {
for (x = sx; x < sx + 8; x++, src++) {
bankp_plot_pixel(x, y, color, *src, transp);
}
}
}
} else {
unsigned int y,x;
for (y = sy; y < sy + 8; y++)
{
if (flipx)
{
for (x = sx + 7; x >= sx; x--, src++) {
bankp_plot_pixel(x, y, color, *src, transp);
}
} else {
for (x = sx; x < sx + 8; x++, src++) {
bankp_plot_pixel(x, y, color, *src, transp);
}
}
}
}
}
*/
static void draw_bg_tiles(int prio)
{
int offs;
for (offs = 0; offs < 0x400; offs++)
{
int code, color, flipx, sx, sy;
code = Rom[0xf800 + offs] | ((Rom[0xfc00 + offs] & 7) << 8);
color = (Rom[0xfc00 + offs] >> 1) & 0x78;
flipx = Rom[0xfc00 + offs] & 0x08;
/*
if (flipscreen) {
sx = (~offs << 3) & 0xf8;
sy = (~offs >> 2) & 0xf8;
flipx ^= 0x08;
} else {
sx = ( offs << 3) & 0xf8;
sy = ( offs >> 2) & 0xf8;
}
*/
sx = (offs) & 0x1f;
sy = ((offs) >> 5)<<6;
register int x = (sx | sy)<<1; //-0x40
//NBG1
ss_map2[x] = flipx <<11 | color>>3;//color/8;
ss_map2[x+1] = code;
// draw_8x8_tiles(Gfx1, code, color, sx - 24, sy - 16, flipx, flipscreen, prio);
}
}
static void draw_fg_tiles(int prio)
{
int offs;
for (offs = 0; offs < 0x400; offs++)
{
int code, color, flipx, sx, sy;
code = Rom[0xf000 + offs] | ((Rom[0xf400 + offs] & 3) << 8);
color = (Rom[0xf400 + offs] >> 1) & 0x7c;
flipx = Rom[0xf400 + offs] & 0x04;
/*
if (flipscreen) {
sx = ((~offs << 3) - scroll_x) & 0xff;
sy = (~offs >> 2) & 0xf8;
flipx ^= 4;
} else {
sx = (( offs << 3) - scroll_x) & 0xff;
sy = ( offs >> 2) & 0xf8;
} */
// draw_8x8_tiles(Gfx0, code, color, sx - 24, sy - 16, flipx, flipscreen, prio);
sx = (offs) & 0x1f;
sy = (offs >> 5)<<6; //+0x40
register int x = (sx | sy)<<1;
//NBG2
ss_map[x] = ss_map[x+0x40] = ss_map[x+0x1000] = ss_map[x+0x1040] = flipx <<12 | color>>2;//color /8;
ss_map[x+1] = ss_map[x+0x41] = ss_map[x+0x1001] = ss_map[x+0x1041] = code+2048;
// ss_map2[x+1] = ss_map2[x+0x41] = 2048;
}
}
static int DrvDraw()
{
/*
SCL_SetPriority(SCL_NBG2,5);
SCL_SetPriority(SCL_NBG1,4);//5
*/
if (priority & 0x02)
SCL_SetPriority(SCL_NBG1,6);
else
SCL_SetPriority(SCL_NBG1,4);
draw_bg_tiles(1);
draw_fg_tiles(0);
Scl_n_reg.n2_move_x = scroll_x;//-24;
return 0;
}
static int DrvFrame()
{
if (DrvReset) {
DrvDoReset();
}
CZetOpen(0);
CZetRun(2578000 / 60);
if (interrupt_enable) CZetNmi();
CZetClose();
// SN76496Update(0, pBurnSoundOut, nBurnSoundLen);
// SN76496Update(1, pBurnSoundOut, nBurnSoundLen);
// SN76496Update(2, pBurnSoundOut, nBurnSoundLen);
// if (pBurnDraw)
{
DrvDraw();
}
return 0;
}
/*
static int DrvScan(int nAction,int *pnMin)
{
struct BurnArea ba;
if (pnMin) {
*pnMin = 0x029521;
}
if (nAction & ACB_VOLATILE) {
memset(&ba, 0, sizeof(ba));
ba.Data = Rom + 0xe000;
ba.nLen = 0x2000;
ba.szName = "All Ram";
BurnAcb(&ba);
CZetScan(nAction);
SCAN_VAR(scroll_x);
SCAN_VAR(priority);
SCAN_VAR(flipscreen);
SCAN_VAR(interrupt_enable);
}
return 0;
}
*/
// Bank Panic
static struct BurnRomInfo bankpRomDesc[] = {
{ "epr6175.bin", 0x4000, 0x044552b8, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code
{ "epr6174.bin", 0x4000, 0xd29b1598, 1 | BRF_ESS | BRF_PRG }, // 1
{ "epr6173.bin", 0x4000, 0xb8405d38, 1 | BRF_ESS | BRF_PRG }, // 2
{ "epr6176.bin", 0x2000, 0xc98ac200, 1 | BRF_ESS | BRF_PRG }, // 3
{ "epr6165.bin", 0x2000, 0xaef34a93, 2 | BRF_GRA }, // 4 Playfield #1 chars
{ "epr6166.bin", 0x2000, 0xca13cb11, 2 | BRF_GRA }, // 5
{ "epr6172.bin", 0x2000, 0xc4c4878b, 3 | BRF_GRA }, // 6 Playfield #2 chars
{ "epr6171.bin", 0x2000, 0xa18165a1, 3 | BRF_GRA }, // 7
{ "epr6170.bin", 0x2000, 0xb58aa8fa, 3 | BRF_GRA }, // 8
{ "epr6169.bin", 0x2000, 0x1aa37fce, 3 | BRF_GRA }, // 9
{ "epr6168.bin", 0x2000, 0x05f3a867, 3 | BRF_GRA }, // 10
{ "epr6167.bin", 0x2000, 0x3fa337e1, 3 | BRF_GRA }, // 11
{ "pr6177.clr", 0x0020, 0xeb70c5ae, 4 | BRF_GRA }, // 12 (unsigned int*)Palette
{ "pr6178.clr", 0x0100, 0x0acca001, 4 | BRF_GRA }, // 13 Charset #1 lut
{ "pr6179.clr", 0x0100, 0xe53bafdb, 4 | BRF_GRA }, // 14 Charset #2 lut
{ "3155074.2c", 0x025b, 0x2e57bbba, 0 | BRF_OPT }, // 15
// { "3155073.pal16l4", 0x0001, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 16 read protected
};
STD_ROM_PICK(bankp)
STD_ROM_FN(bankp)
struct BurnDriver BurnDrvbankp = {
"bankp", NULL, NULL, "1984",
"Bank Panic\0", NULL, "[Sanritsu] Sega", "Misc",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
NULL, bankpRomInfo, bankpRomName, bankpInputInfo, bankpDIPInfo,
DrvInit, DrvExit, DrvFrame, DrvDraw, NULL/*DrvScan*/, 0, NULL, NULL, NULL, NULL,
224, 224, 4, 3
};
// Combat Hawk
static struct BurnRomInfo combhRomDesc[] = {
{ "epr10904.7e", 0x4000, 0x4b106335, 1 | BRF_ESS | BRF_PRG }, // 0 Z80 Code
{ "epr10905.7f", 0x4000, 0xa76fc390, 1 | BRF_ESS | BRF_PRG }, // 1
{ "epr10906.7h", 0x4000, 0x16d54885, 1 | BRF_ESS | BRF_PRG }, // 2
{ "epr10903.7d", 0x2000, 0xb7a59cab, 1 | BRF_ESS | BRF_PRG }, // 3
{ "epr10914.5l", 0x2000, 0x7d7a2340, 2 | BRF_GRA }, // 4 Playfield #1 chars
{ "epr10913.5k", 0x2000, 0xd5c1a8ae, 2 | BRF_GRA }, // 5
{ "epr10907.5b", 0x2000, 0x08e5eea3, 3 | BRF_GRA }, // 6 Playfield #2 chars
{ "epr10908.5d", 0x2000, 0xd9e413f5, 3 | BRF_GRA }, // 7
{ "epr10909.5e", 0x2000, 0xfec7962c, 3 | BRF_GRA }, // 8
{ "epr10910.5f", 0x2000, 0x33db0fa7, 3 | BRF_GRA }, // 9
{ "epr10911.5h", 0x2000, 0x565d9e6d, 3 | BRF_GRA }, // 10
{ "epr10912.5i", 0x2000, 0xcbe22738, 3 | BRF_GRA }, // 11
{ "pr10900.8a", 0x0020, 0xf95fcd66, 4 | BRF_GRA }, // 12 (unsigned int*)Palette
{ "pr10901.6f", 0x0100, 0x6fd981c8, 4 | BRF_GRA }, // 13 Charset #1 lut
{ "pr10902.5a", 0x0100, 0x84d6bded, 4 | BRF_GRA }, // 14 Charset #2 lut
{ "3155074.2c", 0x025b, 0x2e57bbba, 0 | BRF_OPT }, // 15
// { "3155073.pal16l4", 0x0001, 0x00000000, 0 | BRF_OPT | BRF_NODUMP }, // 16 read protected
};
STD_ROM_PICK(combh)
STD_ROM_FN(combh)
struct BurnDriver BurnDrvcombh = {
"combh", NULL, NULL, "1987",
"Combat Hawk\0", NULL, "Sega / Sanritsu", "Misc",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_ORIENTATION_VERTICAL, 2, HARDWARE_MISC_PRE90S, GBF_MISC, 0,
NULL, combhRomInfo, combhRomName, combhInputInfo, combhDIPInfo,
DrvInit, DrvExit, DrvFrame, DrvDraw, NULL/*DrvScan*/, 0, NULL, NULL, NULL, NULL, 0x100,
224, 224, 3, 4
};