Modernization of drivers part 22 (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2013-02-13 13:19:20 +00:00
parent 67af3f42af
commit a1819a469e
44 changed files with 1495 additions and 1441 deletions

View File

@ -326,6 +326,7 @@ public:
TIMER_CALLBACK_MEMBER(coin_input_reset);
TIMER_CALLBACK_MEMBER(hopper_reset);
TIMER_DEVICE_CALLBACK_MEMBER(aristmk4_pf);
inline void uBackgroundColour();
};
/* Partial Cashcade protocol */
@ -340,9 +341,8 @@ void aristmk4_state::video_start()
}
}
INLINE void uBackgroundColour(running_machine &machine)
void aristmk4_state::uBackgroundColour()
{
aristmk4_state *state = machine.driver_data<aristmk4_state>();
/* SW7 can be set when the main door is open, this allows the colours for the background
to be adjusted whilst the machine is running.
@ -350,27 +350,27 @@ INLINE void uBackgroundColour(running_machine &machine)
There are 4 possible combinations for colour select via SW7, colours vary based on software installed.
*/
switch(state->ioport("SW7")->read())
switch(ioport("SW7")->read())
{
case 0x00:
// restore defaults
memcpy(state->m_shapeRomPtr,state->m_shapeRom, sizeof(state->m_shapeRom)); // restore defaults, both switches off
memcpy(m_shapeRomPtr,m_shapeRom, sizeof(m_shapeRom)); // restore defaults, both switches off
// OE enabled on both shapes
break;
case 0x01:
// unselect U22 via SW7. OE on U22 is low.
memset(&state->m_shapeRomPtr[0x4000],0xff,0x2000); // fill unused space with 0xff
memcpy(&state->m_shapeRomPtr[0xa000],&state->m_shapeRom[0xa000], 0x2000); // restore defaults here
memset(&m_shapeRomPtr[0x4000],0xff,0x2000); // fill unused space with 0xff
memcpy(&m_shapeRomPtr[0xa000],&m_shapeRom[0xa000], 0x2000); // restore defaults here
break;
case 0x02:
// unselect U47 via SW7. OE on U47 is low.
memcpy(&state->m_shapeRomPtr[0x4000],&state->m_shapeRom[0x4000], 0x2000);
memset(&state->m_shapeRomPtr[0xa000],0xff,0x2000);
memcpy(&m_shapeRomPtr[0x4000],&m_shapeRom[0x4000], 0x2000);
memset(&m_shapeRomPtr[0xa000],0xff,0x2000);
break;
case 0x03:
// unselect U47 & U22 via SW7. Both output enable low.
memset(&state->m_shapeRomPtr[0x4000],0xff,0x2000);
memset(&state->m_shapeRomPtr[0xa000],0xff,0x2000);
memset(&m_shapeRomPtr[0x4000],0xff,0x2000);
memset(&m_shapeRomPtr[0xa000],0xff,0x2000);
break;
}
}
@ -393,7 +393,7 @@ UINT32 aristmk4_state::screen_update_aristmk4(screen_device &screen, bitmap_ind1
color = ((m_mkiv_vram[count]) & 0xe0) >> 5;
tile = (m_mkiv_vram[count+1]|m_mkiv_vram[count]<<8) & 0x3ff;
bgtile = (m_mkiv_vram[count+1]|m_mkiv_vram[count]<<8) & 0xff; // first 256 tiles
uBackgroundColour(machine()); // read sw7
uBackgroundColour(); // read sw7
gfx->decode(bgtile); // force the machine to update only the first 256 tiles.
// as we only update the background, not the entire display.
flipx = ((m_mkiv_vram[count]) & 0x04);

View File

@ -60,6 +60,12 @@ public:
DECLARE_MACHINE_RESET(airrace);
UINT32 screen_update_atarisy4(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_int);
void image_mem_to_screen( bool clip);
void draw_polygon(UINT16 color);
void execute_gpu_command();
inline UINT8 hex_to_ascii(UINT8 in);
void load_ldafile(address_space &space, const UINT8 *file);
void load_hexfile(address_space &space, const UINT8 *file);
};
@ -207,7 +213,7 @@ INLINE UINT32 xy_to_screen_addr(UINT32 x, UINT32 y)
return (y * 4096) + offset + x;
}
static void image_mem_to_screen(atarisy4_state *state, bool clip)
void atarisy4_state::image_mem_to_screen(bool clip)
{
INT16 y = gpu.gr[1] - 0x200;
UINT16 h = gpu.gr[3];
@ -230,14 +236,14 @@ static void image_mem_to_screen(atarisy4_state *state, bool clip)
{
if (x >= 0 && x <= 511)
{
UINT16 pix = state->m_screen_ram[xy_to_screen_addr(x,y) >> 1];
UINT16 pix = m_screen_ram[xy_to_screen_addr(x,y) >> 1];
if (x & 1)
pix = (pix & (0x00ff)) | gpu.idr << 8;
else
pix = (pix & (0xff00)) | gpu.idr;
state->m_screen_ram[xy_to_screen_addr(x,y) >> 1] = pix;
m_screen_ram[xy_to_screen_addr(x,y) >> 1] = pix;
}
++x;
}
@ -266,17 +272,17 @@ static void draw_scanline(void *dest, INT32 scanline, const poly_extent *extent,
}
}
static void draw_polygon(atarisy4_state *state, UINT16 color)
void atarisy4_state::draw_polygon(UINT16 color)
{
int i;
rectangle clip;
poly_vertex v1, v2, v3;
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly);
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(m_poly);
clip.set(0, 511, 0, 511);
extra->color = color;
extra->screen_ram = state->m_screen_ram;
extra->screen_ram = m_screen_ram;
v1.x = gpu.points[0].x;
v1.y = gpu.points[0].y;
@ -290,7 +296,7 @@ static void draw_polygon(atarisy4_state *state, UINT16 color)
v3.x = gpu.points[i].x;
v3.y = gpu.points[i].y;
poly_render_triangle(state->m_poly, 0, clip, draw_scanline, 1, &v1, &v2, &v3);
poly_render_triangle(m_poly, 0, clip, draw_scanline, 1, &v1, &v2, &v3);
v2 = v3;
}
}
@ -323,9 +329,8 @@ static void draw_polygon(atarisy4_state *state, UINT16 color)
PFVR 0x2B Polygon vector relative
PFC 0x2C Polygon close
*/
void execute_gpu_command(running_machine &machine)
void atarisy4_state::execute_gpu_command()
{
atarisy4_state *state = machine.driver_data<atarisy4_state>();
switch (gpu.ecr)
{
case 0x04:
@ -378,18 +383,18 @@ void execute_gpu_command(running_machine &machine)
for (i = 0; i < gpu.gr[3]; ++i)
{
UINT16 val = state->m_screen_ram[offset >> 1];
UINT16 val = m_screen_ram[offset >> 1];
val >>= (~offset & 1) << 3;
if (gpu.gr[4] & 0x10)
state->m_r_color_table[table_offs] = val;
m_r_color_table[table_offs] = val;
if (gpu.gr[4] & 0x20)
state->m_g_color_table[table_offs] = val;
m_g_color_table[table_offs] = val;
if (gpu.gr[4] & 0x40)
state->m_b_color_table[table_offs] = val;
m_b_color_table[table_offs] = val;
/* Update */
palette_set_color(machine, table_offs, MAKE_RGB(state->m_r_color_table[table_offs], state->m_g_color_table[table_offs], state->m_b_color_table[table_offs]));
palette_set_color(machine(), table_offs, MAKE_RGB(m_r_color_table[table_offs], m_g_color_table[table_offs], m_b_color_table[table_offs]));
++table_offs;
++offset;
@ -399,12 +404,12 @@ void execute_gpu_command(running_machine &machine)
}
case 0x20:
{
image_mem_to_screen(state, false);
image_mem_to_screen(false);
break;
}
case 0x21:
{
image_mem_to_screen(state, true);
image_mem_to_screen(true);
break;
}
case 0x28:
@ -439,8 +444,8 @@ void execute_gpu_command(running_machine &machine)
}
case 0x2c:
{
draw_polygon(state, gpu.gr[2]);
poly_wait(state->m_poly, "Normal");
draw_polygon(gpu.gr[2]);
poly_wait(m_poly, "Normal");
break;
}
default:
@ -476,7 +481,7 @@ WRITE16_MEMBER(atarisy4_state::gpu_w)
case 0x17:
{
gpu.ecr = data;
execute_gpu_command(machine());
execute_gpu_command();
break;
}
case 0x1a: gpu.far = data; break;
@ -795,7 +800,7 @@ ROM_END
*
*************************************/
INLINE UINT8 hex_to_ascii(UINT8 in)
UINT8 atarisy4_state::hex_to_ascii(UINT8 in)
{
if (in < 0x3a)
return in - 0x30;
@ -805,7 +810,7 @@ INLINE UINT8 hex_to_ascii(UINT8 in)
return in;
}
void load_ldafile(address_space &space, const UINT8 *file)
void atarisy4_state::load_ldafile(address_space &space, const UINT8 *file)
{
#define READ_CHAR() file[i++]
int i = 0;
@ -859,7 +864,7 @@ void load_ldafile(address_space &space, const UINT8 *file)
}
/* Load memory space with data from a Tektronix-Extended HEX file */
void load_hexfile(address_space &space, const UINT8 *file)
void atarisy4_state::load_hexfile(address_space &space, const UINT8 *file)
{
#define READ_HEX_CHAR() hex_to_ascii(file[i++])

View File

@ -89,11 +89,6 @@
#define M6809_XTAL 1000000
/*
Function prototypes
*/
INLINE void z80_bank(running_machine &machine, int num, int data);
/***************************************************************************
@ -308,6 +303,10 @@ public:
void exec_w_phase(UINT8 data);
void init_ram();
void command_phase(struct fdc_t &fdc, UINT8 data);
inline UINT8* blitter_get_addr(UINT32 addr);
inline void z80_bank(int num, int data);
UINT8 exec_r_phase(void);
UINT8 results_phase(void);
};
@ -434,28 +433,27 @@ UINT32 bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb32
return 0;
}
INLINE UINT8* blitter_get_addr(running_machine &machine, UINT32 addr)
UINT8* bfcobra_state::blitter_get_addr(UINT32 addr)
{
bfcobra_state *state = machine.driver_data<bfcobra_state>();
if (addr < 0x10000)
{
/* Is this region fixed? */
return (UINT8*)(state->memregion("user1")->base() + addr);
return (UINT8*)(memregion("user1")->base() + addr);
}
else if(addr < 0x20000)
{
addr &= 0xffff;
addr += (state->m_bank_data[0] & 1) ? 0x10000 : 0;
addr += (m_bank_data[0] & 1) ? 0x10000 : 0;
return (UINT8*)(machine.root_device().memregion("user1")->base() + addr + ((state->m_bank_data[0] >> 1) * 0x20000));
return (UINT8*)(machine().root_device().memregion("user1")->base() + addr + ((m_bank_data[0] >> 1) * 0x20000));
}
else if (addr >= 0x20000 && addr < 0x40000)
{
return (UINT8*)&state->m_video_ram[addr - 0x20000];
return (UINT8*)&m_video_ram[addr - 0x20000];
}
else
{
return (UINT8*)&state->m_work_ram[addr - 0x40000];
return (UINT8*)&m_work_ram[addr - 0x40000];
}
}
@ -467,7 +465,7 @@ INLINE UINT8* blitter_get_addr(running_machine &machine, UINT32 addr)
*/
void bfcobra_state::RunBlit(address_space &space)
{
#define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(space.machine(), blitter.program.addr++))
#define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(blitter.program.addr++))
struct blitter_t &blitter = m_blitter;
int cycles_used = 0;
@ -577,7 +575,7 @@ void bfcobra_state::RunBlit(address_space &space)
blitter.source.addr0 -=blitter.step;
}
*blitter_get_addr(space.machine(), blitter.dest.addr) = blitter.pattern;
*blitter_get_addr( blitter.dest.addr) = blitter.pattern;
cycles_used++;
} while (--innercnt);
@ -591,7 +589,7 @@ void bfcobra_state::RunBlit(address_space &space)
if (LOOPTYPE == 3 && innercnt == blitter.innercnt)
{
srcdata = *(blitter_get_addr(space.machine(), blitter.source.addr & 0xfffff));
srcdata = *(blitter_get_addr( blitter.source.addr & 0xfffff));
blitter.source.loword++;
cycles_used++;
}
@ -601,7 +599,7 @@ void bfcobra_state::RunBlit(address_space &space)
{
if (LOOPTYPE == 0 || LOOPTYPE == 1)
{
srcdata = *(blitter_get_addr(space.machine(), blitter.source.addr & 0xfffff));
srcdata = *(blitter_get_addr( blitter.source.addr & 0xfffff));
cycles_used++;
if (blitter.modectl & MODE_SSIGN)
@ -616,7 +614,7 @@ void bfcobra_state::RunBlit(address_space &space)
/* Read destination pixel? */
if (LOOPTYPE == 0)
{
dstdata = *blitter_get_addr(space.machine(), blitter.dest.addr & 0xfffff);
dstdata = *blitter_get_addr( blitter.dest.addr & 0xfffff);
cycles_used++;
}
@ -685,10 +683,10 @@ void bfcobra_state::RunBlit(address_space &space)
The existing destination pixel is used as a lookup
into the table and the colours is replaced.
*/
UINT8 dest = *blitter_get_addr(space.machine(), blitter.dest.addr);
UINT8 newcol = *(blitter_get_addr(space.machine(), (blitter.source.addr + dest) & 0xfffff));
UINT8 dest = *blitter_get_addr( blitter.dest.addr);
UINT8 newcol = *(blitter_get_addr( (blitter.source.addr + dest) & 0xfffff));
*blitter_get_addr(space.machine(), blitter.dest.addr) = newcol;
*blitter_get_addr( blitter.dest.addr) = newcol;
cycles_used += 3;
}
else
@ -707,7 +705,7 @@ void bfcobra_state::RunBlit(address_space &space)
if (blitter.compfunc & CMPFUNC_LOG0)
final_result |= ~result & ~dstdata;
*blitter_get_addr(space.machine(), blitter.dest.addr) = final_result;
*blitter_get_addr( blitter.dest.addr) = final_result;
cycles_used++;
}
}
@ -956,7 +954,7 @@ WRITE8_MEMBER(bfcobra_state::chipset_w)
data &= 0x3f;
m_bank_data[offset] = data;
z80_bank(machine(), offset, data);
z80_bank(offset, data);
break;
}
@ -1031,33 +1029,32 @@ WRITE8_MEMBER(bfcobra_state::chipset_w)
}
}
INLINE void z80_bank(running_machine &machine, int num, int data)
void bfcobra_state::z80_bank(int num, int data)
{
bfcobra_state *state = machine.driver_data<bfcobra_state>();
static const char * const bank_names[] = { "bank1", "bank2", "bank3" };
if (data < 0x08)
{
UINT32 offset = ((state->m_bank_data[0] >> 1) * 0x20000) + ((0x4000 * data) ^ ((state->m_bank_data[0] & 1) ? 0 : 0x10000));
UINT32 offset = ((m_bank_data[0] >> 1) * 0x20000) + ((0x4000 * data) ^ ((m_bank_data[0] & 1) ? 0 : 0x10000));
state->membank(bank_names[num - 1])->set_base(machine.root_device().memregion("user1")->base() + offset);
membank(bank_names[num - 1])->set_base(machine().root_device().memregion("user1")->base() + offset);
}
else if (data < 0x10)
{
state->membank(bank_names[num - 1])->set_base(&state->m_video_ram[(data - 0x08) * 0x4000]);
membank(bank_names[num - 1])->set_base(&m_video_ram[(data - 0x08) * 0x4000]);
}
else
{
state->membank(bank_names[num - 1])->set_base(&state->m_work_ram[(data - 0x10) * 0x4000]);
membank(bank_names[num - 1])->set_base(&m_work_ram[(data - 0x10) * 0x4000]);
}
}
WRITE8_MEMBER(bfcobra_state::rombank_w)
{
m_bank_data[0] = data;
z80_bank(machine(), 1, m_bank_data[1]);
z80_bank(machine(), 2, m_bank_data[2]);
z80_bank(machine(), 3, m_bank_data[3]);
z80_bank(1, m_bank_data[1]);
z80_bank(2, m_bank_data[2]);
z80_bank(3, m_bank_data[3]);
}
@ -1297,7 +1294,7 @@ void bfcobra_state::command_phase(struct fdc_t &fdc, UINT8 data)
}
#ifdef UNUSED_FUNCTION
UINT8 exec_r_phase(void)
UINT8 bfcobra_state::exec_r_phase(void)
{
return 0;
}
@ -1308,7 +1305,7 @@ void bfcobra_state::exec_w_phase(UINT8 data)
}
#ifdef UNUSED_FUNCTION
UINT8 results_phase(void)
UINT8 bfcobra_state::results_phase(void)
{
return 0;
}

View File

@ -181,6 +181,9 @@ public:
virtual void machine_reset();
INTERRUPT_GEN_MEMBER(timer_irq);
void sc1_common_init(int reels, int decrypt, int defaultbank);
void Scorpion1_SetSwitchState(int strobe, int data, int state);
int Scorpion1_GetSwitchState(int strobe, int data);
int sc1_find_project_string( );
};
#define VFD_RESET 0x20
@ -192,19 +195,19 @@ public:
///////////////////////////////////////////////////////////////////////////
static void Scorpion1_SetSwitchState(bfm_sc1_state *drvstate, int strobe, int data, int state)
void bfm_sc1_state::Scorpion1_SetSwitchState(int strobe, int data, int state)
{
if ( state ) drvstate->m_sc1_Inputs[strobe] |= (1<<data);
else drvstate->m_sc1_Inputs[strobe] &= ~(1<<data);
if ( state ) m_sc1_Inputs[strobe] |= (1<<data);
else m_sc1_Inputs[strobe] &= ~(1<<data);
}
///////////////////////////////////////////////////////////////////////////
#ifdef UNUSED_FUNCTION
static int Scorpion1_GetSwitchState(bfm_sc1_state *drvstate, int strobe, int data)
int bfm_sc1_state::Scorpion1_GetSwitchState(int strobe, int data)
{
int state = 0;
if ( strobe < 7 && data < 8 ) state = (drvstate->sc1_Inputs[strobe] & (1<<data))?1:0;
if ( strobe < 7 && data < 8 ) state = (sc1_Inputs[strobe] & (1<<data))?1:0;
return state;
}
@ -1171,12 +1174,12 @@ void bfm_sc1_state::sc1_common_init(int reels, int decrypt, int defaultbank)
}
int sc1_find_project_string(running_machine &machine )
int bfm_sc1_state::sc1_find_project_string( )
{
// search for the project string to find the title (usually just at ff00)
char title_string[7][32] = { "PROJECT NUMBER", "PROJECT PR", "PROJECT ", "CASH ON THE NILE 2", "PR6121", "CHINA TOWN\x0d\x0a", "PROJECTNUMBER" };
UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
int size = machine.root_device().memregion( "maincpu" )->bytes();
UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
int size = machine().root_device().memregion( "maincpu" )->bytes();
for (int search=0;search<7;search++)
{
@ -1252,21 +1255,21 @@ DRIVER_INIT_MEMBER(bfm_sc1_state,toppoker)
sc1_common_init(3,1, 3);
adder2_decode_char_roms(machine()); // decode GFX roms
MechMtr_config(machine(),8);
sc1_find_project_string(machine());
sc1_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc1_state,lotse)
{
sc1_common_init(6,1, 3);
MechMtr_config(machine(),8);
sc1_find_project_string(machine());
sc1_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc1_state,lotse_bank0)
{
sc1_common_init(6,1, 0);
MechMtr_config(machine(),8);
sc1_find_project_string(machine());
sc1_find_project_string();
}
@ -1274,14 +1277,14 @@ DRIVER_INIT_MEMBER(bfm_sc1_state,nocrypt)
{
sc1_common_init(6,0, 3);
MechMtr_config(machine(),8);
sc1_find_project_string(machine());
sc1_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc1_state,nocrypt_bank0)
{
sc1_common_init(6,0, 0);
MechMtr_config(machine(),8);
sc1_find_project_string(machine());
sc1_find_project_string();
}
@ -1291,7 +1294,7 @@ DRIVER_INIT_MEMBER(bfm_sc1_state,rou029)
{
sc1_common_init(6,0, 3);
MechMtr_config(machine(),8);
sc1_find_project_string(machine());
sc1_find_project_string();
}
/////////////////////////////////////////////////////////////////////////////////////
@ -1301,11 +1304,11 @@ DRIVER_INIT_MEMBER(bfm_sc1_state,clatt)
sc1_common_init(6,1, 3);
MechMtr_config(machine(),8);
Scorpion1_SetSwitchState(this,3,2,1);
Scorpion1_SetSwitchState(this,3,3,1);
Scorpion1_SetSwitchState(this,3,6,1);
Scorpion1_SetSwitchState(this,4,1,1);
sc1_find_project_string(machine());
Scorpion1_SetSwitchState(3,2,1);
Scorpion1_SetSwitchState(3,3,1);
Scorpion1_SetSwitchState(3,6,1);
Scorpion1_SetSwitchState(4,1,1);
sc1_find_project_string();
}

View File

@ -304,6 +304,17 @@ public:
DECLARE_MACHINE_START(sc2dmd);
DECLARE_MACHINE_RESET(dm01_init);
INTERRUPT_GEN_MEMBER(timer_irq);
void on_scorpion2_reset();
void Scorpion2_SetSwitchState(int strobe, int data, int state);
int Scorpion2_GetSwitchState(int strobe, int data);
void e2ram_reset();
int recAck(int changed, int data);
int read_e2ram();
int sc2_find_project_string( );
void sc2_common_init(int decrypt);
void adder2_common_init();
void sc2awp_common_init(int reels, int decrypt);
void sc2awpdmd_common_init(int reels, int decrypt);
};
@ -320,11 +331,6 @@ public:
#define MASTER_CLOCK (XTAL_8MHz)
// local prototypes ///////////////////////////////////////////////////////
static int read_e2ram(running_machine &machine);
static void e2ram_reset(running_machine &machine);
/* INPUTS layout
b7 b6 b5 b4 b3 b2 b1 b0
@ -347,98 +353,96 @@ static void e2ram_reset(running_machine &machine);
// called if board is reset ///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
static void on_scorpion2_reset(running_machine &machine)
void bfm_sc2_state::on_scorpion2_reset()
{
bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
state->m_mmtr_latch = 0;
state->m_triac_latch = 0;
state->m_irq_status = 0;
state->m_is_timer_enabled = 1;
state->m_coin_inhibits = 0;
state->m_irq_timer_stat = 0;
state->m_expansion_latch = 0;
state->m_global_volume = 0;
state->m_volume_override = 0;
state->m_triac_select = 0;
state->m_pay_latch = 0;
m_mmtr_latch = 0;
m_triac_latch = 0;
m_irq_status = 0;
m_is_timer_enabled = 1;
m_coin_inhibits = 0;
m_irq_timer_stat = 0;
m_expansion_latch = 0;
m_global_volume = 0;
m_volume_override = 0;
m_triac_select = 0;
m_pay_latch = 0;
state->m_reel12_latch = 0;
state->m_reel34_latch = 0;
state->m_reel56_latch = 0;
m_reel12_latch = 0;
m_reel34_latch = 0;
m_reel56_latch = 0;
state->m_hopper_running = 0; // for video games
state->m_hopper_coin_sense = 0;
m_hopper_running = 0; // for video games
m_hopper_coin_sense = 0;
state->m_slide_states[0] = 0;
state->m_slide_states[1] = 0;
state->m_slide_states[2] = 0;
state->m_slide_states[3] = 0;
state->m_slide_states[4] = 0;
state->m_slide_states[5] = 0;
m_slide_states[0] = 0;
m_slide_states[1] = 0;
m_slide_states[2] = 0;
m_slide_states[3] = 0;
m_slide_states[4] = 0;
m_slide_states[5] = 0;
e2ram_reset(machine);
e2ram_reset();
machine.device("ymsnd")->reset();
machine().device("ymsnd")->reset();
// reset stepper motors /////////////////////////////////////////////////
{
int pattern =0, i;
for ( i = 0; i < state->m_reels; i++)
for ( i = 0; i < m_reels; i++)
{
stepper_reset_position(i);
if ( stepper_optic_state(i) ) pattern |= 1<<i;
}
state->m_optic_pattern = pattern;
m_optic_pattern = pattern;
}
state->m_locked = 0;
m_locked = 0;
// make sure no inputs are overidden ////////////////////////////////////
memset(state->m_input_override, 0, sizeof(state->m_input_override));
memset(m_input_override, 0, sizeof(m_input_override));
// init rom bank ////////////////////////////////////////////////////////
{
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
UINT8 *rom = machine().root_device().memregion("maincpu")->base();
state->membank("bank1")->configure_entries(0, 4, &rom[0x00000], 0x02000);
membank("bank1")->configure_entries(0, 4, &rom[0x00000], 0x02000);
state->membank("bank1")->set_entry(3);
membank("bank1")->set_entry(3);
}
}
///////////////////////////////////////////////////////////////////////////
void Scorpion2_SetSwitchState(running_machine &machine, int strobe, int data, int state)
void bfm_sc2_state::Scorpion2_SetSwitchState(int strobe, int data, int state)
{
bfm_sc2_state *drvstate = machine.driver_data<bfm_sc2_state>();
if ( strobe < 11 && data < 8 )
{
if ( strobe < 8 )
{
drvstate->m_input_override[strobe] |= (1<<data);
m_input_override[strobe] |= (1<<data);
if ( state ) drvstate->m_sc2_Inputs[strobe] |= (1<<data);
else drvstate->m_sc2_Inputs[strobe] &= ~(1<<data);
if ( state ) m_sc2_Inputs[strobe] |= (1<<data);
else m_sc2_Inputs[strobe] &= ~(1<<data);
}
else
{
if ( data > 2 )
{
drvstate->m_input_override[strobe-8+4] |= (1<<(data+2));
m_input_override[strobe-8+4] |= (1<<(data+2));
if ( state ) drvstate->m_sc2_Inputs[strobe-8+4] |= (1<<(data+2));
else drvstate->m_sc2_Inputs[strobe-8+4] &= ~(1<<(data+2));
if ( state ) m_sc2_Inputs[strobe-8+4] |= (1<<(data+2));
else m_sc2_Inputs[strobe-8+4] &= ~(1<<(data+2));
}
else
{
drvstate->m_input_override[strobe-8] |= (1<<(data+5));
m_input_override[strobe-8] |= (1<<(data+5));
if ( state ) drvstate->m_sc2_Inputs[strobe-8] |= (1 << (data+5));
else drvstate->m_sc2_Inputs[strobe-8] &= ~(1 << (data+5));
if ( state ) m_sc2_Inputs[strobe-8] |= (1 << (data+5));
else m_sc2_Inputs[strobe-8] &= ~(1 << (data+5));
}
}
}
@ -446,26 +450,25 @@ void Scorpion2_SetSwitchState(running_machine &machine, int strobe, int data, in
///////////////////////////////////////////////////////////////////////////
int Scorpion2_GetSwitchState(running_machine &machine, int strobe, int data)
int bfm_sc2_state::Scorpion2_GetSwitchState(int strobe, int data)
{
bfm_sc2_state *drvstate = machine.driver_data<bfm_sc2_state>();
int state = 0;
if ( strobe < 11 && data < 8 )
{
if ( strobe < 8 )
{
state = (drvstate->m_sc2_Inputs[strobe] & (1<<data) ) ? 1 : 0;
state = (m_sc2_Inputs[strobe] & (1<<data) ) ? 1 : 0;
}
else
{
if ( data > 2 )
{
state = (drvstate->m_sc2_Inputs[strobe-8+4] & (1<<(data+2)) ) ? 1 : 0;
state = (m_sc2_Inputs[strobe-8+4] & (1<<(data+2)) ) ? 1 : 0;
}
else
{
state = (drvstate->m_sc2_Inputs[strobe-8] & (1 << (data+5)) ) ? 1 : 0;
state = (m_sc2_Inputs[strobe-8] & (1 << (data+5)) ) ? 1 : 0;
}
}
}
@ -915,7 +918,7 @@ WRITE8_MEMBER(bfm_sc2_state::payout_triac_w)
{
int strobe = m_slide_pay_sensor[slide]>>4, data = m_slide_pay_sensor[slide]&0x0F;
Scorpion2_SetSwitchState(machine(), strobe, data, 0);
Scorpion2_SetSwitchState(strobe, data, 0);
}
m_slide_states[slide] = 1;
}
@ -928,7 +931,7 @@ WRITE8_MEMBER(bfm_sc2_state::payout_triac_w)
{
int strobe = m_slide_pay_sensor[slide]>>4, data = m_slide_pay_sensor[slide]&0x0F;
Scorpion2_SetSwitchState(machine(), strobe, data, 1);
Scorpion2_SetSwitchState(strobe, data, 1);
}
m_slide_states[slide] = 0;
}
@ -1063,7 +1066,7 @@ READ8_MEMBER(bfm_sc2_state::key_r)
if ( offset == 7 )
{
result = (result & 0xFE) | read_e2ram(machine());
result = (result & 0xFE) | read_e2ram();
}
return result;
@ -1086,17 +1089,16 @@ on a simple two wire bus.
#define SDA 0x02 //SDA pin (data)
static void e2ram_reset(running_machine &machine)
void bfm_sc2_state::e2ram_reset()
{
bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
state->m_e2reg = 0;
state->m_e2state = 0;
state->m_e2address = 0;
state->m_e2rw = 0;
state->m_e2data_pin = 0;
state->m_e2data = (SDA|SCL);
state->m_e2dummywrite = 0;
state->m_e2data_to_read = 0;
m_e2reg = 0;
m_e2state = 0;
m_e2address = 0;
m_e2rw = 0;
m_e2data_pin = 0;
m_e2data = (SDA|SCL);
m_e2dummywrite = 0;
m_e2data_to_read = 0;
}
int bfm_sc2_state::recdata(int changed, int data)
@ -1131,7 +1133,7 @@ int bfm_sc2_state::recdata(int changed, int data)
return res;
}
static int recAck(int changed, int data)
int bfm_sc2_state::recAck(int changed, int data)
{
int result = 0;
@ -1393,12 +1395,11 @@ WRITE8_MEMBER(bfm_sc2_state::e2ram_w)
}
}
static int read_e2ram(running_machine &machine)
int bfm_sc2_state::read_e2ram()
{
bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
LOG(("e2ram: r %d (%02X) \n", state->m_e2data_pin, state->m_e2data_to_read ));
LOG(("e2ram: r %d (%02X) \n", m_e2data_pin, m_e2data_to_read ));
return state->m_e2data_pin;
return m_e2data_pin;
}
@ -1409,7 +1410,7 @@ MACHINE_RESET_MEMBER(bfm_sc2_state,init)
{
// reset the board //////////////////////////////////////////////////////
on_scorpion2_reset(machine());
on_scorpion2_reset();
m_vfd0->reset();
m_vfd1->reset();
@ -2187,12 +2188,12 @@ MACHINE_CONFIG_END
int sc2_find_project_string(running_machine &machine )
int bfm_sc2_state::sc2_find_project_string( )
{
// search for the project string to find the title (usually just at ff00)
char title_string[4][32] = { "PROJECT NUMBER", "PROJECT PR", "PROJECT ", "CASH ON THE NILE 2" };
UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
int size = machine.root_device().memregion( "maincpu" )->bytes();
UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
int size = machine().root_device().memregion( "maincpu" )->bytes();
for (int search=0;search<4;search++)
{
@ -2262,24 +2263,22 @@ int sc2_find_project_string(running_machine &machine )
}
static void sc2_common_init(running_machine &machine, int decrypt)
void bfm_sc2_state::sc2_common_init(int decrypt)
{
bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
if (decrypt) bfm_decode_mainrom(machine, "maincpu", state->m_codec_data); // decode main rom
if (decrypt) bfm_decode_mainrom(machine(), "maincpu", m_codec_data); // decode main rom
memset(state->m_sc2_Inputs, 0, sizeof(state->m_sc2_Inputs)); // clear all inputs
memset(m_sc2_Inputs, 0, sizeof(m_sc2_Inputs)); // clear all inputs
}
static void adder2_common_init(running_machine &machine)
void bfm_sc2_state::adder2_common_init()
{
bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
UINT8 *pal;
pal = state->memregion("proms")->base();
pal = memregion("proms")->base();
if ( pal )
{
memcpy(state->m_key, pal, 8);
memcpy(m_key, pal, 8);
}
}
@ -2287,18 +2286,18 @@ static void adder2_common_init(running_machine &machine)
DRIVER_INIT_MEMBER(bfm_sc2_state,quintoon)
{
sc2_common_init(machine(), 1);
sc2_common_init( 1);
adder2_decode_char_roms(machine());
MechMtr_config(machine(),8); // setup mech meters
m_has_hopper = 0;
Scorpion2_SetSwitchState(machine(),3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(machine(),3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(machine(),3,2,1); // tube3 level switch
Scorpion2_SetSwitchState(3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(3,2,1); // tube3 level switch
Scorpion2_SetSwitchState(machine(),5,2,1);
Scorpion2_SetSwitchState(machine(),6,4,1);
Scorpion2_SetSwitchState(5,2,1);
Scorpion2_SetSwitchState(6,4,1);
m_sc2_show_door = 1;
m_sc2_door_state = 0x41;
@ -2308,15 +2307,15 @@ DRIVER_INIT_MEMBER(bfm_sc2_state,quintoon)
DRIVER_INIT_MEMBER(bfm_sc2_state,pyramid)
{
sc2_common_init(machine(), 1);
sc2_common_init(1);
adder2_decode_char_roms(machine()); // decode GFX roms
adder2_common_init(machine());
adder2_common_init();
m_has_hopper = 1;
Scorpion2_SetSwitchState(machine(),3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(machine(),3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(machine(),3,2,1); // tube3 level switch
Scorpion2_SetSwitchState(3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(3,2,1); // tube3 level switch
m_sc2_show_door = 1;
m_sc2_door_state = 0x41;
@ -2325,9 +2324,9 @@ DRIVER_INIT_MEMBER(bfm_sc2_state,pyramid)
DRIVER_INIT_MEMBER(bfm_sc2_state,sltsbelg)
{
sc2_common_init(machine(), 1);
sc2_common_init(1);
adder2_decode_char_roms(machine()); // decode GFX roms
adder2_common_init(machine());
adder2_common_init();
m_has_hopper = 1;
@ -2339,15 +2338,15 @@ DRIVER_INIT_MEMBER(bfm_sc2_state,sltsbelg)
DRIVER_INIT_MEMBER(bfm_sc2_state,adder_dutch)
{
sc2_common_init(machine(), 1);
sc2_common_init(1);
adder2_decode_char_roms(machine()); // decode GFX roms
adder2_common_init(machine());
adder2_common_init();
m_has_hopper = 0;
Scorpion2_SetSwitchState(machine(),3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(machine(),3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(machine(),3,2,1); // tube3 level switch
Scorpion2_SetSwitchState(3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(3,2,1); // tube3 level switch
m_sc2_show_door = 1;
m_sc2_door_state = 0x41;
@ -2357,15 +2356,15 @@ DRIVER_INIT_MEMBER(bfm_sc2_state,adder_dutch)
DRIVER_INIT_MEMBER(bfm_sc2_state,gldncrwn)
{
sc2_common_init(machine(), 1);
sc2_common_init(1);
adder2_decode_char_roms(machine()); // decode GFX roms
adder2_common_init(machine());
adder2_common_init();
m_has_hopper = 0;
Scorpion2_SetSwitchState(machine(),3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(machine(),3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(machine(),3,2,1); // tube3 level switch
Scorpion2_SetSwitchState(3,0,1); // tube1 level switch
Scorpion2_SetSwitchState(3,1,1); // tube2 level switch
Scorpion2_SetSwitchState(3,2,1); // tube3 level switch
m_sc2_show_door = 0;
m_sc2_door_state = 0x41;
@ -2662,7 +2661,8 @@ WRITE8_MEMBER(bfm_sc2_state::sc3_expansion_w)
static void bfmdm01_busy(running_machine &machine, int state)
{
Scorpion2_SetSwitchState(machine, 4,4, state?0:1);
bfm_sc2_state *drvstate = machine.driver_data<bfm_sc2_state>();
drvstate->Scorpion2_SetSwitchState(4,4, state?0:1);
}
static const bfmdm01_interface dm01_interface =
@ -2673,7 +2673,7 @@ static const bfmdm01_interface dm01_interface =
/* machine init (called only once) */
MACHINE_RESET_MEMBER(bfm_sc2_state,awp_init)
{
on_scorpion2_reset(machine());
on_scorpion2_reset();
m_vfd0->reset();
m_vfd1->reset();
}
@ -2681,7 +2681,7 @@ MACHINE_RESET_MEMBER(bfm_sc2_state,awp_init)
MACHINE_RESET_MEMBER(bfm_sc2_state,dm01_init)
{
on_scorpion2_reset(machine());
on_scorpion2_reset();
}
@ -3831,36 +3831,34 @@ static MACHINE_CONFIG_START( scorpion2_dm01, bfm_sc2_state )
MCFG_CPU_PERIODIC_INT(bfm_dm01_vbl, 1500 ) /* generate 1500 NMI's per second ?? what is the exact freq?? */
MACHINE_CONFIG_END
static void sc2awp_common_init(running_machine &machine,int reels, int decrypt)
void bfm_sc2_state::sc2awp_common_init(int reels, int decrypt)
{
bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
int n;
sc2_common_init(machine, decrypt);
sc2_common_init(decrypt);
/* setup n default 96 half step reels */
state->m_reels=reels;
m_reels=reels;
for ( n = 0; n < reels; n++ )
{
stepper_config(machine, n, &starpoint_interface_48step);
stepper_config(machine(), n, &starpoint_interface_48step);
}
}
static void sc2awpdmd_common_init(running_machine &machine,int reels, int decrypt)
void bfm_sc2_state::sc2awpdmd_common_init(int reels, int decrypt)
{
bfm_sc2_state *state = machine.driver_data<bfm_sc2_state>();
int n;
BFM_dm01_config(machine, &dm01_interface);
sc2_common_init(machine, decrypt);
BFM_dm01_config(machine(), &dm01_interface);
sc2_common_init(decrypt);
/* setup n default 96 half step reels */
state->m_reels=reels;
m_reels=reels;
for ( n = 0; n < reels; n++ )
{
stepper_config(machine, n, &starpoint_interface_48step);
stepper_config(machine(), n, &starpoint_interface_48step);
}
}
@ -3868,22 +3866,22 @@ static void sc2awpdmd_common_init(running_machine &machine,int reels, int decryp
DRIVER_INIT_MEMBER(bfm_sc2_state,bbrkfst)
{
sc2awp_common_init(machine(),5, 1);
sc2awp_common_init(5, 1);
MechMtr_config(machine(),8);
m_has_hopper = 0;
Scorpion2_SetSwitchState(machine(),4,0, 1); /* GBP1 Low Level Switch */
Scorpion2_SetSwitchState(machine(),4,1, 1); /* 20p Low Level Switch */
Scorpion2_SetSwitchState(machine(),4,2, 1); /* Token Front Low Level Switch */
Scorpion2_SetSwitchState(machine(),4,3, 1); /* Token Rear Low Level Switch */
Scorpion2_SetSwitchState(machine(),4,4, 1);
Scorpion2_SetSwitchState(machine(),6,0, 0);
Scorpion2_SetSwitchState(machine(),6,1, 1);
Scorpion2_SetSwitchState(machine(),6,2, 0);
Scorpion2_SetSwitchState(machine(),6,3, 1);
Scorpion2_SetSwitchState(4,0, 1); /* GBP1 Low Level Switch */
Scorpion2_SetSwitchState(4,1, 1); /* 20p Low Level Switch */
Scorpion2_SetSwitchState(4,2, 1); /* Token Front Low Level Switch */
Scorpion2_SetSwitchState(4,3, 1); /* Token Rear Low Level Switch */
Scorpion2_SetSwitchState(4,4, 1);
Scorpion2_SetSwitchState(6,0, 0);
Scorpion2_SetSwitchState(6,1, 1);
Scorpion2_SetSwitchState(6,2, 0);
Scorpion2_SetSwitchState(6,3, 1);
sc2_find_project_string(machine());
sc2_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc2_state,drwho_common)
@ -3892,57 +3890,57 @@ DRIVER_INIT_MEMBER(bfm_sc2_state,drwho_common)
m_has_hopper = 0;
Scorpion2_SetSwitchState(machine(),4,0, 0); /* GBP1 Low Level Switch */
Scorpion2_SetSwitchState(machine(),4,1, 0); /* 20p Low Level Switch */
Scorpion2_SetSwitchState(machine(),4,2, 0); /* Token Front Low Level Switch */
Scorpion2_SetSwitchState(machine(),4,3, 0); /* Token Rear Low Level Switch */
Scorpion2_SetSwitchState(machine(),7,0, 0); /* GBP1 High Level Switch */
Scorpion2_SetSwitchState(machine(),7,1, 0); /* 20P High Level Switch */
Scorpion2_SetSwitchState(machine(),7,2, 0); /* Token Front High Level Switch */
Scorpion2_SetSwitchState(machine(),7,3, 0); /* Token Rear High Level Switch */
Scorpion2_SetSwitchState(4,0, 0); /* GBP1 Low Level Switch */
Scorpion2_SetSwitchState(4,1, 0); /* 20p Low Level Switch */
Scorpion2_SetSwitchState(4,2, 0); /* Token Front Low Level Switch */
Scorpion2_SetSwitchState(4,3, 0); /* Token Rear Low Level Switch */
Scorpion2_SetSwitchState(7,0, 0); /* GBP1 High Level Switch */
Scorpion2_SetSwitchState(7,1, 0); /* 20P High Level Switch */
Scorpion2_SetSwitchState(7,2, 0); /* Token Front High Level Switch */
Scorpion2_SetSwitchState(7,3, 0); /* Token Rear High Level Switch */
sc2_find_project_string(machine());
sc2_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc2_state,drwho)
{
sc2awp_common_init(machine(),6, 1);
sc2awp_common_init(6, 1);
DRIVER_INIT_CALL(drwho_common);
}
DRIVER_INIT_MEMBER(bfm_sc2_state,drwhon)
{
sc2awp_common_init(machine(),4, 0);
sc2awp_common_init(4, 0);
DRIVER_INIT_CALL(drwho_common);
}
DRIVER_INIT_MEMBER(bfm_sc2_state,focus)
{
sc2awp_common_init(machine(),6, 1);
sc2awp_common_init(6, 1);
MechMtr_config(machine(),5);
sc2_find_project_string(machine());
sc2_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc2_state,cpeno1)
{
sc2awpdmd_common_init(machine(),6, 1);
sc2awpdmd_common_init(6, 1);
MechMtr_config(machine(),5);
Scorpion2_SetSwitchState(machine(),3,3,1); /* 5p play */
Scorpion2_SetSwitchState(machine(),3,4,1); /* 20p play */
Scorpion2_SetSwitchState(3,3,1); /* 5p play */
Scorpion2_SetSwitchState(3,4,1); /* 20p play */
Scorpion2_SetSwitchState(machine(),4,0,1); /* pay tube low (1 pound front) */
Scorpion2_SetSwitchState(machine(),4,1,1); /* pay tube low (20p) */
Scorpion2_SetSwitchState(machine(),4,2,1); /* pay tube low (?1 right) */
Scorpion2_SetSwitchState(machine(),4,3,1); /* pay tube low (?1 left) */
Scorpion2_SetSwitchState(4,0,1); /* pay tube low (1 pound front) */
Scorpion2_SetSwitchState(4,1,1); /* pay tube low (20p) */
Scorpion2_SetSwitchState(4,2,1); /* pay tube low (?1 right) */
Scorpion2_SetSwitchState(4,3,1); /* pay tube low (?1 left) */
Scorpion2_SetSwitchState(machine(),5,0,1); /* pay sensor (GBP1 front) */
Scorpion2_SetSwitchState(machine(),5,1,1); /* pay sensor (20 p) */
Scorpion2_SetSwitchState(machine(),5,2,1); /* pay sensor (1 right) */
Scorpion2_SetSwitchState(machine(),5,3,1); /* pay sensor (?1 left) */
Scorpion2_SetSwitchState(machine(),5,4,1); /* payout unit present */
Scorpion2_SetSwitchState(5,0,1); /* pay sensor (GBP1 front) */
Scorpion2_SetSwitchState(5,1,1); /* pay sensor (20 p) */
Scorpion2_SetSwitchState(5,2,1); /* pay sensor (1 right) */
Scorpion2_SetSwitchState(5,3,1); /* pay sensor (?1 left) */
Scorpion2_SetSwitchState(5,4,1); /* payout unit present */
m_slide_pay_sensor[0] = 0x50;
m_slide_pay_sensor[1] = 0x51;
@ -3951,93 +3949,93 @@ DRIVER_INIT_MEMBER(bfm_sc2_state,cpeno1)
m_slide_pay_sensor[4] = 0;
m_slide_pay_sensor[5] = 0;
Scorpion2_SetSwitchState(machine(),6,0,1); /* ? percentage key */
Scorpion2_SetSwitchState(machine(),6,1,1);
Scorpion2_SetSwitchState(machine(),6,2,1);
Scorpion2_SetSwitchState(machine(),6,3,1);
Scorpion2_SetSwitchState(machine(),6,4,1);
Scorpion2_SetSwitchState(6,0,1); /* ? percentage key */
Scorpion2_SetSwitchState(6,1,1);
Scorpion2_SetSwitchState(6,2,1);
Scorpion2_SetSwitchState(6,3,1);
Scorpion2_SetSwitchState(6,4,1);
Scorpion2_SetSwitchState(machine(),7,0,0); /* GBP1 High Level Switch */
Scorpion2_SetSwitchState(machine(),7,1,0); /* 20P High Level Switch */
Scorpion2_SetSwitchState(machine(),7,2,0); /* Token Front High Level Switch */
Scorpion2_SetSwitchState(machine(),7,3,0); /* Token Rear High Level Switch */
Scorpion2_SetSwitchState(7,0,0); /* GBP1 High Level Switch */
Scorpion2_SetSwitchState(7,1,0); /* 20P High Level Switch */
Scorpion2_SetSwitchState(7,2,0); /* Token Front High Level Switch */
Scorpion2_SetSwitchState(7,3,0); /* Token Rear High Level Switch */
m_sc2_show_door = 1;
m_sc2_door_state = 0x31;
m_has_hopper = 0;
sc2_find_project_string(machine());
sc2_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc2_state,ofah)
{
sc2awpdmd_common_init(machine(),4, 1);
sc2awpdmd_common_init(4, 1);
Scorpion2_SetSwitchState(machine(),4,0,1); /* pay tube low (1 pound front) */
Scorpion2_SetSwitchState(machine(),4,1,1); /* pay tube low (20p) */
Scorpion2_SetSwitchState(machine(),4,2,1); /* pay tube low (?1 right) */
Scorpion2_SetSwitchState(machine(),4,3,1); /* pay tube low (?1 left) */
Scorpion2_SetSwitchState(4,0,1); /* pay tube low (1 pound front) */
Scorpion2_SetSwitchState(4,1,1); /* pay tube low (20p) */
Scorpion2_SetSwitchState(4,2,1); /* pay tube low (?1 right) */
Scorpion2_SetSwitchState(4,3,1); /* pay tube low (?1 left) */
Scorpion2_SetSwitchState(machine(),6,0,0); /* ? percentage key */
Scorpion2_SetSwitchState(machine(),6,1,1);
Scorpion2_SetSwitchState(machine(),6,2,0);
Scorpion2_SetSwitchState(machine(),6,3,1);
Scorpion2_SetSwitchState(6,0,0); /* ? percentage key */
Scorpion2_SetSwitchState(6,1,1);
Scorpion2_SetSwitchState(6,2,0);
Scorpion2_SetSwitchState(6,3,1);
MechMtr_config(machine(),3);
sc2_find_project_string(machine());
sc2_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc2_state,prom)
{
sc2awpdmd_common_init(machine(),6, 1);
sc2awpdmd_common_init(6, 1);
Scorpion2_SetSwitchState(machine(),4,0,1); /* pay tube low (1 pound front) */
Scorpion2_SetSwitchState(machine(),4,1,1); /* pay tube low (20p) */
Scorpion2_SetSwitchState(machine(),4,2,1); /* pay tube low (?1 right) */
Scorpion2_SetSwitchState(machine(),4,3,1); /* pay tube low (?1 left) */
Scorpion2_SetSwitchState(4,0,1); /* pay tube low (1 pound front) */
Scorpion2_SetSwitchState(4,1,1); /* pay tube low (20p) */
Scorpion2_SetSwitchState(4,2,1); /* pay tube low (?1 right) */
Scorpion2_SetSwitchState(4,3,1); /* pay tube low (?1 left) */
Scorpion2_SetSwitchState(machine(),6,0,0); /* ? percentage key */
Scorpion2_SetSwitchState(machine(),6,1,1);
Scorpion2_SetSwitchState(machine(),6,2,0);
Scorpion2_SetSwitchState(machine(),6,3,1);
Scorpion2_SetSwitchState(6,0,0); /* ? percentage key */
Scorpion2_SetSwitchState(6,1,1);
Scorpion2_SetSwitchState(6,2,0);
Scorpion2_SetSwitchState(6,3,1);
MechMtr_config(machine(),3);
sc2_find_project_string(machine());
sc2_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc2_state,bfmcgslm)
{
sc2awp_common_init(machine(),6, 1);
sc2awp_common_init(6, 1);
MechMtr_config(machine(),8);
m_has_hopper = 0;
sc2_find_project_string(machine());
sc2_find_project_string();
}
DRIVER_INIT_MEMBER(bfm_sc2_state,luvjub)
{
sc2awpdmd_common_init(machine(),6, 1);
sc2awpdmd_common_init(6, 1);
MechMtr_config(machine(),8);
m_has_hopper = 0;
Scorpion2_SetSwitchState(machine(),3,0,1);
Scorpion2_SetSwitchState(machine(),3,1,1);
Scorpion2_SetSwitchState(3,0,1);
Scorpion2_SetSwitchState(3,1,1);
Scorpion2_SetSwitchState(machine(),4,0,1);
Scorpion2_SetSwitchState(machine(),4,1,1);
Scorpion2_SetSwitchState(machine(),4,2,1);
Scorpion2_SetSwitchState(machine(),4,3,1);
Scorpion2_SetSwitchState(4,0,1);
Scorpion2_SetSwitchState(4,1,1);
Scorpion2_SetSwitchState(4,2,1);
Scorpion2_SetSwitchState(4,3,1);
Scorpion2_SetSwitchState(machine(),6,0,1);
Scorpion2_SetSwitchState(machine(),6,1,1);
Scorpion2_SetSwitchState(machine(),6,2,1);
Scorpion2_SetSwitchState(machine(),6,3,0);
Scorpion2_SetSwitchState(6,0,1);
Scorpion2_SetSwitchState(6,1,1);
Scorpion2_SetSwitchState(6,2,1);
Scorpion2_SetSwitchState(6,3,0);
Scorpion2_SetSwitchState(machine(),7,0,0);
Scorpion2_SetSwitchState(machine(),7,1,0);
Scorpion2_SetSwitchState(machine(),7,2,0);
Scorpion2_SetSwitchState(machine(),7,3,0);
sc2_find_project_string(machine());
Scorpion2_SetSwitchState(7,0,0);
Scorpion2_SetSwitchState(7,1,0);
Scorpion2_SetSwitchState(7,2,0);
Scorpion2_SetSwitchState(7,3,0);
sc2_find_project_string();
}

View File

@ -113,6 +113,7 @@ public:
virtual void machine_start();
virtual void machine_reset();
INTERRUPT_GEN_MEMBER(timer_irq);
int b85_find_project_string( );
};
#define MASTER_CLOCK (XTAL_4MHz)
@ -676,12 +677,12 @@ ROM_START( b85cb7p )
ROM_END
int b85_find_project_string(running_machine &machine )
int bfmsys85_state::b85_find_project_string( )
{
// search for the project string to find the title (usually just at ff00)
char title_string[7][32] = { "PROJECT NUMBER", "PROJECT PR", "PROJECT ", "CASH ON THE NILE 2", "PR6121", "CHINA TOWN\x0d\x0a", "PROJECTNUMBER" };
UINT8 *src = machine.root_device().memregion( "maincpu" )->base();
int size = machine.root_device().memregion( "maincpu" )->bytes();
UINT8 *src = machine().root_device().memregion( "maincpu" )->base();
int size = machine().root_device().memregion( "maincpu" )->bytes();
for (int search=0;search<7;search++)
{
@ -754,12 +755,12 @@ int b85_find_project_string(running_machine &machine )
DRIVER_INIT_MEMBER(bfmsys85_state,decode)
{
bfm_decode_mainrom(machine(),"maincpu", m_codec_data);
b85_find_project_string(machine());
b85_find_project_string();
}
DRIVER_INIT_MEMBER(bfmsys85_state,nodecode)
{
b85_find_project_string(machine());
b85_find_project_string();
}
// PROJECT NUMBER 5539 2P CASH EXPLOSION GAME No 39-350-190 - 29-MAR-1989 11:45:25

View File

@ -182,6 +182,7 @@ public:
virtual void machine_start();
virtual void machine_reset();
IRQ_CALLBACK_MEMBER(irq_callback);
void intel82439tx_init();
};
@ -368,15 +369,14 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i
state->m_mxtc_config_reg[reg] = data;
}
static void intel82439tx_init(running_machine &machine)
void calchase_state::intel82439tx_init()
{
calchase_state *state = machine.driver_data<calchase_state>();
state->m_mxtc_config_reg[0x60] = 0x02;
state->m_mxtc_config_reg[0x61] = 0x02;
state->m_mxtc_config_reg[0x62] = 0x02;
state->m_mxtc_config_reg[0x63] = 0x02;
state->m_mxtc_config_reg[0x64] = 0x02;
state->m_mxtc_config_reg[0x65] = 0x02;
m_mxtc_config_reg[0x60] = 0x02;
m_mxtc_config_reg[0x61] = 0x02;
m_mxtc_config_reg[0x62] = 0x02;
m_mxtc_config_reg[0x63] = 0x02;
m_mxtc_config_reg[0x64] = 0x02;
m_mxtc_config_reg[0x65] = 0x02;
}
static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
@ -968,7 +968,7 @@ DRIVER_INIT_MEMBER(calchase_state,calchase)
init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int);
intel82439tx_init(machine());
intel82439tx_init();
kbdc8042_init(machine(), &at8042);

View File

@ -93,6 +93,7 @@ public:
virtual void video_start();
virtual void palette_init();
UINT32 screen_update_chanbara(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};
@ -159,45 +160,44 @@ void chanbara_state::video_start()
m_bg_tilemap->set_transparent_pen(0);
}
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void chanbara_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
chanbara_state *state = machine.driver_data<chanbara_state>();
int offs;
for (offs = 0; offs < 0x80; offs += 4)
{
if (state->m_spriteram[offs + 0x80] & 0x80)
if (m_spriteram[offs + 0x80] & 0x80)
{
int attr = state->m_spriteram[offs + 0];
int code = state->m_spriteram[offs + 1];
int color = state->m_spriteram[offs + 0x80] & 0x1f;
int attr = m_spriteram[offs + 0];
int code = m_spriteram[offs + 1];
int color = m_spriteram[offs + 0x80] & 0x1f;
int flipx = 0;
int flipy = attr & 2;
int sx = 240 - state->m_spriteram[offs + 3];
int sy = 232 - state->m_spriteram[offs + 2];
int sx = 240 - m_spriteram[offs + 3];
int sy = 232 - m_spriteram[offs + 2];
sy+=16;
if (state->m_spriteram[offs + 0x80] & 0x10) code += 0x200;
if (state->m_spriteram[offs + 0x80] & 0x20) code += 0x400;
if (state->m_spriteram[offs + 0x80] & 0x40) code += 0x100;
if (m_spriteram[offs + 0x80] & 0x10) code += 0x200;
if (m_spriteram[offs + 0x80] & 0x20) code += 0x400;
if (m_spriteram[offs + 0x80] & 0x40) code += 0x100;
if (attr & 0x10)
{
if (!flipy)
{
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy-16, 0);
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code+1, color, flipx, flipy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy-16, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code+1, color, flipx, flipy, sx, sy, 0);
}
else
{
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code+1, color, flipx, flipy, sx, sy-16, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code+1, color, flipx, flipy, sx, sy-16, 0);
}
}
else
{
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy, 0);
}
}
}
@ -207,7 +207,7 @@ UINT32 chanbara_state::screen_update_chanbara(screen_device &screen, bitmap_ind1
{
m_bg2_tilemap->set_scrolly(0, m_scroll | (m_scrollhi << 8));
m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -93,6 +93,9 @@ public:
UINT32 screen_update_cntsteer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_zerotrgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(sound_interrupt);
void zerotrgt_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void cntsteer_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void zerotrgt_rearrange_gfx( int romsize, int romarea );
};
@ -174,29 +177,28 @@ Sprite list:
[2] xxxx xxxx X attribute
[3] xxxx xxxx sprite number
*/
static void zerotrgt_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void cntsteer_state::zerotrgt_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
cntsteer_state *state = machine.driver_data<cntsteer_state>();
int offs;
for (offs = 0; offs < 0x200; offs += 4)
{
int multi, fx, fy, sx, sy, code, color;
if ((state->m_spriteram[offs + 1] & 1) == 1)
if ((m_spriteram[offs + 1] & 1) == 1)
continue;
code = state->m_spriteram[offs + 3] + ((state->m_spriteram[offs + 1] & 0xc0) << 2);
sx = (state->m_spriteram[offs + 2]);
sy = 0xf0 - state->m_spriteram[offs];
color = 0x10 + ((state->m_spriteram[offs + 1] & 0x20) >> 4) + ((state->m_spriteram[offs + 1] & 0x8)>>3);
code = m_spriteram[offs + 3] + ((m_spriteram[offs + 1] & 0xc0) << 2);
sx = (m_spriteram[offs + 2]);
sy = 0xf0 - m_spriteram[offs];
color = 0x10 + ((m_spriteram[offs + 1] & 0x20) >> 4) + ((m_spriteram[offs + 1] & 0x8)>>3);
fx = !(state->m_spriteram[offs + 1] & 0x04);
fy = (state->m_spriteram[offs + 1] & 0x02);
fx = !(m_spriteram[offs + 1] & 0x04);
fy = (m_spriteram[offs + 1] & 0x02);
multi = state->m_spriteram[offs + 1] & 0x10;
multi = m_spriteram[offs + 1] & 0x10;
if (state->m_flipscreen)
if (m_flipscreen)
{
sy = 240 - sy;
sx = 240 - sx;
@ -209,17 +211,17 @@ static void zerotrgt_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
{
if (fy)
{
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code + 1, color, fx, fy, sx, sy - 16, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code + 1, color, fx, fy, sx, sy - 16, 0);
}
else
{
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, fx, fy, sx, sy - 16, 0);
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code + 1, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, fx, fy, sx, sy - 16, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code + 1, color, fx, fy, sx, sy, 0);
}
}
else
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, fx, fy, sx, sy, 0);
}
}
@ -232,29 +234,28 @@ static void zerotrgt_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
---- --xx tile bank
*/
static void cntsteer_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void cntsteer_state::cntsteer_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
cntsteer_state *state = machine.driver_data<cntsteer_state>();
int offs;
for (offs = 0; offs < 0x80; offs += 4)
{
int multi, fx, fy, sx, sy, code, color;
if ((state->m_spriteram[offs + 0] & 1) == 0)
if ((m_spriteram[offs + 0] & 1) == 0)
continue;
code = state->m_spriteram[offs + 1] + ((state->m_spriteram[offs + 0x80] & 0x03) << 8);
sx = 0x100 - state->m_spriteram[offs + 3];
sy = 0x100 - state->m_spriteram[offs + 2];
color = 0x10 + ((state->m_spriteram[offs + 0x80] & 0x70) >> 4);
code = m_spriteram[offs + 1] + ((m_spriteram[offs + 0x80] & 0x03) << 8);
sx = 0x100 - m_spriteram[offs + 3];
sy = 0x100 - m_spriteram[offs + 2];
color = 0x10 + ((m_spriteram[offs + 0x80] & 0x70) >> 4);
fx = (state->m_spriteram[offs + 0] & 0x04);
fy = (state->m_spriteram[offs + 0] & 0x02);
fx = (m_spriteram[offs + 0] & 0x04);
fy = (m_spriteram[offs + 0] & 0x02);
multi = state->m_spriteram[offs + 0] & 0x10;
multi = m_spriteram[offs + 0] & 0x10;
if (state->m_flipscreen)
if (m_flipscreen)
{
sy = 240 - sy;
sx = 240 - sx;
@ -267,17 +268,17 @@ static void cntsteer_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
{
if (fy)
{
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code + 1, color, fx, fy, sx, sy - 16, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code + 1, color, fx, fy, sx, sy - 16, 0);
}
else
{
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, fx, fy, sx, sy - 16, 0);
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code + 1, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, fx, fy, sx, sy - 16, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code + 1, color, fx, fy, sx, sy, 0);
}
}
else
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, color, fx, fy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, fx, fy, sx, sy, 0);
}
}
@ -324,7 +325,7 @@ UINT32 cntsteer_state::screen_update_zerotrgt(screen_device &screen, bitmap_ind1
0, 0);
}
zerotrgt_draw_sprites(machine(), bitmap, cliprect);
zerotrgt_draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0;
@ -371,7 +372,7 @@ UINT32 cntsteer_state::screen_update_cntsteer(screen_device &screen, bitmap_ind1
0, 0);
}
cntsteer_draw_sprites(machine(), bitmap, cliprect);
cntsteer_draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0;
@ -1139,10 +1140,10 @@ ROM_END
/***************************************************************************/
static void zerotrgt_rearrange_gfx( running_machine &machine, int romsize, int romarea )
void cntsteer_state::zerotrgt_rearrange_gfx( int romsize, int romarea )
{
UINT8 *src = machine.root_device().memregion("gfx4")->base();
UINT8 *dst = machine.root_device().memregion("gfx3")->base();
UINT8 *src = machine().root_device().memregion("gfx4")->base();
UINT8 *dst = machine().root_device().memregion("gfx3")->base();
int rm;
int cnt1;
@ -1174,7 +1175,7 @@ DRIVER_INIT_MEMBER(cntsteer_state,cntsteer)
DRIVER_INIT_MEMBER(cntsteer_state,zerotrgt)
{
zerotrgt_rearrange_gfx(machine(), 0x02000, 0x10000);
zerotrgt_rearrange_gfx(0x02000, 0x10000);
}

View File

@ -395,7 +395,7 @@ public:
void gfx_write_reg(running_machine &machine, UINT64 data);
void display(bitmap_rgb32 *bitmap, const rectangle &cliprect);
inline rgb_t texture_fetch(UINT32 *texture, int u, int v, int width, int format);
private:
bitmap_rgb32 *m_framebuffer;
bitmap_rgb32 *m_backbuffer;
@ -724,6 +724,7 @@ public:
UINT32 screen_update_cobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(cobra_vblank);
void cobra_video_exit();
int decode_debug_state_value(int v);
};
void cobra_renderer::render_color_scan(INT32 scanline, const extent_t &extent, const cobra_polydata &extradata, int threadid)
@ -772,7 +773,7 @@ void cobra_renderer::render_color_scan(INT32 scanline, const extent_t &extent, c
}
}
INLINE rgb_t texture_fetch(UINT32 *texture, int u, int v, int width, int format)
rgb_t cobra_renderer::texture_fetch(UINT32 *texture, int u, int v, int width, int format)
{
UINT32 texel = texture[((v * width) + u) / 2];
@ -1020,7 +1021,7 @@ UINT32 cobra_state::screen_update_cobra(screen_device &screen, bitmap_rgb32 &bit
/*****************************************************************************/
static int decode_debug_state_value(int v)
int cobra_state::decode_debug_state_value(int v)
{
switch (v)
{

View File

@ -88,6 +88,7 @@ public:
void laserdisc_w(UINT8 data);
void laserdisc_response_w(UINT8 data);
DECLARE_PALETTE_INIT( cops );
};
void cops_state::video_start()
@ -617,7 +618,7 @@ void cops_state::machine_reset()
}
static PALETTE_INIT( cops )
PALETTE_INIT_MEMBER( cops_state,cops )
{
}
@ -635,7 +636,7 @@ static MACHINE_CONFIG_START( cops, cops_state )
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_PALETTE_INIT(cops)
MCFG_PALETTE_INIT_OVERRIDE(cops_state,cops)
MCFG_PALETTE_LENGTH(8)
/* via */

View File

@ -59,6 +59,7 @@ public:
virtual void video_start();
UINT32 screen_update_wcvol95(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(deco32_vbl_interrupt);
void descramble_sound( const char *tag );
};
@ -617,11 +618,11 @@ ROM_END
/**********************************************************************************/
static void descramble_sound( running_machine &machine, const char *tag )
void deco156_state::descramble_sound( const char *tag )
{
UINT8 *rom = machine.root_device().memregion(tag)->base();
int length = machine.root_device().memregion(tag)->bytes();
UINT8 *buf1 = auto_alloc_array(machine, UINT8, length);
UINT8 *rom = machine().root_device().memregion(tag)->base();
int length = machine().root_device().memregion(tag)->bytes();
UINT8 *buf1 = auto_alloc_array(machine(), UINT8, length);
UINT32 x;
for (x = 0; x < length; x++)
@ -640,21 +641,21 @@ static void descramble_sound( running_machine &machine, const char *tag )
memcpy(rom,buf1,length);
auto_free(machine, buf1);
auto_free(machine(), buf1);
}
DRIVER_INIT_MEMBER(deco156_state,hvysmsh)
{
deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */
deco156_decrypt(machine());
descramble_sound(machine(), "oki2");
descramble_sound("oki2");
}
DRIVER_INIT_MEMBER(deco156_state,wcvol95)
{
deco56_decrypt_gfx(machine(), "gfx1"); /* 141 */
deco156_decrypt(machine());
descramble_sound(machine(), "ymz");
descramble_sound("ymz");
}

View File

@ -148,11 +148,12 @@ public:
virtual void machine_start();
UINT32 screen_update_rblaster(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(sound_interrupt);
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *spriteram, UINT16 tile_bank );
};
static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *spriteram, UINT16 tile_bank )
void deco_ld_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT8 *spriteram, UINT16 tile_bank )
{
gfx_element *gfx = machine.gfx[1];
gfx_element *gfx = machine().gfx[1];
int i,spr_offs,x,y,col,fx,fy;
/*
@ -202,8 +203,8 @@ UINT32 deco_ld_state::screen_update_rblaster(screen_device &screen, bitmap_rgb32
bitmap.fill(0, cliprect);
draw_sprites(machine(), bitmap,cliprect,m_vram1,0x000);
draw_sprites(machine(), bitmap,cliprect,m_vram0,0x100);
draw_sprites(bitmap,cliprect,m_vram1,0x000);
draw_sprites(bitmap,cliprect,m_vram0,0x100);
for (y=0;y<32;y++)
{

View File

@ -71,6 +71,7 @@ public:
virtual void machine_start();
virtual void video_start();
UINT32 screen_update_diverboy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};
@ -78,11 +79,10 @@ void diverboy_state::video_start()
{
}
static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void diverboy_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
diverboy_state *state = machine.driver_data<diverboy_state>();
UINT16 *source = state->m_spriteram;
UINT16 *finish = source + (state->m_spriteram.bytes() / 2);
UINT16 *source = m_spriteram;
UINT16 *finish = source + (m_spriteram.bytes() / 2);
while (source < finish)
{
@ -100,9 +100,9 @@ static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap, const
bank = (source[1] & 0x0002) >> 1;
if (!flash || (machine.primary_screen->frame_number() & 1))
if (!flash || (machine().primary_screen->frame_number() & 1))
{
drawgfx_transpen(bitmap,cliprect,machine.gfx[bank],
drawgfx_transpen(bitmap,cliprect,machine().gfx[bank],
number,
colr,
0,0,
@ -117,7 +117,7 @@ static void draw_sprites( running_machine& machine, bitmap_ind16 &bitmap, const
UINT32 diverboy_state::screen_update_diverboy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// bitmap.fill(get_black_pen(machine()), cliprect);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -80,27 +80,27 @@ public:
virtual void machine_reset();
virtual void video_start();
UINT32 screen_update_egghunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
};
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
void egghunt_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
{
egghunt_state *state = machine.driver_data<egghunt_state>();
int flipscreen = 0;
int offs, sx, sy;
for (offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20)
{
int code = state->m_spram[offs];
int attr = state->m_spram[offs + 1];
int code = m_spram[offs];
int attr = m_spram[offs + 1];
int color = attr & 0x0f;
sx = state->m_spram[offs + 3] + ((attr & 0x10) << 4);
sy = ((state->m_spram[offs + 2] + 8) & 0xff) - 8;
sx = m_spram[offs + 3] + ((attr & 0x10) << 4);
sy = ((m_spram[offs + 2] + 8) & 0xff) - 8;
code += (attr & 0xe0) << 3;
if (attr & 0xe0)
{
switch(state->m_gfx_banking & 0x30)
switch(m_gfx_banking & 0x30)
{
// case 0x00:
// case 0x10: code += 0; break;
@ -114,7 +114,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const r
sx = 496 - sx;
sy = 240 - sy;
}
drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code,
color,
flipscreen,flipscreen,
@ -183,7 +183,7 @@ void egghunt_state::video_start()
UINT32 egghunt_state::screen_update_egghunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -93,6 +93,11 @@ public:
UINT32 screen_update_enigma2a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(interrupt_clear_callback);
TIMER_CALLBACK_MEMBER(interrupt_assert_callback);
inline UINT16 vpos_to_vysnc_chain_counter( int vpos );
inline int vysnc_chain_counter_to_vpos( UINT16 counter );
void create_interrupt_timers( );
void start_interrupt_timers( );
void get_pens(pen_t *pens);
};
@ -103,13 +108,13 @@ public:
*************************************/
INLINE UINT16 vpos_to_vysnc_chain_counter( int vpos )
UINT16 enigma2_state::vpos_to_vysnc_chain_counter( int vpos )
{
return vpos + VCOUNTER_START;
}
INLINE int vysnc_chain_counter_to_vpos( UINT16 counter )
int enigma2_state::vysnc_chain_counter_to_vpos( UINT16 counter )
{
return counter - VCOUNTER_START;
}
@ -144,26 +149,24 @@ TIMER_CALLBACK_MEMBER(enigma2_state::interrupt_assert_callback)
}
static void create_interrupt_timers( running_machine &machine )
void enigma2_state::create_interrupt_timers( )
{
enigma2_state *state = machine.driver_data<enigma2_state>();
state->m_interrupt_clear_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_clear_callback),state));
state->m_interrupt_assert_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_assert_callback),state));
m_interrupt_clear_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_clear_callback),this));
m_interrupt_assert_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_assert_callback),this));
}
static void start_interrupt_timers( running_machine &machine )
void enigma2_state::start_interrupt_timers( )
{
enigma2_state *state = machine.driver_data<enigma2_state>();
int vpos = vysnc_chain_counter_to_vpos(INT_TRIGGER_COUNT_1);
state->m_interrupt_assert_timer->adjust(machine.primary_screen->time_until_pos(vpos));
m_interrupt_assert_timer->adjust(machine().primary_screen->time_until_pos(vpos));
}
void enigma2_state::machine_start()
{
create_interrupt_timers(machine());
create_interrupt_timers();
m_maincpu = machine().device<cpu_device>("maincpu");
m_audiocpu = machine().device<cpu_device>("audiocpu");
@ -185,7 +188,7 @@ void enigma2_state::machine_reset()
m_sound_latch = 0;
m_blink_count = 0;
start_interrupt_timers(machine());
start_interrupt_timers();
}
@ -195,7 +198,7 @@ void enigma2_state::machine_reset()
*
*************************************/
static void get_pens(pen_t *pens)
void enigma2_state::get_pens(pen_t *pens)
{
offs_t i;

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,8 @@ public:
virtual void video_start();
UINT32 screen_update_firefox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(video_timer_callback);
void set_rgba( int start, int index, unsigned char *palette_ram );
void firq_gen(phillips_22vp931_device &laserdisc, int state);
};
@ -258,26 +260,26 @@ TIMER_DEVICE_CALLBACK_MEMBER(firefox_state::video_timer_callback)
machine().device("maincpu")->execute().set_input_line(M6809_IRQ_LINE, ASSERT_LINE );
}
static void set_rgba( running_machine &machine, int start, int index, unsigned char *palette_ram )
void firefox_state::set_rgba( int start, int index, unsigned char *palette_ram )
{
int r = palette_ram[ index ];
int g = palette_ram[ index + 256 ];
int b = palette_ram[ index + 512 ];
int a = ( b & 3 ) * 0x55;
palette_set_color( machine, start + index, MAKE_ARGB( a, r, g, b ) );
palette_set_color( machine(), start + index, MAKE_ARGB( a, r, g, b ) );
}
WRITE8_MEMBER(firefox_state::tile_palette_w)
{
m_tile_palette[ offset ] = data;
set_rgba( machine(), 0, offset & 0xff, m_tile_palette );
set_rgba( 0, offset & 0xff, m_tile_palette );
}
WRITE8_MEMBER(firefox_state::sprite_palette_w)
{
m_sprite_palette[ offset ] = data;
set_rgba( machine(), 256, offset & 0xff, m_sprite_palette );
set_rgba( 256, offset & 0xff, m_sprite_palette );
}
WRITE8_MEMBER(firefox_state::firefox_objram_bank_w)
@ -476,10 +478,10 @@ WRITE8_MEMBER(firefox_state::firefox_coin_counter_w)
static void firq_gen(running_machine &machine, phillips_22vp931_device &laserdisc, int state)
void firefox_state::firq_gen(phillips_22vp931_device &laserdisc, int state)
{
if (state)
machine.device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE );
machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, ASSERT_LINE );
}
@ -489,7 +491,7 @@ void firefox_state::machine_start()
m_nvram_1c = machine().device<x2212_device>("nvram_1c");
m_nvram_1d = machine().device<x2212_device>("nvram_1d");
m_laserdisc->set_data_ready_callback(phillips_22vp931_device::data_ready_delegate(FUNC(firq_gen), &machine()));
m_laserdisc->set_data_ready_callback(phillips_22vp931_device::data_ready_delegate(FUNC(firefox_state::firq_gen), this));
m_control_num = 0;
m_sprite_bank = 0;

View File

@ -114,6 +114,7 @@ public:
virtual void video_start();
UINT32 screen_update_galpani3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(galpani3_vblank);
int gp3_is_alpha_pen(int pen);
};
@ -150,38 +151,37 @@ void galpani3_state::video_start()
static int gp3_is_alpha_pen(running_machine &machine, int pen)
int galpani3_state::gp3_is_alpha_pen(int pen)
{
galpani3_state *state = machine.driver_data<galpani3_state>();
UINT16 dat = 0;
if (pen<0x4000)
{
dat = state->m_generic_paletteram_16[pen];
dat = m_generic_paletteram_16[pen];
}
else if (pen<0x4100)
{
dat = state->m_grap2_0->m_framebuffer_palette[pen&0xff];
dat = m_grap2_0->m_framebuffer_palette[pen&0xff];
}
else if (pen<0x4200)
{
dat = state->m_grap2_1->m_framebuffer_palette[pen&0xff];
dat = m_grap2_1->m_framebuffer_palette[pen&0xff];
}
else if (pen<0x4300)
{
dat = state->m_grap2_2->m_framebuffer_palette[pen&0xff];
dat = m_grap2_2->m_framebuffer_palette[pen&0xff];
}
else if (pen<0x4301)
{
dat = state->m_grap2_0->m_framebuffer_bgcol;
dat = m_grap2_0->m_framebuffer_bgcol;
}
else if (pen<0x4302)
{
dat = state->m_grap2_1->m_framebuffer_bgcol;
dat = m_grap2_1->m_framebuffer_bgcol;
}
else if (pen<0x4303)
{
dat = state->m_grap2_2->m_framebuffer_bgcol;
dat = m_grap2_2->m_framebuffer_bgcol;
}
if (dat&0x8000) return 1;
@ -259,7 +259,7 @@ UINT32 galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rgb3
UINT16 pen = dat1+0x4000;
UINT32 pal = paldata[pen];
if (gp3_is_alpha_pen(machine(), pen))
if (gp3_is_alpha_pen(pen))
{
int r,g,b;
r = (pal & 0x00ff0000)>>16;
@ -287,7 +287,7 @@ UINT32 galpani3_state::screen_update_galpani3(screen_device &screen, bitmap_rgb3
UINT16 pen = dat2+0x4100;
UINT32 pal = paldata[pen];
if (gp3_is_alpha_pen(machine(), pen))
if (gp3_is_alpha_pen(pen))
{
int r,g,b;
r = (pal & 0x00ff0000)>>16;

View File

@ -372,6 +372,9 @@ public:
UINT32 screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
UINT32 screen_update_hornet_2board(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(irq_off);
int jvs_encode_data(UINT8 *in, int length);
int jvs_decode_data(UINT8 *in, UINT8 *out, int length);
void jamma_jvs_cmd_exec();
};
@ -1140,8 +1143,6 @@ MACHINE_CONFIG_END
/*****************************************************************************/
static void jamma_jvs_cmd_exec(running_machine &machine);
static void jamma_jvs_w(device_t *device, UINT8 data)
{
hornet_state *state = device->machine().driver_data<hornet_state>();
@ -1151,10 +1152,10 @@ static void jamma_jvs_w(device_t *device, UINT8 data)
state->m_jvs_sdata_ptr++;
if (state->m_jvs_sdata_ptr >= 3 && state->m_jvs_sdata_ptr >= 3 + state->m_jvs_sdata[2])
jamma_jvs_cmd_exec(device->machine());
state->jamma_jvs_cmd_exec();
}
static int jvs_encode_data(running_machine &machine, UINT8 *in, int length)
int hornet_state::jvs_encode_data(UINT8 *in, int length)
{
int inptr = 0;
int sum = 0;
@ -1165,25 +1166,25 @@ static int jvs_encode_data(running_machine &machine, UINT8 *in, int length)
if (b == 0xe0)
{
sum += 0xd0 + 0xdf;
ppc4xx_spu_receive_byte(machine.device("maincpu"), 0xd0);
ppc4xx_spu_receive_byte(machine.device("maincpu"), 0xdf);
ppc4xx_spu_receive_byte(machine().device("maincpu"), 0xd0);
ppc4xx_spu_receive_byte(machine().device("maincpu"), 0xdf);
}
else if (b == 0xd0)
{
sum += 0xd0 + 0xcf;
ppc4xx_spu_receive_byte(machine.device("maincpu"), 0xd0);
ppc4xx_spu_receive_byte(machine.device("maincpu"), 0xcf);
ppc4xx_spu_receive_byte(machine().device("maincpu"), 0xd0);
ppc4xx_spu_receive_byte(machine().device("maincpu"), 0xcf);
}
else
{
sum += b;
ppc4xx_spu_receive_byte(machine.device("maincpu"), b);
ppc4xx_spu_receive_byte(machine().device("maincpu"), b);
}
}
return sum;
}
static int jvs_decode_data(UINT8 *in, UINT8 *out, int length)
int hornet_state::jvs_decode_data(UINT8 *in, UINT8 *out, int length)
{
int outptr = 0;
int inptr = 0;
@ -1205,9 +1206,8 @@ static int jvs_decode_data(UINT8 *in, UINT8 *out, int length)
return outptr;
}
static void jamma_jvs_cmd_exec(running_machine &machine)
void hornet_state::jamma_jvs_cmd_exec()
{
hornet_state *state = machine.driver_data<hornet_state>();
UINT8 byte_num;
UINT8 data[1024], rdata[1024];
#if 0
@ -1216,19 +1216,19 @@ static void jamma_jvs_cmd_exec(running_machine &machine)
int rdata_ptr;
int sum;
// sync = state->m_jvs_sdata[0];
// node = state->m_jvs_sdata[1];
byte_num = state->m_jvs_sdata[2];
// sync = m_jvs_sdata[0];
// node = m_jvs_sdata[1];
byte_num = m_jvs_sdata[2];
#if 0
length =
#endif
jvs_decode_data(&state->m_jvs_sdata[3], data, byte_num-1);
jvs_decode_data(&m_jvs_sdata[3], data, byte_num-1);
#if 0
printf("jvs input data:\n");
for (i=0; i < byte_num; i++)
{
printf("%02X ", state->m_jvs_sdata[3+i]);
printf("%02X ", m_jvs_sdata[3+i]);
}
printf("\n");
@ -1271,13 +1271,13 @@ static void jamma_jvs_cmd_exec(running_machine &machine)
// write jvs return data
sum = 0x00 + (rdata_ptr+1);
ppc4xx_spu_receive_byte(machine.device("maincpu"), 0xe0); // sync
ppc4xx_spu_receive_byte(machine.device("maincpu"), 0x00); // node
ppc4xx_spu_receive_byte(machine.device("maincpu"), rdata_ptr + 1); // num of bytes
sum += jvs_encode_data(machine, rdata, rdata_ptr);
ppc4xx_spu_receive_byte(machine.device("maincpu"), sum - 1); // checksum
ppc4xx_spu_receive_byte(machine().device("maincpu"), 0xe0); // sync
ppc4xx_spu_receive_byte(machine().device("maincpu"), 0x00); // node
ppc4xx_spu_receive_byte(machine().device("maincpu"), rdata_ptr + 1); // num of bytes
sum += jvs_encode_data(rdata, rdata_ptr);
ppc4xx_spu_receive_byte(machine().device("maincpu"), sum - 1); // checksum
state->m_jvs_sdata_ptr = 0;
m_jvs_sdata_ptr = 0;
}
/*****************************************************************************/

View File

@ -205,6 +205,18 @@ public:
UINT32 screen_update_igs011(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_vbowl(screen_device &screen, bool state);
INTERRUPT_GEN_MEMBER(lhb_vblank_irq);
void wlcc_decrypt();
void lhb_decrypt();
void drgnwrld_type3_decrypt();
void drgnwrld_type2_decrypt();
void drgnwrld_type1_decrypt();
void lhb2_decrypt();
void nkishusp_decrypt();
void vbowlj_decrypt();
void dbc_decrypt();
void ryukobou_decrypt();
void lhb2_decrypt_gfx();
void drgnwrld_gfx_decrypt();
};
@ -586,10 +598,10 @@ READ16_MEMBER(igs011_state::igs_5_dips_r){ return igs_dips_r(5); }
***************************************************************************/
static void wlcc_decrypt(running_machine &machine)
void igs011_state::wlcc_decrypt()
{
int i;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
int rom_size = 0x80000;
@ -610,10 +622,10 @@ static void wlcc_decrypt(running_machine &machine)
}
static void lhb_decrypt(running_machine &machine)
void igs011_state::lhb_decrypt()
{
int i;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
int rom_size = 0x80000;
@ -635,10 +647,10 @@ static void lhb_decrypt(running_machine &machine)
}
static void drgnwrld_type3_decrypt(running_machine &machine)
void igs011_state::drgnwrld_type3_decrypt()
{
int i;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
int rom_size = 0x80000;
@ -663,10 +675,10 @@ static void drgnwrld_type3_decrypt(running_machine &machine)
}
}
static void drgnwrld_type2_decrypt(running_machine &machine)
void igs011_state::drgnwrld_type2_decrypt()
{
int i;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
int rom_size = 0x80000;
@ -696,10 +708,10 @@ static void drgnwrld_type2_decrypt(running_machine &machine)
}
}
static void drgnwrld_type1_decrypt(running_machine &machine)
void igs011_state::drgnwrld_type1_decrypt()
{
int i;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
int rom_size = 0x80000;
@ -725,12 +737,12 @@ static void drgnwrld_type1_decrypt(running_machine &machine)
}
static void lhb2_decrypt(running_machine &machine)
void igs011_state::lhb2_decrypt()
{
int i,j;
int rom_size = 0x80000;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *result_data = auto_alloc_array(machine, UINT16, rom_size/2);
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
UINT16 *result_data = auto_alloc_array(machine(), UINT16, rom_size/2);
for (i=0; i<rom_size/2; i++)
{
@ -752,17 +764,17 @@ static void lhb2_decrypt(running_machine &machine)
memcpy(src,result_data,rom_size);
auto_free(machine, result_data);
auto_free(machine(), result_data);
}
// xor similar to ryukobou (both sets are Japan), address scrambling from lhb2
static void nkishusp_decrypt(running_machine &machine)
void igs011_state::nkishusp_decrypt()
{
int i,j;
int rom_size = 0x80000;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *result_data = auto_alloc_array(machine, UINT16, rom_size/2);
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
UINT16 *result_data = auto_alloc_array(machine(), UINT16, rom_size/2);
for (i=0; i<rom_size/2; i++)
{
@ -792,14 +804,14 @@ static void nkishusp_decrypt(running_machine &machine)
memcpy(src,result_data,rom_size);
auto_free(machine, result_data);
auto_free(machine(), result_data);
}
static void vbowlj_decrypt(running_machine &machine)
void igs011_state::vbowlj_decrypt()
{
int i;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
int rom_size = 0x80000;
@ -830,10 +842,10 @@ static void vbowlj_decrypt(running_machine &machine)
}
static void dbc_decrypt(running_machine &machine)
void igs011_state::dbc_decrypt()
{
int i;
UINT16 *src = (UINT16 *) (machine.root_device().memregion("maincpu")->base());
UINT16 *src = (UINT16 *) (machine().root_device().memregion("maincpu")->base());
int rom_size = 0x80000;
@ -880,10 +892,10 @@ static void dbc_decrypt(running_machine &machine)
}
static void ryukobou_decrypt(running_machine &machine)
void igs011_state::ryukobou_decrypt()
{
int i;
UINT16 *src = (UINT16 *) machine.root_device().memregion("maincpu")->base();
UINT16 *src = (UINT16 *) machine().root_device().memregion("maincpu")->base();
int rom_size = 0x80000;
for (i=0; i<rom_size/2; i++)
@ -911,34 +923,34 @@ static void ryukobou_decrypt(running_machine &machine)
***************************************************************************/
static void lhb2_decrypt_gfx(running_machine &machine)
void igs011_state::lhb2_decrypt_gfx()
{
int i;
unsigned rom_size = 0x200000;
UINT8 *src = (UINT8 *) (machine.root_device().memregion("blitter")->base());
UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
UINT8 *src = (UINT8 *) (machine().root_device().memregion("blitter")->base());
UINT8 *result_data = auto_alloc_array(machine(), UINT8, rom_size);
for (i=0; i<rom_size; i++)
result_data[i] = src[BITSWAP24(i, 23,22,21,20, 19, 17,16,15, 13,12, 10,9,8,7,6,5,4, 2,1, 3, 11, 14, 18, 0)];
memcpy(src,result_data,rom_size);
auto_free(machine, result_data);
auto_free(machine(), result_data);
}
static void drgnwrld_gfx_decrypt(running_machine &machine)
void igs011_state::drgnwrld_gfx_decrypt()
{
int i;
unsigned rom_size = 0x400000;
UINT8 *src = (UINT8 *) (machine.root_device().memregion("blitter")->base());
UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
UINT8 *src = (UINT8 *) (machine().root_device().memregion("blitter")->base());
UINT8 *result_data = auto_alloc_array(machine(), UINT8, rom_size);
for (i=0; i<rom_size; i++)
result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 12, 13, 14, 11,10,9,8,7,6,5,4,3,2,1,0)];
memcpy(src,result_data,rom_size);
auto_free(machine, result_data);
auto_free(machine(), result_data);
}
@ -1899,8 +1911,8 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrld)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
drgnwrld_type1_decrypt(machine());
drgnwrld_gfx_decrypt(machine());
drgnwrld_type1_decrypt();
drgnwrld_gfx_decrypt();
/*
// PROTECTION CHECKS
rom[0x032ee/2] = 0x606c; // 0032EE: 676C beq 335c (ASIC11 CHECK PORT ERROR 3)
@ -1925,8 +1937,8 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrldv30)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
drgnwrld_type1_decrypt(machine());
drgnwrld_gfx_decrypt(machine());
drgnwrld_type1_decrypt();
drgnwrld_gfx_decrypt();
/*
// PROTECTION CHECKS
rom[0x032ee/2] = 0x606c; // 0032EE: 676C beq 335c (ASIC11 CHECK PORT ERROR 3)
@ -1950,8 +1962,8 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrldv21)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
drgnwrld_type2_decrypt(machine());
drgnwrld_gfx_decrypt(machine());
drgnwrld_type2_decrypt();
drgnwrld_gfx_decrypt();
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd4c0, 0xd4ff, read16_delegate(FUNC(igs011_state::drgnwrldv21_igs011_prot2_r), this));
/*
// PROTECTION CHECKS
@ -1979,8 +1991,8 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrldv21j)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
drgnwrld_type3_decrypt(machine());
drgnwrld_gfx_decrypt(machine());
drgnwrld_type3_decrypt();
drgnwrld_gfx_decrypt();
/*
// PROTECTION CHECKS
rom[0x033d2/2] = 0x606c; // 0033D2: 676C beq 3440 (ASIC11 CHECK PORT ERROR 3)
@ -2006,8 +2018,8 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrldv20j)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
drgnwrld_type3_decrypt(machine());
drgnwrld_gfx_decrypt(machine());
drgnwrld_type3_decrypt();
drgnwrld_gfx_decrypt();
/*
// PROTECTION CHECKS
// bp 33d2; bp 11c74; bp 23d2a; bp 23f68; bp 240d4; bp 242ac; bp 244b2; bp 24630; bp 24886; bp 24aca; bp 24d46; bp 24f8e; bp 254ba; bp 26a52; bp 276a0; bp 2a86e
@ -2033,8 +2045,8 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrldv20j)
DRIVER_INIT_MEMBER(igs011_state,drgnwrldv11h)
{
drgnwrld_type1_decrypt(machine());
drgnwrld_gfx_decrypt(machine());
drgnwrld_type1_decrypt();
drgnwrld_gfx_decrypt();
// PROTECTION CHECKS
// the protection checks are already patched out like we do!
@ -2044,8 +2056,8 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrldv10c)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
drgnwrld_type1_decrypt(machine());
drgnwrld_gfx_decrypt(machine());
drgnwrld_type1_decrypt();
drgnwrld_gfx_decrypt();
/*
// PROTECTION CHECKS
// bp 33d2; bp 23d0e; bp 23f58; bp 240d0; bp 242a8; bp 244ae; bp 2462c; bp 24882; bp 24ac6; bp 24d42; bp 24f8a; bp 254b6; bp 2a23a
@ -2070,7 +2082,7 @@ DRIVER_INIT_MEMBER(igs011_state,lhb)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
lhb_decrypt(machine());
lhb_decrypt();
// PROTECTION CHECKS
// rom[0x2eef6/2] = 0x4e75; // 02EEF6: 4E56 FE00 link A6, #-$200 (fills palette with pink otherwise)
@ -2080,7 +2092,7 @@ DRIVER_INIT_MEMBER(igs011_state,lhbv33c)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
lhb_decrypt(machine());
lhb_decrypt();
// PROTECTION CHECKS
// rom[0x2e988/2] = 0x4e75; // 02E988: 4E56 FE00 link A6, #-$200 (fills palette with pink otherwise)
@ -2090,7 +2102,7 @@ DRIVER_INIT_MEMBER(igs011_state,dbc)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
dbc_decrypt(machine());
dbc_decrypt();
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::dbc_igs011_prot2_r), this));
/*
@ -2120,7 +2132,7 @@ DRIVER_INIT_MEMBER(igs011_state,ryukobou)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
ryukobou_decrypt(machine());
ryukobou_decrypt();
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::ryukobou_igs011_prot2_r), this));
@ -2133,7 +2145,7 @@ DRIVER_INIT_MEMBER(igs011_state,xymg)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
lhb_decrypt(machine());
lhb_decrypt();
/*
// PROTECTION CHECKS
rom[0x00502/2] = 0x6006; // 000502: 6050 bra 554
@ -2167,7 +2179,7 @@ DRIVER_INIT_MEMBER(igs011_state,wlcc)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
wlcc_decrypt(machine());
wlcc_decrypt();
/*
// PROTECTION CHECKS
rom[0x16b96/2] = 0x6000; // 016B96: 6700 02FE beq 16e96 (fills palette with red otherwise)
@ -2191,8 +2203,8 @@ DRIVER_INIT_MEMBER(igs011_state,lhb2)
{
// UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
lhb2_decrypt(machine());
lhb2_decrypt_gfx(machine());
lhb2_decrypt();
lhb2_decrypt_gfx();
/*
// PROTECTION CHECKS
rom[0x034f4/2] = 0x4e71; // 0034F4: 660E bne 3504 (rom test, fills palette with white otherwise)
@ -2216,7 +2228,7 @@ DRIVER_INIT_MEMBER(igs011_state,vbowl)
UINT8 *gfx = (UINT8 *) machine().root_device().memregion("blitter")->base();
int i;
vbowlj_decrypt(machine());
vbowlj_decrypt();
for (i = 0x400000-1; i >= 0; i--)
{
@ -2242,7 +2254,7 @@ DRIVER_INIT_MEMBER(igs011_state,vbowlj)
UINT8 *gfx = (UINT8 *) machine().root_device().memregion("blitter")->base();
int i;
vbowlj_decrypt(machine());
vbowlj_decrypt();
for (i = 0x400000-1; i >= 0; i--)
{
@ -2263,8 +2275,8 @@ DRIVER_INIT_MEMBER(igs011_state,nkishusp)
{
UINT16 *rom = (UINT16 *) machine().root_device().memregion("maincpu")->base();
nkishusp_decrypt(machine());
lhb2_decrypt_gfx(machine());
nkishusp_decrypt();
lhb2_decrypt_gfx();
// PROTECTION CHECKS (similar to lhb2)

View File

@ -159,6 +159,23 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(irqblocka_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(mgcs_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(mgdh_interrupt);
void expand_sprites();
void draw_sprite(bitmap_ind16 &bitmap,const rectangle &cliprect, int sx, int sy, int dimx, int dimy, int flipx, int flipy, int color, int addr);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
int debug_viewer(bitmap_ind16 &bitmap,const rectangle &cliprect);
void decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0);
void iqblocka_patch_rom();
void tjsb_decrypt_sprites();
void mgcs_decrypt_program_rom();
void mgcs_decrypt_tiles();
void mgcs_flip_sprites();
void mgcs_patch_rom();
void starzan_decrypt(UINT8 *ROM, int size, bool isOpcode);
void lhzb2_patch_rom();
void lhzb2_decrypt_tiles();
void lhzb2_decrypt_sprites();
void slqz2_patch_rom();
void slqz2_decrypt_tiles();
};
@ -249,23 +266,22 @@ WRITE16_MEMBER(igs017_state::spriteram_lsb_w)
// Eeach 16 bit word in the sprites gfx roms contains three 5 bit pens: x-22222-11111-00000 (little endian!).
// This routine expands each word into three bytes.
static void expand_sprites(running_machine &machine)
void igs017_state::expand_sprites()
{
igs017_state *state = machine.driver_data<igs017_state>();
UINT8 *rom = state->memregion("sprites")->base();
int size = state->memregion("sprites")->bytes();
UINT8 *rom = memregion("sprites")->base();
int size = memregion("sprites")->bytes();
int i;
state->m_sprites_gfx_size = size / 2 * 3;
state->m_sprites_gfx = auto_alloc_array(machine, UINT8, state->m_sprites_gfx_size);
m_sprites_gfx_size = size / 2 * 3;
m_sprites_gfx = auto_alloc_array(machine(), UINT8, m_sprites_gfx_size);
for (i = 0; i < size / 2 ; i++)
{
UINT16 pens = (rom[i*2+1] << 8) | rom[i*2];
state->m_sprites_gfx[i * 3 + 0] = (pens >> 0) & 0x1f;
state->m_sprites_gfx[i * 3 + 1] = (pens >> 5) & 0x1f;
state->m_sprites_gfx[i * 3 + 2] = (pens >> 10) & 0x1f;
m_sprites_gfx[i * 3 + 0] = (pens >> 0) & 0x1f;
m_sprites_gfx[i * 3 + 1] = (pens >> 5) & 0x1f;
m_sprites_gfx[i * 3 + 2] = (pens >> 10) & 0x1f;
}
}
@ -281,7 +297,7 @@ void igs017_state::video_start()
m_debug_addr = 0;
m_debug_width = 512;
expand_sprites(machine());
expand_sprites();
}
/***************************************************************************
@ -317,16 +333,15 @@ void igs017_state::video_start()
***************************************************************************/
static void draw_sprite(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, int sx, int sy, int dimx, int dimy, int flipx, int flipy, int color, int addr)
void igs017_state::draw_sprite(bitmap_ind16 &bitmap,const rectangle &cliprect, int sx, int sy, int dimx, int dimy, int flipx, int flipy, int color, int addr)
{
igs017_state *state = machine.driver_data<igs017_state>();
// prepare GfxElement on the fly
// Bounds checking
if ( addr + dimx * dimy >= state->m_sprites_gfx_size )
if ( addr + dimx * dimy >= m_sprites_gfx_size )
return;
gfx_element gfx(machine, state->m_sprites_gfx + addr, dimx, dimy, dimx, 0x100, 32);
gfx_element gfx(machine(), m_sprites_gfx + addr, dimx, dimy, dimx, 0x100, 32);
drawgfx_transpen( bitmap,cliprect, &gfx,
0, color,
@ -334,11 +349,10 @@ static void draw_sprite(running_machine &machine, bitmap_ind16 &bitmap,const rec
sx, sy, 0x1f );
}
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
void igs017_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
igs017_state *state = machine.driver_data<igs017_state>();
UINT8 *s = state->m_spriteram;
UINT8 *end = state->m_spriteram + 0x800;
UINT8 *s = m_spriteram;
UINT8 *end = m_spriteram + 0x800;
for ( ; s < end; s += 8 )
{
@ -365,36 +379,35 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
color = (s[7] & 0xe0) >> 5;
draw_sprite(machine, bitmap, cliprect, sx, sy, dimx, dimy, flipx, flipy, color, addr);
draw_sprite(bitmap, cliprect, sx, sy, dimx, dimy, flipx, flipy, color, addr);
}
}
// A simple gfx viewer (toggle with T)
static int debug_viewer(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
int igs017_state::debug_viewer(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
#ifdef MAME_DEBUG
igs017_state *state = machine.driver_data<igs017_state>();
if (machine.input().code_pressed_once(KEYCODE_T)) state->m_toggle = 1-state->m_toggle;
if (state->m_toggle) {
int h = 256, w = state->m_debug_width, a = state->m_debug_addr;
if (machine().input().code_pressed_once(KEYCODE_T)) m_toggle = 1-m_toggle;
if (m_toggle) {
int h = 256, w = m_debug_width, a = m_debug_addr;
if (machine.input().code_pressed(KEYCODE_O)) w += 1;
if (machine.input().code_pressed(KEYCODE_I)) w -= 1;
if (machine().input().code_pressed(KEYCODE_O)) w += 1;
if (machine().input().code_pressed(KEYCODE_I)) w -= 1;
if (machine.input().code_pressed(KEYCODE_U)) w += 8;
if (machine.input().code_pressed(KEYCODE_Y)) w -= 8;
if (machine().input().code_pressed(KEYCODE_U)) w += 8;
if (machine().input().code_pressed(KEYCODE_Y)) w -= 8;
if (machine.input().code_pressed(KEYCODE_RIGHT)) a += 1;
if (machine.input().code_pressed(KEYCODE_LEFT)) a -= 1;
if (machine().input().code_pressed(KEYCODE_RIGHT)) a += 1;
if (machine().input().code_pressed(KEYCODE_LEFT)) a -= 1;
if (machine.input().code_pressed(KEYCODE_DOWN)) a += w;
if (machine.input().code_pressed(KEYCODE_UP)) a -= w;
if (machine().input().code_pressed(KEYCODE_DOWN)) a += w;
if (machine().input().code_pressed(KEYCODE_UP)) a -= w;
if (machine.input().code_pressed(KEYCODE_PGDN)) a += w * h;
if (machine.input().code_pressed(KEYCODE_PGUP)) a -= w * h;
if (machine().input().code_pressed(KEYCODE_PGDN)) a += w * h;
if (machine().input().code_pressed(KEYCODE_PGUP)) a -= w * h;
if (a < 0) a = 0;
if (a > state->m_sprites_gfx_size) a = state->m_sprites_gfx_size;
if (a > m_sprites_gfx_size) a = m_sprites_gfx_size;
if (w <= 0) w = 0;
if (w > 1024) w = 1024;
@ -403,9 +416,9 @@ static int debug_viewer(running_machine &machine, bitmap_ind16 &bitmap,const rec
draw_sprite(machine, bitmap, cliprect, 0,0, w,h, 0,0, 0, a);
popmessage("a: %08X w: %03X p: %02x-%02x-%02x",a,w,state->m_sprites_gfx[a/3*3+0],state->m_sprites_gfx[a/3*3+1],state->m_sprites_gfx[a/3*3+2]);
state->m_debug_addr = a;
state->m_debug_width = w;
popmessage("a: %08X w: %03X p: %02x-%02x-%02x",a,w,m_sprites_gfx[a/3*3+0],m_sprites_gfx[a/3*3+1],m_sprites_gfx[a/3*3+2]);
m_debug_addr = a;
m_debug_width = w;
osd_sleep(200000);
return 1;
}
@ -428,7 +441,7 @@ UINT32 igs017_state::screen_update_igs017(screen_device &screen, bitmap_ind16 &b
}
#endif
if (debug_viewer(machine(), bitmap,cliprect))
if (debug_viewer(bitmap,cliprect))
return 0;
bitmap.fill(get_black_pen(machine()), cliprect);
@ -438,7 +451,7 @@ UINT32 igs017_state::screen_update_igs017(screen_device &screen, bitmap_ind16 &b
if (layers_ctrl & 1) m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
if (layers_ctrl & 4) draw_sprites(machine(), bitmap, cliprect);
if (layers_ctrl & 4) draw_sprites(bitmap, cliprect);
if (layers_ctrl & 2) m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
@ -449,11 +462,11 @@ UINT32 igs017_state::screen_update_igs017(screen_device &screen, bitmap_ind16 &b
Decryption
***************************************************************************/
static void decrypt_program_rom(running_machine &machine, int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0)
void igs017_state::decrypt_program_rom(int mask, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0)
{
int length = machine.root_device().memregion("maincpu")->bytes();
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
int length = machine().root_device().memregion("maincpu")->bytes();
UINT8 *rom = machine().root_device().memregion("maincpu")->base();
UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
int i;
// decrypt the program ROM
@ -502,9 +515,9 @@ static void decrypt_program_rom(running_machine &machine, int mask, int a7, int
// iqblocka
static void iqblocka_patch_rom(running_machine &machine)
void igs017_state::iqblocka_patch_rom()
{
UINT8 *rom = machine.root_device().memregion("maincpu")->base();
UINT8 *rom = machine().root_device().memregion("maincpu")->base();
// rom[0x7b64] = 0xc9;
@ -529,25 +542,25 @@ static void iqblocka_patch_rom(running_machine &machine)
DRIVER_INIT_MEMBER(igs017_state,iqblocka)
{
decrypt_program_rom(machine(), 0x11, 7, 6, 5, 4, 3, 2, 1, 0);
iqblocka_patch_rom(machine());
decrypt_program_rom(0x11, 7, 6, 5, 4, 3, 2, 1, 0);
iqblocka_patch_rom();
}
// iqblockf
DRIVER_INIT_MEMBER(igs017_state,iqblockf)
{
decrypt_program_rom(machine(), 0x11, 7, 6, 5, 4, 3, 2, 1, 0);
// iqblockf_patch_rom(machine());
decrypt_program_rom(0x11, 7, 6, 5, 4, 3, 2, 1, 0);
// iqblockf_patch_rom();
}
// tjsb
static void tjsb_decrypt_sprites(running_machine &machine)
void igs017_state::tjsb_decrypt_sprites()
{
int length = machine.root_device().memregion("sprites")->bytes();
UINT8 *rom = machine.root_device().memregion("sprites")->base();
UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
int length = machine().root_device().memregion("sprites")->bytes();
UINT8 *rom = machine().root_device().memregion("sprites")->base();
UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
int i, addr;
// address lines swap
@ -570,18 +583,18 @@ static void tjsb_decrypt_sprites(running_machine &machine)
DRIVER_INIT_MEMBER(igs017_state,tjsb)
{
decrypt_program_rom(machine(), 0x05, 7, 6, 3, 2, 5, 4, 1, 0);
decrypt_program_rom(0x05, 7, 6, 3, 2, 5, 4, 1, 0);
tjsb_decrypt_sprites(machine());
tjsb_decrypt_sprites();
}
// mgcs
static void mgcs_decrypt_program_rom(running_machine &machine)
void igs017_state::mgcs_decrypt_program_rom()
{
int i;
UINT16 *src = (UINT16 *)machine.root_device().memregion("maincpu")->base();
UINT16 *src = (UINT16 *)machine().root_device().memregion("maincpu")->base();
int rom_size = 0x80000;
@ -628,11 +641,11 @@ static void mgcs_decrypt_program_rom(running_machine &machine)
}
}
static void mgcs_decrypt_tiles(running_machine &machine)
void igs017_state::mgcs_decrypt_tiles()
{
int length = machine.root_device().memregion("tilemaps")->bytes();
UINT8 *rom = machine.root_device().memregion("tilemaps")->base();
UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
int length = machine().root_device().memregion("tilemaps")->bytes();
UINT8 *rom = machine().root_device().memregion("tilemaps")->base();
UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
int i;
memcpy(tmp,rom,length);
@ -642,13 +655,13 @@ static void mgcs_decrypt_tiles(running_machine &machine)
rom[i] = tmp[addr];
}
auto_free(machine, tmp);
auto_free(machine(), tmp);
}
static void mgcs_flip_sprites(running_machine &machine)
void igs017_state::mgcs_flip_sprites()
{
int length = machine.root_device().memregion("sprites")->bytes();
UINT8 *rom = machine.root_device().memregion("sprites")->base();
int length = machine().root_device().memregion("sprites")->bytes();
UINT8 *rom = machine().root_device().memregion("sprites")->base();
int i;
for (i = 0;i < length;i+=2)
@ -666,9 +679,9 @@ static void mgcs_flip_sprites(running_machine &machine)
}
}
static void mgcs_patch_rom(running_machine &machine)
void igs017_state::mgcs_patch_rom()
{
UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
rom[0x4e036/2] = 0x6006;
@ -681,11 +694,11 @@ static void mgcs_patch_rom(running_machine &machine)
DRIVER_INIT_MEMBER(igs017_state,mgcs)
{
mgcs_decrypt_program_rom(machine());
mgcs_patch_rom(machine());
mgcs_decrypt_program_rom();
mgcs_patch_rom();
mgcs_decrypt_tiles(machine());
mgcs_flip_sprites(machine());
mgcs_decrypt_tiles();
mgcs_flip_sprites();
}
@ -741,7 +754,7 @@ DRIVER_INIT_MEMBER(igs017_state,tarzana)
// decryption is incomplete: data decryption is correct but opcodes are encrypted differently.
static void starzan_decrypt(UINT8 *ROM, int size, bool isOpcode)
void igs017_state::starzan_decrypt(UINT8 *ROM, int size, bool isOpcode)
{
for(int i=0; i<size; i++)
{
@ -802,7 +815,7 @@ DRIVER_INIT_MEMBER(igs017_state,starzan)
machine().device("maincpu")->memory().space(AS_PROGRAM).set_decrypted_region(0x00000, 0x3ffff, code);
mgcs_flip_sprites(machine());
mgcs_flip_sprites();
}
@ -896,7 +909,7 @@ DRIVER_INIT_MEMBER(igs017_state,mgdha)
src[i] = x;
}
mgcs_flip_sprites(machine());
mgcs_flip_sprites();
}
DRIVER_INIT_MEMBER(igs017_state,mgdh)
@ -913,9 +926,9 @@ DRIVER_INIT_MEMBER(igs017_state,mgdh)
// lhzb2
static void lhzb2_patch_rom(running_machine &machine)
void igs017_state::lhzb2_patch_rom()
{
UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
// Prot. checks:
rom[0x14786/2] = 0x6044; // 014786: 6744 beq $147cc
@ -924,11 +937,11 @@ static void lhzb2_patch_rom(running_machine &machine)
rom[0x0b48a/2] = 0x604e; // 00B48A: 674E beq $b4da
}
static void lhzb2_decrypt_tiles(running_machine &machine)
void igs017_state::lhzb2_decrypt_tiles()
{
int length = machine.root_device().memregion("tilemaps")->bytes();
UINT8 *rom = machine.root_device().memregion("tilemaps")->base();
UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
int length = machine().root_device().memregion("tilemaps")->bytes();
UINT8 *rom = machine().root_device().memregion("tilemaps")->base();
UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
int i;
int addr;
@ -939,14 +952,14 @@ static void lhzb2_decrypt_tiles(running_machine &machine)
rom[i] = tmp[addr];
}
auto_free(machine, tmp);
auto_free(machine(), tmp);
}
static void lhzb2_decrypt_sprites(running_machine &machine)
void igs017_state::lhzb2_decrypt_sprites()
{
int length = machine.root_device().memregion("sprites")->bytes();
UINT8 *rom = machine.root_device().memregion("sprites")->base();
UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
int length = machine().root_device().memregion("sprites")->bytes();
UINT8 *rom = machine().root_device().memregion("sprites")->base();
UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
int i, addr;
// address lines swap
@ -1053,9 +1066,9 @@ DRIVER_INIT_MEMBER(igs017_state,lhzb2)
src[i] = x;
}
lhzb2_decrypt_tiles(machine());
lhzb2_decrypt_sprites(machine());
lhzb2_patch_rom(machine());
lhzb2_decrypt_tiles();
lhzb2_decrypt_sprites();
lhzb2_patch_rom();
}
@ -1119,16 +1132,16 @@ DRIVER_INIT_MEMBER(igs017_state,lhzb2a)
src[i] = x;
}
lhzb2_decrypt_tiles(machine());
lhzb2_decrypt_sprites(machine());
lhzb2_decrypt_tiles();
lhzb2_decrypt_sprites();
}
//slqz2
static void slqz2_patch_rom(running_machine &machine)
void igs017_state::slqz2_patch_rom()
{
UINT16 *rom = (UINT16 *)machine.root_device().memregion("maincpu")->base();
UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base();
// Prot. checks:
rom[0x1489c/2] = 0x6044; // 01489C: 6744 beq $148e2
@ -1137,11 +1150,11 @@ static void slqz2_patch_rom(running_machine &machine)
rom[0x0b77a/2] = 0x604e; // 00B77A: 674E beq $b7ca
}
static void slqz2_decrypt_tiles(running_machine &machine)
void igs017_state::slqz2_decrypt_tiles()
{
int length = machine.root_device().memregion("tilemaps")->bytes();
UINT8 *rom = machine.root_device().memregion("tilemaps")->base();
UINT8 *tmp = auto_alloc_array(machine, UINT8, length);
int length = machine().root_device().memregion("tilemaps")->bytes();
UINT8 *rom = machine().root_device().memregion("tilemaps")->base();
UINT8 *tmp = auto_alloc_array(machine(), UINT8, length);
int i;
memcpy(tmp,rom,length);
@ -1151,7 +1164,7 @@ static void slqz2_decrypt_tiles(running_machine &machine)
rom[i] = tmp[addr];
}
auto_free(machine, tmp);
auto_free(machine(), tmp);
}
DRIVER_INIT_MEMBER(igs017_state,slqz2)
@ -1230,9 +1243,9 @@ DRIVER_INIT_MEMBER(igs017_state,slqz2)
src[i] = x;
}
slqz2_decrypt_tiles(machine());
lhzb2_decrypt_sprites(machine());
slqz2_patch_rom(machine());
slqz2_decrypt_tiles();
lhzb2_decrypt_sprites();
slqz2_patch_rom();
}
/***************************************************************************

View File

@ -69,6 +69,8 @@ public:
UINT32 screen_update_igs_majhong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_fearless(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(igs_majhong_interrupt);
void sdwx_gfx_decrypt();
void pgm_create_dummy_internal_arm_region();
};
@ -278,12 +280,12 @@ static const UINT8 sdwx_tab[] =
static void sdwx_gfx_decrypt(running_machine &machine)
void igs_m027_state::sdwx_gfx_decrypt()
{
int i;
unsigned rom_size = 0x80000;
UINT8 *src = (UINT8 *) (machine.root_device().memregion("gfx1")->base());
UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
UINT8 *src = (UINT8 *) (machine().root_device().memregion("gfx1")->base());
UINT8 *result_data = auto_alloc_array(machine(), UINT8, rom_size);
for (i=0; i<rom_size; i++)
result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)];
@ -295,7 +297,7 @@ static void sdwx_gfx_decrypt(running_machine &machine)
memcpy(src+i+0x100,result_data+i+0x080,0x80);
memcpy(src+i+0x180,result_data+i+0x180,0x80);
}
auto_free(machine, result_data);
auto_free(machine(), result_data);
}
/***************************************************************************
@ -840,9 +842,9 @@ ROM_END
static void pgm_create_dummy_internal_arm_region(running_machine &machine)
void igs_m027_state::pgm_create_dummy_internal_arm_region()
{
UINT16 *temp16 = (UINT16 *)machine.root_device().memregion("maincpu")->base();
UINT16 *temp16 = (UINT16 *)machine().root_device().memregion("maincpu")->base();
// fill with RX 14
int i;
@ -875,36 +877,36 @@ DRIVER_INIT_MEMBER(igs_m027_state,igs_m027)
DRIVER_INIT_MEMBER(igs_m027_state,sdwx)
{
sdwx_decrypt(machine());
sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
sdwx_gfx_decrypt();
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,klxyj)
{
klxyj_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,chessc2)
{
chessc2_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,hauntedh)
{
hauntedh_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,fearless)
{
fearless_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
@ -912,42 +914,42 @@ DRIVER_INIT_MEMBER(igs_m027_state,lhzb4)
{
lhzb4_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,mgfx)
{
mgfx_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,lhzb3)
{
lhzb3_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,sddz)
{
sddz_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,gonefsh2)
{
gonefsh2_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
DRIVER_INIT_MEMBER(igs_m027_state,bigd2)
{
big2_decrypt(machine());
//sdwx_gfx_decrypt(machine());
pgm_create_dummy_internal_arm_region(machine());
pgm_create_dummy_internal_arm_region();
}
/***************************************************************************

View File

@ -84,6 +84,8 @@ public:
DECLARE_DRIVER_INIT(konamigq);
DECLARE_MACHINE_START(konamigq);
DECLARE_MACHINE_RESET(konamigq);
void scsi_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size );
void scsi_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size );
};
/* Sound */
@ -250,23 +252,23 @@ static const k054539_interface k054539_config =
/* SCSI */
static void scsi_dma_read( konamigq_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
void konamigq_state::scsi_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
{
UINT8 *sector_buffer = state->m_sector_buffer;
UINT8 *sector_buffer = m_sector_buffer;
int i;
int n_this;
while( n_size > 0 )
{
if( n_size > sizeof( state->m_sector_buffer ) / 4 )
if( n_size > sizeof( m_sector_buffer ) / 4 )
{
n_this = sizeof( state->m_sector_buffer ) / 4;
n_this = sizeof( m_sector_buffer ) / 4;
}
else
{
n_this = n_size;
}
state->m_am53cf96->dma_read_data( n_this * 4, sector_buffer );
m_am53cf96->dma_read_data( n_this * 4, sector_buffer );
n_size -= n_this;
i = 0;
@ -284,7 +286,7 @@ static void scsi_dma_read( konamigq_state *state, UINT32 *p_n_psxram, UINT32 n_a
}
}
static void scsi_dma_write( konamigq_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
void konamigq_state::scsi_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
{
}
@ -310,8 +312,8 @@ static MACHINE_CONFIG_START( konamigq, konamigq_state )
MCFG_CPU_ADD( "maincpu", CXD8530BQ, XTAL_67_7376MHz )
MCFG_CPU_PROGRAM_MAP( konamigq_map )
MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 5, psx_dma_read_delegate( FUNC( scsi_dma_read ), (konamigq_state *) owner ) )
MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 5, psx_dma_write_delegate( FUNC( scsi_dma_write ), (konamigq_state *) owner ) )
MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 5, psx_dma_read_delegate( FUNC( konamigq_state::scsi_dma_read ), (konamigq_state *) owner ) )
MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 5, psx_dma_write_delegate( FUNC( konamigq_state::scsi_dma_write ), (konamigq_state *) owner ) )
MCFG_CPU_ADD( "soundcpu", M68000, 8000000 )
MCFG_CPU_PROGRAM_MAP( konamigq_sound_map)

View File

@ -170,6 +170,8 @@ public:
DECLARE_DRIVER_INIT(konamigv);
DECLARE_DRIVER_INIT(btchamp);
DECLARE_MACHINE_START(konamigv);
void scsi_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size );
void scsi_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size );
};
/* EEPROM handlers */
@ -210,17 +212,17 @@ ADDRESS_MAP_END
/* SCSI */
static void scsi_dma_read( konamigv_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
void konamigv_state::scsi_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
{
UINT8 *sector_buffer = state->m_sector_buffer;
UINT8 *sector_buffer = m_sector_buffer;
int i;
int n_this;
while( n_size > 0 )
{
if( n_size > sizeof( state->m_sector_buffer ) / 4 )
if( n_size > sizeof( m_sector_buffer ) / 4 )
{
n_this = sizeof( state->m_sector_buffer ) / 4;
n_this = sizeof( m_sector_buffer ) / 4;
}
else
{
@ -229,12 +231,12 @@ static void scsi_dma_read( konamigv_state *state, UINT32 *p_n_psxram, UINT32 n_a
if( n_this < 2048 / 4 )
{
/* non-READ commands */
state->m_am53cf96->dma_read_data( n_this * 4, sector_buffer );
m_am53cf96->dma_read_data( n_this * 4, sector_buffer );
}
else
{
/* assume normal 2048 byte data for now */
state->m_am53cf96->dma_read_data( 2048, sector_buffer );
m_am53cf96->dma_read_data( 2048, sector_buffer );
n_this = 2048 / 4;
}
n_size -= n_this;
@ -254,17 +256,17 @@ static void scsi_dma_read( konamigv_state *state, UINT32 *p_n_psxram, UINT32 n_a
}
}
static void scsi_dma_write( konamigv_state *state, UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
void konamigv_state::scsi_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size )
{
UINT8 *sector_buffer = state->m_sector_buffer;
UINT8 *sector_buffer = m_sector_buffer;
int i;
int n_this;
while( n_size > 0 )
{
if( n_size > sizeof( state->m_sector_buffer ) / 4 )
if( n_size > sizeof( m_sector_buffer ) / 4 )
{
n_this = sizeof( state->m_sector_buffer ) / 4;
n_this = sizeof( m_sector_buffer ) / 4;
}
else
{
@ -284,7 +286,7 @@ static void scsi_dma_write( konamigv_state *state, UINT32 *p_n_psxram, UINT32 n_
n_this--;
}
state->m_am53cf96->dma_write_data( n_this * 4, sector_buffer );
m_am53cf96->dma_write_data( n_this * 4, sector_buffer );
}
}
@ -307,8 +309,8 @@ static MACHINE_CONFIG_START( konamigv, konamigv_state )
MCFG_CPU_ADD( "maincpu", CXD8530BQ, XTAL_67_7376MHz )
MCFG_CPU_PROGRAM_MAP( konamigv_map )
MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 5, psx_dma_read_delegate( FUNC( scsi_dma_read ), (konamigv_state *) owner ) )
MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 5, psx_dma_write_delegate( FUNC( scsi_dma_write ), (konamigv_state *) owner ) )
MCFG_PSX_DMA_CHANNEL_READ( "maincpu", 5, psx_dma_read_delegate( FUNC( konamigv_state::scsi_dma_read ), (konamigv_state *) owner ) )
MCFG_PSX_DMA_CHANNEL_WRITE( "maincpu", 5, psx_dma_write_delegate( FUNC( konamigv_state::scsi_dma_write ), (konamigv_state *) owner ) )
MCFG_MACHINE_START_OVERRIDE(konamigv_state, konamigv )

View File

@ -251,6 +251,10 @@ public:
virtual void video_start();
UINT32 screen_update_m2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(m2);
void cde_init();
void cde_handle_command();
void cde_handle_reports();
void cde_dma_transfer(address_space &space, int channel, int next);
};
@ -487,16 +491,15 @@ WRITE64_MEMBER(konamim2_state::reset_w)
static void cde_init(running_machine &machine)
void konamim2_state::cde_init()
{
konamim2_state *state = machine.driver_data<konamim2_state>();
cdrom_file *cdfile = cdrom_open(get_disk_handle(machine, ":cdrom"));
cdrom_file *cdfile = cdrom_open(get_disk_handle(machine(), ":cdrom"));
const cdrom_toc *toc = cdrom_get_toc(cdfile);
if (cdfile)
{
memcpy(&state->m_cde_toc, toc, sizeof(cdrom_toc));
memcpy(&m_cde_toc, toc, sizeof(cdrom_toc));
/*
printf("%d tracks\n", toc->numtrks);
@ -511,210 +514,208 @@ static void cde_init(running_machine &machine)
cdrom_close(cdfile);
}
state->m_cde_drive_state = CDE_DRIVE_STATE_PAUSED;
m_cde_drive_state = CDE_DRIVE_STATE_PAUSED;
state->m_cde_num_status_bytes = 0;
state->m_cde_status_byte_ptr = 0;
state->m_cde_command_byte_ptr = 0;
m_cde_num_status_bytes = 0;
m_cde_status_byte_ptr = 0;
m_cde_command_byte_ptr = 0;
state->m_cde_response = 0;
m_cde_response = 0;
state->m_cde_enable_qchannel_reports = 0;
state->m_cde_enable_seek_reports = 0;
m_cde_enable_qchannel_reports = 0;
m_cde_enable_seek_reports = 0;
state->m_cde_qchannel_offset = 0;
m_cde_qchannel_offset = 0;
}
static void cde_handle_command(running_machine &machine)
void konamim2_state::cde_handle_command()
{
konamim2_state *state = machine.driver_data<konamim2_state>();
switch (state->m_cde_command_bytes[0])
switch (m_cde_command_bytes[0])
{
case 0x04: // Set Speed
{
state->m_cde_num_status_bytes = 1;
m_cde_num_status_bytes = 1;
state->m_cde_status_bytes[0] = 0x04;
state->m_cde_status_byte_ptr = 0;
m_cde_status_bytes[0] = 0x04;
m_cde_status_byte_ptr = 0;
// mame_printf_debug("CDE: SET SPEED %02X, %02X\n", state->m_cde_command_bytes[1], state->m_cde_command_bytes[2]);
// mame_printf_debug("CDE: SET SPEED %02X, %02X\n", m_cde_command_bytes[1], m_cde_command_bytes[2]);
break;
}
case 0x06: // Audio Format / Data Format
{
state->m_cde_num_status_bytes = 1;
m_cde_num_status_bytes = 1;
state->m_cde_status_bytes[0] = 0x06;
state->m_cde_status_byte_ptr = 0;
m_cde_status_bytes[0] = 0x06;
m_cde_status_byte_ptr = 0;
if (state->m_cde_command_bytes[1] == 0x00) // Audio Format
if (m_cde_command_bytes[1] == 0x00) // Audio Format
{
// mame_printf_debug("CDE: AUDIO FORMAT\n");
}
else if (state->m_cde_command_bytes[1] == 0x78) // Data Format
else if (m_cde_command_bytes[1] == 0x78) // Data Format
{
// mame_printf_debug("CDE: DATA FORMAT\n");
}
else
{
fatalerror("CDE: unknown command %02X, %02X\n", state->m_cde_command_bytes[0], state->m_cde_command_bytes[1]);
fatalerror("CDE: unknown command %02X, %02X\n", m_cde_command_bytes[0], m_cde_command_bytes[1]);
}
break;
}
case 0x08: // Pause / Eject / Play
{
state->m_cde_num_status_bytes = 1;
m_cde_num_status_bytes = 1;
state->m_cde_status_bytes[0] = 0x08;
state->m_cde_status_byte_ptr = 0;
m_cde_status_bytes[0] = 0x08;
m_cde_status_byte_ptr = 0;
if (state->m_cde_command_bytes[1] == 0x00) // Eject
if (m_cde_command_bytes[1] == 0x00) // Eject
{
// mame_printf_debug("CDE: EJECT command\n");
}
else if (state->m_cde_command_bytes[1] == 0x02) // Pause
else if (m_cde_command_bytes[1] == 0x02) // Pause
{
// mame_printf_debug("CDE: PAUSE command\n");
state->m_cde_drive_state = CDE_DRIVE_STATE_PAUSED;
m_cde_drive_state = CDE_DRIVE_STATE_PAUSED;
}
else if (state->m_cde_command_bytes[1] == 0x03) // Play
else if (m_cde_command_bytes[1] == 0x03) // Play
{
// mame_printf_debug("CDE: PLAY command\n");
}
else
{
fatalerror("CDE: unknown command %02X, %02X\n", state->m_cde_command_bytes[0], state->m_cde_command_bytes[1]);
fatalerror("CDE: unknown command %02X, %02X\n", m_cde_command_bytes[0], m_cde_command_bytes[1]);
}
break;
}
case 0x09: // Seek
{
state->m_cde_num_status_bytes = 1;
m_cde_num_status_bytes = 1;
state->m_cde_status_bytes[0] = 0x1b;
state->m_cde_status_byte_ptr = 0;
m_cde_status_bytes[0] = 0x1b;
m_cde_status_byte_ptr = 0;
state->m_cde_drive_state = CDE_DRIVE_STATE_SEEK_DONE;
m_cde_drive_state = CDE_DRIVE_STATE_SEEK_DONE;
// mame_printf_debug("CDE: SEEK %08X\n", (state->m_cde_command_bytes[1] << 16) | (state->m_cde_command_bytes[2] << 8) | (state->m_cde_command_bytes[3]));
// mame_printf_debug("CDE: SEEK %08X\n", (m_cde_command_bytes[1] << 16) | (m_cde_command_bytes[2] << 8) | (m_cde_command_bytes[3]));
break;
}
case 0x0b: // Get Drive State
{
state->m_cde_num_status_bytes = 0x3;
m_cde_num_status_bytes = 0x3;
state->m_cde_status_bytes[0] = 0x0b;
state->m_cde_status_bytes[1] = 0x1b;
state->m_cde_status_bytes[2] = state->m_cde_drive_state;
state->m_cde_status_byte_ptr = 0;
m_cde_status_bytes[0] = 0x0b;
m_cde_status_bytes[1] = 0x1b;
m_cde_status_bytes[2] = m_cde_drive_state;
m_cde_status_byte_ptr = 0;
if (state->m_cde_command_bytes[1] & 0x02)
if (m_cde_command_bytes[1] & 0x02)
{
state->m_cde_enable_seek_reports = 1;
m_cde_enable_seek_reports = 1;
}
else
{
state->m_cde_enable_seek_reports = 0;
m_cde_enable_seek_reports = 0;
}
// mame_printf_debug("CDE: GET DRIVE STATE %02X\n", state->m_cde_command_bytes[1]);
// mame_printf_debug("CDE: GET DRIVE STATE %02X\n", m_cde_command_bytes[1]);
break;
}
case 0x0c: // ?
{
state->m_cde_num_status_bytes = 1;
m_cde_num_status_bytes = 1;
state->m_cde_status_bytes[0] = 0x0c;
state->m_cde_status_byte_ptr = 0;
m_cde_status_bytes[0] = 0x0c;
m_cde_status_byte_ptr = 0;
if (state->m_cde_command_bytes[1] == 0x02)
if (m_cde_command_bytes[1] == 0x02)
{
state->m_cde_enable_qchannel_reports = 1;
state->m_cde_drive_state = CDE_DRIVE_STATE_PAUSED;
m_cde_enable_qchannel_reports = 1;
m_cde_drive_state = CDE_DRIVE_STATE_PAUSED;
}
else if (state->m_cde_command_bytes[0] == 0x00)
else if (m_cde_command_bytes[0] == 0x00)
{
state->m_cde_enable_qchannel_reports = 0;
m_cde_enable_qchannel_reports = 0;
}
// mame_printf_debug("CDE: UNKNOWN CMD 0x0c %02X\n", state->m_cde_command_bytes[1]);
// mame_printf_debug("CDE: UNKNOWN CMD 0x0c %02X\n", m_cde_command_bytes[1]);
break;
}
case 0x0d: // Get Switch State
{
state->m_cde_num_status_bytes = 0x4;
m_cde_num_status_bytes = 0x4;
state->m_cde_status_bytes[0] = 0x0d;
state->m_cde_status_bytes[1] = 0x1d;
state->m_cde_status_bytes[2] = 0x02;
state->m_cde_status_byte_ptr = 0;
m_cde_status_bytes[0] = 0x0d;
m_cde_status_bytes[1] = 0x1d;
m_cde_status_bytes[2] = 0x02;
m_cde_status_byte_ptr = 0;
// mame_printf_debug("CDE: GET SWITCH STATE %02X\n", state->m_cde_command_bytes[1]);
// mame_printf_debug("CDE: GET SWITCH STATE %02X\n", m_cde_command_bytes[1]);
break;
}
case 0x21: // Mech type
{
state->m_cde_num_status_bytes = 0x8;
m_cde_num_status_bytes = 0x8;
state->m_cde_status_bytes[0] = 0x21;
state->m_cde_status_bytes[1] = 0xff;
state->m_cde_status_bytes[2] = 0x08; // Max Speed
state->m_cde_status_bytes[3] = 0xff;
state->m_cde_status_bytes[4] = 0xff;
state->m_cde_status_bytes[5] = 0xff;
state->m_cde_status_bytes[6] = 0xff;
state->m_cde_status_bytes[7] = 0xff;
m_cde_status_bytes[0] = 0x21;
m_cde_status_bytes[1] = 0xff;
m_cde_status_bytes[2] = 0x08; // Max Speed
m_cde_status_bytes[3] = 0xff;
m_cde_status_bytes[4] = 0xff;
m_cde_status_bytes[5] = 0xff;
m_cde_status_bytes[6] = 0xff;
m_cde_status_bytes[7] = 0xff;
state->m_cde_status_byte_ptr = 0;
m_cde_status_byte_ptr = 0;
// mame_printf_debug("CDE: MECH TYPE %02X, %02X, %02X\n", state->m_cde_command_bytes[1], state->m_cde_command_bytes[2], state->m_cde_command_bytes[3]);
// mame_printf_debug("CDE: MECH TYPE %02X, %02X, %02X\n", m_cde_command_bytes[1], m_cde_command_bytes[2], m_cde_command_bytes[3]);
break;
}
case 0x83: // Read ID
{
state->m_cde_num_status_bytes = 0xc;
m_cde_num_status_bytes = 0xc;
state->m_cde_status_bytes[0] = 0x03;
state->m_cde_status_bytes[1] = 0xff;
state->m_cde_status_bytes[2] = 0xff;
state->m_cde_status_bytes[3] = 0xff;
state->m_cde_status_bytes[4] = 0xff;
state->m_cde_status_bytes[5] = 0xff;
state->m_cde_status_bytes[6] = 0xff;
state->m_cde_status_bytes[7] = 0xff;
state->m_cde_status_bytes[8] = 0xff;
state->m_cde_status_bytes[9] = 0xff;
state->m_cde_status_bytes[10] = 0xff;
state->m_cde_status_bytes[11] = 0xff;
m_cde_status_bytes[0] = 0x03;
m_cde_status_bytes[1] = 0xff;
m_cde_status_bytes[2] = 0xff;
m_cde_status_bytes[3] = 0xff;
m_cde_status_bytes[4] = 0xff;
m_cde_status_bytes[5] = 0xff;
m_cde_status_bytes[6] = 0xff;
m_cde_status_bytes[7] = 0xff;
m_cde_status_bytes[8] = 0xff;
m_cde_status_bytes[9] = 0xff;
m_cde_status_bytes[10] = 0xff;
m_cde_status_bytes[11] = 0xff;
state->m_cde_status_byte_ptr = 0;
m_cde_status_byte_ptr = 0;
// mame_printf_debug("CDE: READ ID\n");
break;
}
default:
{
fatalerror("CDE: unknown command %08X\n", state->m_cde_command_bytes[0]);
fatalerror("CDE: unknown command %08X\n", m_cde_command_bytes[0]);
break;
}
}
}
static void cde_handle_reports(running_machine &machine)
void konamim2_state::cde_handle_reports()
{
konamim2_state *state = machine.driver_data<konamim2_state>();
switch (state->m_cde_command_bytes[0])
switch (m_cde_command_bytes[0])
{
case 0x09:
{
if (state->m_cde_enable_seek_reports)
if (m_cde_enable_seek_reports)
{
state->m_cde_num_status_bytes = 0x2;
state->m_cde_status_bytes[0] = 0x02;
m_cde_num_status_bytes = 0x2;
m_cde_status_bytes[0] = 0x02;
state->m_cde_status_byte_ptr = 0;
m_cde_status_byte_ptr = 0;
state->m_cde_command_bytes[0] = 0x0c;
m_cde_command_bytes[0] = 0x0c;
// mame_printf_debug("CDE: SEEK REPORT\n");
}
@ -723,94 +724,94 @@ static void cde_handle_reports(running_machine &machine)
case 0x0b:
{
if (state->m_cde_enable_qchannel_reports)
if (m_cde_enable_qchannel_reports)
{
int track, num_tracks;
num_tracks = state->m_cde_toc.numtrks;
track = state->m_cde_qchannel_offset % (num_tracks+3);
num_tracks = m_cde_toc.numtrks;
track = m_cde_qchannel_offset % (num_tracks+3);
state->m_cde_num_status_bytes = 0xb;
state->m_cde_status_bytes[0] = 0x1c;
m_cde_num_status_bytes = 0xb;
m_cde_status_bytes[0] = 0x1c;
/*
state->m_cde_status_bytes[1] = 0x0; // q-Mode
state->m_cde_status_bytes[2] = 0x0; // TNO
state->m_cde_status_bytes[3] = 0x0; // Index / Pointer
state->m_cde_status_bytes[4] = 0x0; // Min
state->m_cde_status_bytes[5] = 0x0; // Sec
state->m_cde_status_bytes[6] = 0x0; // Frac
state->m_cde_status_bytes[7] = 0x0; // Zero
state->m_cde_status_bytes[8] = 0x0; // A-Min
state->m_cde_status_bytes[9] = 0x0; // A-Sec
state->m_cde_status_bytes[10] = 0x0; // A-Frac
m_cde_status_bytes[1] = 0x0; // q-Mode
m_cde_status_bytes[2] = 0x0; // TNO
m_cde_status_bytes[3] = 0x0; // Index / Pointer
m_cde_status_bytes[4] = 0x0; // Min
m_cde_status_bytes[5] = 0x0; // Sec
m_cde_status_bytes[6] = 0x0; // Frac
m_cde_status_bytes[7] = 0x0; // Zero
m_cde_status_bytes[8] = 0x0; // A-Min
m_cde_status_bytes[9] = 0x0; // A-Sec
m_cde_status_bytes[10] = 0x0; // A-Frac
*/
if (track < num_tracks)
{
int time = lba_to_msf(state->m_cde_toc.tracks[track].physframeofs);
int time = lba_to_msf(m_cde_toc.tracks[track].physframeofs);
state->m_cde_status_bytes[1] = 0x41; // q-Mode
state->m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
state->m_cde_status_bytes[3] = track+1; // Pointer
state->m_cde_status_bytes[4] = 0x0; // Min
state->m_cde_status_bytes[5] = 0x0; // Sec
state->m_cde_status_bytes[6] = 0x0; // Frac
state->m_cde_status_bytes[7] = 0x0; // Zero
state->m_cde_status_bytes[8] = (time >> 16) & 0xff; // P-Min
state->m_cde_status_bytes[9] = (time >> 8) & 0xff; // P-Sec
state->m_cde_status_bytes[10] = time & 0xff; // P-Frac
m_cde_status_bytes[1] = 0x41; // q-Mode
m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
m_cde_status_bytes[3] = track+1; // Pointer
m_cde_status_bytes[4] = 0x0; // Min
m_cde_status_bytes[5] = 0x0; // Sec
m_cde_status_bytes[6] = 0x0; // Frac
m_cde_status_bytes[7] = 0x0; // Zero
m_cde_status_bytes[8] = (time >> 16) & 0xff; // P-Min
m_cde_status_bytes[9] = (time >> 8) & 0xff; // P-Sec
m_cde_status_bytes[10] = time & 0xff; // P-Frac
}
else
{
if (track == num_tracks+0)
{
state->m_cde_status_bytes[1] = 0x41; // q-Mode / Control
state->m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
state->m_cde_status_bytes[3] = 0xa0; // Pointer
state->m_cde_status_bytes[4] = 0x0; // Min
state->m_cde_status_bytes[5] = 0x0; // Sec
state->m_cde_status_bytes[6] = 0x0; // Frac
state->m_cde_status_bytes[7] = 0x0; // Zero
state->m_cde_status_bytes[8] = 1; // P-Min
state->m_cde_status_bytes[9] = 0x0; // P-Sec
state->m_cde_status_bytes[10] = 0x0; // P-Frac
m_cde_status_bytes[1] = 0x41; // q-Mode / Control
m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
m_cde_status_bytes[3] = 0xa0; // Pointer
m_cde_status_bytes[4] = 0x0; // Min
m_cde_status_bytes[5] = 0x0; // Sec
m_cde_status_bytes[6] = 0x0; // Frac
m_cde_status_bytes[7] = 0x0; // Zero
m_cde_status_bytes[8] = 1; // P-Min
m_cde_status_bytes[9] = 0x0; // P-Sec
m_cde_status_bytes[10] = 0x0; // P-Frac
}
else if (track == num_tracks+1)
{
state->m_cde_status_bytes[1] = 0x41; // q-Mode / Control
state->m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
state->m_cde_status_bytes[3] = 0xa1; // Pointer
state->m_cde_status_bytes[4] = 0x0; // Min
state->m_cde_status_bytes[5] = 0x0; // Sec
state->m_cde_status_bytes[6] = 0x0; // Frac
state->m_cde_status_bytes[7] = 0x0; // Zero
state->m_cde_status_bytes[8] = num_tracks; // P-Min
state->m_cde_status_bytes[9] = 0x0; // P-Sec
state->m_cde_status_bytes[10] = 0x0; // P-Frac
m_cde_status_bytes[1] = 0x41; // q-Mode / Control
m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
m_cde_status_bytes[3] = 0xa1; // Pointer
m_cde_status_bytes[4] = 0x0; // Min
m_cde_status_bytes[5] = 0x0; // Sec
m_cde_status_bytes[6] = 0x0; // Frac
m_cde_status_bytes[7] = 0x0; // Zero
m_cde_status_bytes[8] = num_tracks; // P-Min
m_cde_status_bytes[9] = 0x0; // P-Sec
m_cde_status_bytes[10] = 0x0; // P-Frac
}
else
{
int leadout_lba = state->m_cde_toc.tracks[num_tracks-1].physframeofs + state->m_cde_toc.tracks[num_tracks-1].frames;
int leadout_lba = m_cde_toc.tracks[num_tracks-1].physframeofs + m_cde_toc.tracks[num_tracks-1].frames;
int leadout_time = lba_to_msf(leadout_lba);
state->m_cde_status_bytes[1] = 0x41; // q-Mode / Control
state->m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
state->m_cde_status_bytes[3] = 0xa2; // Pointer
state->m_cde_status_bytes[4] = 0x0; // Min
state->m_cde_status_bytes[5] = 0x0; // Sec
state->m_cde_status_bytes[6] = 0x0; // Frac
state->m_cde_status_bytes[7] = 0x0; // Zero
state->m_cde_status_bytes[8] = (leadout_time >> 16) & 0xff; // P-Min
state->m_cde_status_bytes[9] = (leadout_time >> 8) & 0xff; // P-Sec
state->m_cde_status_bytes[10] = leadout_time & 0xff; // P-Frac
m_cde_status_bytes[1] = 0x41; // q-Mode / Control
m_cde_status_bytes[2] = 0x0; // TNO (Lead-in track)
m_cde_status_bytes[3] = 0xa2; // Pointer
m_cde_status_bytes[4] = 0x0; // Min
m_cde_status_bytes[5] = 0x0; // Sec
m_cde_status_bytes[6] = 0x0; // Frac
m_cde_status_bytes[7] = 0x0; // Zero
m_cde_status_bytes[8] = (leadout_time >> 16) & 0xff; // P-Min
m_cde_status_bytes[9] = (leadout_time >> 8) & 0xff; // P-Sec
m_cde_status_bytes[10] = leadout_time & 0xff; // P-Frac
}
}
state->m_cde_qchannel_offset++;
m_cde_qchannel_offset++;
state->m_cde_status_byte_ptr = 0;
state->m_cde_command_bytes[0] = 0x0c;
m_cde_status_byte_ptr = 0;
m_cde_command_bytes[0] = 0x0c;
// mame_printf_debug("CDE: QCHANNEL REPORT\n");
break;
@ -819,25 +820,24 @@ static void cde_handle_reports(running_machine &machine)
}
}
static void cde_dma_transfer(address_space &space, int channel, int next)
void konamim2_state::cde_dma_transfer(address_space &space, int channel, int next)
{
konamim2_state *state = space.machine().driver_data<konamim2_state>();
UINT32 address;
//int length;
int i;
if (next)
{
address = state->m_cde_dma[channel].next_dst_addr;
//length = state->m_cde_dma[channel].next_length;
address = m_cde_dma[channel].next_dst_addr;
//length = m_cde_dma[channel].next_length;
}
else
{
address = state->m_cde_dma[channel].dst_addr;
//length = state->m_cde_dma[channel].length;
address = m_cde_dma[channel].dst_addr;
//length = m_cde_dma[channel].length;
}
for (i=0; i < state->m_cde_dma[channel].next_length; i++)
for (i=0; i < m_cde_dma[channel].next_length; i++)
{
space.write_byte(address, 0xff); // TODO: do the real transfer...
address++;
@ -883,7 +883,7 @@ READ64_MEMBER(konamim2_state::cde_r)
if (!m_cde_response)
{
cde_handle_reports(machine());
cde_handle_reports();
// m_cde_command_byte_ptr = 0;
// m_cde_command_bytes[m_cde_command_byte_ptr++] = 0x1c;
@ -944,7 +944,7 @@ WRITE64_MEMBER(konamim2_state::cde_w)
{
if (m_cde_response)
{
cde_handle_command(machine());
cde_handle_command();
m_cde_response = 0;
}
@ -1299,7 +1299,7 @@ DRIVER_INIT_MEMBER(konamim2_state,m2)
{
m_unk3 = U64(0xffffffffffffffff);
m_unk20004 = 0;
cde_init(machine());
cde_init();
}
GAME( 1997, polystar, 0, m2, m2, konamim2_state, m2, ROT0, "Konami", "Tobe! Polystars (ver JAA)", GAME_NOT_WORKING | GAME_NO_SOUND )

View File

@ -186,6 +186,7 @@ public:
UINT32 screen_update_m63(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(snd_irq);
INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};
@ -313,30 +314,29 @@ VIDEO_START_MEMBER(m63_state,m63)
m_fg_tilemap->set_transparent_pen(0);
}
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void m63_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
m63_state *state = machine.driver_data<m63_state>();
int offs;
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
int code = state->m_spriteram[offs + 1] | ((state->m_spriteram[offs + 2] & 0x10) << 4);
int color = (state->m_spriteram[offs + 2] & 0x0f) + (state->m_pal_bank << 4);
int flipx = state->m_spriteram[offs + 2] & 0x20;
int code = m_spriteram[offs + 1] | ((m_spriteram[offs + 2] & 0x10) << 4);
int color = (m_spriteram[offs + 2] & 0x0f) + (m_pal_bank << 4);
int flipx = m_spriteram[offs + 2] & 0x20;
int flipy = 0;
int sx = state->m_spriteram[offs + 3];
int sy = state->m_sy_offset - state->m_spriteram[offs];
int sx = m_spriteram[offs + 3];
int sy = m_sy_offset - m_spriteram[offs];
if (state->flip_screen())
if (flip_screen())
{
sx = 240 - sx;
sy = state->m_sy_offset - sy;
sy = m_sy_offset - sy;
flipx = !flipx;
flipy = !flipy;
}
drawgfx_transpen(bitmap, cliprect,
machine.gfx[2],
machine().gfx[2],
code, color,
flipx, flipy,
sx, sy, 0);
@ -345,7 +345,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if (sx > 0xf0)
{
drawgfx_transpen(bitmap, cliprect,
machine.gfx[2],
machine().gfx[2],
code, color,
flipx, flipy,
sx - 0x100, sy, 0);
@ -362,7 +362,7 @@ UINT32 m63_state::screen_update_m63(screen_device &screen, bitmap_ind16 &bitmap,
m_bg_tilemap->set_scrolly(col, m_scrollram[col * 8]);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -60,6 +60,7 @@ public:
DECLARE_DRIVER_INIT(a600xl);
DECLARE_MACHINE_RESET(supervisor_board);
TIMER_DEVICE_CALLBACK_MEMBER(mcu_timer_proc);
int atari_input_disabled();
};
@ -263,10 +264,9 @@ INPUT_CHANGED_MEMBER(maxaflex_state::coin_inserted)
machine().device("mcu")->execute().set_input_line(M6805_IRQ_LINE, HOLD_LINE );
}
int atari_input_disabled(running_machine &machine)
int maxaflex_state::atari_input_disabled()
{
maxaflex_state *state = machine.driver_data<maxaflex_state>();
return (state->m_portB_out & 0x80) == 0x00;
return (m_portB_out & 0x80) == 0x00;
}
@ -373,12 +373,12 @@ static const pokey_interface pokey_config = {
READ8_MEMBER(maxaflex_state::maxaflex_atari_pia_pa_r)
{
return atari_input_disabled(machine()) ? 0xFF : machine().root_device().ioport("djoy_0_1")->read_safe(0);
return atari_input_disabled() ? 0xFF : machine().root_device().ioport("djoy_0_1")->read_safe(0);
}
READ8_MEMBER(maxaflex_state::maxaflex_atari_pia_pb_r)
{
return atari_input_disabled(machine()) ? 0xFF : machine().root_device().ioport("djoy_2_3")->read_safe(0);
return atari_input_disabled() ? 0xFF : machine().root_device().ioport("djoy_2_3")->read_safe(0);
}

View File

@ -200,6 +200,14 @@ public:
DECLARE_READ32_MEMBER(speedup11_r);
TIMER_DEVICE_CALLBACK_MEMBER(sound_timer_callback);
IRQ_CALLBACK_MEMBER(irq_callback);
void draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y);
void draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void draw_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void ad1847_reg_write(int reg, UINT8 data);
inline UINT32 generic_speedup(address_space &space, int idx);
void report_speedups();
void install_speedups(const speedup_entry *entries, int count);
void init_mediagx();
};
// Display controller registers
@ -252,7 +260,7 @@ void mediagx_state::video_start()
}
}
static void draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y)
void mediagx_state::draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_element *gfx, int ch, int att, int x, int y)
{
int i,j;
const UINT8 *dp;
@ -278,44 +286,43 @@ static void draw_char(bitmap_rgb32 &bitmap, const rectangle &cliprect, gfx_eleme
}
}
static void draw_framebuffer(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
void mediagx_state::draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
mediagx_state *state = machine.driver_data<mediagx_state>();
int i, j;
int width, height;
int line_delta = (state->m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4;
int line_delta = (m_disp_ctrl_reg[DC_LINE_DELTA] & 0x3ff) * 4;
width = (state->m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1;
if (state->m_disp_ctrl_reg[DC_TIMING_CFG] & 0x8000) // pixel double
width = (m_disp_ctrl_reg[DC_H_TIMING_1] & 0x7ff) + 1;
if (m_disp_ctrl_reg[DC_TIMING_CFG] & 0x8000) // pixel double
{
width >>= 1;
}
width += 4;
height = (state->m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1;
height = (m_disp_ctrl_reg[DC_V_TIMING_1] & 0x7ff) + 1;
if ( (width != state->m_frame_width || height != state->m_frame_height) &&
if ( (width != m_frame_width || height != m_frame_height) &&
(width > 1 && height > 1 && width <= 640 && height <= 480) )
{
rectangle visarea;
state->m_frame_width = width;
state->m_frame_height = height;
m_frame_width = width;
m_frame_height = height;
visarea.set(0, width - 1, 0, height - 1);
machine.primary_screen->configure(width, height * 262 / 240, visarea, machine.primary_screen->frame_period().attoseconds);
machine().primary_screen->configure(width, height * 262 / 240, visarea, machine().primary_screen->frame_period().attoseconds);
}
if (state->m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode
if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // 8-bit mode
{
UINT8 *framebuf = (UINT8*)&state->m_vram[state->m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
UINT8 *pal = state->m_pal;
UINT8 *framebuf = (UINT8*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
UINT8 *pal = m_pal;
for (j=0; j < state->m_frame_height; j++)
for (j=0; j < m_frame_height; j++)
{
UINT32 *p = &bitmap.pix32(j);
UINT8 *si = &framebuf[j * line_delta];
for (i=0; i < state->m_frame_width; i++)
for (i=0; i < m_frame_width; i++)
{
int c = *si++;
int r = pal[(c*3)+0] << 2;
@ -328,16 +335,16 @@ static void draw_framebuffer(running_machine &machine, bitmap_rgb32 &bitmap, con
}
else // 16-bit
{
UINT16 *framebuf = (UINT16*)&state->m_vram[state->m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
UINT16 *framebuf = (UINT16*)&m_vram[m_disp_ctrl_reg[DC_FB_ST_OFFSET]/4];
// RGB 5-6-5 mode
if ((state->m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0)
if ((m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x2) == 0)
{
for (j=0; j < state->m_frame_height; j++)
for (j=0; j < m_frame_height; j++)
{
UINT32 *p = &bitmap.pix32(j);
UINT16 *si = &framebuf[j * (line_delta/2)];
for (i=0; i < state->m_frame_width; i++)
for (i=0; i < m_frame_width; i++)
{
UINT16 c = *si++;
int r = ((c >> 11) & 0x1f) << 3;
@ -351,11 +358,11 @@ static void draw_framebuffer(running_machine &machine, bitmap_rgb32 &bitmap, con
// RGB 5-5-5 mode
else
{
for (j=0; j < state->m_frame_height; j++)
for (j=0; j < m_frame_height; j++)
{
UINT32 *p = &bitmap.pix32(j);
UINT16 *si = &framebuf[j * (line_delta/2)];
for (i=0; i < state->m_frame_width; i++)
for (i=0; i < m_frame_width; i++)
{
UINT16 c = *si++;
int r = ((c >> 10) & 0x1f) << 3;
@ -369,12 +376,11 @@ static void draw_framebuffer(running_machine &machine, bitmap_rgb32 &bitmap, con
}
}
static void draw_cga(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect)
void mediagx_state::draw_cga(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
mediagx_state *state = machine.driver_data<mediagx_state>();
int i, j;
gfx_element *gfx = machine.gfx[0];
UINT32 *cga = state->m_cga_ram;
gfx_element *gfx = machine().gfx[0];
UINT32 *cga = m_cga_ram;
int index = 0;
for (j=0; j < 25; j++)
@ -397,11 +403,11 @@ UINT32 mediagx_state::screen_update_mediagx(screen_device &screen, bitmap_rgb32
{
bitmap.fill(0, cliprect);
draw_framebuffer(machine(), bitmap, cliprect);
draw_framebuffer( bitmap, cliprect);
if (m_disp_ctrl_reg[DC_OUTPUT_CFG] & 0x1) // don't show MDA text screen on 16-bit mode. this is basically a hack
{
draw_cga(machine(), bitmap, cliprect);
draw_cga(bitmap, cliprect);
}
return 0;
}
@ -749,9 +755,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(mediagx_state::sound_timer_callback)
m_dacr_ptr = 0;
}
static void ad1847_reg_write(running_machine &machine, int reg, UINT8 data)
void mediagx_state::ad1847_reg_write(int reg, UINT8 data)
{
mediagx_state *state = machine.driver_data<mediagx_state>();
static const int divide_factor[] = { 3072, 1536, 896, 768, 448, 384, 512, 2560 };
switch (reg)
@ -760,14 +765,14 @@ static void ad1847_reg_write(running_machine &machine, int reg, UINT8 data)
{
if (data & 0x1)
{
state->m_ad1847_sample_rate = 16934400 / divide_factor[(data >> 1) & 0x7];
m_ad1847_sample_rate = 16934400 / divide_factor[(data >> 1) & 0x7];
}
else
{
state->m_ad1847_sample_rate = 24576000 / divide_factor[(data >> 1) & 0x7];
m_ad1847_sample_rate = 24576000 / divide_factor[(data >> 1) & 0x7];
}
dmadac_set_frequency(&state->m_dmadac[0], 2, state->m_ad1847_sample_rate);
dmadac_set_frequency(&m_dmadac[0], 2, m_ad1847_sample_rate);
if (data & 0x20)
{
@ -782,7 +787,7 @@ static void ad1847_reg_write(running_machine &machine, int reg, UINT8 data)
default:
{
state->m_ad1847_regs[reg] = data;
m_ad1847_regs[reg] = data;
break;
}
}
@ -818,7 +823,7 @@ WRITE32_MEMBER(mediagx_state::ad1847_w)
else if (offset == 3)
{
int reg = (data >> 8) & 0xf;
ad1847_reg_write(machine(), reg, data & 0xff);
ad1847_reg_write(reg, data & 0xff);
}
}
@ -1233,29 +1238,25 @@ static void mediagx_set_keyb_int(running_machine &machine, int _state)
pic8259_ir1_w(state->m_pic8259_1, _state);
}
static void init_mediagx(running_machine &machine)
void mediagx_state::init_mediagx()
{
mediagx_state *state = machine.driver_data<mediagx_state>();
m_frame_width = m_frame_height = 1;
state->m_frame_width = state->m_frame_height = 1;
init_pc_common(machine(), PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int);
init_pc_common(machine, PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int);
kbdc8042_init(machine, &at8042);
kbdc8042_init(machine(), &at8042);
}
#if SPEEDUP_HACKS
INLINE UINT32 generic_speedup(address_space &space, int idx)
UINT32 mediagx_state::generic_speedup(address_space &space, int idx)
{
mediagx_state *state = space.machine().driver_data<mediagx_state>();
if (space.device().safe_pc() == state->m_speedup_table[idx].pc)
if (space.device().safe_pc() == m_speedup_table[idx].pc)
{
state->m_speedup_hits[idx]++;
m_speedup_hits[idx]++;
space.device().execute().spin_until_interrupt();
}
return state->m_main_ram[state->m_speedup_table[idx].offset/4];
return m_main_ram[m_speedup_table[idx].offset/4];
}
READ32_MEMBER(mediagx_state::speedup0_r) { return generic_speedup(space, 0); }
@ -1279,34 +1280,32 @@ static const struct { read32_delegate func; } speedup_handlers[] =
};
#ifdef MAME_DEBUG
static void report_speedups(running_machine &machine)
void mediagx_state::report_speedups()
{
mediagx_state *state = machine.driver_data<mediagx_state>();
int i;
for (i = 0; i < state->m_speedup_count; i++)
printf("Speedup %2d: offs=%06X pc=%06X hits=%d\n", i, state->m_speedup_table[i].offset, state->m_speedup_table[i].pc, state->m_speedup_hits[i]);
for (i = 0; i < m_speedup_count; i++)
printf("Speedup %2d: offs=%06X pc=%06X hits=%d\n", i, m_speedup_table[i].offset, m_speedup_table[i].pc, m_speedup_hits[i]);
}
#endif
static void install_speedups(running_machine &machine, const speedup_entry *entries, int count)
void mediagx_state::install_speedups(const speedup_entry *entries, int count)
{
mediagx_state *state = machine.driver_data<mediagx_state>();
int i;
assert(count < ARRAY_LENGTH(speedup_handlers));
state->m_speedup_table = entries;
state->m_speedup_count = count;
m_speedup_table = entries;
m_speedup_count = count;
for (i = 0; i < count; i++) {
read32_delegate func = speedup_handlers[i].func;
func.late_bind(*state);
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(entries[i].offset, entries[i].offset + 3, func);
func.late_bind(*this);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(entries[i].offset, entries[i].offset + 3, func);
}
#ifdef MAME_DEBUG
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(report_speedups), &machine));
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(report_speedups), &machine));
#endif
}
@ -1328,10 +1327,10 @@ static const speedup_entry a51site4_speedups[] =
DRIVER_INIT_MEMBER(mediagx_state,a51site4)
{
init_mediagx(machine());
init_mediagx();
#if SPEEDUP_HACKS
install_speedups(machine(), a51site4_speedups, ARRAY_LENGTH(a51site4_speedups));
install_speedups(a51site4_speedups, ARRAY_LENGTH(a51site4_speedups));
#endif
}

View File

@ -40,6 +40,8 @@ public:
virtual void palette_init();
UINT32 screen_update_mgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(interrupt_callback);
void update_plunger( );
double calc_plunger_pos();
};
@ -92,24 +94,23 @@ UINT32 mgolf_state::screen_update_mgolf(screen_device &screen, bitmap_ind16 &bit
}
static void update_plunger( running_machine &machine )
void mgolf_state::update_plunger( )
{
mgolf_state *state = machine.driver_data<mgolf_state>();
UINT8 val = state->ioport("BUTTON")->read();
UINT8 val = ioport("BUTTON")->read();
if (state->m_prev != val)
if (m_prev != val)
{
if (val == 0)
{
state->m_time_released = machine.time();
m_time_released = machine().time();
if (!state->m_mask)
state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
if (!m_mask)
m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
}
else
state->m_time_pushed = machine.time();
m_time_pushed = machine().time();
state->m_prev = val;
m_prev = val;
}
}
@ -118,7 +119,7 @@ TIMER_CALLBACK_MEMBER(mgolf_state::interrupt_callback)
{
int scanline = param;
update_plunger(machine());
update_plunger();
generic_pulse_irq_line(*m_maincpu, 0, 1);
@ -131,10 +132,9 @@ TIMER_CALLBACK_MEMBER(mgolf_state::interrupt_callback)
}
static double calc_plunger_pos(running_machine &machine)
double mgolf_state::calc_plunger_pos()
{
mgolf_state *state = machine.driver_data<mgolf_state>();
return (machine.time().as_double() - state->m_time_released.as_double()) * (state->m_time_released.as_double() - state->m_time_pushed.as_double() + 0.2);
return (machine().time().as_double() - m_time_released.as_double()) * (m_time_released.as_double() - m_time_pushed.as_double() + 0.2);
}
@ -163,7 +163,7 @@ READ8_MEMBER(mgolf_state::mgolf_dial_r)
READ8_MEMBER(mgolf_state::mgolf_misc_r)
{
double plunger = calc_plunger_pos(machine()); /* see Video Pinball */
double plunger = calc_plunger_pos(); /* see Video Pinball */
UINT8 val = ioport("61")->read();

View File

@ -188,6 +188,12 @@ emu_timer *m_ic21_timer;
TIMER_CALLBACK_MEMBER(ic21_timeout);
TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz);
TIMER_DEVICE_CALLBACK_MEMBER(ic10_callback);
void update_triacs();
void mpu3_stepper_reset();
void ic11_update(mpu3_state *state);
void ic21_output(mpu3_state *state,int data);
void ic21_setup(mpu3_state *state);
void mpu3_config_common();
};
#define DISPLAY_PORT 0
@ -195,12 +201,11 @@ emu_timer *m_ic21_timer;
#define BWB_FUNCTIONALITY 2
static void update_triacs(running_machine &machine)
void mpu3_state::update_triacs()
{
mpu3_state *state = machine.driver_data<mpu3_state>();
int i,triacdata;
triacdata=state->m_triac_ic3 + (state->m_triac_ic4 << 8) + (state->m_triac_ic5 << 9);
triacdata=m_triac_ic3 + (m_triac_ic4 << 8) + (m_triac_ic5 << 9);
for (i = 0; i < 8; i++)
{
@ -209,23 +214,22 @@ static void update_triacs(running_machine &machine)
}
/* called if board is reset */
static void mpu3_stepper_reset(running_machine &machine)
void mpu3_state::mpu3_stepper_reset()
{
mpu3_state *state = machine.driver_data<mpu3_state>();
int pattern = 0,reel;
for (reel = 0; reel < 6; reel++)
{
stepper_reset_position(reel);
if (stepper_optic_state(reel)) pattern |= 1<<reel;
}
state->m_optic_pattern = pattern;
m_optic_pattern = pattern;
}
void mpu3_state::machine_reset()
{
m_vfd->reset();
mpu3_stepper_reset(machine());
mpu3_stepper_reset();
m_lamp_strobe = 0;
m_led_strobe = 0;
@ -292,29 +296,29 @@ IC23 is a 74LS138 1-of-8 Decoder
It is used as a multiplexer for the LEDs, lamp selects and inputs.*/
static void ic11_update(mpu3_state *state)
void mpu3_state::ic11_update(mpu3_state *state)
{
if (!state->m_IC11G2A)
if (!m_IC11G2A)
{
if (!state->m_IC11G2B)
if (!m_IC11G2B)
{
if (state->m_IC11G1)
if (m_IC11G1)
{
if ( state->m_IC11GA ) state->m_input_strobe |= 0x01;
else state->m_input_strobe &= ~0x01;
if ( m_IC11GA ) m_input_strobe |= 0x01;
else m_input_strobe &= ~0x01;
if ( state->m_IC11GB ) state->m_input_strobe |= 0x02;
else state->m_input_strobe &= ~0x02;
if ( m_IC11GB ) m_input_strobe |= 0x02;
else m_input_strobe &= ~0x02;
if ( state->m_IC11GC ) state->m_input_strobe |= 0x04;
else state->m_input_strobe &= ~0x04;
if ( m_IC11GC ) m_input_strobe |= 0x04;
else m_input_strobe &= ~0x04;
}
}
}
else
if ((state->m_IC11G2A)||(state->m_IC11G2B)||(!state->m_IC11G1))
if ((m_IC11G2A)||(m_IC11G2B)||(!m_IC11G1))
{
state->m_input_strobe = 0x00;
m_input_strobe = 0x00;
}
}
@ -338,20 +342,20 @@ t/ns = .34 * 47 * 2.2e6 [ 1+ (1/47)]
This seems less stable than the revised version used in MPU4
*/
static void ic21_output(mpu3_state *state,int data)
void mpu3_state::ic21_output(mpu3_state *state,int data)
{
state->m_IC11G1 = data;
m_IC11G1 = data;
ic11_update(state);
}
static void ic21_setup(mpu3_state *state)
void mpu3_state::ic21_setup(mpu3_state *state)
{
if (state->m_IC11GA)
if (m_IC11GA)
{
{
state->m_ic11_active=1;
m_ic11_active=1;
ic21_output(state,1);
state->m_ic21_timer->adjust(attotime::from_nsec( (0.34 * 47 * 2200000) *(1+(1/47))));
m_ic21_timer->adjust(attotime::from_nsec( (0.34 * 47 * 2200000) *(1+(1/47))));
}
}
}
@ -783,15 +787,14 @@ static const stepper_interface mpu3_reel_interface =
};
/* Common configurations */
static void mpu3_config_common(running_machine &machine)
void mpu3_state::mpu3_config_common()
{
mpu3_state *state = machine.driver_data<mpu3_state>();
state->m_ic21_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mpu3_state::ic21_timeout),state));
m_ic21_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mpu3_state::ic21_timeout),this));
}
void mpu3_state::machine_start()
{
mpu3_config_common(machine());
mpu3_config_common();
/* setup 8 mechanical meters */
MechMtr_config(machine(),8);
@ -861,7 +864,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mpu3_state::gen_50hz)
m_signal_50hz = m_signal_50hz?0:1;
machine().device<ptm6840_device>("ptm_ic2")->set_c1(m_signal_50hz);
machine().device<pia6821_device>("pia_ic3")->cb1_w(~m_signal_50hz);
update_triacs(machine());
update_triacs();
}
TIMER_DEVICE_CALLBACK_MEMBER(mpu3_state::ic10_callback)

View File

@ -298,6 +298,7 @@ public:
DECLARE_WRITE8_MEMBER(vid_o2_callback);
DECLARE_WRITE8_MEMBER(vid_o3_callback);
DECLARE_READ8_MEMBER(pia_ic5_porta_track_r);
void mpu4vid_char_cheat( int address);
};
@ -2018,41 +2019,40 @@ DRIVER_INIT_MEMBER(mpu4vid_state,prizeinv)
m_current_chr_table = prizeinv_data;
}
void mpu4vid_char_cheat(running_machine& machine, int address)
void mpu4vid_state::mpu4vid_char_cheat( int address)
{
mpu4_state *state = machine.driver_data<mpu4_state>();
UINT8* cheattable = state->memregion( "video" )->base()+address;
state->m_current_chr_table = blank_data;
UINT8* cheattable = memregion( "video" )->base()+address;
m_current_chr_table = blank_data;
for (int i=0;i<72;i++)
{
state->m_current_chr_table[i].response = cheattable++[0];
state->m_current_chr_table[i].call = cheattable++[0];
m_current_chr_table[i].response = cheattable++[0];
m_current_chr_table[i].call = cheattable++[0];
}
}
DRIVER_INIT_MEMBER(mpu4vid_state,v4barqst)
{
mpu4vid_char_cheat(machine(),0x154);
mpu4vid_char_cheat(0x154);
}
DRIVER_INIT_MEMBER(mpu4vid_state,v4barqst2)
{
mpu4vid_char_cheat(machine(),0x15c);
mpu4vid_char_cheat(0x15c);
}
DRIVER_INIT_MEMBER(mpu4vid_state,v4wize)
{
mpu4vid_char_cheat(machine(),0x16c);
mpu4vid_char_cheat(0x16c);
}
DRIVER_INIT_MEMBER(mpu4vid_state,v4cmazeb)
{
mpu4vid_char_cheat(machine(),0x4c6);
mpu4vid_char_cheat(0x4c6);
}
DRIVER_INIT_MEMBER(mpu4vid_state,v4opt3)
{
mpu4vid_char_cheat(machine(),0x164);
mpu4vid_char_cheat(0x164);
}

View File

@ -100,6 +100,7 @@ public:
virtual void machine_reset();
virtual void video_start();
UINT32 screen_update_mwarr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};
@ -404,12 +405,11 @@ void mwarr_state::video_start()
save_item(NAME(m_sprites_buffer));
}
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void mwarr_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
mwarr_state *state = machine.driver_data<mwarr_state>();
const UINT16 *source = state->m_sprites_buffer + 0x800 - 4;
const UINT16 *finish = state->m_sprites_buffer;
gfx_element *gfx = machine.gfx[0];
const UINT16 *source = m_sprites_buffer + 0x800 - 4;
const UINT16 *finish = m_sprites_buffer;
gfx_element *gfx = machine().gfx[0];
int x, y, color, flipx, dy, pri, pri_mask, i;
while (source >= finish)
@ -437,7 +437,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
color,
flipx,0,
x,y+i*16,
machine.priority_bitmap,pri_mask,0 );
machine().priority_bitmap,pri_mask,0 );
/* wrap around x */
pdrawgfx_transpen( bitmap,
@ -447,7 +447,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
color,
flipx,0,
x-1024,y+i*16,
machine.priority_bitmap,pri_mask,0 );
machine().priority_bitmap,pri_mask,0 );
/* wrap around y */
pdrawgfx_transpen( bitmap,
@ -457,7 +457,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
color,
flipx,0,
x,y-512+i*16,
machine.priority_bitmap,pri_mask,0 );
machine().priority_bitmap,pri_mask,0 );
/* wrap around x & y */
pdrawgfx_transpen( bitmap,
@ -467,7 +467,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
color,
flipx,0,
x-1024,y-512+i*16,
machine.priority_bitmap,pri_mask,0 );
machine().priority_bitmap,pri_mask,0 );
}
}
@ -525,7 +525,7 @@ UINT32 mwarr_state::screen_update_mwarr(screen_device &screen, bitmap_ind16 &bit
m_mlow_tilemap->draw(bitmap, cliprect, 0, 0x02);
m_mhigh_tilemap->draw(bitmap, cliprect, 0, 0x04);
m_tx_tilemap->draw(bitmap, cliprect, 0, 0x10);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -88,6 +88,7 @@ public:
virtual void palette_init();
UINT32 screen_update_olibochu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(olibochu_scanline);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
};
@ -168,15 +169,14 @@ void olibochu_state::video_start()
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(olibochu_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
void olibochu_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
olibochu_state *state = machine.driver_data<olibochu_state>();
UINT8 *spriteram = state->m_spriteram;
UINT8 *spriteram_2 = state->m_spriteram2;
UINT8 *spriteram = m_spriteram;
UINT8 *spriteram_2 = m_spriteram2;
int offs;
/* 16x16 sprites */
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
int attr = spriteram[offs + 1];
int code = spriteram[offs];
@ -186,7 +186,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int sx = spriteram[offs + 3];
int sy = ((spriteram[offs + 2] + 8) & 0xff) - 8;
if (state->flip_screen())
if (flip_screen())
{
sx = 240 - sx;
sy = 240 - sy;
@ -195,14 +195,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
}
drawgfx_transpen(bitmap, cliprect,
machine.gfx[1],
machine().gfx[1],
code, color,
flipx, flipy,
sx, sy, 0);
}
/* 8x8 sprites */
for (offs = 0; offs < state->m_spriteram2.bytes(); offs += 4)
for (offs = 0; offs < m_spriteram2.bytes(); offs += 4)
{
int attr = spriteram_2[offs + 1];
int code = spriteram_2[offs];
@ -212,7 +212,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int sx = spriteram_2[offs + 3];
int sy = spriteram_2[offs + 2];
if (state->flip_screen())
if (flip_screen())
{
sx = 248 - sx;
sy = 248 - sy;
@ -221,7 +221,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
}
drawgfx_transpen(bitmap, cliprect,
machine.gfx[0],
machine().gfx[0],
code, color,
flipx, flipy,
sx, sy, 0);
@ -231,7 +231,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
UINT32 olibochu_state::screen_update_olibochu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -126,6 +126,9 @@ public:
virtual void machine_reset();
UINT32 screen_update_tetriskr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
IRQ_CALLBACK_MEMBER(irq_callback);
UINT8 pcxt_speaker_get_spk();
void pcxt_speaker_set_spkrdata(UINT8 data);
void pcxt_speaker_set_input(UINT8 data);
};
UINT32 pcxt_state::screen_update_tetriskr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@ -235,32 +238,29 @@ Pit8253
*********************************/
// pc_speaker_get_spk, pc_speaker_set_spkrdata, and pc_speaker_set_input already exists in MESS, can the implementations be merged?
UINT8 pcxt_speaker_get_spk(running_machine &machine)
UINT8 pcxt_state::pcxt_speaker_get_spk()
{
pcxt_state *state = machine.driver_data<pcxt_state>();
return state->m_pc_spkrdata & state->m_pc_input;
return m_pc_spkrdata & m_pc_input;
}
void pcxt_speaker_set_spkrdata(running_machine &machine, UINT8 data)
void pcxt_state::pcxt_speaker_set_spkrdata(UINT8 data)
{
device_t *speaker = machine.device("speaker");
pcxt_state *state = machine.driver_data<pcxt_state>();
state->m_pc_spkrdata = data ? 1 : 0;
speaker_level_w( speaker, pcxt_speaker_get_spk(machine) );
device_t *speaker = machine().device("speaker");
m_pc_spkrdata = data ? 1 : 0;
speaker_level_w( speaker, pcxt_speaker_get_spk() );
}
void pcxt_speaker_set_input(running_machine &machine, UINT8 data)
void pcxt_state::pcxt_speaker_set_input(UINT8 data)
{
device_t *speaker = machine.device("speaker");
pcxt_state *state = machine.driver_data<pcxt_state>();
state->m_pc_input = data ? 1 : 0;
speaker_level_w( speaker, pcxt_speaker_get_spk(machine) );
device_t *speaker = machine().device("speaker");
m_pc_input = data ? 1 : 0;
speaker_level_w( speaker, pcxt_speaker_get_spk() );
}
WRITE_LINE_MEMBER(pcxt_state::ibm5150_pit8253_out2_changed)
{
pcxt_speaker_set_input( machine(), state );
pcxt_speaker_set_input( state );
}
@ -330,7 +330,7 @@ WRITE8_MEMBER(pcxt_state::port_b_w)
{
/* PPI controller port B*/
pit8253_gate2_w(m_pit8253, BIT(data, 0));
pcxt_speaker_set_spkrdata( machine(), data & 0x02 );
pcxt_speaker_set_spkrdata( data & 0x02 );
m_port_b_data = data;
// device_t *beep = machine().device("beep");
// device_t *cvsd = machine().device("cvsd");

View File

@ -47,13 +47,14 @@ public:
virtual void machine_start();
virtual void machine_reset();
void pengadvb_postload();
void mem_map_banks();
void pengadvb_decrypt(const char* region);
};
static void mem_map_banks(running_machine &machine)
void pengadvb_state::mem_map_banks()
{
pengadvb_state *state = machine.driver_data<pengadvb_state>();
/* memorymap: (rest is assumed unmapped)
slot 0
0000-7fff BIOS ROM
@ -64,70 +65,70 @@ static void mem_map_banks(running_machine &machine)
*/
// page 0 (0000-3fff)
switch(state->m_mem_map & 3)
switch(m_mem_map & 3)
{
case 0:
// BIOS
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1" );
state->membank("bank1")->set_base(state->memregion("maincpu")->base());
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1" );
membank("bank1")->set_base(memregion("maincpu")->base());
break;
default:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x0000, 0x3fff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x0000, 0x3fff);
break;
}
// page 1 (4000-7fff)
switch(state->m_mem_map >> 2 & 3)
switch(m_mem_map >> 2 & 3)
{
case 0:
// BIOS
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
state->membank("bank21")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000);
state->membank("bank22")->set_base(machine.root_device().memregion("maincpu")->base() + 0x4000 + 0x2000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
membank("bank21")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000);
membank("bank22")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000 + 0x2000);
break;
case 1:
// game
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
state->membank("bank21")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[0]*0x2000);
state->membank("bank22")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[1]*0x2000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x5fff, "bank21" );
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0x7fff, "bank22" );
membank("bank21")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[0]*0x2000);
membank("bank22")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[1]*0x2000);
break;
default:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x4000, 0x7fff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x4000, 0x7fff);
break;
}
// page 2 (8000-bfff)
switch(state->m_mem_map >> 4 & 3)
switch(m_mem_map >> 4 & 3)
{
case 1:
// game
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0x9fff, "bank31" );
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xbfff, "bank32" );
state->membank("bank31")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[2]*0x2000);
state->membank("bank32")->set_base(machine.root_device().memregion("game")->base() + state->m_mem_banks[3]*0x2000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0x9fff, "bank31" );
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xa000, 0xbfff, "bank32" );
membank("bank31")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[2]*0x2000);
membank("bank32")->set_base(machine().root_device().memregion("game")->base() + m_mem_banks[3]*0x2000);
break;
default:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x8000, 0xbfff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x8000, 0xbfff);
break;
}
// page 3 (c000-ffff)
switch(state->m_mem_map >> 6 & 3)
switch(m_mem_map >> 6 & 3)
{
case 3:
// RAM
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xffff, "bank4" );
state->membank("bank4")->set_base(state->m_main_mem);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xffff, "bank4" );
membank("bank4")->set_base(m_main_mem);
break;
default:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0xc000, 0xffff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0xc000, 0xffff);
break;
}
}
@ -144,7 +145,7 @@ WRITE8_MEMBER(pengadvb_state::mem_w)
{
// ROM bankswitch
m_mem_banks[(offset - 0x4000) >> 13] = data & 0xf;
mem_map_banks(machine());
mem_map_banks();
}
}
@ -210,7 +211,7 @@ WRITE8_MEMBER(pengadvb_state::pengadvb_ppi_port_a_w)
if (data != m_mem_map)
{
m_mem_map = data;
mem_map_banks(machine());
mem_map_banks();
}
}
@ -247,7 +248,7 @@ static TMS9928A_INTERFACE(pengadvb_tms9928a_interface)
void pengadvb_state::pengadvb_postload()
{
mem_map_banks(machine());
mem_map_banks();
}
void pengadvb_state::machine_start()
@ -262,7 +263,7 @@ void pengadvb_state::machine_reset()
{
m_mem_map = 0;
m_mem_banks[0] = m_mem_banks[1] = m_mem_banks[2] = m_mem_banks[3] = 0;
mem_map_banks(machine());
mem_map_banks();
}
@ -287,10 +288,10 @@ static MACHINE_CONFIG_START( pengadvb, pengadvb_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MACHINE_CONFIG_END
static void pengadvb_decrypt(running_machine &machine, const char* region)
void pengadvb_state::pengadvb_decrypt(const char* region)
{
UINT8 *mem = machine.root_device().memregion(region)->base();
int memsize = machine.root_device().memregion(region)->bytes();
UINT8 *mem = machine().root_device().memregion(region)->base();
int memsize = machine().root_device().memregion(region)->bytes();
UINT8 *buf;
int i;
@ -301,19 +302,19 @@ static void pengadvb_decrypt(running_machine &machine, const char* region)
}
// address line swap
buf = auto_alloc_array(machine, UINT8, memsize);
buf = auto_alloc_array(machine(), UINT8, memsize);
memcpy(buf, mem, memsize);
for ( i = 0; i < memsize; i++ )
{
mem[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,5,11,10,9,8,7,6,12,4,3,2,1,0)];
}
auto_free(machine, buf);
auto_free(machine(), buf);
}
DRIVER_INIT_MEMBER(pengadvb_state,pengadvb)
{
pengadvb_decrypt(machine(), "maincpu");
pengadvb_decrypt(machine(), "game");
pengadvb_decrypt("maincpu");
pengadvb_decrypt("game");
m_main_mem = auto_alloc_array(machine(), UINT8, 0x4000);
}

View File

@ -97,23 +97,24 @@ public:
virtual void video_start();
UINT32 screen_update_popobear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(popobear_irq);
void draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
};
void popobear_state::video_start()
{
}
static void draw_layer(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n)
void popobear_state::draw_layer(bitmap_ind16 &bitmap,const rectangle &cliprect, UINT8 layer_n)
{
popobear_state *state = machine.driver_data<popobear_state>();
// ERROR: This cast is NOT endian-safe without the use of BYTE/WORD/DWORD_XOR_* macros!
UINT8* vram = reinterpret_cast<UINT8 *>(state->m_vram.target());
UINT16* vreg = (UINT16 *)state->m_vregs;
UINT8* vram = reinterpret_cast<UINT8 *>(m_vram.target());
UINT16* vreg = (UINT16 *)m_vregs;
int count;
const UINT8 vreg_base[] = { 0x10/2, 0x14/2 };
int xscroll,yscroll;
// count = (state->m_vregs[vreg_base[layer_n]]<<5);
// count = (m_vregs[vreg_base[layer_n]]<<5);
// count &= 0xfc000;
count = (0xf0000+layer_n*0x4000);
if(layer_n & 2)
@ -154,21 +155,21 @@ static void draw_layer(running_machine &machine, bitmap_ind16 &bitmap,const rect
color = (vram[((xi+yi*1024)+xtile+ytile) & 0xfffff] & 0xff);
if(cliprect.contains(xoffs+1, yoffs) && color)
bitmap.pix16(yoffs, xoffs+1) = machine.pens[color];
bitmap.pix16(yoffs, xoffs+1) = machine().pens[color];
if(cliprect.contains(xoffs+1, yoffs+512) && color)
bitmap.pix16(yoffs+512, xoffs+1) = machine.pens[color];
bitmap.pix16(yoffs+512, xoffs+1) = machine().pens[color];
//if(cliprect.contains(xoffs+1, yoffs+256) && color)
// bitmap.pix16(yoffs+512, xoffs+1) = machine.pens[color];
// bitmap.pix16(yoffs+512, xoffs+1) = machine().pens[color];
color = (vram[((xi+1+yi*1024)+xtile+ytile) & 0xfffff] & 0xff);
if(cliprect.contains(xoffs, yoffs) && color)
bitmap.pix16(yoffs, xoffs) = machine.pens[color];
bitmap.pix16(yoffs, xoffs) = machine().pens[color];
if(cliprect.contains(xoffs, yoffs+512) && color)
bitmap.pix16(yoffs+512, xoffs) = machine.pens[color];
bitmap.pix16(yoffs+512, xoffs) = machine().pens[color];
}
}
@ -177,19 +178,18 @@ static void draw_layer(running_machine &machine, bitmap_ind16 &bitmap,const rect
}
}
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
void popobear_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{
popobear_state *state = machine.driver_data<popobear_state>();
// ERROR: This cast is NOT endian-safe without the use of BYTE/WORD/DWORD_XOR_* macros!
UINT8* vram = reinterpret_cast<UINT8 *>(state->m_spr.target());
UINT8* vram = reinterpret_cast<UINT8 *>(m_spr.target());
int i;
#if 0
static int bank_test = 1;
if(machine.input().code_pressed_once(KEYCODE_Z))
if(machine().input().code_pressed_once(KEYCODE_Z))
bank_test<<=1;
if(machine.input().code_pressed_once(KEYCODE_X))
if(machine().input().code_pressed_once(KEYCODE_X))
bank_test>>=1;
popmessage("%02x",bank_test);
@ -242,14 +242,14 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
y_res = (y_dir) ? y+(height - yi) : y+yi;
if(cliprect.contains(x_res, y_res) && color)
bitmap.pix16(y_res, x_res) = machine.pens[color+0x100+color_bank];
bitmap.pix16(y_res, x_res) = machine().pens[color+0x100+color_bank];
color = (vram[spr_num+1] & 0xff);
x_res = (x_dir) ? x+1+(width - xi) : x+0+xi;
y_res = (y_dir) ? y+(height - yi) : y+yi;
if(cliprect.contains(x_res, y_res) && color)
bitmap.pix16(y_res, x_res) = machine.pens[color+0x100+color_bank];
bitmap.pix16(y_res, x_res) = machine().pens[color+0x100+color_bank];
spr_num+=2;
}
@ -263,11 +263,11 @@ UINT32 popobear_state::screen_update_popobear(screen_device &screen, bitmap_ind1
//popmessage("%04x",m_vregs[0/2]);
draw_layer(machine(),bitmap,cliprect,3);
draw_layer(machine(),bitmap,cliprect,2);
draw_layer(machine(),bitmap,cliprect,1);
draw_layer(machine(),bitmap,cliprect,0);
draw_sprites(machine(),bitmap,cliprect);
draw_layer(bitmap,cliprect,3);
draw_layer(bitmap,cliprect,2);
draw_layer(bitmap,cliprect,1);
draw_layer(bitmap,cliprect,0);
draw_sprites(bitmap,cliprect);
return 0;
}

View File

@ -91,6 +91,7 @@ public:
virtual void machine_start();
virtual void machine_reset();
IRQ_CALLBACK_MEMBER(irq_callback);
void intel82439tx_init();
};
@ -134,15 +135,14 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i
state->m_mxtc_config_reg[reg] = data;
}
static void intel82439tx_init(running_machine &machine)
void queen_state::intel82439tx_init()
{
queen_state *state = machine.driver_data<queen_state>();
state->m_mxtc_config_reg[0x60] = 0x02;
state->m_mxtc_config_reg[0x61] = 0x02;
state->m_mxtc_config_reg[0x62] = 0x02;
state->m_mxtc_config_reg[0x63] = 0x02;
state->m_mxtc_config_reg[0x64] = 0x02;
state->m_mxtc_config_reg[0x65] = 0x02;
m_mxtc_config_reg[0x60] = 0x02;
m_mxtc_config_reg[0x61] = 0x02;
m_mxtc_config_reg[0x62] = 0x02;
m_mxtc_config_reg[0x63] = 0x02;
m_mxtc_config_reg[0x64] = 0x02;
m_mxtc_config_reg[0x65] = 0x02;
}
static UINT32 intel82439tx_pci_r(device_t *busdevice, device_t *device, int function, int reg, UINT32 mem_mask)
@ -521,7 +521,7 @@ void queen_state::machine_start()
init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, queen_set_keyb_int);
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(queen_state::irq_callback),this));
intel82439tx_init(machine());
intel82439tx_init();
kbdc8042_init(machine(), &at8042);
}

View File

@ -200,6 +200,8 @@ public:
INTERRUPT_GEN_MEMBER(suzume_irq);
INTERRUPT_GEN_MEMBER(mjtensin_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(janptr96_interrupt);
void mjtensin_update_rombank();
void cafetime_update_rombank();
};
@ -1056,20 +1058,19 @@ READ8_MEMBER(royalmah_state::mjtensin_p3_r)
return 0xff;
}
static void mjtensin_update_rombank(running_machine &machine)
void royalmah_state::mjtensin_update_rombank()
{
royalmah_state *state = machine.driver_data<royalmah_state>();
state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x10000 + state->m_rombank * 0x8000 );
membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000 + m_rombank * 0x8000 );
}
WRITE8_MEMBER(royalmah_state::mjtensin_p4_w)
{
m_rombank = (m_rombank & 0xf0) | (data & 0x0f);
mjtensin_update_rombank(machine());
mjtensin_update_rombank();
}
WRITE8_MEMBER(royalmah_state::mjtensin_6ff3_w)
{
m_rombank = (data << 4) | (m_rombank & 0x0f);
mjtensin_update_rombank(machine());
mjtensin_update_rombank();
}
static ADDRESS_MAP_START( mjtensin_map, AS_PROGRAM, 8, royalmah_state )
@ -1098,20 +1099,19 @@ ADDRESS_MAP_END
Mahjong Cafe Time
****************************************************************************/
static void cafetime_update_rombank(running_machine &machine)
void royalmah_state::cafetime_update_rombank()
{
royalmah_state *state = machine.driver_data<royalmah_state>();
state->membank("bank1")->set_base(state->memregion("maincpu")->base() + 0x10000 + state->m_rombank * 0x8000 );
membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000 + m_rombank * 0x8000 );
}
WRITE8_MEMBER(royalmah_state::cafetime_p4_w)
{
m_rombank = (m_rombank & 0xf0) | (data & 0x0f);
cafetime_update_rombank(machine());
cafetime_update_rombank();
}
WRITE8_MEMBER(royalmah_state::cafetime_p3_w)
{
m_rombank = (m_rombank & 0x0f) | ((data & 0x0c) << 2);
cafetime_update_rombank(machine());
cafetime_update_rombank();
}
WRITE8_MEMBER(royalmah_state::cafetime_dsw_w)

View File

@ -112,6 +112,7 @@ public:
UINT32 screen_update_sandscrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_sandscrp(screen_device &screen, bool state);
INTERRUPT_GEN_MEMBER(sandscrp_interrupt);
void update_irq_state();
};
@ -149,13 +150,12 @@ void sandscrp_state::machine_reset()
/* Update the IRQ state based on all possible causes */
static void update_irq_state(running_machine &machine)
void sandscrp_state::update_irq_state()
{
sandscrp_state *state = machine.driver_data<sandscrp_state>();
if (state->m_vblank_irq || state->m_sprite_irq || state->m_unknown_irq)
machine.device("maincpu")->execute().set_input_line(1, ASSERT_LINE);
if (m_vblank_irq || m_sprite_irq || m_unknown_irq)
machine().device("maincpu")->execute().set_input_line(1, ASSERT_LINE);
else
machine.device("maincpu")->execute().set_input_line(1, CLEAR_LINE);
machine().device("maincpu")->execute().set_input_line(1, CLEAR_LINE);
}
@ -164,7 +164,7 @@ static void update_irq_state(running_machine &machine)
INTERRUPT_GEN_MEMBER(sandscrp_state::sandscrp_interrupt)
{
m_vblank_irq = 1;
update_irq_state(machine());
update_irq_state();
}
@ -175,7 +175,7 @@ void sandscrp_state::screen_eof_sandscrp(screen_device &screen, bool state)
{
device_t *pandora = machine().device("pandora");
m_sprite_irq = 1;
update_irq_state(machine());
update_irq_state();
pandora_eof(pandora);
}
}
@ -202,7 +202,7 @@ WRITE16_MEMBER(sandscrp_state::sandscrp_irq_cause_w)
if (data & 0x20) m_vblank_irq = 0;
}
update_irq_state(machine());
update_irq_state();
}

View File

@ -68,99 +68,100 @@ public:
DECLARE_MACHINE_RESET(pzlestar);
DECLARE_MACHINE_RESET(sexyboom);
TIMER_DEVICE_CALLBACK_MEMBER(sangho_interrupt);
void pzlestar_map_banks();
void sexyboom_map_bank(int bank);
};
static void pzlestar_map_banks(running_machine &machine)
void sangho_state::pzlestar_map_banks()
{
sangho_state *state = machine.driver_data<sangho_state>();
int slot_select;
// page 0
slot_select = (state->m_pzlestar_mem_bank >> 0) & 0x03;
slot_select = (m_pzlestar_mem_bank >> 0) & 0x03;
switch(slot_select)
{
case 0:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0000, 0x3fff, "bank5");
state->membank("bank1")->set_base(state->m_ram);
state->membank("bank5")->set_base(state->m_ram);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x0000, 0x3fff, "bank5");
membank("bank1")->set_base(m_ram);
membank("bank5")->set_base(m_ram);
break;
case 2:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x3fff);
state->membank("bank1")->set_base(state->memregion("user1")->base()+ 0x10000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1");
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x3fff);
membank("bank1")->set_base(memregion("user1")->base()+ 0x10000);
break;
case 1:
case 3:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x0000, 0x3fff);
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x3fff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x0000, 0x3fff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x3fff);
break;
}
// page 1
slot_select = (state->m_pzlestar_mem_bank >> 2) & 0x03;
slot_select = (m_pzlestar_mem_bank >> 2) & 0x03;
switch(slot_select)
{
case 0:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x4000, 0x7fff, "bank6");
state->membank("bank2")->set_base(state->m_ram + 0x4000);
state->membank("bank6")->set_base(state->m_ram + 0x4000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x4000, 0x7fff, "bank6");
membank("bank2")->set_base(m_ram + 0x4000);
membank("bank6")->set_base(m_ram + 0x4000);
break;
case 2:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base()+ 0x18000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
membank("bank2")->set_base(machine().root_device().memregion("user1")->base()+ 0x18000);
break;
case 3:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
state->membank("bank2")->set_base(machine.root_device().memregion("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000) + 0x4000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank2");
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
membank("bank2")->set_base(machine().root_device().memregion("user1")->base()+ 0x20000 + (m_pzlestar_rom_bank*0x8000) + 0x4000);
break;
case 1:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x4000, 0x7fff);
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x4000, 0x7fff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x4000, 0x7fff);
break;
}
// page 2
slot_select = (state->m_pzlestar_mem_bank >> 4) & 0x03;
slot_select = (m_pzlestar_mem_bank >> 4) & 0x03;
switch(slot_select)
{
case 0:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank3");
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x8000, 0xbfff, "bank7");
state->membank("bank3")->set_base(state->m_ram + 0x8000);
state->membank("bank7")->set_base(state->m_ram + 0x8000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank3");
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x8000, 0xbfff, "bank7");
membank("bank3")->set_base(m_ram + 0x8000);
membank("bank7")->set_base(m_ram + 0x8000);
break;
case 3:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank3");
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
state->membank("bank3")->set_base(machine.root_device().memregion("user1")->base()+ 0x20000 + (state->m_pzlestar_rom_bank*0x8000));
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank3");
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
membank("bank3")->set_base(machine().root_device().memregion("user1")->base()+ 0x20000 + (m_pzlestar_rom_bank*0x8000));
break;
case 1:
case 2:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x8000, 0xbfff);
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0x8000, 0xbfff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x8000, 0xbfff);
break;
}
// page 3
slot_select = (state->m_pzlestar_mem_bank >> 6) & 0x03;
slot_select = (m_pzlestar_mem_bank >> 6) & 0x03;
switch(slot_select)
{
case 0:
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xffff, "bank4");
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0xc000, 0xffff, "bank8");
state->membank("bank4")->set_base(state->m_ram + 0xc000);
state->membank("bank8")->set_base(state->m_ram + 0xc000);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xc000, 0xffff, "bank4");
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0xc000, 0xffff, "bank8");
membank("bank4")->set_base(m_ram + 0xc000);
membank("bank8")->set_base(m_ram + 0xc000);
break;
case 1:
case 2:
case 3:
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0xc000, 0xffff);
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xc000, 0xffff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_read(0xc000, 0xffff);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xc000, 0xffff);
break;
}
@ -170,14 +171,14 @@ WRITE8_MEMBER(sangho_state::pzlestar_bank_w)
{
logerror("rom bank %02x\n", data);
m_pzlestar_rom_bank = data;
pzlestar_map_banks(machine());
pzlestar_map_banks();
}
WRITE8_MEMBER(sangho_state::pzlestar_mem_bank_w)
{
logerror("mem bank %02x\n", data);
m_pzlestar_mem_bank = data;
pzlestar_map_banks(machine());
pzlestar_map_banks();
}
READ8_MEMBER(sangho_state::pzlestar_mem_bank_r)
@ -185,14 +186,13 @@ READ8_MEMBER(sangho_state::pzlestar_mem_bank_r)
return m_pzlestar_mem_bank;
}
static void sexyboom_map_bank(running_machine &machine, int bank)
void sangho_state::sexyboom_map_bank(int bank)
{
sangho_state *state = machine.driver_data<sangho_state>();
UINT8 banknum, banktype;
char read_bank_name[6], write_bank_name[6];
banknum = state->m_sexyboom_bank[bank*2];
banktype = state->m_sexyboom_bank[bank*2 + 1];
banknum = m_sexyboom_bank[bank*2];
banktype = m_sexyboom_bank[bank*2 + 1];
sprintf(read_bank_name, "bank%d", bank+1);
sprintf(write_bank_name, "bank%d", bank+1+4);
@ -201,26 +201,26 @@ static void sexyboom_map_bank(running_machine &machine, int bank)
if (banknum & 0x80)
{
// ram
state->membank(read_bank_name)->set_base(&state->m_ram[(banknum & 0x7f) * 0x4000]);
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(bank*0x4000, (bank+1)*0x4000 - 1, write_bank_name );
state->membank(write_bank_name)->set_base(&state->m_ram[(banknum & 0x7f) * 0x4000]);
membank(read_bank_name)->set_base(&m_ram[(banknum & 0x7f) * 0x4000]);
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(bank*0x4000, (bank+1)*0x4000 - 1, write_bank_name );
membank(write_bank_name)->set_base(&m_ram[(banknum & 0x7f) * 0x4000]);
}
else
{
// rom 0
state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x4000*banknum);
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
membank(read_bank_name)->set_base(machine().root_device().memregion("user1")->base()+0x4000*banknum);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
}
}
else if (banktype == 0x82)
{
state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x20000+banknum*0x4000);
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
membank(read_bank_name)->set_base(machine().root_device().memregion("user1")->base()+0x20000+banknum*0x4000);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
}
else if (banktype == 0x80)
{
state->membank(read_bank_name)->set_base(machine.root_device().memregion("user1")->base()+0x120000+banknum*0x4000);
machine.device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
membank(read_bank_name)->set_base(machine().root_device().memregion("user1")->base()+0x120000+banknum*0x4000);
machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(bank*0x4000, (bank+1)*0x4000 - 1);
}
else
{
@ -231,7 +231,7 @@ static void sexyboom_map_bank(running_machine &machine, int bank)
WRITE8_MEMBER(sangho_state::sexyboom_bank_w)
{
m_sexyboom_bank[offset] = data;
sexyboom_map_bank(machine(), offset>>1);
sexyboom_map_bank(offset>>1);
}
static ADDRESS_MAP_START( sangho_map, AS_PROGRAM, 8, sangho_state )
@ -382,7 +382,7 @@ INPUT_PORTS_END
MACHINE_RESET_MEMBER(sangho_state,pzlestar)
{
m_pzlestar_mem_bank = 2;
pzlestar_map_banks(machine());
pzlestar_map_banks();
}
MACHINE_RESET_MEMBER(sangho_state,sexyboom)
@ -395,10 +395,10 @@ MACHINE_RESET_MEMBER(sangho_state,sexyboom)
m_sexyboom_bank[5] = 0x00;
m_sexyboom_bank[6] = 0x80;
m_sexyboom_bank[7] = 0x01;
sexyboom_map_bank(machine(), 0);
sexyboom_map_bank(machine(), 1);
sexyboom_map_bank(machine(), 2);
sexyboom_map_bank(machine(), 3);
sexyboom_map_bank(0);
sexyboom_map_bank(1);
sexyboom_map_bank(2);
sexyboom_map_bank(3);
}
static void msx_vdp_interrupt(device_t *, v99x8_device &device, int i)

View File

@ -69,6 +69,7 @@ public:
UINT32 screen_update_sbrkout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(scanline_callback);
TIMER_CALLBACK_MEMBER(pot_trigger_callback);
void update_nmi_state();
};
@ -201,20 +202,19 @@ READ8_MEMBER(sbrkout_state::switches_r)
}
static void update_nmi_state(running_machine &machine)
void sbrkout_state::update_nmi_state()
{
sbrkout_state *state = machine.driver_data<sbrkout_state>();
if ((state->m_pot_trigger[0] & ~state->m_pot_mask[0]) | (state->m_pot_trigger[1] & ~state->m_pot_mask[1]))
machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
if ((m_pot_trigger[0] & ~m_pot_mask[0]) | (m_pot_trigger[1] & ~m_pot_mask[1]))
machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
else
machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
TIMER_CALLBACK_MEMBER(sbrkout_state::pot_trigger_callback)
{
m_pot_trigger[param] = 1;
update_nmi_state(machine());
update_nmi_state();
}
@ -222,7 +222,7 @@ WRITE8_MEMBER(sbrkout_state::pot_mask1_w)
{
m_pot_mask[0] = ~offset & 1;
m_pot_trigger[0] = 0;
update_nmi_state(machine());
update_nmi_state();
}
@ -230,7 +230,7 @@ WRITE8_MEMBER(sbrkout_state::pot_mask2_w)
{
m_pot_mask[1] = ~offset & 1;
m_pot_trigger[1] = 0;
update_nmi_state(machine());
update_nmi_state();
}

View File

@ -80,6 +80,8 @@ public:
DECLARE_DRIVER_INIT(sfkick);
virtual void machine_reset();
TIMER_DEVICE_CALLBACK_MEMBER(sfkick_interrupt);
void sfkick_remap_banks();
void sfkick_bank_set(int num, int data);
};
@ -105,127 +107,126 @@ READ8_MEMBER(sfkick_state::ppi_port_b_r)
return 0xff;
}
static void sfkick_remap_banks(running_machine &machine)
void sfkick_state::sfkick_remap_banks()
{
sfkick_state *state = machine.driver_data<sfkick_state>();
/* 0000-3ffff */
switch(state->m_bank_cfg&3)
switch(m_bank_cfg&3)
{
case 0: /* bios */
{
UINT8 *mem = state->memregion("bios")->base();
state->membank("bank1")->set_base(mem);
state->membank("bank2")->set_base(mem+0x2000);
UINT8 *mem = memregion("bios")->base();
membank("bank1")->set_base(mem);
membank("bank2")->set_base(mem+0x2000);
}
break;
case 1: /* ext rom */
{
UINT8 *mem = machine.root_device().memregion("extrom")->base();
state->membank("bank1")->set_base(mem+0x4000);
state->membank("bank2")->set_base(mem+0x6000);
UINT8 *mem = machine().root_device().memregion("extrom")->base();
membank("bank1")->set_base(mem+0x4000);
membank("bank2")->set_base(mem+0x6000);
}
break;
case 2: /* banked */
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank1")->set_base(mem+0x2000*state->m_bank[0]);
state->membank("bank2")->set_base(mem+0x2000*state->m_bank[1]);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank1")->set_base(mem+0x2000*m_bank[0]);
membank("bank2")->set_base(mem+0x2000*m_bank[1]);
}
break;
case 3: /* unknown */
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank1")->set_base(mem+0x18000);
state->membank("bank2")->set_base(mem+0x18000);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank1")->set_base(mem+0x18000);
membank("bank2")->set_base(mem+0x18000);
}
break;
}
/* 4000-7ffff */
switch((state->m_bank_cfg>>2)&3)
switch((m_bank_cfg>>2)&3)
{
case 0: /* bios - upper part */
{
UINT8 *mem = machine.root_device().memregion("bios")->base();
state->membank("bank3")->set_base(mem+0x4000);
state->membank("bank4")->set_base(mem+0x6000);
UINT8 *mem = machine().root_device().memregion("bios")->base();
membank("bank3")->set_base(mem+0x4000);
membank("bank4")->set_base(mem+0x6000);
}
break;
case 1: /* unknown */
case 3:
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank3")->set_base(mem+0x18000);
state->membank("bank4")->set_base(mem+0x18000);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank3")->set_base(mem+0x18000);
membank("bank4")->set_base(mem+0x18000);
}
break;
case 2: /* banked */
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank3")->set_base(mem+0x2000*state->m_bank[2]);
state->membank("bank4")->set_base(mem+0x2000*state->m_bank[3]);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank3")->set_base(mem+0x2000*m_bank[2]);
membank("bank4")->set_base(mem+0x2000*m_bank[3]);
}
break;
}
/* 8000-bffff */
switch((state->m_bank_cfg>>4)&3)
switch((m_bank_cfg>>4)&3)
{
case 0: /* cartridge */
{
UINT8 *mem = machine.root_device().memregion("cartridge")->base();
state->membank("bank5")->set_base(mem+0x4000);
state->membank("bank6")->set_base(mem+0x6000);
UINT8 *mem = machine().root_device().memregion("cartridge")->base();
membank("bank5")->set_base(mem+0x4000);
membank("bank6")->set_base(mem+0x6000);
}
break;
case 1: /* unknown */
case 3:
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank5")->set_base(mem+0x18000);
state->membank("bank6")->set_base(mem+0x18000);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank5")->set_base(mem+0x18000);
membank("bank6")->set_base(mem+0x18000);
}
break;
case 2: /* banked */
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank5")->set_base(mem+0x2000*state->m_bank[4]);
state->membank("bank6")->set_base(mem+0x2000*state->m_bank[5]);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank5")->set_base(mem+0x2000*m_bank[4]);
membank("bank6")->set_base(mem+0x2000*m_bank[5]);
}
break;
}
/* c000-fffff */
switch((state->m_bank_cfg>>6)&3)
switch((m_bank_cfg>>6)&3)
{
case 0: /* unknown */
case 1:
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank7")->set_base(mem+0x18000);
state->membank("bank8")->set_base(mem+0x18000);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank7")->set_base(mem+0x18000);
membank("bank8")->set_base(mem+0x18000);
}
break;
case 2: /* banked */
{
UINT8 *mem = machine.root_device().memregion("banked")->base();
state->membank("bank7")->set_base(mem+0x2000*state->m_bank[6]);
state->membank("bank8")->set_base(mem+0x2000*state->m_bank[7]);
UINT8 *mem = machine().root_device().memregion("banked")->base();
membank("bank7")->set_base(mem+0x2000*m_bank[6]);
membank("bank8")->set_base(mem+0x2000*m_bank[7]);
}
break;
case 3: /* RAM */
{
state->membank("bank7")->set_base(state->m_main_mem);
state->membank("bank8")->set_base(state->m_main_mem+0x2000);
membank("bank7")->set_base(m_main_mem);
membank("bank8")->set_base(m_main_mem+0x2000);
}
break;
}
@ -234,19 +235,18 @@ static void sfkick_remap_banks(running_machine &machine)
WRITE8_MEMBER(sfkick_state::ppi_port_a_w)
{
m_bank_cfg=data;
sfkick_remap_banks(machine());
sfkick_remap_banks();
}
static void sfkick_bank_set(running_machine &machine,int num, int data)
void sfkick_state::sfkick_bank_set(int num, int data)
{
sfkick_state *state = machine.driver_data<sfkick_state>();
/* ignore bit 1 */
data&=0xf;
num&=5;
state->m_bank[num]=data;
m_bank[num]=data;
num|=2;
state->m_bank[num]=data;
sfkick_remap_banks(machine);
m_bank[num]=data;
sfkick_remap_banks();
}
WRITE8_MEMBER(sfkick_state::page0_w)
@ -255,11 +255,11 @@ WRITE8_MEMBER(sfkick_state::page0_w)
{
if(offset<0x2000)
{
sfkick_bank_set(machine(),0,data);
sfkick_bank_set(0,data);
}
else
{
sfkick_bank_set(machine(),1,data);
sfkick_bank_set(1,data);
}
}
}
@ -270,11 +270,11 @@ WRITE8_MEMBER(sfkick_state::page1_w)
{
if(offset<0x2000)
{
sfkick_bank_set(machine(),2,data);
sfkick_bank_set(2,data);
}
else
{
sfkick_bank_set(machine(),3,data);
sfkick_bank_set(3,data);
}
}
}
@ -285,11 +285,11 @@ WRITE8_MEMBER(sfkick_state::page2_w)
{
if(offset<0x2000)
{
sfkick_bank_set(machine(),4,data);
sfkick_bank_set(4,data);
}
else
{
sfkick_bank_set(machine(),5,data);
sfkick_bank_set(5,data);
}
}
}
@ -300,11 +300,11 @@ WRITE8_MEMBER(sfkick_state::page3_w)
{
if(offset<0x2000)
{
sfkick_bank_set(machine(),6,data);
sfkick_bank_set(6,data);
}
else
{
sfkick_bank_set(machine(),7,data);
sfkick_bank_set(7,data);
}
}
else
@ -447,7 +447,7 @@ void sfkick_state::machine_reset()
m_bank[5]=0;
m_bank[6]=0;
m_bank[7]=0;
sfkick_remap_banks(machine());
sfkick_remap_banks();
}
TIMER_DEVICE_CALLBACK_MEMBER(sfkick_state::sfkick_interrupt)

View File

@ -113,6 +113,7 @@ public:
virtual void machine_reset();
virtual void video_start();
UINT32 screen_update_silvmil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void tumblepb_gfx1_rearrange();
};
@ -394,10 +395,10 @@ ROM_START( silvmil )
ROM_END
static void tumblepb_gfx1_rearrange(running_machine &machine)
void silvmil_state::tumblepb_gfx1_rearrange()
{
UINT8 *rom = machine.root_device().memregion("gfx1")->base();
int len = machine.root_device().memregion("gfx1")->bytes();
UINT8 *rom = machine().root_device().memregion("gfx1")->base();
int len = machine().root_device().memregion("gfx1")->bytes();
int i;
/* gfx data is in the wrong order */
@ -417,7 +418,7 @@ static void tumblepb_gfx1_rearrange(running_machine &machine)
DRIVER_INIT_MEMBER(silvmil_state,silvmil)
{
tumblepb_gfx1_rearrange(machine());
tumblepb_gfx1_rearrange();
}
GAME( 1995, silvmil, 0, silvmil, silvmil, silvmil_state, silvmil, ROT270, "Para", "Silver Millennium", 0 )