mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
Eliminated global/static variables in a aristocr/atlus/bfm/bmc/
capcom/cinemat/dataeast drivers by introducing/using driver_device classes. [Atari Ace]
This commit is contained in:
parent
8c1a233836
commit
15d6716ee3
@ -2147,8 +2147,8 @@ static CPU_RESET( sh2 )
|
||||
sh2_state *sh2 = get_safe_token(device);
|
||||
emu_timer *tsave, *tsaved0, *tsaved1;
|
||||
UINT32 *m;
|
||||
int (*dma_callback_kludge)(UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_fifo_data_available)(UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_kludge)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_fifo_data_available)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int save_is_slave;
|
||||
|
||||
void (*f)(UINT32 data);
|
||||
|
@ -61,8 +61,8 @@ typedef struct _sh2_cpu_core sh2_cpu_core;
|
||||
struct _sh2_cpu_core
|
||||
{
|
||||
int is_slave;
|
||||
int (*dma_callback_kludge)(UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_fifo_data_available)(UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_kludge)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_fifo_data_available)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
};
|
||||
|
||||
DECLARE_LEGACY_CPU_DEVICE(SH1, sh1);
|
||||
|
@ -209,7 +209,7 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
|
||||
if (sh2->dma_callback_fifo_data_available)
|
||||
{
|
||||
int available = sh2->dma_callback_fifo_data_available(tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
int available = sh2->dma_callback_fifo_data_available(sh2->device, tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
|
||||
if (!available)
|
||||
{
|
||||
@ -226,7 +226,7 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
|
||||
|
||||
dmadata = sh2->program->read_byte(tempsrc);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(sh2->device, tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
sh2->program->write_byte(tempdst, dmadata);
|
||||
|
||||
if(sh2->active_dma_incs[dma] == 2)
|
||||
@ -257,7 +257,7 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
|
||||
if (sh2->dma_callback_fifo_data_available)
|
||||
{
|
||||
int available = sh2->dma_callback_fifo_data_available(tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
int available = sh2->dma_callback_fifo_data_available(sh2->device, tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
|
||||
if (!available)
|
||||
{
|
||||
@ -274,7 +274,7 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
|
||||
// check: should this really be using read_word_32 / write_word_32?
|
||||
dmadata = sh2->program->read_word(tempsrc);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(sh2->device, tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
sh2->program->write_word(tempdst, dmadata);
|
||||
|
||||
if(sh2->active_dma_incs[dma] == 2)
|
||||
@ -304,7 +304,7 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
|
||||
if (sh2->dma_callback_fifo_data_available)
|
||||
{
|
||||
int available = sh2->dma_callback_fifo_data_available(tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
int available = sh2->dma_callback_fifo_data_available(sh2->device, tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
|
||||
if (!available)
|
||||
{
|
||||
@ -320,7 +320,7 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
#endif
|
||||
|
||||
dmadata = sh2->program->read_dword(tempsrc);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(sh2->device, tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
sh2->program->write_dword(tempdst, dmadata);
|
||||
|
||||
if(sh2->active_dma_incs[dma] == 2)
|
||||
@ -349,7 +349,7 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
|
||||
if (sh2->dma_callback_fifo_data_available)
|
||||
{
|
||||
int available = sh2->dma_callback_fifo_data_available(tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
int available = sh2->dma_callback_fifo_data_available(sh2->device, tempsrc, tempdst, 0, sh2->active_dma_size[dma]);
|
||||
|
||||
if (!available)
|
||||
{
|
||||
@ -365,19 +365,19 @@ void sh2_do_dma(sh2_state *sh2, int dma)
|
||||
#endif
|
||||
|
||||
dmadata = sh2->program->read_dword(tempsrc);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(sh2->device, tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
sh2->program->write_dword(tempdst, dmadata);
|
||||
|
||||
dmadata = sh2->program->read_dword(tempsrc+4);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(sh2->device, tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
sh2->program->write_dword(tempdst+4, dmadata);
|
||||
|
||||
dmadata = sh2->program->read_dword(tempsrc+8);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(sh2->device, tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
sh2->program->write_dword(tempdst+8, dmadata);
|
||||
|
||||
dmadata = sh2->program->read_dword(tempsrc+12);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
if (sh2->dma_callback_kludge) dmadata = sh2->dma_callback_kludge(sh2->device, tempsrc, tempdst, dmadata, sh2->active_dma_size[dma]);
|
||||
sh2->program->write_dword(tempdst+12, dmadata);
|
||||
|
||||
if(sh2->active_dma_incd[dma] == 2)
|
||||
|
@ -148,8 +148,8 @@ typedef struct
|
||||
UINT32 active_dma_count[2];
|
||||
|
||||
int is_slave, cpu_type;
|
||||
int (*dma_callback_kludge)(UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_fifo_data_available)(UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_kludge)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
int (*dma_callback_fifo_data_available)(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size);
|
||||
|
||||
void (*ftcsr_read_callback)(UINT32 data);
|
||||
|
||||
|
@ -11,51 +11,54 @@
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
static int sound_flags;
|
||||
static int coin_flag;
|
||||
static device_t *ctc;
|
||||
|
||||
WRITE8_HANDLER( cchasm_reset_coin_flag_w )
|
||||
{
|
||||
if (coin_flag)
|
||||
cchasm_state *state = space->machine->driver_data<cchasm_state>();
|
||||
if (state->coin_flag)
|
||||
{
|
||||
coin_flag = 0;
|
||||
z80ctc_trg0_w(ctc, coin_flag);
|
||||
state->coin_flag = 0;
|
||||
z80ctc_trg0_w(state->ctc, state->coin_flag);
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_CHANGED( cchasm_set_coin_flag )
|
||||
{
|
||||
if (!newval && !coin_flag)
|
||||
cchasm_state *state = field->port->machine->driver_data<cchasm_state>();
|
||||
if (!newval && !state->coin_flag)
|
||||
{
|
||||
coin_flag = 1;
|
||||
z80ctc_trg0_w(ctc, coin_flag);
|
||||
state->coin_flag = 1;
|
||||
z80ctc_trg0_w(state->ctc, state->coin_flag);
|
||||
}
|
||||
}
|
||||
|
||||
READ8_HANDLER( cchasm_coin_sound_r )
|
||||
{
|
||||
cchasm_state *state = space->machine->driver_data<cchasm_state>();
|
||||
UINT8 coin = (input_port_read(space->machine, "IN3") >> 4) & 0x7;
|
||||
return sound_flags | (coin_flag << 3) | coin;
|
||||
return state->sound_flags | (state->coin_flag << 3) | coin;
|
||||
}
|
||||
|
||||
READ8_HANDLER( cchasm_soundlatch2_r )
|
||||
{
|
||||
sound_flags &= ~0x80;
|
||||
z80ctc_trg2_w(ctc, 0);
|
||||
cchasm_state *state = space->machine->driver_data<cchasm_state>();
|
||||
state->sound_flags &= ~0x80;
|
||||
z80ctc_trg2_w(state->ctc, 0);
|
||||
return soundlatch2_r(space, offset);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( cchasm_soundlatch4_w )
|
||||
{
|
||||
sound_flags |= 0x40;
|
||||
cchasm_state *state = space->machine->driver_data<cchasm_state>();
|
||||
state->sound_flags |= 0x40;
|
||||
soundlatch4_w(space, offset, data);
|
||||
cputag_set_input_line(space->machine, "maincpu", 1, HOLD_LINE);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( cchasm_io_w )
|
||||
{
|
||||
static int led;
|
||||
cchasm_state *state = space->machine->driver_data<cchasm_state>();
|
||||
//static int led;
|
||||
|
||||
if (ACCESSING_BITS_8_15)
|
||||
{
|
||||
@ -66,13 +69,13 @@ WRITE16_HANDLER( cchasm_io_w )
|
||||
soundlatch_w (space, offset, data);
|
||||
break;
|
||||
case 1:
|
||||
sound_flags |= 0x80;
|
||||
state->sound_flags |= 0x80;
|
||||
soundlatch2_w (space, offset, data);
|
||||
z80ctc_trg2_w(ctc, 1);
|
||||
z80ctc_trg2_w(state->ctc, 1);
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
break;
|
||||
case 2:
|
||||
led = data;
|
||||
//led = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -80,15 +83,16 @@ WRITE16_HANDLER( cchasm_io_w )
|
||||
|
||||
READ16_HANDLER( cchasm_io_r )
|
||||
{
|
||||
cchasm_state *state = space->machine->driver_data<cchasm_state>();
|
||||
switch (offset & 0xf)
|
||||
{
|
||||
case 0x0:
|
||||
return soundlatch3_r (space, offset) << 8;
|
||||
case 0x1:
|
||||
sound_flags &= ~0x40;
|
||||
state->sound_flags &= ~0x40;
|
||||
return soundlatch4_r (space,offset) << 8;
|
||||
case 0x2:
|
||||
return (sound_flags| (input_port_read(space->machine, "IN3") & 0x07) | 0x08) << 8;
|
||||
return (state->sound_flags| (input_port_read(space->machine, "IN3") & 0x07) | 0x08) << 8;
|
||||
case 0x5:
|
||||
return input_port_read(space->machine, "IN2") << 8;
|
||||
case 0x8:
|
||||
@ -98,26 +102,26 @@ READ16_HANDLER( cchasm_io_r )
|
||||
}
|
||||
}
|
||||
|
||||
static int channel_active[2];
|
||||
static int output[2];
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( ctc_timer_1_w )
|
||||
{
|
||||
cchasm_state *drvstate = device->machine->driver_data<cchasm_state>();
|
||||
if (state) /* rising edge */
|
||||
{
|
||||
output[0] ^= 0x7f;
|
||||
channel_active[0] = 1;
|
||||
dac_data_w(device->machine->device("dac1"), output[0]);
|
||||
drvstate->output[0] ^= 0x7f;
|
||||
drvstate->channel_active[0] = 1;
|
||||
dac_data_w(device->machine->device("dac1"), drvstate->output[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( ctc_timer_2_w )
|
||||
{
|
||||
cchasm_state *drvstate = device->machine->driver_data<cchasm_state>();
|
||||
if (state) /* rising edge */
|
||||
{
|
||||
output[1] ^= 0x7f;
|
||||
channel_active[1] = 1;
|
||||
dac_data_w(device->machine->device("dac2"), output[0]);
|
||||
drvstate->output[1] ^= 0x7f;
|
||||
drvstate->channel_active[1] = 1;
|
||||
dac_data_w(device->machine->device("dac2"), drvstate->output[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,9 +136,10 @@ Z80CTC_INTERFACE( cchasm_ctc_intf )
|
||||
|
||||
SOUND_START( cchasm )
|
||||
{
|
||||
coin_flag = 0;
|
||||
sound_flags = 0;
|
||||
output[0] = 0; output[1] = 0;
|
||||
cchasm_state *state = machine->driver_data<cchasm_state>();
|
||||
state->coin_flag = 0;
|
||||
state->sound_flags = 0;
|
||||
state->output[0] = 0; state->output[1] = 0;
|
||||
|
||||
ctc = machine->device("ctc");
|
||||
state->ctc = machine->device("ctc");
|
||||
}
|
||||
|
@ -38,11 +38,11 @@
|
||||
#define SOUNDVAL_RISING_EDGE(bit) RISING_EDGE(bit, bits_changed, sound_val)
|
||||
#define SOUNDVAL_FALLING_EDGE(bit) FALLING_EDGE(bit, bits_changed, sound_val)
|
||||
|
||||
#define SHIFTREG_RISING_EDGE(bit) RISING_EDGE(bit, (last_shift ^ current_shift), current_shift)
|
||||
#define SHIFTREG_FALLING_EDGE(bit) FALLING_EDGE(bit, (last_shift ^ current_shift), current_shift)
|
||||
#define SHIFTREG_RISING_EDGE(bit) RISING_EDGE(bit, (state->last_shift ^ state->current_shift), state->current_shift)
|
||||
#define SHIFTREG_FALLING_EDGE(bit) FALLING_EDGE(bit, (state->last_shift ^ state->current_shift), state->current_shift)
|
||||
|
||||
#define SHIFTREG2_RISING_EDGE(bit) RISING_EDGE(bit, (last_shift2 ^ current_shift), current_shift)
|
||||
#define SHIFTREG2_FALLING_EDGE(bit) FALLING_EDGE(bit, (last_shift2 ^ current_shift), current_shift)
|
||||
#define SHIFTREG2_RISING_EDGE(bit) RISING_EDGE(bit, (state->last_shift2 ^ state->current_shift), state->current_shift)
|
||||
#define SHIFTREG2_FALLING_EDGE(bit) FALLING_EDGE(bit, (state->last_shift2 ^ state->current_shift), state->current_shift)
|
||||
|
||||
|
||||
|
||||
@ -53,20 +53,10 @@
|
||||
*************************************/
|
||||
|
||||
static void (*sound_handler)(running_machine *,UINT8 sound_val, UINT8 bits_changed);
|
||||
static UINT8 sound_control;
|
||||
|
||||
/* general shift register variables */
|
||||
static UINT32 current_shift;
|
||||
static UINT32 last_shift;
|
||||
static UINT32 last_shift2;
|
||||
static UINT32 current_pitch;
|
||||
static UINT32 last_frame;
|
||||
|
||||
/* Rockola sound variables */
|
||||
static UINT8 sound_fifo[16];
|
||||
static UINT8 sound_fifo_in;
|
||||
static UINT8 sound_fifo_out;
|
||||
static UINT8 last_portb_write;
|
||||
|
||||
|
||||
|
||||
@ -78,14 +68,15 @@ static UINT8 last_portb_write;
|
||||
|
||||
WRITE8_HANDLER( cinemat_sound_control_w )
|
||||
{
|
||||
UINT8 oldval = sound_control;
|
||||
cinemat_state *state = space->machine->driver_data<cinemat_state>();
|
||||
UINT8 oldval = state->sound_control;
|
||||
|
||||
/* form an 8-bit value with the new bit */
|
||||
sound_control = (sound_control & ~(1 << offset)) | ((data & 1) << offset);
|
||||
state->sound_control = (state->sound_control & ~(1 << offset)) | ((data & 1) << offset);
|
||||
|
||||
/* if something changed, call the sound subroutine */
|
||||
if ((sound_control != oldval) && sound_handler)
|
||||
(*sound_handler)(space->machine, sound_control, sound_control ^ oldval);
|
||||
if ((state->sound_control != oldval) && sound_handler)
|
||||
(*sound_handler)(space->machine, state->sound_control, state->sound_control ^ oldval);
|
||||
}
|
||||
|
||||
|
||||
@ -98,22 +89,24 @@ WRITE8_HANDLER( cinemat_sound_control_w )
|
||||
|
||||
static MACHINE_START( generic )
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
/* register for save states */
|
||||
state_save_register_global(machine, sound_control);
|
||||
state_save_register_global(machine, current_shift);
|
||||
state_save_register_global(machine, last_shift);
|
||||
state_save_register_global(machine, last_shift2);
|
||||
state_save_register_global(machine, current_pitch);
|
||||
state_save_register_global(machine, last_frame);
|
||||
state_save_register_global_array(machine, sound_fifo);
|
||||
state_save_register_global(machine, sound_fifo_in);
|
||||
state_save_register_global(machine, sound_fifo_out);
|
||||
state_save_register_global(machine, last_portb_write);
|
||||
state_save_register_global(machine, state->sound_control);
|
||||
state_save_register_global(machine, state->current_shift);
|
||||
state_save_register_global(machine, state->last_shift);
|
||||
state_save_register_global(machine, state->last_shift2);
|
||||
state_save_register_global(machine, state->current_pitch);
|
||||
state_save_register_global(machine, state->last_frame);
|
||||
state_save_register_global_array(machine, state->sound_fifo);
|
||||
state_save_register_global(machine, state->sound_fifo_in);
|
||||
state_save_register_global(machine, state->sound_fifo_out);
|
||||
state_save_register_global(machine, state->last_portb_write);
|
||||
}
|
||||
|
||||
|
||||
static void generic_init(running_machine *machine, void (*callback)(running_machine *,UINT8, UINT8))
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
/* call the standard init */
|
||||
MACHINE_RESET_CALL(cinemat);
|
||||
|
||||
@ -121,18 +114,18 @@ static void generic_init(running_machine *machine, void (*callback)(running_mach
|
||||
sound_handler = callback;
|
||||
|
||||
/* reset sound control */
|
||||
sound_control = 0x9f;
|
||||
state->sound_control = 0x9f;
|
||||
|
||||
/* reset shift register values */
|
||||
current_shift = 0xffff;
|
||||
last_shift = 0xffff;
|
||||
last_shift2 = 0xffff;
|
||||
state->current_shift = 0xffff;
|
||||
state->last_shift = 0xffff;
|
||||
state->last_shift2 = 0xffff;
|
||||
|
||||
/* reset frame counters */
|
||||
last_frame = 0;
|
||||
state->last_frame = 0;
|
||||
|
||||
/* reset Star Castle pitch */
|
||||
current_pitch = 0x10000;
|
||||
state->current_pitch = 0x10000;
|
||||
}
|
||||
|
||||
|
||||
@ -299,12 +292,13 @@ static const samples_interface speedfrk_samples_interface =
|
||||
|
||||
static void speedfrk_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
|
||||
/* on the falling edge of bit 0x08, clock the inverse of bit 0x04 into the top of the shiftreg */
|
||||
if (SOUNDVAL_FALLING_EDGE(0x08))
|
||||
{
|
||||
current_shift = ((current_shift >> 1) & 0x7fff) | ((~sound_val << 13) & 1);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7fff) | ((~sound_val << 13) & 1);
|
||||
/* high 12 bits control the frequency - counts from value to $FFF, carry triggers */
|
||||
/* another counter */
|
||||
|
||||
@ -513,13 +507,14 @@ static const samples_interface tailg_samples_interface =
|
||||
|
||||
static void tailg_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
/* the falling edge of bit 0x10 clocks bit 0x08 into the mux selected by bits 0x07 */
|
||||
if (SOUNDVAL_FALLING_EDGE(0x10))
|
||||
{
|
||||
device_t *samples = machine->device("samples");
|
||||
|
||||
/* update the shift register (actually just a simple mux) */
|
||||
current_shift = (current_shift & ~(1 << (sound_val & 7))) | (((sound_val >> 3) & 1) << (sound_val & 7));
|
||||
state->current_shift = (state->current_shift & ~(1 << (sound_val & 7))) | (((sound_val >> 3) & 1) << (sound_val & 7));
|
||||
|
||||
/* explosion - falling edge */
|
||||
if (SHIFTREG_FALLING_EDGE(0x01))
|
||||
@ -552,10 +547,10 @@ static void tailg_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
|
||||
sample_start(samples, 5, 5, 0);
|
||||
|
||||
/* LED */
|
||||
set_led_status(machine, 0, current_shift & 0x40);
|
||||
set_led_status(machine, 0, state->current_shift & 0x40);
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
}
|
||||
|
||||
@ -674,11 +669,12 @@ static const samples_interface armora_samples_interface =
|
||||
|
||||
static void armora_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
|
||||
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
|
||||
if (SOUNDVAL_RISING_EDGE(0x10))
|
||||
current_shift = ((current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
|
||||
/* execute on the rising edge of bit 0x01 */
|
||||
if (SOUNDVAL_RISING_EDGE(0x01))
|
||||
@ -702,7 +698,7 @@ static void armora_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
|
||||
sample_start(samples, 3, 3, 0);
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
|
||||
/* tank sound - 0=on, 1=off */
|
||||
@ -776,18 +772,19 @@ static const samples_interface ripoff_samples_interface =
|
||||
|
||||
static void ripoff_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
|
||||
/* on the rising edge of bit 0x02, clock bit 0x01 into the shift register */
|
||||
if (SOUNDVAL_RISING_EDGE(0x02))
|
||||
current_shift = ((current_shift >> 1) & 0x7f) | ((sound_val << 7) & 0x80);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7f) | ((sound_val << 7) & 0x80);
|
||||
|
||||
/* execute on the rising edge of bit 0x04 */
|
||||
if (SOUNDVAL_RISING_EDGE(0x04))
|
||||
{
|
||||
/* background - 0=on, 1=off, selected by bits 0x38 */
|
||||
if ((((current_shift ^ last_shift) & 0x38) && !(current_shift & 0x04)) || SHIFTREG_FALLING_EDGE(0x04))
|
||||
sample_start(samples, 5, 5 + ((current_shift >> 5) & 7), 1);
|
||||
if ((((state->current_shift ^ state->last_shift) & 0x38) && !(state->current_shift & 0x04)) || SHIFTREG_FALLING_EDGE(0x04))
|
||||
sample_start(samples, 5, 5 + ((state->current_shift >> 5) & 7), 1);
|
||||
if (SHIFTREG_RISING_EDGE(0x04))
|
||||
sample_stop(samples, 5);
|
||||
|
||||
@ -802,7 +799,7 @@ static void ripoff_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
|
||||
sample_stop(samples, 1);
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
|
||||
/* torpedo - falling edge */
|
||||
@ -864,12 +861,13 @@ static const samples_interface starcas_samples_interface =
|
||||
|
||||
static void starcas_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
UINT32 target_pitch;
|
||||
|
||||
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
|
||||
if (SOUNDVAL_RISING_EDGE(0x10))
|
||||
current_shift = ((current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
|
||||
/* execute on the rising edge of bit 0x01 */
|
||||
if (SOUNDVAL_RISING_EDGE(0x01))
|
||||
@ -901,22 +899,22 @@ static void starcas_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
|
||||
sample_stop(samples, 4);
|
||||
|
||||
/* latch the drone pitch */
|
||||
target_pitch = (current_shift & 7) + ((current_shift & 2) << 2);
|
||||
target_pitch = (state->current_shift & 7) + ((state->current_shift & 2) << 2);
|
||||
target_pitch = 0x5800 + (target_pitch << 12);
|
||||
|
||||
/* once per frame slide the pitch toward the target */
|
||||
if (machine->primary_screen->frame_number() > last_frame)
|
||||
if (machine->primary_screen->frame_number() > state->last_frame)
|
||||
{
|
||||
if (current_pitch > target_pitch)
|
||||
current_pitch -= 225;
|
||||
if (current_pitch < target_pitch)
|
||||
current_pitch += 150;
|
||||
sample_set_freq(samples, 4, current_pitch);
|
||||
last_frame = machine->primary_screen->frame_number();
|
||||
if (state->current_pitch > target_pitch)
|
||||
state->current_pitch -= 225;
|
||||
if (state->current_pitch < target_pitch)
|
||||
state->current_pitch += 150;
|
||||
sample_set_freq(samples, 4, state->current_pitch);
|
||||
state->last_frame = machine->primary_screen->frame_number();
|
||||
}
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
|
||||
/* loud explosion - falling edge */
|
||||
@ -978,18 +976,18 @@ static const samples_interface solarq_samples_interface =
|
||||
|
||||
static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
static float target_volume, current_volume;
|
||||
|
||||
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
|
||||
if (SOUNDVAL_RISING_EDGE(0x10))
|
||||
current_shift = ((current_shift >> 1) & 0x7fff) | ((sound_val << 8) & 0x8000);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7fff) | ((sound_val << 8) & 0x8000);
|
||||
|
||||
/* execute on the rising edge of bit 0x02 */
|
||||
if (SOUNDVAL_RISING_EDGE(0x02))
|
||||
{
|
||||
/* only the upper 8 bits matter */
|
||||
current_shift >>= 8;
|
||||
state->current_shift >>= 8;
|
||||
|
||||
/* loud explosion - falling edge */
|
||||
if (SHIFTREG_FALLING_EDGE(0x80))
|
||||
@ -1002,25 +1000,25 @@ static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
|
||||
/* thrust - 0=on, 1=off */
|
||||
if (SHIFTREG_FALLING_EDGE(0x20))
|
||||
{
|
||||
target_volume = 1.0;
|
||||
state->target_volume = 1.0;
|
||||
if (!sample_playing(samples, 2))
|
||||
sample_start(samples, 2, 2, 1);
|
||||
}
|
||||
if (SHIFTREG_RISING_EDGE(0x20))
|
||||
target_volume = 0;
|
||||
state->target_volume = 0;
|
||||
|
||||
/* ramp the thrust volume */
|
||||
if (sample_playing(samples, 2) && machine->primary_screen->frame_number() > last_frame)
|
||||
if (sample_playing(samples, 2) && machine->primary_screen->frame_number() > state->last_frame)
|
||||
{
|
||||
if (current_volume > target_volume)
|
||||
current_volume -= 0.078f;
|
||||
if (current_volume < target_volume)
|
||||
current_volume += 0.078f;
|
||||
if (current_volume > 0)
|
||||
sample_set_volume(samples, 2, current_volume);
|
||||
if (state->current_volume > state->target_volume)
|
||||
state->current_volume -= 0.078f;
|
||||
if (state->current_volume < state->target_volume)
|
||||
state->current_volume += 0.078f;
|
||||
if (state->current_volume > 0)
|
||||
sample_set_volume(samples, 2, state->current_volume);
|
||||
else
|
||||
sample_stop(samples, 2);
|
||||
last_frame = machine->primary_screen->frame_number();
|
||||
state->last_frame = machine->primary_screen->frame_number();
|
||||
}
|
||||
|
||||
/* fire - falling edge */
|
||||
@ -1042,7 +1040,7 @@ static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
|
||||
sample_start(samples, 6, 6, 0);
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
|
||||
/* clock music data on the rising edge of bit 0x01 */
|
||||
@ -1057,15 +1055,15 @@ static void solarq_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits
|
||||
sample_stop(samples, 7);
|
||||
|
||||
/* set the frequency */
|
||||
freq = 56818.181818 / (4096 - (current_shift & 0xfff));
|
||||
freq = 56818.181818 / (4096 - (state->current_shift & 0xfff));
|
||||
sample_set_freq(samples, 7, 44100 * freq / 1050);
|
||||
|
||||
/* set the volume */
|
||||
vol = (~current_shift >> 12) & 7;
|
||||
vol = (~state->current_shift >> 12) & 7;
|
||||
sample_set_volume(samples, 7, vol / 7.0);
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift2 = current_shift;
|
||||
state->last_shift2 = state->current_shift;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1119,17 +1117,18 @@ static const samples_interface boxingb_samples_interface =
|
||||
|
||||
static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
|
||||
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
|
||||
if (SOUNDVAL_RISING_EDGE(0x10))
|
||||
current_shift = ((current_shift >> 1) & 0x7fff) | ((sound_val << 8) & 0x8000);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7fff) | ((sound_val << 8) & 0x8000);
|
||||
|
||||
/* execute on the rising edge of bit 0x02 */
|
||||
if (SOUNDVAL_RISING_EDGE(0x02))
|
||||
{
|
||||
/* only the upper 8 bits matter */
|
||||
current_shift >>= 8;
|
||||
state->current_shift >>= 8;
|
||||
|
||||
/* soft explosion - falling edge */
|
||||
if (SHIFTREG_FALLING_EDGE(0x80))
|
||||
@ -1166,7 +1165,7 @@ static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
|
||||
sample_start(samples, 7, 7, 0);
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
|
||||
/* clock music data on the rising edge of bit 0x01 */
|
||||
@ -1181,11 +1180,11 @@ static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
|
||||
sample_stop(samples, 8);
|
||||
|
||||
/* set the frequency */
|
||||
freq = 56818.181818 / (4096 - (current_shift & 0xfff));
|
||||
freq = 56818.181818 / (4096 - (state->current_shift & 0xfff));
|
||||
sample_set_freq(samples, 8, 44100 * freq / 1050);
|
||||
|
||||
/* set the volume */
|
||||
vol = (~current_shift >> 12) & 3;
|
||||
vol = (~state->current_shift >> 12) & 3;
|
||||
sample_set_volume(samples, 8, vol / 3.0);
|
||||
|
||||
/* cannon - falling edge */
|
||||
@ -1193,7 +1192,7 @@ static void boxingb_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bit
|
||||
sample_start(samples, 9, 9, 0);
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift2 = current_shift;
|
||||
state->last_shift2 = state->current_shift;
|
||||
}
|
||||
|
||||
/* bounce - rising edge */
|
||||
@ -1251,12 +1250,13 @@ static const samples_interface wotw_samples_interface =
|
||||
|
||||
static void wotw_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
UINT32 target_pitch;
|
||||
|
||||
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
|
||||
if (SOUNDVAL_RISING_EDGE(0x10))
|
||||
current_shift = ((current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
|
||||
/* execute on the rising edge of bit 0x01 */
|
||||
if (SOUNDVAL_RISING_EDGE(0x01))
|
||||
@ -1288,22 +1288,22 @@ static void wotw_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_c
|
||||
sample_stop(samples, 4);
|
||||
|
||||
/* latch the drone pitch */
|
||||
target_pitch = (current_shift & 7) + ((current_shift & 2) << 2);
|
||||
target_pitch = (state->current_shift & 7) + ((state->current_shift & 2) << 2);
|
||||
target_pitch = 0x10000 + (target_pitch << 12);
|
||||
|
||||
/* once per frame slide the pitch toward the target */
|
||||
if (machine->primary_screen->frame_number() > last_frame)
|
||||
if (machine->primary_screen->frame_number() > state->last_frame)
|
||||
{
|
||||
if (current_pitch > target_pitch)
|
||||
current_pitch -= 300;
|
||||
if (current_pitch < target_pitch)
|
||||
current_pitch += 200;
|
||||
sample_set_freq(samples, 4, current_pitch);
|
||||
last_frame = machine->primary_screen->frame_number();
|
||||
if (state->current_pitch > target_pitch)
|
||||
state->current_pitch -= 300;
|
||||
if (state->current_pitch < target_pitch)
|
||||
state->current_pitch += 200;
|
||||
sample_set_freq(samples, 4, state->current_pitch);
|
||||
state->last_frame = machine->primary_screen->frame_number();
|
||||
}
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
|
||||
/* loud explosion - falling edge */
|
||||
@ -1365,12 +1365,13 @@ static const samples_interface wotwc_samples_interface =
|
||||
|
||||
static void wotwc_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_changed)
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
device_t *samples = machine->device("samples");
|
||||
UINT32 target_pitch;
|
||||
|
||||
/* on the rising edge of bit 0x10, clock bit 0x80 into the shift register */
|
||||
if (SOUNDVAL_RISING_EDGE(0x10))
|
||||
current_shift = ((current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
state->current_shift = ((state->current_shift >> 1) & 0x7f) | (sound_val & 0x80);
|
||||
|
||||
/* execute on the rising edge of bit 0x01 */
|
||||
if (SOUNDVAL_RISING_EDGE(0x01))
|
||||
@ -1402,22 +1403,22 @@ static void wotwc_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
|
||||
sample_stop(samples, 4);
|
||||
|
||||
/* latch the drone pitch */
|
||||
target_pitch = (current_shift & 7) + ((current_shift & 2) << 2);
|
||||
target_pitch = (state->current_shift & 7) + ((state->current_shift & 2) << 2);
|
||||
target_pitch = 0x10000 + (target_pitch << 12);
|
||||
|
||||
/* once per frame slide the pitch toward the target */
|
||||
if (machine->primary_screen->frame_number() > last_frame)
|
||||
if (machine->primary_screen->frame_number() > state->last_frame)
|
||||
{
|
||||
if (current_pitch > target_pitch)
|
||||
current_pitch -= 300;
|
||||
if (current_pitch < target_pitch)
|
||||
current_pitch += 200;
|
||||
sample_set_freq(samples, 4, current_pitch);
|
||||
last_frame = machine->primary_screen->frame_number();
|
||||
if (state->current_pitch > target_pitch)
|
||||
state->current_pitch -= 300;
|
||||
if (state->current_pitch < target_pitch)
|
||||
state->current_pitch += 200;
|
||||
sample_set_freq(samples, 4, state->current_pitch);
|
||||
state->last_frame = machine->primary_screen->frame_number();
|
||||
}
|
||||
|
||||
/* remember the previous value */
|
||||
last_shift = current_shift;
|
||||
state->last_shift = state->current_shift;
|
||||
}
|
||||
|
||||
/* loud explosion - falling edge */
|
||||
@ -1459,8 +1460,9 @@ MACHINE_CONFIG_END
|
||||
|
||||
static TIMER_CALLBACK( synced_sound_w )
|
||||
{
|
||||
sound_fifo[sound_fifo_in] = param;
|
||||
sound_fifo_in = (sound_fifo_in + 1) % 16;
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state->sound_fifo[state->sound_fifo_in] = param;
|
||||
state->sound_fifo_in = (state->sound_fifo_in + 1) % 16;
|
||||
}
|
||||
|
||||
|
||||
@ -1477,33 +1479,36 @@ static void demon_sound_w(running_machine *machine, UINT8 sound_val, UINT8 bits_
|
||||
|
||||
static READ8_DEVICE_HANDLER( sound_porta_r )
|
||||
{
|
||||
cinemat_state *state = device->machine->driver_data<cinemat_state>();
|
||||
/* bits 0-3 are the sound data; bit 4 is the data ready */
|
||||
return sound_fifo[sound_fifo_out] | ((sound_fifo_in != sound_fifo_out) << 4);
|
||||
return state->sound_fifo[state->sound_fifo_out] | ((state->sound_fifo_in != state->sound_fifo_out) << 4);
|
||||
}
|
||||
|
||||
|
||||
static READ8_DEVICE_HANDLER( sound_portb_r )
|
||||
{
|
||||
return last_portb_write;
|
||||
cinemat_state *state = device->machine->driver_data<cinemat_state>();
|
||||
return state->last_portb_write;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_portb_w )
|
||||
{
|
||||
cinemat_state *state = device->machine->driver_data<cinemat_state>();
|
||||
/* watch for a 0->1 edge on bit 0 ("shift out") to advance the data pointer */
|
||||
if ((data & 1) != (last_portb_write & 1) && (data & 1) != 0)
|
||||
sound_fifo_out = (sound_fifo_out + 1) % 16;
|
||||
if ((data & 1) != (state->last_portb_write & 1) && (data & 1) != 0)
|
||||
state->sound_fifo_out = (state->sound_fifo_out + 1) % 16;
|
||||
|
||||
/* watch for a 0->1 edge of bit 1 ("hard reset") to reset the FIFO */
|
||||
if ((data & 2) != (last_portb_write & 2) && (data & 2) != 0)
|
||||
sound_fifo_in = sound_fifo_out = 0;
|
||||
if ((data & 2) != (state->last_portb_write & 2) && (data & 2) != 0)
|
||||
state->sound_fifo_in = state->sound_fifo_out = 0;
|
||||
|
||||
/* bit 2 controls the global mute */
|
||||
if ((data & 4) != (last_portb_write & 4))
|
||||
if ((data & 4) != (state->last_portb_write & 4))
|
||||
device->machine->sound().system_mute(data & 4);
|
||||
|
||||
/* remember the last value written */
|
||||
last_portb_write = data;
|
||||
state->last_portb_write = data;
|
||||
}
|
||||
|
||||
|
||||
@ -1546,12 +1551,13 @@ static Z80CTC_INTERFACE( demon_z80ctc_interface )
|
||||
|
||||
static MACHINE_RESET( demon_sound )
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
/* generic init */
|
||||
generic_init(machine, demon_sound_w);
|
||||
|
||||
/* reset the FIFO */
|
||||
sound_fifo_in = sound_fifo_out = 0;
|
||||
last_portb_write = 0xff;
|
||||
state->sound_fifo_in = state->sound_fifo_out = 0;
|
||||
state->last_portb_write = 0xff;
|
||||
|
||||
/* turn off channel A on AY8910 #0 because it is used as a low-pass filter */
|
||||
ay8910_set_volume(machine->device("ay1"), 0, 0);
|
||||
|
@ -40,7 +40,7 @@ static STREAM_UPDATE( cps3_stream_update )
|
||||
|
||||
// the actual 'user5' region only exists on the nocd sets, on the others it's allocated in the initialization.
|
||||
// it's a shared gfx/sound region, so can't be allocated as part of the sound device.
|
||||
state->base = (INT8*)cps3_user5region;
|
||||
state->base = (INT8*)device->machine->driver_data<cps3_state>()->user5region;
|
||||
|
||||
/* Clear the buffers */
|
||||
memset(outputs[0], 0, samples*sizeof(*outputs[0]));
|
||||
|
@ -33,7 +33,17 @@ Changes 02/06/2009 - Palindrome
|
||||
#include "sound/ay8910.h"
|
||||
#include "machine/6522via.h"
|
||||
|
||||
static UINT8 *lions_vram;
|
||||
|
||||
class _86lions_state : public driver_device
|
||||
{
|
||||
public:
|
||||
_86lions_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *lions_vram;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static VIDEO_START(lions)
|
||||
{
|
||||
@ -41,6 +51,7 @@ static VIDEO_START(lions)
|
||||
|
||||
static VIDEO_UPDATE(lions)
|
||||
{
|
||||
_86lions_state *state = screen->machine->driver_data<_86lions_state>();
|
||||
const gfx_element *gfx = screen->machine->gfx[0];
|
||||
int count = 0;
|
||||
|
||||
@ -50,7 +61,7 @@ static VIDEO_UPDATE(lions)
|
||||
{
|
||||
for (x=0;x<38;x++)
|
||||
{
|
||||
int tile = lions_vram[count+1]|lions_vram[count]<<8;
|
||||
int tile = state->lions_vram[count+1]|state->lions_vram[count]<<8;
|
||||
tile&=0x1ff;
|
||||
//int colour = tile>>12;
|
||||
drawgfx_opaque(bitmap,cliprect,gfx,tile,0,0,0,x*8,y*8);
|
||||
@ -75,7 +86,7 @@ static READ8_HANDLER( test_r )
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( lions_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&lions_vram)
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE_MEMBER(_86lions_state, lions_vram)
|
||||
AM_RANGE(0x0800, 0x0fff) AM_RAM
|
||||
AM_RANGE(0x1800, 0x1800) AM_DEVWRITE("crtc", mc6845_address_w)
|
||||
AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
|
||||
@ -340,7 +351,7 @@ static PALETTE_INIT( lions )
|
||||
}
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( lions, driver_device )
|
||||
static MACHINE_CONFIG_START( lions, _86lions_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6809, MAIN_CLOCK/4) /* 3 MHz.(guess) */
|
||||
MCFG_CPU_PROGRAM_MAP(lions_map)
|
||||
|
@ -107,27 +107,37 @@
|
||||
#include "machine/nvram.h"
|
||||
|
||||
|
||||
int rtc_address_strobe = 0;
|
||||
int rtc_data_strobe = 0;
|
||||
class aristmk4_state : public driver_device
|
||||
{
|
||||
public:
|
||||
aristmk4_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
int rtc_address_strobe;
|
||||
int rtc_data_strobe;
|
||||
device_t *samples;
|
||||
UINT8 *shapeRomPtr;
|
||||
UINT8 shapeRom[0xc000];
|
||||
UINT8 *mkiv_vram;
|
||||
UINT8 *nvram;
|
||||
UINT8 psg_data;
|
||||
int ay8910_1;
|
||||
int ay8910_2;
|
||||
int u3_p0_w;
|
||||
UINT8 cgdrsw;
|
||||
UINT8 ripple;
|
||||
int hopper_motor;
|
||||
int inscrd;
|
||||
int cashcade_c;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
device_t *samples;
|
||||
UINT8 *shapeRomPtr; // pointer to tile_gfx shape roms
|
||||
UINT8 shapeRom[0xc000]; // shaperom restore array.
|
||||
|
||||
static UINT8 *mkiv_vram;
|
||||
static UINT8 *nvram; // backup
|
||||
static UINT8 psg_data;
|
||||
static int ay8910_1;
|
||||
static int ay8910_2;
|
||||
static int u3_p0_w;
|
||||
static UINT8 cgdrsw;
|
||||
static UINT8 ripple;
|
||||
static int hopper_motor;
|
||||
static int inscrd;
|
||||
|
||||
/* Partial Caschcade protocol */
|
||||
static int cashcade_p[] ={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0};
|
||||
static int cashcade_c = 0;
|
||||
static const UINT8 cashcade_p[] ={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0};
|
||||
|
||||
static VIDEO_START(aristmk4)
|
||||
{
|
||||
@ -140,6 +150,7 @@ static VIDEO_START(aristmk4)
|
||||
|
||||
INLINE void uBackgroundColour(running_machine *machine)
|
||||
{
|
||||
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.
|
||||
|
||||
@ -150,29 +161,30 @@ INLINE void uBackgroundColour(running_machine *machine)
|
||||
{
|
||||
case 0x00:
|
||||
// restore defaults
|
||||
memcpy(shapeRomPtr,shapeRom, sizeof(shapeRom)); // restore defaults, both switches off
|
||||
memcpy(state->shapeRomPtr,state->shapeRom, sizeof(state->shapeRom)); // restore defaults, both switches off
|
||||
// OE enabled on both shapes
|
||||
break;
|
||||
case 0x01:
|
||||
// unselect U22 via SW7 . OE on U22 is low.
|
||||
memset(&shapeRomPtr[0x4000],0xff,0x2000); // fill unused space with 0xff
|
||||
memcpy(&shapeRomPtr[0xa000],&shapeRom[0xa000], 0x2000); // restore defaults here
|
||||
memset(&state->shapeRomPtr[0x4000],0xff,0x2000); // fill unused space with 0xff
|
||||
memcpy(&state->shapeRomPtr[0xa000],&state->shapeRom[0xa000], 0x2000); // restore defaults here
|
||||
break;
|
||||
case 0x02:
|
||||
// unselect U47 via SW7 . OE on U47 is low.
|
||||
memcpy(&shapeRomPtr[0x4000],&shapeRom[0x4000], 0x2000);
|
||||
memset(&shapeRomPtr[0xa000],0xff,0x2000);
|
||||
memcpy(&state->shapeRomPtr[0x4000],&state->shapeRom[0x4000], 0x2000);
|
||||
memset(&state->shapeRomPtr[0xa000],0xff,0x2000);
|
||||
break;
|
||||
case 0x03:
|
||||
// unselect U47 & u22 via SW7. both output enable low.
|
||||
memset(&shapeRomPtr[0x4000],0xff,0x2000);
|
||||
memset(&shapeRomPtr[0xa000],0xff,0x2000);
|
||||
memset(&state->shapeRomPtr[0x4000],0xff,0x2000);
|
||||
memset(&state->shapeRomPtr[0xa000],0xff,0x2000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE(aristmk4)
|
||||
{
|
||||
aristmk4_state *state = screen->machine->driver_data<aristmk4_state>();
|
||||
const gfx_element *gfx = screen->machine->gfx[0];
|
||||
int x,y;
|
||||
int count = 0;
|
||||
@ -186,14 +198,14 @@ static VIDEO_UPDATE(aristmk4)
|
||||
{
|
||||
for (x=38;x--;)
|
||||
{
|
||||
color = ((mkiv_vram[count]) & 0xe0) >> 5;
|
||||
tile = (mkiv_vram[count+1]|mkiv_vram[count]<<8) & 0x3ff;
|
||||
bgtile = (mkiv_vram[count+1]|mkiv_vram[count]<<8) & 0xff; // first 256 tiles
|
||||
color = ((state->mkiv_vram[count]) & 0xe0) >> 5;
|
||||
tile = (state->mkiv_vram[count+1]|state->mkiv_vram[count]<<8) & 0x3ff;
|
||||
bgtile = (state->mkiv_vram[count+1]|state->mkiv_vram[count]<<8) & 0xff; // first 256 tiles
|
||||
uBackgroundColour(screen->machine); // read sw7
|
||||
gfx_element_decode(gfx, bgtile); // force the machine to update only the first 256 tiles.
|
||||
// as we only update the background, not the entire display.
|
||||
flipx = ((mkiv_vram[count]) & 0x04);
|
||||
flipy = ((mkiv_vram[count]) & 0x08);
|
||||
flipx = ((state->mkiv_vram[count]) & 0x04);
|
||||
flipy = ((state->mkiv_vram[count]) & 0x08);
|
||||
drawgfx_opaque(bitmap,cliprect,gfx,tile,color,flipx,flipy,(38-x-1)<<3,(27-y-1)<<3);
|
||||
count+=2;
|
||||
}
|
||||
@ -203,42 +215,47 @@ static VIDEO_UPDATE(aristmk4)
|
||||
|
||||
static READ8_HANDLER(ldsw)
|
||||
{
|
||||
aristmk4_state *state = space->machine->driver_data<aristmk4_state>();
|
||||
|
||||
int U3_p2_ret= input_port_read(space->machine, "5002");
|
||||
if(U3_p2_ret & 0x1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return cgdrsw = input_port_read(space->machine, "CGDRSW");
|
||||
return state->cgdrsw = input_port_read(space->machine, "CGDRSW");
|
||||
}
|
||||
|
||||
static READ8_HANDLER(cgdrr)
|
||||
{
|
||||
aristmk4_state *state = space->machine->driver_data<aristmk4_state>();
|
||||
|
||||
if(cgdrsw) // is the LC closed
|
||||
if(state->cgdrsw) // is the LC closed
|
||||
{
|
||||
return ripple; // return a positive value from the ripple counter
|
||||
return state->ripple; // return a positive value from the state->ripple counter
|
||||
}
|
||||
return 0x0; // otherwise the counter outputs are set low.
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(cgdrw)
|
||||
{
|
||||
aristmk4_state *state = space->machine->driver_data<aristmk4_state>();
|
||||
|
||||
ripple = data;
|
||||
state->ripple = data;
|
||||
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(u3_p0)
|
||||
{
|
||||
aristmk4_state *state = space->machine->driver_data<aristmk4_state>();
|
||||
|
||||
u3_p0_w = data;
|
||||
//logerror("u3_p0_w: %02X\n",u3_p0_w);
|
||||
state->u3_p0_w = data;
|
||||
//logerror("u3_p0_w: %02X\n",state->u3_p0_w);
|
||||
|
||||
}
|
||||
|
||||
static READ8_HANDLER(u3_p2)
|
||||
{
|
||||
aristmk4_state *state = space->machine->driver_data<aristmk4_state>();
|
||||
|
||||
int u3_p2_ret= input_port_read(space->machine, "5002");
|
||||
int u3_p3_ret= input_port_read(space->machine, "5003");
|
||||
@ -246,18 +263,18 @@ static READ8_HANDLER(u3_p2)
|
||||
output_set_lamp_value(19, (u3_p2_ret >> 4) & 1); //auditkey light
|
||||
output_set_lamp_value(20, (u3_p3_ret >> 2) & 1); //jackpotkey light
|
||||
|
||||
if (u3_p0_w&0x20) // DOPTE on
|
||||
if (state->u3_p0_w&0x20) // DOPTE on
|
||||
{
|
||||
if (u3_p3_ret&0x02) // door closed
|
||||
u3_p2_ret = u3_p2_ret^0x08; // DOPTI on
|
||||
}
|
||||
|
||||
if (inscrd==0)
|
||||
if (state->inscrd==0)
|
||||
{
|
||||
inscrd=input_port_read(space->machine, "insertcoin");
|
||||
state->inscrd=input_port_read(space->machine, "insertcoin");
|
||||
}
|
||||
|
||||
if (inscrd==1)
|
||||
if (state->inscrd==1)
|
||||
u3_p2_ret=u3_p2_ret^0x02;
|
||||
|
||||
return u3_p2_ret;
|
||||
@ -297,8 +314,9 @@ static READ8_HANDLER(mkiv_pia_ina)
|
||||
|
||||
static WRITE8_HANDLER(mkiv_pia_outa)
|
||||
{
|
||||
aristmk4_state *state = space->machine->driver_data<aristmk4_state>();
|
||||
mc146818_device *mc = space->machine->device<mc146818_device>("rtc");
|
||||
if(rtc_data_strobe)
|
||||
if(state->rtc_data_strobe)
|
||||
{
|
||||
mc->write(*space,1,data);
|
||||
//logerror("rtc protocol write data: %02X\n",data);
|
||||
@ -316,7 +334,8 @@ static WRITE8_HANDLER(mkiv_pia_outa)
|
||||
//output ca2
|
||||
static WRITE8_DEVICE_HANDLER(mkiv_pia_ca2)
|
||||
{
|
||||
rtc_address_strobe = data;
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>();
|
||||
state->rtc_address_strobe = data;
|
||||
// logerror("address strobe %02X\n", address_strobe);
|
||||
}
|
||||
|
||||
@ -324,7 +343,8 @@ static WRITE8_DEVICE_HANDLER(mkiv_pia_ca2)
|
||||
//output cb2
|
||||
static WRITE8_DEVICE_HANDLER(mkiv_pia_cb2)
|
||||
{
|
||||
rtc_data_strobe = data;
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>();
|
||||
state->rtc_data_strobe = data;
|
||||
//logerror("data strobe: %02X\n", data);
|
||||
}
|
||||
|
||||
@ -333,6 +353,7 @@ static WRITE8_DEVICE_HANDLER(mkiv_pia_cb2)
|
||||
//output b
|
||||
static WRITE8_DEVICE_HANDLER(mkiv_pia_outb)
|
||||
{
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>();
|
||||
|
||||
UINT8 emet[5];
|
||||
int i = 0;
|
||||
@ -351,7 +372,7 @@ static WRITE8_DEVICE_HANDLER(mkiv_pia_outb)
|
||||
if(emet[i])
|
||||
{
|
||||
//logerror("Mechanical meter %d pulse: %02d\n",i+1, emet[i]);
|
||||
sample_start(samples,i,0, FALSE); // pulse sound for mechanical meters
|
||||
sample_start(state->samples,i,0, FALSE); // pulse sound for mechanical meters
|
||||
}
|
||||
}
|
||||
|
||||
@ -383,15 +404,17 @@ VERSATILE INTERFACE ADAPTER CONFIGURATION
|
||||
|
||||
static TIMER_CALLBACK(coin_input_reset)
|
||||
{
|
||||
aristmk4_state *state = machine->driver_data<aristmk4_state>();
|
||||
|
||||
inscrd=0; //reset credit input after 150msec
|
||||
state->inscrd=0; //reset credit input after 150msec
|
||||
|
||||
}
|
||||
|
||||
static TIMER_CALLBACK(hopper_reset)
|
||||
{
|
||||
aristmk4_state *state = machine->driver_data<aristmk4_state>();
|
||||
|
||||
hopper_motor=0x01;
|
||||
state->hopper_motor=0x01;
|
||||
|
||||
}
|
||||
|
||||
@ -400,15 +423,16 @@ static TIMER_CALLBACK(hopper_reset)
|
||||
|
||||
static READ8_DEVICE_HANDLER(via_a_r)
|
||||
{
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>();
|
||||
int psg_ret=0;
|
||||
|
||||
if (ay8910_1&0x03) // SW1 read.
|
||||
if (state->ay8910_1&0x03) // SW1 read.
|
||||
{
|
||||
psg_ret = ay8910_r(device->machine->device("ay1"), 0);
|
||||
//logerror("PSG porta ay1 returned %02X\n",psg_ret);
|
||||
}
|
||||
|
||||
else if (ay8910_2&0x03) //i don't think we read anything from Port A on ay2, Can be removed once game works ok.
|
||||
else if (state->ay8910_2&0x03) //i don't think we read anything from Port A on ay2, Can be removed once game works ok.
|
||||
{
|
||||
psg_ret = ay8910_r(device->machine->device("ay2"), 0);
|
||||
//logerror("PSG porta ay2 returned %02X\n",psg_ret);
|
||||
@ -420,6 +444,7 @@ static READ8_DEVICE_HANDLER(via_a_r)
|
||||
|
||||
static READ8_DEVICE_HANDLER(via_b_r)
|
||||
{
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>();
|
||||
|
||||
int ret=input_port_read(device->machine, "via_port_b");
|
||||
|
||||
@ -432,7 +457,7 @@ static READ8_DEVICE_HANDLER(via_b_r)
|
||||
/* Coin input... CBOPT2 goes LOW, then the optic detectors OPTA1 / OPTB1 detect the coin passing */
|
||||
/* The timer causes one credit, per 150ms or so... */
|
||||
|
||||
switch(inscrd)
|
||||
switch(state->inscrd)
|
||||
{
|
||||
|
||||
case 0x00:
|
||||
@ -440,12 +465,12 @@ static READ8_DEVICE_HANDLER(via_b_r)
|
||||
|
||||
case 0x01:
|
||||
ret=ret^0x10;
|
||||
inscrd++;
|
||||
state->inscrd++;
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
ret=ret^0x20;
|
||||
inscrd++;
|
||||
state->inscrd++;
|
||||
device->machine->scheduler().timer_set(attotime::from_msec(150), FUNC(coin_input_reset));
|
||||
break;
|
||||
|
||||
@ -456,12 +481,12 @@ static READ8_DEVICE_HANDLER(via_b_r)
|
||||
|
||||
// if user presses collect.. send coins to hopper.
|
||||
|
||||
switch(hopper_motor)
|
||||
switch(state->hopper_motor)
|
||||
{
|
||||
case 0x00:
|
||||
ret=ret^0x40;
|
||||
device->machine->scheduler().timer_set(attotime::from_msec(175), FUNC(hopper_reset));
|
||||
hopper_motor=0x02;
|
||||
state->hopper_motor=0x02;
|
||||
break;
|
||||
case 0x01:
|
||||
break; //default
|
||||
@ -476,37 +501,39 @@ static READ8_DEVICE_HANDLER(via_b_r)
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(via_a_w)
|
||||
{ //via_b_w will handle sending the data to the ay8910, so just write the data for it to use later
|
||||
{
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>(); //via_b_w will handle sending the data to the ay8910, so just write the data for it to use later
|
||||
|
||||
//logerror("VIA port A write %02X\n",data);
|
||||
psg_data = data;
|
||||
state->psg_data = data;
|
||||
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(via_b_w)
|
||||
{
|
||||
ay8910_1 = ( data & 0x0F ) ; //only need first 4 bits per schematics
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>();
|
||||
state->ay8910_1 = ( data & 0x0F ) ; //only need first 4 bits per schematics
|
||||
//NOTE: when bit 4 is off, we write to AY1, when bit 4 is on, we write to AY2
|
||||
ay8910_2 = ay8910_1;
|
||||
state->ay8910_2 = state->ay8910_1;
|
||||
|
||||
if ( ay8910_2 & 0x08 ) // is bit 4 on ?
|
||||
if ( state->ay8910_2 & 0x08 ) // is bit 4 on ?
|
||||
{
|
||||
ay8910_2 = (ay8910_2 | 0x02) ; // bit 2 is turned on as bit 4 hooks to bit 2 in the schematics
|
||||
ay8910_1 = 0x00; // write only to ay2
|
||||
state->ay8910_2 = (state->ay8910_2 | 0x02) ; // bit 2 is turned on as bit 4 hooks to bit 2 in the schematics
|
||||
state->ay8910_1 = 0x00; // write only to ay2
|
||||
}
|
||||
else
|
||||
{
|
||||
ay8910_2 = 0x00; // write only to ay1
|
||||
state->ay8910_2 = 0x00; // write only to ay1
|
||||
}
|
||||
|
||||
//only need bc1/bc2 and bdir so drop bit 4.
|
||||
|
||||
ay8910_1 = (ay8910_1 & 0x07);
|
||||
ay8910_2 = (ay8910_2 & 0x07);
|
||||
state->ay8910_1 = (state->ay8910_1 & 0x07);
|
||||
state->ay8910_2 = (state->ay8910_2 & 0x07);
|
||||
|
||||
//PSG ay1
|
||||
|
||||
switch(ay8910_1)
|
||||
switch(state->ay8910_1)
|
||||
{
|
||||
|
||||
case 0x00: //INACT -Nothing to do here. Inactive PSG
|
||||
@ -517,26 +544,26 @@ static WRITE8_DEVICE_HANDLER(via_b_w)
|
||||
|
||||
case 0x06: //WRITE
|
||||
{
|
||||
ay8910_data_w( device->machine->device("ay1"), 0 , psg_data );
|
||||
//logerror("VIA Port A write data ay1: %02X\n",psg_data);
|
||||
ay8910_data_w( device->machine->device("ay1"), 0 , state->psg_data );
|
||||
//logerror("VIA Port A write data ay1: %02X\n",state->psg_data);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x07: //LATCH Address (set register)
|
||||
{
|
||||
ay8910_address_w( device->machine->device("ay1"), 0 , psg_data );
|
||||
//logerror("VIA Port B write register ay1: %02X\n",psg_data);
|
||||
ay8910_address_w( device->machine->device("ay1"), 0 , state->psg_data );
|
||||
//logerror("VIA Port B write register ay1: %02X\n",state->psg_data);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
//logerror("Unknown PSG state on ay1: %02X\n",ay8910_1);
|
||||
//logerror("Unknown PSG state on ay1: %02X\n",state->ay8910_1);
|
||||
break;
|
||||
}
|
||||
|
||||
//PSG ay2
|
||||
|
||||
switch(ay8910_2)
|
||||
switch(state->ay8910_2)
|
||||
{
|
||||
|
||||
case 0x00: //INACT - Nothing to do here. Inactive PSG
|
||||
@ -550,20 +577,20 @@ static WRITE8_DEVICE_HANDLER(via_b_w)
|
||||
|
||||
case 0x06: //WRITE
|
||||
{
|
||||
ay8910_data_w( device->machine->device("ay2"), 0 , psg_data );
|
||||
//logerror("VIA Port A write data ay2: %02X\n",psg_data);
|
||||
ay8910_data_w( device->machine->device("ay2"), 0 , state->psg_data );
|
||||
//logerror("VIA Port A write data ay2: %02X\n",state->psg_data);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x07: //LATCH Address (set register)
|
||||
{
|
||||
ay8910_address_w( device->machine->device("ay2"), 0 , psg_data );
|
||||
//logerror("VIA Port B write register ay2: %02X\n",psg_data);
|
||||
ay8910_address_w( device->machine->device("ay2"), 0 , state->psg_data );
|
||||
//logerror("VIA Port B write register ay2: %02X\n",state->psg_data);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
//logerror("Unknown PSG state on ay2: %02X\n",ay8910_2);
|
||||
//logerror("Unknown PSG state on ay2: %02X\n",state->ay8910_2);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -597,14 +624,15 @@ static WRITE8_DEVICE_HANDLER(via_ca2_w)
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(via_cb2_w)
|
||||
{
|
||||
aristmk4_state *state = device->machine->driver_data<aristmk4_state>();
|
||||
// CB2 = hopper motor (HOPMO1). When it is 0x01, it is not running (active low)
|
||||
// when it goes to 0, we're expecting to coins to be paid out, handled in via_b_r
|
||||
// as soon as it is 1, HOPCO1 to remain 'ON'
|
||||
|
||||
if (data==0x01)
|
||||
hopper_motor=data;
|
||||
else if (hopper_motor<0x02)
|
||||
hopper_motor=data;
|
||||
state->hopper_motor=data;
|
||||
else if (state->hopper_motor<0x02)
|
||||
state->hopper_motor=data;
|
||||
}
|
||||
|
||||
|
||||
@ -658,8 +686,9 @@ static WRITE8_DEVICE_HANDLER(zn434_w)
|
||||
|
||||
static READ8_HANDLER(cashcade_r)
|
||||
{
|
||||
aristmk4_state *state = space->machine->driver_data<aristmk4_state>();
|
||||
/* work around for cashcade games */
|
||||
return cashcade_p[(cashcade_c++)%15];
|
||||
return cashcade_p[(state->cashcade_c++)%15];
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(mk4_printer_w)
|
||||
@ -673,7 +702,7 @@ static READ8_HANDLER(mk4_printer_r)
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( aristmk4_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&mkiv_vram) // video ram - chips U49 / U50
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE_MEMBER(aristmk4_state, mkiv_vram) // video ram - chips U49 / U50
|
||||
AM_RANGE(0x0800, 0x17ff) AM_RAM
|
||||
AM_RANGE(0x1800, 0x1800) AM_DEVWRITE("crtc", mc6845_address_w)
|
||||
AM_RANGE(0x1801, 0x1801) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
|
||||
@ -1168,16 +1197,18 @@ static PALETTE_INIT( aristmk4 )
|
||||
|
||||
static DRIVER_INIT( aristmk4 )
|
||||
{
|
||||
shapeRomPtr = (UINT8 *)machine->region("tile_gfx")->base();
|
||||
memcpy(shapeRom,shapeRomPtr,sizeof(shapeRom)); // back up
|
||||
nvram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
aristmk4_state *state = machine->driver_data<aristmk4_state>();
|
||||
state->shapeRomPtr = (UINT8 *)machine->region("tile_gfx")->base();
|
||||
memcpy(state->shapeRom,state->shapeRomPtr,sizeof(state->shapeRom)); // back up
|
||||
state->nvram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
}
|
||||
|
||||
static MACHINE_START( aristmk4 )
|
||||
{
|
||||
aristmk4_state *state = machine->driver_data<aristmk4_state>();
|
||||
|
||||
samples = machine->device("samples");
|
||||
state_save_register_global_pointer(machine, nvram, 0x1000); // nvram
|
||||
state->samples = machine->device("samples");
|
||||
state_save_register_global_pointer(machine, state->nvram, 0x1000); // state->nvram
|
||||
}
|
||||
|
||||
|
||||
@ -1197,7 +1228,7 @@ static MACHINE_RESET( aristmk4 )
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( aristmk4, driver_device )
|
||||
static MACHINE_CONFIG_START( aristmk4, aristmk4_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6809, MAIN_CLOCK/8) // 1.5mhz (goldenc needs a bit faster for some reason)
|
||||
|
@ -63,20 +63,33 @@
|
||||
#include "includes/archimds.h"
|
||||
//#include "machine/i2cmem.h"
|
||||
|
||||
static emu_timer *mk5_2KHz_timer;
|
||||
static UINT8 ext_latch;
|
||||
|
||||
class aristmk5_state : public driver_device
|
||||
{
|
||||
public:
|
||||
aristmk5_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
emu_timer *mk5_2KHz_timer;
|
||||
UINT8 ext_latch;
|
||||
UINT8 flyback;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static WRITE32_HANDLER( mk5_ext_latch_w )
|
||||
{
|
||||
aristmk5_state *state = space->machine->driver_data<aristmk5_state>();
|
||||
/* this banks "something" */
|
||||
ext_latch = data & 1;
|
||||
state->ext_latch = data & 1;
|
||||
}
|
||||
|
||||
static READ32_HANDLER( ext_timer_latch_r )
|
||||
{
|
||||
aristmk5_state *state = space->machine->driver_data<aristmk5_state>();
|
||||
/* reset 2KHz timer */
|
||||
ioc_regs[IRQ_STATUS_A] &= 0xfe;
|
||||
mk5_2KHz_timer->adjust(attotime::from_hz(2000));
|
||||
state->mk5_2KHz_timer->adjust(attotime::from_hz(2000));
|
||||
|
||||
return 0xffffffff; //value doesn't matter apparently
|
||||
}
|
||||
@ -84,7 +97,8 @@ static READ32_HANDLER( ext_timer_latch_r )
|
||||
/* same as plain AA but with the I2C unconnected */
|
||||
static READ32_HANDLER( mk5_ioc_r )
|
||||
{
|
||||
static UINT32 ioc_addr;
|
||||
aristmk5_state *state = space->machine->driver_data<aristmk5_state>();
|
||||
UINT32 ioc_addr;
|
||||
|
||||
ioc_addr = offset*4;
|
||||
ioc_addr >>= 16;
|
||||
@ -92,15 +106,14 @@ static READ32_HANDLER( mk5_ioc_r )
|
||||
|
||||
if(((ioc_addr == 0x20) || (ioc_addr == 0x30)) && (offset & 0x1f) == 0)
|
||||
{
|
||||
static UINT8 flyback; //internal name for vblank here
|
||||
int vert_pos;
|
||||
|
||||
vert_pos = space->machine->primary_screen->vpos();
|
||||
flyback = (vert_pos <= vidc_regs[VIDC_VDSR] || vert_pos >= vidc_regs[VIDC_VDER]) ? 0x80 : 0x00;
|
||||
state->flyback = (vert_pos <= vidc_regs[VIDC_VDSR] || vert_pos >= vidc_regs[VIDC_VDER]) ? 0x80 : 0x00;
|
||||
|
||||
//i2c_data = (i2cmem_sda_read(space->machine->device("i2cmem")) & 1);
|
||||
|
||||
return (flyback) | (ioc_regs[CONTROL] & 0x7c) | (1<<1) | 1;
|
||||
return (state->flyback) | (ioc_regs[CONTROL] & 0x7c) | (1<<1) | 1;
|
||||
}
|
||||
|
||||
return archimedes_ioc_r(space,offset,mem_mask);
|
||||
@ -108,13 +121,14 @@ static READ32_HANDLER( mk5_ioc_r )
|
||||
|
||||
static WRITE32_HANDLER( mk5_ioc_w )
|
||||
{
|
||||
static UINT32 ioc_addr;
|
||||
aristmk5_state *state = space->machine->driver_data<aristmk5_state>();
|
||||
UINT32 ioc_addr;
|
||||
|
||||
ioc_addr = offset*4;
|
||||
ioc_addr >>= 16;
|
||||
ioc_addr &= 0x37;
|
||||
|
||||
if(!ext_latch)
|
||||
if(!state->ext_latch)
|
||||
{
|
||||
if(((ioc_addr == 0x20) || (ioc_addr == 0x30)) && (offset & 0x1f) == 0)
|
||||
{
|
||||
@ -219,25 +233,28 @@ static DRIVER_INIT( aristmk5 )
|
||||
|
||||
static TIMER_CALLBACK( mk5_2KHz_callback )
|
||||
{
|
||||
aristmk5_state *state = machine->driver_data<aristmk5_state>();
|
||||
ioc_regs[4] |= 1;
|
||||
|
||||
mk5_2KHz_timer->adjust(attotime::never);
|
||||
state->mk5_2KHz_timer->adjust(attotime::never);
|
||||
}
|
||||
|
||||
static MACHINE_START( aristmk5 )
|
||||
{
|
||||
aristmk5_state *state = machine->driver_data<aristmk5_state>();
|
||||
archimedes_init(machine);
|
||||
|
||||
// reset the DAC to centerline
|
||||
//dac_signed_data_w(machine->device("dac"), 0x80);
|
||||
|
||||
mk5_2KHz_timer = machine->scheduler().timer_alloc(FUNC(mk5_2KHz_callback));
|
||||
state->mk5_2KHz_timer = machine->scheduler().timer_alloc(FUNC(mk5_2KHz_callback));
|
||||
}
|
||||
|
||||
static MACHINE_RESET( aristmk5 )
|
||||
{
|
||||
aristmk5_state *state = machine->driver_data<aristmk5_state>();
|
||||
archimedes_reset(machine);
|
||||
mk5_2KHz_timer->adjust(attotime::from_hz(2000));
|
||||
state->mk5_2KHz_timer->adjust(attotime::from_hz(2000));
|
||||
|
||||
ioc_regs[IRQ_STATUS_B] |= 0x40; //hack, set keyboard irq empty to be ON
|
||||
|
||||
@ -273,7 +290,7 @@ static const i2cmem_interface i2cmem_interface =
|
||||
};
|
||||
#endif
|
||||
|
||||
static MACHINE_CONFIG_START( aristmk5, driver_device )
|
||||
static MACHINE_CONFIG_START( aristmk5, aristmk5_state )
|
||||
MCFG_CPU_ADD("maincpu", ARM, 10000000) // ?
|
||||
MCFG_CPU_PROGRAM_MAP(aristmk5_map)
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "sound/c6280.h"
|
||||
#include "includes/battlera.h"
|
||||
|
||||
static int control_port_select;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@ -45,12 +44,14 @@ static WRITE8_HANDLER( battlera_sound_w )
|
||||
|
||||
static WRITE8_HANDLER( control_data_w )
|
||||
{
|
||||
control_port_select=data;
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
state->control_port_select=data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( control_data_r )
|
||||
{
|
||||
switch (control_port_select)
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
switch (state->control_port_select)
|
||||
{
|
||||
case 0xfe: return input_port_read(space->machine, "IN0"); /* Player 1 */
|
||||
case 0xfd: return input_port_read(space->machine, "IN1"); /* Player 2 */
|
||||
@ -83,23 +84,23 @@ ADDRESS_MAP_END
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static int msm5205next;
|
||||
|
||||
static void battlera_adpcm_int(device_t *device)
|
||||
{
|
||||
static int toggle;
|
||||
battlera_state *state = device->machine->driver_data<battlera_state>();
|
||||
|
||||
msm5205_data_w(device,msm5205next >> 4);
|
||||
msm5205next <<= 4;
|
||||
msm5205_data_w(device,state->msm5205next >> 4);
|
||||
state->msm5205next <<= 4;
|
||||
|
||||
toggle = 1 - toggle;
|
||||
if (toggle)
|
||||
state->toggle = 1 - state->toggle;
|
||||
if (state->toggle)
|
||||
cputag_set_input_line(device->machine, "audiocpu", 1, HOLD_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( battlera_adpcm_data_w )
|
||||
{
|
||||
msm5205next = data;
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
state->msm5205next = data;
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( battlera_adpcm_reset_w )
|
||||
@ -229,7 +230,7 @@ static const c6280_interface c6280_config =
|
||||
"audiocpu"
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( battlera, driver_device )
|
||||
static MACHINE_CONFIG_START( battlera, battlera_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", H6280,21477200/3)
|
||||
|
@ -81,6 +81,42 @@
|
||||
#include "sound/ay8910.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
|
||||
class bfcobra_state : public driver_device
|
||||
{
|
||||
public:
|
||||
bfcobra_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 bank_data[4];
|
||||
UINT8 *work_ram;
|
||||
UINT8 *video_ram;
|
||||
UINT8 h_scroll;
|
||||
UINT8 v_scroll;
|
||||
UINT8 flip_8;
|
||||
UINT8 flip_22;
|
||||
UINT8 videomode;
|
||||
UINT8 z80_m6809_line;
|
||||
UINT8 m6809_z80_line;
|
||||
UINT8 data_r;
|
||||
UINT8 data_t;
|
||||
int irq_state;
|
||||
int acia_irq;
|
||||
int vblank_irq;
|
||||
int blitter_irq;
|
||||
UINT8 z80_int;
|
||||
UINT8 z80_inten;
|
||||
UINT32 meter_latch;
|
||||
UINT32 mux_input;
|
||||
UINT32 mux_outputlatch;
|
||||
UINT8 col4bit[16];
|
||||
UINT8 col3bit[16];
|
||||
UINT8 col8bit[256];
|
||||
UINT8 col7bit[256];
|
||||
UINT8 col6bit[256];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Defines
|
||||
*/
|
||||
@ -88,37 +124,6 @@
|
||||
#define M6809_XTAL 1000000
|
||||
|
||||
|
||||
/*
|
||||
Globals
|
||||
*/
|
||||
static UINT8 bank_data[4];
|
||||
static UINT8 *work_ram;
|
||||
static UINT8 *video_ram;
|
||||
static UINT8 h_scroll;
|
||||
static UINT8 v_scroll;
|
||||
static UINT8 flip_8;
|
||||
static UINT8 flip_22;
|
||||
static UINT8 videomode;
|
||||
|
||||
/* UART source/sinks */
|
||||
static UINT8 z80_m6809_line;
|
||||
static UINT8 m6809_z80_line;
|
||||
static UINT8 data_r;
|
||||
static UINT8 data_t;
|
||||
|
||||
static int irq_state;
|
||||
static int acia_irq;
|
||||
static int vblank_irq;
|
||||
static int blitter_irq;
|
||||
|
||||
static UINT8 z80_int;
|
||||
static UINT8 z80_inten;
|
||||
|
||||
/* EM and lamps stuff */
|
||||
static UINT32 meter_latch;
|
||||
static UINT32 mux_input;
|
||||
static UINT32 mux_outputlatch;
|
||||
|
||||
/*
|
||||
Function prototypes
|
||||
*/
|
||||
@ -127,12 +132,13 @@ INLINE void z80_bank(running_machine *machine, int num, int data);
|
||||
|
||||
static void update_irqs(running_machine *machine)
|
||||
{
|
||||
int newstate = blitter_irq || vblank_irq || acia_irq;
|
||||
bfcobra_state *state = machine->driver_data<bfcobra_state>();
|
||||
int newstate = state->blitter_irq || state->vblank_irq || state->acia_irq;
|
||||
|
||||
if (newstate != irq_state)
|
||||
if (newstate != state->irq_state)
|
||||
{
|
||||
irq_state = newstate;
|
||||
cputag_set_input_line(machine, "maincpu", 0, irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
state->irq_state = newstate;
|
||||
cputag_set_input_line(machine, "maincpu", 0, state->irq_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,37 +298,34 @@ static const UINT8 col3bit_default[16]=
|
||||
RED_7 | GREEN_7 | BLUE_3
|
||||
};
|
||||
|
||||
static UINT8 col4bit[16];
|
||||
static UINT8 col3bit[16];
|
||||
static UINT8 col8bit[256];
|
||||
static UINT8 col7bit[256];
|
||||
static UINT8 col6bit[256];
|
||||
static const UINT8 col76index[] = {0, 2, 4, 7};
|
||||
|
||||
|
||||
static VIDEO_START( bfcobra )
|
||||
{
|
||||
bfcobra_state *state = machine->driver_data<bfcobra_state>();
|
||||
int i;
|
||||
|
||||
memcpy(col4bit, col4bit_default, sizeof(col4bit));
|
||||
memcpy(col3bit, col3bit_default, sizeof(col3bit));
|
||||
memcpy(state->col4bit, col4bit_default, sizeof(state->col4bit));
|
||||
memcpy(state->col3bit, col3bit_default, sizeof(state->col3bit));
|
||||
for (i = 0; i < 256; ++i)
|
||||
{
|
||||
UINT8 col;
|
||||
|
||||
col8bit[i] = i;
|
||||
state->col8bit[i] = i;
|
||||
col = i & 0x7f;
|
||||
col = (col & 0x1f) | (col76index[ ( (col & 0x60) >> 5 ) & 3] << 5);
|
||||
col7bit[i] = col;
|
||||
state->col7bit[i] = col;
|
||||
|
||||
col = (col & 3) | (col76index[( (col & 0x0c) >> 2) & 3] << 2 ) |
|
||||
(col76index[( (col & 0x30) >> 4) & 3] << 5 );
|
||||
col6bit[i] = col;
|
||||
state->col6bit[i] = col;
|
||||
}
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( bfcobra )
|
||||
{
|
||||
bfcobra_state *state = screen->machine->driver_data<bfcobra_state>();
|
||||
int x, y;
|
||||
UINT8 *src;
|
||||
UINT32 *dest;
|
||||
@ -332,39 +335,39 @@ static VIDEO_UPDATE( bfcobra )
|
||||
|
||||
/* Select screen has to be programmed into two registers */
|
||||
/* No idea what happens if the registers are different */
|
||||
if (flip_8 & 0x40 && flip_22 & 0x40)
|
||||
if (state->flip_8 & 0x40 && state->flip_22 & 0x40)
|
||||
offset = 0x10000;
|
||||
else
|
||||
offset = 0;
|
||||
|
||||
if(videomode & 0x20)
|
||||
if(state->videomode & 0x20)
|
||||
{
|
||||
hirescol = col3bit;
|
||||
lorescol = col7bit;
|
||||
hirescol = state->col3bit;
|
||||
lorescol = state->col7bit;
|
||||
}
|
||||
else if(videomode & 0x40)
|
||||
else if(state->videomode & 0x40)
|
||||
{
|
||||
hirescol = col4bit;
|
||||
lorescol = col6bit;
|
||||
hirescol = state->col4bit;
|
||||
lorescol = state->col6bit;
|
||||
}
|
||||
else
|
||||
{
|
||||
hirescol = col4bit;
|
||||
lorescol = col8bit;
|
||||
hirescol = state->col4bit;
|
||||
lorescol = state->col8bit;
|
||||
}
|
||||
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; ++y)
|
||||
{
|
||||
UINT16 y_offset = (y + v_scroll) * 256;
|
||||
src = &video_ram[offset + y_offset];
|
||||
UINT16 y_offset = (y + state->v_scroll) * 256;
|
||||
src = &state->video_ram[offset + y_offset];
|
||||
dest = BITMAP_ADDR32(bitmap, y, 0);
|
||||
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x / 2; ++x)
|
||||
{
|
||||
UINT8 x_offset = x + h_scroll;
|
||||
UINT8 x_offset = x + state->h_scroll;
|
||||
UINT8 pen = *(src + x_offset);
|
||||
|
||||
if ( ( videomode & 0x81 ) == 1 || (videomode & 0x80 && pen & 0x80) )
|
||||
if ( ( state->videomode & 0x81 ) == 1 || (state->videomode & 0x80 && pen & 0x80) )
|
||||
{
|
||||
*dest++ = screen->machine->pens[hirescol[pen & 0x0f]];
|
||||
*dest++ = screen->machine->pens[hirescol[(pen >> 4) & 0x0f]];
|
||||
@ -382,6 +385,7 @@ static VIDEO_UPDATE( bfcobra )
|
||||
|
||||
INLINE UINT8* blitter_get_addr(running_machine *machine, UINT32 addr)
|
||||
{
|
||||
bfcobra_state *state = machine->driver_data<bfcobra_state>();
|
||||
if (addr < 0x10000)
|
||||
{
|
||||
/* Is this region fixed? */
|
||||
@ -390,17 +394,17 @@ INLINE UINT8* blitter_get_addr(running_machine *machine, UINT32 addr)
|
||||
else if(addr < 0x20000)
|
||||
{
|
||||
addr &= 0xffff;
|
||||
addr += (bank_data[0] & 1) ? 0x10000 : 0;
|
||||
addr += (state->bank_data[0] & 1) ? 0x10000 : 0;
|
||||
|
||||
return (UINT8*)(machine->region("user1")->base() + addr + ((bank_data[0] >> 1) * 0x20000));
|
||||
return (UINT8*)(machine->region("user1")->base() + addr + ((state->bank_data[0] >> 1) * 0x20000));
|
||||
}
|
||||
else if (addr >= 0x20000 && addr < 0x40000)
|
||||
{
|
||||
return (UINT8*)&video_ram[addr - 0x20000];
|
||||
return (UINT8*)&state->video_ram[addr - 0x20000];
|
||||
}
|
||||
else
|
||||
{
|
||||
return (UINT8*)&work_ram[addr - 0x40000];
|
||||
return (UINT8*)&state->work_ram[addr - 0x40000];
|
||||
}
|
||||
}
|
||||
|
||||
@ -823,6 +827,7 @@ static WRITE8_HANDLER( ramdac_w )
|
||||
|
||||
static READ8_HANDLER( chipset_r )
|
||||
{
|
||||
bfcobra_state *state = space->machine->driver_data<bfcobra_state>();
|
||||
UINT8 val = 0xff;
|
||||
|
||||
switch(offset)
|
||||
@ -831,18 +836,18 @@ static READ8_HANDLER( chipset_r )
|
||||
case 2:
|
||||
case 3:
|
||||
{
|
||||
val = bank_data[offset];
|
||||
val = state->bank_data[offset];
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
/* TODO */
|
||||
val = vblank_irq << 4;
|
||||
val = state->vblank_irq << 4;
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
vblank_irq = 0;
|
||||
state->vblank_irq = 0;
|
||||
val = 0x1;
|
||||
|
||||
/* TODO */
|
||||
@ -877,6 +882,7 @@ static READ8_HANDLER( chipset_r )
|
||||
|
||||
static WRITE8_HANDLER( chipset_w )
|
||||
{
|
||||
bfcobra_state *state = space->machine->driver_data<bfcobra_state>();
|
||||
switch (offset)
|
||||
{
|
||||
case 0x01:
|
||||
@ -887,42 +893,42 @@ static WRITE8_HANDLER( chipset_w )
|
||||
popmessage("%x: Unusual bank access (%x)\n", cpu_get_previouspc(space->cpu), data);
|
||||
|
||||
data &= 0x3f;
|
||||
bank_data[offset] = data;
|
||||
state->bank_data[offset] = data;
|
||||
z80_bank(space->machine, offset, data);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x08:
|
||||
{
|
||||
flip_8 = data;
|
||||
state->flip_8 = data;
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
videomode = data;
|
||||
state->videomode = data;
|
||||
break;
|
||||
|
||||
case 0x0B:
|
||||
{
|
||||
h_scroll = data;
|
||||
state->h_scroll = data;
|
||||
break;
|
||||
}
|
||||
case 0x0C:
|
||||
{
|
||||
v_scroll = data;
|
||||
state->v_scroll = data;
|
||||
break;
|
||||
}
|
||||
case 0x0E:
|
||||
{
|
||||
col4bit[5] = data;
|
||||
col3bit[5] = data;
|
||||
col3bit[5 + 8] = data;
|
||||
state->col4bit[5] = data;
|
||||
state->col3bit[5] = data;
|
||||
state->col3bit[5 + 8] = data;
|
||||
break;
|
||||
}
|
||||
case 0x0f:
|
||||
{
|
||||
col4bit[6] = data;
|
||||
col3bit[6] = data;
|
||||
col3bit[6 + 8] = data;
|
||||
state->col4bit[6] = data;
|
||||
state->col3bit[6] = data;
|
||||
state->col3bit[6 + 8] = data;
|
||||
break;
|
||||
}
|
||||
case 0x18:
|
||||
@ -953,7 +959,7 @@ static WRITE8_HANDLER( chipset_w )
|
||||
}
|
||||
case 0x22:
|
||||
{
|
||||
flip_22 = data;
|
||||
state->flip_22 = data;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -965,30 +971,32 @@ static WRITE8_HANDLER( chipset_w )
|
||||
|
||||
INLINE void z80_bank(running_machine *machine, 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 = ((bank_data[0] >> 1) * 0x20000) + ((0x4000 * data) ^ ((bank_data[0] & 1) ? 0 : 0x10000));
|
||||
UINT32 offset = ((state->bank_data[0] >> 1) * 0x20000) + ((0x4000 * data) ^ ((state->bank_data[0] & 1) ? 0 : 0x10000));
|
||||
|
||||
memory_set_bankptr(machine, bank_names[num - 1], machine->region("user1")->base() + offset);
|
||||
}
|
||||
else if (data < 0x10)
|
||||
{
|
||||
memory_set_bankptr(machine, bank_names[num - 1], &video_ram[(data - 0x08) * 0x4000]);
|
||||
memory_set_bankptr(machine, bank_names[num - 1], &state->video_ram[(data - 0x08) * 0x4000]);
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_set_bankptr(machine, bank_names[num - 1], &work_ram[(data - 0x10) * 0x4000]);
|
||||
memory_set_bankptr(machine, bank_names[num - 1], &state->work_ram[(data - 0x10) * 0x4000]);
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( rombank_w )
|
||||
{
|
||||
bank_data[0] = data;
|
||||
z80_bank(space->machine, 1, bank_data[1]);
|
||||
z80_bank(space->machine, 2, bank_data[2]);
|
||||
z80_bank(space->machine, 3, bank_data[3]);
|
||||
bfcobra_state *state = space->machine->driver_data<bfcobra_state>();
|
||||
state->bank_data[0] = data;
|
||||
z80_bank(space->machine, 1, state->bank_data[1]);
|
||||
z80_bank(space->machine, 2, state->bank_data[2]);
|
||||
z80_bank(space->machine, 3, state->bank_data[3]);
|
||||
}
|
||||
|
||||
|
||||
@ -1281,6 +1289,7 @@ WRITE8_HANDLER( fd_ctrl_w )
|
||||
|
||||
static MACHINE_RESET( bfcobra )
|
||||
{
|
||||
bfcobra_state *state = machine->driver_data<bfcobra_state>();
|
||||
unsigned int pal;
|
||||
|
||||
for (pal = 0; pal < 256; ++pal)
|
||||
@ -1288,11 +1297,11 @@ static MACHINE_RESET( bfcobra )
|
||||
palette_set_color_rgb(machine, pal, pal3bit((pal>>5)&7), pal3bit((pal>>2)&7), pal2bit(pal&3));
|
||||
}
|
||||
|
||||
bank_data[0] = 1;
|
||||
state->bank_data[0] = 1;
|
||||
memset(&ramdac, 0, sizeof(ramdac));
|
||||
reset_fdc();
|
||||
|
||||
irq_state = blitter_irq = vblank_irq = acia_irq = 0;
|
||||
state->irq_state = state->blitter_irq = state->vblank_irq = state->acia_irq = 0;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -1352,16 +1361,18 @@ static READ8_HANDLER( int_latch_r )
|
||||
/* TODO */
|
||||
static READ8_HANDLER( meter_r )
|
||||
{
|
||||
return meter_latch;
|
||||
bfcobra_state *state = space->machine->driver_data<bfcobra_state>();
|
||||
return state->meter_latch;
|
||||
}
|
||||
|
||||
/* TODO: This is borrowed from Scorpion 1 */
|
||||
static WRITE8_HANDLER( meter_w )
|
||||
{
|
||||
bfcobra_state *state = space->machine->driver_data<bfcobra_state>();
|
||||
int i;
|
||||
int changed = meter_latch ^ data;
|
||||
int changed = state->meter_latch ^ data;
|
||||
|
||||
meter_latch = data;
|
||||
state->meter_latch = data;
|
||||
|
||||
/*
|
||||
When a meter is triggered, the current drawn is sensed. If a meter
|
||||
@ -1380,20 +1391,22 @@ static WRITE8_HANDLER( meter_w )
|
||||
/* TODO */
|
||||
static READ8_HANDLER( latch_r )
|
||||
{
|
||||
return mux_input;
|
||||
bfcobra_state *state = space->machine->driver_data<bfcobra_state>();
|
||||
return state->mux_input;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( latch_w )
|
||||
{
|
||||
bfcobra_state *state = space->machine->driver_data<bfcobra_state>();
|
||||
/* TODO: This is borrowed from Scorpion 1 */
|
||||
switch(offset)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
int changed = mux_outputlatch ^ data;
|
||||
int changed = state->mux_outputlatch ^ data;
|
||||
static const char *const port[] = { "STROBE0", "STROBE1", "STROBE2", "STROBE3", "STROBE4", "STROBE5", "STROBE6", "STROBE7" };
|
||||
|
||||
mux_outputlatch = data;
|
||||
state->mux_outputlatch = data;
|
||||
|
||||
/* Clock has changed */
|
||||
if (changed & 0x08)
|
||||
@ -1402,7 +1415,7 @@ static WRITE8_HANDLER( latch_w )
|
||||
|
||||
/* Clock is low */
|
||||
if (!(data & 0x08))
|
||||
mux_input = input_port_read(space->machine, port[input_strobe]);
|
||||
state->mux_input = input_port_read(space->machine, port[input_strobe]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1561,11 +1574,12 @@ INPUT_PORTS_END
|
||||
*/
|
||||
static void init_ram(running_machine *machine)
|
||||
{
|
||||
bfcobra_state *state = machine->driver_data<bfcobra_state>();
|
||||
/* 768kB work RAM */
|
||||
work_ram = auto_alloc_array_clear(machine, UINT8, 0xC0000);
|
||||
state->work_ram = auto_alloc_array_clear(machine, UINT8, 0xC0000);
|
||||
|
||||
/* 128kB video RAM */
|
||||
video_ram = auto_alloc_array_clear(machine, UINT8, 0x20000);
|
||||
state->video_ram = auto_alloc_array_clear(machine, UINT8, 0x20000);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1574,17 +1588,20 @@ static void init_ram(running_machine *machine)
|
||||
|
||||
static READ_LINE_DEVICE_HANDLER( z80_acia_rx_r )
|
||||
{
|
||||
return m6809_z80_line;
|
||||
bfcobra_state *state = device->machine->driver_data<bfcobra_state>();
|
||||
return state->m6809_z80_line;
|
||||
}
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( z80_acia_tx_w )
|
||||
{
|
||||
z80_m6809_line = state;
|
||||
bfcobra_state *drvstate = device->machine->driver_data<bfcobra_state>();
|
||||
drvstate->z80_m6809_line = state;
|
||||
}
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( z80_acia_irq )
|
||||
{
|
||||
acia_irq = state ? CLEAR_LINE : ASSERT_LINE;
|
||||
bfcobra_state *drvstate = device->machine->driver_data<bfcobra_state>();
|
||||
drvstate->acia_irq = state ? CLEAR_LINE : ASSERT_LINE;
|
||||
update_irqs(device->machine);
|
||||
}
|
||||
|
||||
@ -1602,12 +1619,14 @@ static ACIA6850_INTERFACE( z80_acia_if )
|
||||
|
||||
static READ_LINE_DEVICE_HANDLER( m6809_acia_rx_r )
|
||||
{
|
||||
return z80_m6809_line;
|
||||
bfcobra_state *state = device->machine->driver_data<bfcobra_state>();
|
||||
return state->z80_m6809_line;
|
||||
}
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( m6809_acia_tx_w )
|
||||
{
|
||||
m6809_z80_line = state;
|
||||
bfcobra_state *drvstate = device->machine->driver_data<bfcobra_state>();
|
||||
drvstate->m6809_z80_line = state;
|
||||
}
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( m6809_data_irq )
|
||||
@ -1629,12 +1648,14 @@ static ACIA6850_INTERFACE( m6809_acia_if )
|
||||
|
||||
static READ_LINE_DEVICE_HANDLER( data_acia_rx_r )
|
||||
{
|
||||
return data_r;
|
||||
bfcobra_state *state = device->machine->driver_data<bfcobra_state>();
|
||||
return state->data_r;
|
||||
}
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( data_acia_tx_w )
|
||||
{
|
||||
data_t = state;
|
||||
bfcobra_state *drvstate = device->machine->driver_data<bfcobra_state>();
|
||||
drvstate->data_t = state;
|
||||
}
|
||||
|
||||
|
||||
@ -1654,6 +1675,7 @@ static ACIA6850_INTERFACE( data_acia_if )
|
||||
/* TODO: Driver vs Machine Init */
|
||||
static DRIVER_INIT( bfcobra )
|
||||
{
|
||||
bfcobra_state *state = machine->driver_data<bfcobra_state>();
|
||||
/*
|
||||
6809 ROM address and data lines are scrambled.
|
||||
This is the same scrambling as Scorpion 2.
|
||||
@ -1689,31 +1711,31 @@ static DRIVER_INIT( bfcobra )
|
||||
|
||||
init_ram(machine);
|
||||
|
||||
bank_data[0] = 1;
|
||||
bank_data[1] = 0;
|
||||
bank_data[2] = 0;
|
||||
bank_data[3] = 0;
|
||||
state->bank_data[0] = 1;
|
||||
state->bank_data[1] = 0;
|
||||
state->bank_data[2] = 0;
|
||||
state->bank_data[3] = 0;
|
||||
|
||||
/* Fixed 16kB ROM region */
|
||||
memory_set_bankptr(machine, "bank4", machine->region("user1")->base());
|
||||
|
||||
/* TODO: Properly sort out the data ACIA */
|
||||
data_r = 1;
|
||||
state->data_r = 1;
|
||||
|
||||
/* Finish this */
|
||||
state_save_register_global(machine, z80_m6809_line);
|
||||
state_save_register_global(machine, m6809_z80_line);
|
||||
state_save_register_global(machine, data_r);
|
||||
state_save_register_global(machine, data_t);
|
||||
state_save_register_global(machine, h_scroll);
|
||||
state_save_register_global(machine, v_scroll);
|
||||
state_save_register_global(machine, flip_8);
|
||||
state_save_register_global(machine, flip_22);
|
||||
state_save_register_global(machine, z80_int);
|
||||
state_save_register_global(machine, z80_inten);
|
||||
state_save_register_global_array(machine, bank_data);
|
||||
state_save_register_global_pointer(machine, work_ram, 0xc0000);
|
||||
state_save_register_global_pointer(machine, video_ram, 0x20000);
|
||||
state_save_register_global(machine, state->z80_m6809_line);
|
||||
state_save_register_global(machine, state->m6809_z80_line);
|
||||
state_save_register_global(machine, state->data_r);
|
||||
state_save_register_global(machine, state->data_t);
|
||||
state_save_register_global(machine, state->h_scroll);
|
||||
state_save_register_global(machine, state->v_scroll);
|
||||
state_save_register_global(machine, state->flip_8);
|
||||
state_save_register_global(machine, state->flip_22);
|
||||
state_save_register_global(machine, state->z80_int);
|
||||
state_save_register_global(machine, state->z80_inten);
|
||||
state_save_register_global_array(machine, state->bank_data);
|
||||
state_save_register_global_pointer(machine, state->work_ram, 0xc0000);
|
||||
state_save_register_global_pointer(machine, state->video_ram, 0x20000);
|
||||
}
|
||||
|
||||
/* TODO */
|
||||
@ -1725,11 +1747,12 @@ static INTERRUPT_GEN( timer_irq )
|
||||
/* TODO */
|
||||
static INTERRUPT_GEN( vblank_gen )
|
||||
{
|
||||
vblank_irq = 1;
|
||||
bfcobra_state *state = device->machine->driver_data<bfcobra_state>();
|
||||
state->vblank_irq = 1;
|
||||
update_irqs(device->machine);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( bfcobra, driver_device )
|
||||
static MACHINE_CONFIG_START( bfcobra, bfcobra_state )
|
||||
MCFG_CPU_ADD("maincpu", Z80, Z80_XTAL)
|
||||
MCFG_CPU_PROGRAM_MAP(z80_prog_map)
|
||||
MCFG_CPU_IO_MAP(z80_io_map)
|
||||
|
@ -93,6 +93,39 @@ Optional (on expansion card) (Viper)
|
||||
#include "sound/upd7759.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "bfm_sc1.lh"
|
||||
|
||||
|
||||
class bfm_sc1_state : public driver_device
|
||||
{
|
||||
public:
|
||||
bfm_sc1_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
int mmtr_latch;
|
||||
int triac_latch;
|
||||
int vfd_latch;
|
||||
int irq_status;
|
||||
int optic_pattern;
|
||||
int acia_status;
|
||||
int locked;
|
||||
int is_timer_enabled;
|
||||
int reel_changed;
|
||||
int coin_inhibits;
|
||||
int mux1_outputlatch;
|
||||
int mux1_datalo;
|
||||
int mux1_datahi;
|
||||
int mux1_input;
|
||||
int mux2_outputlatch;
|
||||
int mux2_datalo;
|
||||
int mux2_datahi;
|
||||
int mux2_input;
|
||||
int watchdog_cnt;
|
||||
int watchdog_kicked;
|
||||
UINT8 Lamps[256];
|
||||
UINT8 sc1_Inputs[64];
|
||||
UINT8 codec_data[256];
|
||||
};
|
||||
|
||||
#define VFD_RESET 0x20
|
||||
#define VFD_CLOCK1 0x80
|
||||
#define VFD_DATA 0x40
|
||||
@ -102,49 +135,27 @@ Optional (on expansion card) (Viper)
|
||||
|
||||
// local vars /////////////////////////////////////////////////////////////
|
||||
|
||||
static int mmtr_latch; // mechanical meter latch
|
||||
static int triac_latch; // payslide triac latch
|
||||
static int vfd_latch; // vfd latch
|
||||
static int irq_status; // custom chip IRQ status
|
||||
static int optic_pattern; // reel optics
|
||||
static int acia_status; // MC6850 status
|
||||
static int locked; // hardware lock/unlock status (0=unlocked)
|
||||
static int is_timer_enabled;
|
||||
static int reel_changed;
|
||||
static int coin_inhibits;
|
||||
static int mux1_outputlatch;
|
||||
static int mux1_datalo;
|
||||
static int mux1_datahi;
|
||||
static int mux1_input;
|
||||
|
||||
static int mux2_outputlatch;
|
||||
static int mux2_datalo;
|
||||
static int mux2_datahi;
|
||||
static int mux2_input;
|
||||
|
||||
static int watchdog_cnt;
|
||||
static int watchdog_kicked;
|
||||
|
||||
// user interface stuff ///////////////////////////////////////////////////
|
||||
|
||||
static UINT8 Lamps[256]; // 256 multiplexed lamps
|
||||
static UINT8 sc1_Inputs[64]; // 64? multiplexed inputs
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void Scorpion1_SetSwitchState(int strobe, int data, int state)
|
||||
static void Scorpion1_SetSwitchState(bfm_sc1_state *drvstate, int strobe, int data, int state)
|
||||
{
|
||||
if ( state ) sc1_Inputs[strobe] |= (1<<data);
|
||||
else sc1_Inputs[strobe] &= ~(1<<data);
|
||||
if ( state ) drvstate->sc1_Inputs[strobe] |= (1<<data);
|
||||
else drvstate->sc1_Inputs[strobe] &= ~(1<<data);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static int Scorpion1_GetSwitchState(int strobe, int data)
|
||||
static int Scorpion1_GetSwitchState(bfm_sc1_state *drvstate, int strobe, int data)
|
||||
{
|
||||
int state = 0;
|
||||
|
||||
if ( strobe < 7 && data < 8 ) state = (sc1_Inputs[strobe] & (1<<data))?1:0;
|
||||
if ( strobe < 7 && data < 8 ) state = (drvstate->sc1_Inputs[strobe] & (1<<data))?1:0;
|
||||
|
||||
return state;
|
||||
}
|
||||
@ -160,26 +171,27 @@ static WRITE8_HANDLER( bankswitch_w )
|
||||
|
||||
static INTERRUPT_GEN( timer_irq )
|
||||
{
|
||||
if ( watchdog_kicked )
|
||||
bfm_sc1_state *state = device->machine->driver_data<bfm_sc1_state>();
|
||||
if ( state->watchdog_kicked )
|
||||
{
|
||||
watchdog_cnt = 0;
|
||||
watchdog_kicked = 0;
|
||||
state->watchdog_cnt = 0;
|
||||
state->watchdog_kicked = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
watchdog_cnt++;
|
||||
if ( watchdog_cnt > 2 ) // this is a hack, i don't know what the watchdog timeout is, 3 IRQ's works fine
|
||||
state->watchdog_cnt++;
|
||||
if ( state->watchdog_cnt > 2 ) // this is a hack, i don't know what the watchdog timeout is, 3 IRQ's works fine
|
||||
{ // reset board
|
||||
device->machine->schedule_soft_reset();// reset entire machine. CPU 0 should be enough, but that doesn't seem to work !!
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_timer_enabled )
|
||||
if ( state->is_timer_enabled )
|
||||
{
|
||||
irq_status = 0x01 |0x02; //0xff;
|
||||
state->irq_status = 0x01 |0x02; //0xff;
|
||||
|
||||
sc1_Inputs[2] = input_port_read(device->machine,"STROBE0");
|
||||
state->sc1_Inputs[2] = input_port_read(device->machine,"STROBE0");
|
||||
|
||||
generic_pulse_irq_line(device->machine->device("maincpu"), M6809_IRQ_LINE);
|
||||
}
|
||||
@ -189,9 +201,10 @@ static INTERRUPT_GEN( timer_irq )
|
||||
|
||||
static READ8_HANDLER( irqlatch_r )
|
||||
{
|
||||
int result = irq_status | 0x02;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
int result = state->irq_status | 0x02;
|
||||
|
||||
irq_status = 0;
|
||||
state->irq_status = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -200,19 +213,20 @@ static READ8_HANDLER( irqlatch_r )
|
||||
|
||||
static WRITE8_HANDLER( reel12_w )
|
||||
{
|
||||
if ( locked & 0x01 )
|
||||
{ // hardware is still locked,
|
||||
if ( data == 0x46 ) locked &= ~0x01;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
if ( state->locked & 0x01 )
|
||||
{ // hardware is still state->locked,
|
||||
if ( data == 0x46 ) state->locked &= ~0x01;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( stepper_update(0, data>>4) ) reel_changed |= 0x01;
|
||||
if ( stepper_update(1, data ) ) reel_changed |= 0x02;
|
||||
if ( stepper_update(0, data>>4) ) state->reel_changed |= 0x01;
|
||||
if ( stepper_update(1, data ) ) state->reel_changed |= 0x02;
|
||||
|
||||
if ( stepper_optic_state(0) ) optic_pattern |= 0x01;
|
||||
else optic_pattern &= ~0x01;
|
||||
if ( stepper_optic_state(1) ) optic_pattern |= 0x02;
|
||||
else optic_pattern &= ~0x02;
|
||||
if ( stepper_optic_state(0) ) state->optic_pattern |= 0x01;
|
||||
else state->optic_pattern &= ~0x01;
|
||||
if ( stepper_optic_state(1) ) state->optic_pattern |= 0x02;
|
||||
else state->optic_pattern &= ~0x02;
|
||||
}
|
||||
awp_draw_reel(0);
|
||||
awp_draw_reel(1);
|
||||
@ -222,19 +236,20 @@ static WRITE8_HANDLER( reel12_w )
|
||||
|
||||
static WRITE8_HANDLER( reel34_w )
|
||||
{
|
||||
if ( locked & 0x02 )
|
||||
{ // hardware is still locked,
|
||||
if ( data == 0x42 ) locked &= ~0x02;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
if ( state->locked & 0x02 )
|
||||
{ // hardware is still state->locked,
|
||||
if ( data == 0x42 ) state->locked &= ~0x02;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( stepper_update(2, data>>4) ) reel_changed |= 0x04;
|
||||
if ( stepper_update(3, data ) ) reel_changed |= 0x08;
|
||||
if ( stepper_update(2, data>>4) ) state->reel_changed |= 0x04;
|
||||
if ( stepper_update(3, data ) ) state->reel_changed |= 0x08;
|
||||
|
||||
if ( stepper_optic_state(2) ) optic_pattern |= 0x04;
|
||||
else optic_pattern &= ~0x04;
|
||||
if ( stepper_optic_state(3) ) optic_pattern |= 0x08;
|
||||
else optic_pattern &= ~0x08;
|
||||
if ( stepper_optic_state(2) ) state->optic_pattern |= 0x04;
|
||||
else state->optic_pattern &= ~0x04;
|
||||
if ( stepper_optic_state(3) ) state->optic_pattern |= 0x08;
|
||||
else state->optic_pattern &= ~0x08;
|
||||
}
|
||||
awp_draw_reel(2);
|
||||
awp_draw_reel(3);
|
||||
@ -244,13 +259,14 @@ static WRITE8_HANDLER( reel34_w )
|
||||
|
||||
static WRITE8_HANDLER( reel56_w )
|
||||
{
|
||||
if ( stepper_update(4, data>>4) ) reel_changed |= 0x10;
|
||||
if ( stepper_update(5, data ) ) reel_changed |= 0x20;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
if ( stepper_update(4, data>>4) ) state->reel_changed |= 0x10;
|
||||
if ( stepper_update(5, data ) ) state->reel_changed |= 0x20;
|
||||
|
||||
if ( stepper_optic_state(4) ) optic_pattern |= 0x10;
|
||||
else optic_pattern &= ~0x10;
|
||||
if ( stepper_optic_state(5) ) optic_pattern |= 0x20;
|
||||
else optic_pattern &= ~0x20;
|
||||
if ( stepper_optic_state(4) ) state->optic_pattern |= 0x10;
|
||||
else state->optic_pattern &= ~0x10;
|
||||
if ( stepper_optic_state(5) ) state->optic_pattern |= 0x20;
|
||||
else state->optic_pattern &= ~0x20;
|
||||
awp_draw_reel(5);
|
||||
awp_draw_reel(6);
|
||||
}
|
||||
@ -261,16 +277,17 @@ static WRITE8_HANDLER( reel56_w )
|
||||
|
||||
static WRITE8_HANDLER( mmtr_w )
|
||||
{
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
int i;
|
||||
if ( locked & 0x04 )
|
||||
{ // hardware is still locked,
|
||||
locked &= ~0x04;
|
||||
if ( state->locked & 0x04 )
|
||||
{ // hardware is still state->locked,
|
||||
state->locked &= ~0x04;
|
||||
}
|
||||
else
|
||||
{
|
||||
int changed = mmtr_latch ^ data;
|
||||
int changed = state->mmtr_latch ^ data;
|
||||
|
||||
mmtr_latch = data;
|
||||
state->mmtr_latch = data;
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
{
|
||||
@ -287,7 +304,8 @@ static WRITE8_HANDLER( mmtr_w )
|
||||
|
||||
static READ8_HANDLER( mmtr_r )
|
||||
{
|
||||
return mmtr_latch;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
return state->mmtr_latch;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -308,9 +326,10 @@ static READ8_DEVICE_HANDLER( nec_r )
|
||||
|
||||
static WRITE8_HANDLER( vfd_w )
|
||||
{
|
||||
int changed = vfd_latch ^ data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
int changed = state->vfd_latch ^ data;
|
||||
|
||||
vfd_latch = data;
|
||||
state->vfd_latch = data;
|
||||
|
||||
if ( changed )
|
||||
{
|
||||
@ -388,7 +407,8 @@ static int receive_from_adder(void)
|
||||
|
||||
static READ8_HANDLER( mux1latch_r )
|
||||
{
|
||||
return mux1_input;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
return state->mux1_input;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -409,9 +429,10 @@ static READ8_HANDLER( mux1dathi_r )
|
||||
|
||||
static WRITE8_HANDLER( mux1latch_w )
|
||||
{
|
||||
int changed = mux1_outputlatch ^ data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
int changed = state->mux1_outputlatch ^ data;
|
||||
static const char *const portnames[] = { "STROBE0", "STROBE1", "STROBE2", "STROBE3", "STROBE4", "STROBE5", "STROBE6", "STROBE7" };
|
||||
mux1_outputlatch = data;
|
||||
state->mux1_outputlatch = data;
|
||||
|
||||
if ( changed & 0x08 )
|
||||
{ // clock changed
|
||||
@ -427,8 +448,8 @@ static WRITE8_HANDLER( mux1latch_w )
|
||||
|
||||
for ( i = 0; i < 8; i++ )
|
||||
{
|
||||
Lamps[ BFM_strcnv[offset ] ] = mux1_datalo & pattern?1:0;
|
||||
Lamps[ BFM_strcnv[offset+8] ] = mux1_datahi & pattern?1:0;
|
||||
state->Lamps[ BFM_strcnv[offset ] ] = state->mux1_datalo & pattern?1:0;
|
||||
state->Lamps[ BFM_strcnv[offset+8] ] = state->mux1_datahi & pattern?1:0;
|
||||
pattern<<=1;
|
||||
offset++;
|
||||
}
|
||||
@ -437,16 +458,16 @@ static WRITE8_HANDLER( mux1latch_w )
|
||||
{
|
||||
for ( i = 0; i < 256; i++ )
|
||||
{
|
||||
output_set_lamp_value(i, Lamps[i]);
|
||||
output_set_lamp_value(i, state->Lamps[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !(data & 0x08) )
|
||||
{
|
||||
sc1_Inputs[ input_strobe ] = input_port_read(space->machine,portnames[input_strobe]);
|
||||
state->sc1_Inputs[ input_strobe ] = input_port_read(space->machine,portnames[input_strobe]);
|
||||
|
||||
mux1_input = sc1_Inputs[ input_strobe ];
|
||||
state->mux1_input = state->sc1_Inputs[ input_strobe ];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -455,21 +476,24 @@ static WRITE8_HANDLER( mux1latch_w )
|
||||
|
||||
static WRITE8_HANDLER( mux1datlo_w )
|
||||
{
|
||||
mux1_datalo = data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
state->mux1_datalo = data;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static WRITE8_HANDLER( mux1dathi_w )
|
||||
{
|
||||
mux1_datahi = data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
state->mux1_datahi = data;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static READ8_HANDLER( mux2latch_r )
|
||||
{
|
||||
return mux2_input;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
return state->mux2_input;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -490,9 +514,10 @@ static READ8_HANDLER( mux2dathi_r )
|
||||
|
||||
static WRITE8_HANDLER( mux2latch_w )
|
||||
{
|
||||
int changed = mux2_outputlatch ^ data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
int changed = state->mux2_outputlatch ^ data;
|
||||
|
||||
mux2_outputlatch = data;
|
||||
state->mux2_outputlatch = data;
|
||||
|
||||
if ( changed & 0x08 )
|
||||
{ // clock changed
|
||||
@ -507,8 +532,8 @@ static WRITE8_HANDLER( mux2latch_w )
|
||||
|
||||
for ( i = 0; i < 8; i++ )
|
||||
{
|
||||
Lamps[ BFM_strcnv[offset ] ] = mux2_datalo & pattern?1:0;
|
||||
Lamps[ BFM_strcnv[offset+8] ] = mux2_datahi & pattern?1:0;
|
||||
state->Lamps[ BFM_strcnv[offset ] ] = state->mux2_datalo & pattern?1:0;
|
||||
state->Lamps[ BFM_strcnv[offset+8] ] = state->mux2_datahi & pattern?1:0;
|
||||
pattern<<=1;
|
||||
offset++;
|
||||
}
|
||||
@ -516,7 +541,7 @@ static WRITE8_HANDLER( mux2latch_w )
|
||||
|
||||
if ( !(data & 0x08) )
|
||||
{
|
||||
mux2_input = 0x3F ^ optic_pattern;
|
||||
state->mux2_input = 0x3F ^ state->optic_pattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -525,21 +550,24 @@ static WRITE8_HANDLER( mux2latch_w )
|
||||
|
||||
static WRITE8_HANDLER( mux2datlo_w )
|
||||
{
|
||||
mux2_datalo = data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
state->mux2_datalo = data;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static WRITE8_HANDLER( mux2dathi_w )
|
||||
{
|
||||
mux2_datahi = data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
state->mux2_datahi = data;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static WRITE8_HANDLER( watchdog_w )
|
||||
{
|
||||
watchdog_kicked = 1;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
state->watchdog_kicked = 1;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -560,7 +588,8 @@ static WRITE8_HANDLER( aciadata_w )
|
||||
|
||||
static READ8_HANDLER( aciastat_r )
|
||||
{
|
||||
return acia_status;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
return state->acia_status;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -576,14 +605,16 @@ static READ8_HANDLER( aciadata_r )
|
||||
|
||||
static WRITE8_HANDLER( triac_w )
|
||||
{
|
||||
triac_latch = data;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
state->triac_latch = data;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static READ8_HANDLER( triac_r )
|
||||
{
|
||||
return triac_latch;
|
||||
bfm_sc1_state *state = space->machine->driver_data<bfm_sc1_state>();
|
||||
return state->triac_latch;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -653,11 +684,11 @@ static const UINT8 DataDecode[]=
|
||||
0
|
||||
};
|
||||
|
||||
static UINT8 codec_data[256];
|
||||
|
||||
|
||||
static void decode_sc1(running_machine *machine,const char *rom_region)
|
||||
{
|
||||
bfm_sc1_state *state = machine->driver_data<bfm_sc1_state>();
|
||||
UINT8 *tmp, *rom;
|
||||
|
||||
rom = machine->region(rom_region)->base();
|
||||
@ -685,7 +716,7 @@ static void decode_sc1(running_machine *machine,const char *rom_region)
|
||||
pattern <<= 1;
|
||||
} while ( *(++tab) );
|
||||
|
||||
codec_data[i] = newdata;
|
||||
state->codec_data[i] = newdata;
|
||||
}
|
||||
|
||||
for ( address = 0; address < 0x10000; address++)
|
||||
@ -702,7 +733,7 @@ static void decode_sc1(running_machine *machine,const char *rom_region)
|
||||
pattern <<= 1;
|
||||
} while ( *(++tab) );
|
||||
|
||||
rom[newaddress] = codec_data[ tmp[address] ];
|
||||
rom[newaddress] = state->codec_data[ tmp[address] ];
|
||||
}
|
||||
auto_free( machine, tmp );
|
||||
}
|
||||
@ -711,21 +742,22 @@ static void decode_sc1(running_machine *machine,const char *rom_region)
|
||||
|
||||
static MACHINE_RESET( bfm_sc1 )
|
||||
{
|
||||
bfm_sc1_state *state = machine->driver_data<bfm_sc1_state>();
|
||||
BFM_BD1_init(0);
|
||||
vfd_latch = 0;
|
||||
mmtr_latch = 0;
|
||||
triac_latch = 0;
|
||||
irq_status = 0;
|
||||
is_timer_enabled = 1;
|
||||
coin_inhibits = 0;
|
||||
mux1_outputlatch = 0x08; // clock HIGH
|
||||
mux1_datalo = 0;
|
||||
mux1_datahi = 0;
|
||||
mux1_input = 0;
|
||||
mux2_outputlatch = 0x08; // clock HIGH
|
||||
mux2_datalo = 0;
|
||||
mux2_datahi = 0;
|
||||
mux2_input = 0;
|
||||
state->vfd_latch = 0;
|
||||
state->mmtr_latch = 0;
|
||||
state->triac_latch = 0;
|
||||
state->irq_status = 0;
|
||||
state->is_timer_enabled = 1;
|
||||
state->coin_inhibits = 0;
|
||||
state->mux1_outputlatch = 0x08; // clock HIGH
|
||||
state->mux1_datalo = 0;
|
||||
state->mux1_datahi = 0;
|
||||
state->mux1_input = 0;
|
||||
state->mux2_outputlatch = 0x08; // clock HIGH
|
||||
state->mux2_datalo = 0;
|
||||
state->mux2_datahi = 0;
|
||||
state->mux2_input = 0;
|
||||
|
||||
BFM_BD1_reset(0); // reset display1
|
||||
BFM_BD1_reset(1); // reset display2
|
||||
@ -741,12 +773,12 @@ static MACHINE_RESET( bfm_sc1 )
|
||||
if ( stepper_optic_state(i) ) pattern |= 1<<i;
|
||||
}
|
||||
|
||||
optic_pattern = pattern;
|
||||
state->optic_pattern = pattern;
|
||||
|
||||
}
|
||||
|
||||
acia_status = 0x02; // MC6850 transmit buffer empty !!!
|
||||
locked = 0x07; // hardware is locked
|
||||
state->acia_status = 0x02; // MC6850 transmit buffer empty !!!
|
||||
state->locked = 0x07; // hardware is state->locked
|
||||
|
||||
// init rom bank ////////////////////////////////////////////////////////////////////
|
||||
{
|
||||
@ -1240,7 +1272,7 @@ INPUT_PORTS_END
|
||||
// machine driver for scorpion1 board ///////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static MACHINE_CONFIG_START( scorpion1, driver_device )
|
||||
static MACHINE_CONFIG_START( scorpion1, bfm_sc1_state )
|
||||
MCFG_MACHINE_RESET(bfm_sc1) // main scorpion1 board initialisation
|
||||
MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK/4) // 6809 CPU at 1 Mhz
|
||||
MCFG_CPU_PROGRAM_MAP(memmap) // setup read and write memorymap
|
||||
@ -1335,6 +1367,7 @@ ROM_END
|
||||
|
||||
static void sc1_common_init(running_machine *machine, int reels, int decrypt)
|
||||
{
|
||||
bfm_sc1_state *state = machine->driver_data<bfm_sc1_state>();
|
||||
UINT8 *rom, i;
|
||||
|
||||
rom = machine->region("maincpu")->base();
|
||||
@ -1343,7 +1376,7 @@ static void sc1_common_init(running_machine *machine, int reels, int decrypt)
|
||||
memcpy(&rom[0x10000], &rom[0x00000], 0x2000);
|
||||
}
|
||||
|
||||
memset(sc1_Inputs, 0, sizeof(sc1_Inputs));
|
||||
memset(state->sc1_Inputs, 0, sizeof(state->sc1_Inputs));
|
||||
|
||||
// setup n default 96 half step reels ///////////////////////////////////////////
|
||||
for ( i = 0; i < reels; i++ )
|
||||
@ -1389,15 +1422,16 @@ static DRIVER_INIT(rou029)
|
||||
|
||||
static DRIVER_INIT(clatt)
|
||||
{
|
||||
bfm_sc1_state *state = machine->driver_data<bfm_sc1_state>();
|
||||
sc1_common_init(machine,6,1);
|
||||
MechMtr_config(machine,8);
|
||||
|
||||
BFM_BD1_init(0);
|
||||
|
||||
Scorpion1_SetSwitchState(3,2,1);
|
||||
Scorpion1_SetSwitchState(3,3,1);
|
||||
Scorpion1_SetSwitchState(3,6,1);
|
||||
Scorpion1_SetSwitchState(4,1,1);
|
||||
Scorpion1_SetSwitchState(state,3,2,1);
|
||||
Scorpion1_SetSwitchState(state,3,3,1);
|
||||
Scorpion1_SetSwitchState(state,3,6,1);
|
||||
Scorpion1_SetSwitchState(state,4,1,1);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -67,6 +67,32 @@ ___________________________________________________________________________
|
||||
#include "sound/ay8910.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
|
||||
class bfmsys85_state : public driver_device
|
||||
{
|
||||
public:
|
||||
bfmsys85_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
int mmtr_latch;
|
||||
int triac_latch;
|
||||
int vfd_latch;
|
||||
int irq_status;
|
||||
int optic_pattern;
|
||||
int locked;
|
||||
int is_timer_enabled;
|
||||
int reel_changed;
|
||||
int coin_inhibits;
|
||||
int mux_output_strobe;
|
||||
int mux_input_strobe;
|
||||
int mux_input;
|
||||
UINT8 Lamps[128];
|
||||
UINT8 Inputs[64];
|
||||
UINT8 sys85_data_line_r;
|
||||
UINT8 sys85_data_line_t;
|
||||
};
|
||||
|
||||
|
||||
#define VFD_RESET 0x20
|
||||
#define VFD_CLOCK1 0x80
|
||||
#define VFD_DATA 0x40
|
||||
@ -78,39 +104,25 @@ ___________________________________________________________________________
|
||||
|
||||
// local vars /////////////////////////////////////////////////////////////
|
||||
|
||||
static int mmtr_latch; // mechanical meter latch
|
||||
static int triac_latch; // payslide triac latch
|
||||
static int vfd_latch; // vfd latch
|
||||
static int irq_status; // custom chip IRQ status
|
||||
static int optic_pattern; // reel optics
|
||||
static int locked; // hardware lock/unlock status (0=unlocked)
|
||||
static int is_timer_enabled;
|
||||
static int reel_changed;
|
||||
static int coin_inhibits;
|
||||
static int mux_output_strobe;
|
||||
static int mux_input_strobe;
|
||||
static int mux_input;
|
||||
|
||||
// user interface stuff ///////////////////////////////////////////////////
|
||||
|
||||
static UINT8 Lamps[128]; // 128 multiplexed lamps
|
||||
static UINT8 Inputs[64]; // ?? multiplexed inputs
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Serial Communications (Where does this go?) ////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static UINT8 sys85_data_line_r;
|
||||
static UINT8 sys85_data_line_t;
|
||||
|
||||
static READ_LINE_DEVICE_HANDLER( sys85_data_r )
|
||||
{
|
||||
return sys85_data_line_r;
|
||||
bfmsys85_state *state = device->machine->driver_data<bfmsys85_state>();
|
||||
return state->sys85_data_line_r;
|
||||
}
|
||||
|
||||
static WRITE_LINE_DEVICE_HANDLER( sys85_data_w )
|
||||
{
|
||||
sys85_data_line_t = state;
|
||||
bfmsys85_state *drvstate = device->machine->driver_data<bfmsys85_state>();
|
||||
drvstate->sys85_data_line_t = state;
|
||||
}
|
||||
|
||||
static ACIA6850_INTERFACE( m6809_acia_if )
|
||||
@ -128,15 +140,16 @@ static ACIA6850_INTERFACE( m6809_acia_if )
|
||||
|
||||
static MACHINE_RESET( bfm_sys85 )
|
||||
{
|
||||
vfd_latch = 0;
|
||||
mmtr_latch = 0;
|
||||
triac_latch = 0;
|
||||
irq_status = 0;
|
||||
is_timer_enabled = 1;
|
||||
coin_inhibits = 0;
|
||||
mux_output_strobe = 0;
|
||||
mux_input_strobe = 0;
|
||||
mux_input = 0;
|
||||
bfmsys85_state *state = machine->driver_data<bfmsys85_state>();
|
||||
state->vfd_latch = 0;
|
||||
state->mmtr_latch = 0;
|
||||
state->triac_latch = 0;
|
||||
state->irq_status = 0;
|
||||
state->is_timer_enabled = 1;
|
||||
state->coin_inhibits = 0;
|
||||
state->mux_output_strobe = 0;
|
||||
state->mux_input_strobe = 0;
|
||||
state->mux_input = 0;
|
||||
|
||||
ROC10937_reset(0); // reset display1
|
||||
|
||||
@ -149,9 +162,9 @@ static MACHINE_RESET( bfm_sys85 )
|
||||
stepper_reset_position(i);
|
||||
if ( stepper_optic_state(i) ) pattern |= 1<<i;
|
||||
}
|
||||
optic_pattern = pattern;
|
||||
state->optic_pattern = pattern;
|
||||
}
|
||||
locked = 0x00; // hardware is NOT locked
|
||||
state->locked = 0x00; // hardware is NOT state->locked
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -164,9 +177,10 @@ static WRITE8_HANDLER( watchdog_w )
|
||||
|
||||
static INTERRUPT_GEN( timer_irq )
|
||||
{
|
||||
if ( is_timer_enabled )
|
||||
bfmsys85_state *state = device->machine->driver_data<bfmsys85_state>();
|
||||
if ( state->is_timer_enabled )
|
||||
{
|
||||
irq_status = 0x01 |0x02; //0xff;
|
||||
state->irq_status = 0x01 |0x02; //0xff;
|
||||
generic_pulse_irq_line(device, M6809_IRQ_LINE);
|
||||
}
|
||||
}
|
||||
@ -175,9 +189,10 @@ static INTERRUPT_GEN( timer_irq )
|
||||
|
||||
static READ8_HANDLER( irqlatch_r )
|
||||
{
|
||||
int result = irq_status | 0x02;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
int result = state->irq_status | 0x02;
|
||||
|
||||
irq_status = 0;
|
||||
state->irq_status = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -186,13 +201,14 @@ static READ8_HANDLER( irqlatch_r )
|
||||
|
||||
static WRITE8_HANDLER( reel12_w )
|
||||
{
|
||||
if ( stepper_update(0, data>>4) ) reel_changed |= 0x01;
|
||||
if ( stepper_update(1, data ) ) reel_changed |= 0x02;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
if ( stepper_update(0, data>>4) ) state->reel_changed |= 0x01;
|
||||
if ( stepper_update(1, data ) ) state->reel_changed |= 0x02;
|
||||
|
||||
if ( stepper_optic_state(0) ) optic_pattern |= 0x01;
|
||||
else optic_pattern &= ~0x01;
|
||||
if ( stepper_optic_state(1) ) optic_pattern |= 0x02;
|
||||
else optic_pattern &= ~0x02;
|
||||
if ( stepper_optic_state(0) ) state->optic_pattern |= 0x01;
|
||||
else state->optic_pattern &= ~0x01;
|
||||
if ( stepper_optic_state(1) ) state->optic_pattern |= 0x02;
|
||||
else state->optic_pattern &= ~0x02;
|
||||
awp_draw_reel(0);
|
||||
awp_draw_reel(1);
|
||||
}
|
||||
@ -201,13 +217,14 @@ static WRITE8_HANDLER( reel12_w )
|
||||
|
||||
static WRITE8_HANDLER( reel34_w )
|
||||
{
|
||||
if ( stepper_update(2, data>>4) ) reel_changed |= 0x04;
|
||||
if ( stepper_update(3, data ) ) reel_changed |= 0x08;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
if ( stepper_update(2, data>>4) ) state->reel_changed |= 0x04;
|
||||
if ( stepper_update(3, data ) ) state->reel_changed |= 0x08;
|
||||
|
||||
if ( stepper_optic_state(2) ) optic_pattern |= 0x04;
|
||||
else optic_pattern &= ~0x04;
|
||||
if ( stepper_optic_state(3) ) optic_pattern |= 0x08;
|
||||
else optic_pattern &= ~0x08;
|
||||
if ( stepper_optic_state(2) ) state->optic_pattern |= 0x04;
|
||||
else state->optic_pattern &= ~0x04;
|
||||
if ( stepper_optic_state(3) ) state->optic_pattern |= 0x08;
|
||||
else state->optic_pattern &= ~0x08;
|
||||
awp_draw_reel(2);
|
||||
awp_draw_reel(3);
|
||||
}
|
||||
@ -218,10 +235,11 @@ static WRITE8_HANDLER( reel34_w )
|
||||
|
||||
static WRITE8_HANDLER( mmtr_w )
|
||||
{
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
int i;
|
||||
int changed = mmtr_latch ^ data;
|
||||
int changed = state->mmtr_latch ^ data;
|
||||
|
||||
mmtr_latch = data;
|
||||
state->mmtr_latch = data;
|
||||
|
||||
for (i=0; i<8; i++)
|
||||
if ( changed & (1 << i) ) MechMtr_update(i, data & (1 << i) );
|
||||
@ -232,15 +250,17 @@ static WRITE8_HANDLER( mmtr_w )
|
||||
|
||||
static READ8_HANDLER( mmtr_r )
|
||||
{
|
||||
return mmtr_latch;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
return state->mmtr_latch;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static WRITE8_HANDLER( vfd_w )
|
||||
{
|
||||
int changed = vfd_latch ^ data;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
int changed = state->vfd_latch ^ data;
|
||||
|
||||
vfd_latch = data;
|
||||
state->vfd_latch = data;
|
||||
|
||||
if ( changed )
|
||||
{
|
||||
@ -294,6 +314,7 @@ static const UINT8 BFM_strcnv85[] =
|
||||
|
||||
static WRITE8_HANDLER( mux_ctrl_w )
|
||||
{
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
switch ( data & 0xF0 )
|
||||
{
|
||||
case 0x10:
|
||||
@ -306,15 +327,15 @@ static WRITE8_HANDLER( mux_ctrl_w )
|
||||
|
||||
case 0x40:
|
||||
//logerror(" sys85 mux: read strobe");
|
||||
mux_input_strobe = data & 0x07;
|
||||
state->mux_input_strobe = data & 0x07;
|
||||
|
||||
if ( mux_input_strobe == 5 ) Inputs[5] = 0xFF ^ optic_pattern;
|
||||
if ( state->mux_input_strobe == 5 ) state->Inputs[5] = 0xFF ^ state->optic_pattern;
|
||||
|
||||
mux_input = ~Inputs[mux_input_strobe];
|
||||
state->mux_input = ~state->Inputs[state->mux_input_strobe];
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
mux_output_strobe = data & 0x0F;
|
||||
state->mux_output_strobe = data & 0x0F;
|
||||
break;
|
||||
|
||||
case 0xC0:
|
||||
@ -336,28 +357,30 @@ static READ8_HANDLER( mux_ctrl_r )
|
||||
|
||||
static WRITE8_HANDLER( mux_data_w )
|
||||
{
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
int pattern = 0x01, i,
|
||||
off = mux_output_strobe<<4;
|
||||
off = state->mux_output_strobe<<4;
|
||||
|
||||
for ( i = 0; i < 8; i++ )
|
||||
{
|
||||
Lamps[BFM_strcnv85[off]] = data & pattern ? 1 : 0;
|
||||
state->Lamps[BFM_strcnv85[off]] = data & pattern ? 1 : 0;
|
||||
pattern <<= 1;
|
||||
off++;
|
||||
}
|
||||
|
||||
if (mux_output_strobe == 0)
|
||||
if (state->mux_output_strobe == 0)
|
||||
{
|
||||
for ( i = 0; i < 128; i++ )
|
||||
{
|
||||
output_set_lamp_value(i, Lamps[i]);
|
||||
output_set_lamp_value(i, state->Lamps[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static READ8_HANDLER( mux_data_r )
|
||||
{
|
||||
return mux_input;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
return state->mux_input;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -372,14 +395,16 @@ static WRITE8_HANDLER( mux_enable_w )
|
||||
|
||||
static WRITE8_HANDLER( triac_w )
|
||||
{
|
||||
triac_latch = data;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
state->triac_latch = data;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static READ8_HANDLER( triac_r )
|
||||
{
|
||||
return triac_latch;
|
||||
bfmsys85_state *state = space->machine->driver_data<bfmsys85_state>();
|
||||
return state->triac_latch;
|
||||
}
|
||||
|
||||
// machine start (called only once) ////////////////////////////////////////
|
||||
@ -433,7 +458,7 @@ ADDRESS_MAP_END
|
||||
|
||||
// machine driver for system85 board //////////////////////////////////////
|
||||
|
||||
static MACHINE_CONFIG_START( bfmsys85, driver_device )
|
||||
static MACHINE_CONFIG_START( bfmsys85, bfmsys85_state )
|
||||
MCFG_MACHINE_START(bfm_sys85) // main system85 board initialisation
|
||||
MCFG_MACHINE_RESET(bfm_sys85)
|
||||
MCFG_CPU_ADD("maincpu", M6809, MASTER_CLOCK/4) // 6809 CPU at 1 Mhz
|
||||
|
@ -107,14 +107,24 @@ Main board:
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/okim6295.h"
|
||||
|
||||
static UINT16 *bmcbowl_vid1;
|
||||
static UINT16 *bmcbowl_vid2;
|
||||
static UINT8 *bmc_colorram;
|
||||
|
||||
static UINT8 *stats_ram;
|
||||
static size_t stats_ram_size;
|
||||
static int clr_offset=0;
|
||||
static int bmc_input=0;
|
||||
class bmcbowl_state : public driver_device
|
||||
{
|
||||
public:
|
||||
bmcbowl_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT16 *vid1;
|
||||
UINT16 *vid2;
|
||||
UINT8 *bmc_colorram;
|
||||
UINT8 *stats_ram;
|
||||
size_t stats_ram_size;
|
||||
int clr_offset;
|
||||
int bmc_input;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#define NVRAM_HACK
|
||||
|
||||
@ -124,6 +134,7 @@ static VIDEO_START( bmcbowl )
|
||||
|
||||
static VIDEO_UPDATE( bmcbowl )
|
||||
{
|
||||
bmcbowl_state *state = screen->machine->driver_data<bmcbowl_state>();
|
||||
/*
|
||||
280x230,4 bitmap layers, 8bpp,
|
||||
missing scroll and priorities (maybe fixed ones)
|
||||
@ -137,28 +148,28 @@ static VIDEO_UPDATE( bmcbowl )
|
||||
{
|
||||
for (x=0;x<280;x+=2)
|
||||
{
|
||||
pixdat = bmcbowl_vid2[0x8000+z];
|
||||
pixdat = state->vid2[0x8000+z];
|
||||
|
||||
if(pixdat&0xff)
|
||||
*BITMAP_ADDR16(bitmap, y, x+1) = (pixdat&0xff);
|
||||
if(pixdat>>8)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = (pixdat>>8);
|
||||
|
||||
pixdat = bmcbowl_vid2[z];
|
||||
pixdat = state->vid2[z];
|
||||
|
||||
if(pixdat&0xff)
|
||||
*BITMAP_ADDR16(bitmap, y, x+1) = (pixdat&0xff);
|
||||
if(pixdat>>8)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = (pixdat>>8);
|
||||
|
||||
pixdat = bmcbowl_vid1[0x8000+z];
|
||||
pixdat = state->vid1[0x8000+z];
|
||||
|
||||
if(pixdat&0xff)
|
||||
*BITMAP_ADDR16(bitmap, y, x+1) = (pixdat&0xff);
|
||||
if(pixdat>>8)
|
||||
*BITMAP_ADDR16(bitmap, y, x) = (pixdat>>8);
|
||||
|
||||
pixdat = bmcbowl_vid1[z];
|
||||
pixdat = state->vid1[z];
|
||||
|
||||
if(pixdat&0xff)
|
||||
*BITMAP_ADDR16(bitmap, y, x+1) = (pixdat&0xff);
|
||||
@ -195,14 +206,16 @@ static READ16_HANDLER( bmc_protection_r )
|
||||
|
||||
static WRITE16_HANDLER( bmc_RAMDAC_offset_w )
|
||||
{
|
||||
clr_offset=data*3;
|
||||
bmcbowl_state *state = space->machine->driver_data<bmcbowl_state>();
|
||||
state->clr_offset=data*3;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( bmc_RAMDAC_color_w )
|
||||
{
|
||||
bmc_colorram[clr_offset]=data;
|
||||
palette_set_color_rgb(space->machine,clr_offset/3,pal6bit(bmc_colorram[(clr_offset/3)*3]),pal6bit(bmc_colorram[(clr_offset/3)*3+1]),pal6bit(bmc_colorram[(clr_offset/3)*3+2]));
|
||||
clr_offset=(clr_offset+1)%768;
|
||||
bmcbowl_state *state = space->machine->driver_data<bmcbowl_state>();
|
||||
state->bmc_colorram[state->clr_offset]=data;
|
||||
palette_set_color_rgb(space->machine,state->clr_offset/3,pal6bit(state->bmc_colorram[(state->clr_offset/3)*3]),pal6bit(state->bmc_colorram[(state->clr_offset/3)*3+1]),pal6bit(state->bmc_colorram[(state->clr_offset/3)*3+2]));
|
||||
state->clr_offset=(state->clr_offset+1)%768;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( scroll_w )
|
||||
@ -276,36 +289,37 @@ static const UINT8 bmc_nv3[]=
|
||||
};
|
||||
|
||||
|
||||
static void init_stats(const UINT8 *table, int table_len, int address)
|
||||
static void init_stats(bmcbowl_state *state, const UINT8 *table, int table_len, int address)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<table_len; i++)
|
||||
stats_ram[address+2*i]=table[i];
|
||||
state->stats_ram[address+2*i]=table[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
static NVRAM_HANDLER( bmcbowl )
|
||||
{
|
||||
bmcbowl_state *state = machine->driver_data<bmcbowl_state>();
|
||||
int i;
|
||||
|
||||
if (read_or_write)
|
||||
file->write(stats_ram, stats_ram_size);
|
||||
file->write(state->stats_ram, state->stats_ram_size);
|
||||
else
|
||||
|
||||
#ifdef NVRAM_HACK
|
||||
for (i = 0; i < stats_ram_size; i++)
|
||||
stats_ram[i] = 0xff;
|
||||
for (i = 0; i < state->stats_ram_size; i++)
|
||||
state->stats_ram[i] = 0xff;
|
||||
|
||||
init_stats(bmc_nv1,ARRAY_LENGTH(bmc_nv1),0);
|
||||
init_stats(bmc_nv2,ARRAY_LENGTH(bmc_nv2),0x3b0);
|
||||
init_stats(bmc_nv3,ARRAY_LENGTH(bmc_nv3),0xfe2);
|
||||
init_stats(state,bmc_nv1,ARRAY_LENGTH(bmc_nv1),0);
|
||||
init_stats(state,bmc_nv2,ARRAY_LENGTH(bmc_nv2),0x3b0);
|
||||
init_stats(state,bmc_nv3,ARRAY_LENGTH(bmc_nv3),0xfe2);
|
||||
#else
|
||||
if (file)
|
||||
file->read(stats_ram, stats_ram_size);
|
||||
file->read(state->stats_ram, state->stats_ram_size);
|
||||
else
|
||||
|
||||
for (i = 0; i < stats_ram_size; i++)
|
||||
stats_ram[i] = 0xff;
|
||||
for (i = 0; i < state->stats_ram_size; i++)
|
||||
state->stats_ram[i] = 0xff;
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -327,12 +341,12 @@ static ADDRESS_MAP_START( bmcbowl_mem, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x092800, 0x092803) AM_DEVWRITE8("aysnd", ay8910_data_address_w, 0xff00)
|
||||
AM_RANGE(0x092802, 0x092803) AM_DEVREAD8("aysnd", ay8910_r, 0xff00)
|
||||
AM_RANGE(0x093802, 0x093803) AM_READ_PORT("IN0")
|
||||
AM_RANGE(0x095000, 0x095fff) AM_RAM AM_BASE((UINT16 **)&stats_ram) AM_SIZE(&stats_ram_size) /* 8 bit */
|
||||
AM_RANGE(0x095000, 0x095fff) AM_RAM AM_BASE_MEMBER(bmcbowl_state, stats_ram) AM_SIZE_MEMBER(bmcbowl_state, stats_ram_size) /* 8 bit */
|
||||
AM_RANGE(0x097000, 0x097001) AM_READNOP
|
||||
AM_RANGE(0x140000, 0x1bffff) AM_ROM
|
||||
AM_RANGE(0x1c0000, 0x1effff) AM_RAM AM_BASE(&bmcbowl_vid1)
|
||||
AM_RANGE(0x1c0000, 0x1effff) AM_RAM AM_BASE_MEMBER(bmcbowl_state, vid1)
|
||||
AM_RANGE(0x1f0000, 0x1fffff) AM_RAM
|
||||
AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_BASE(&bmcbowl_vid2)
|
||||
AM_RANGE(0x200000, 0x21ffff) AM_RAM AM_BASE_MEMBER(bmcbowl_state, vid2)
|
||||
|
||||
AM_RANGE(0x28c000, 0x28c001) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0xff00)
|
||||
|
||||
@ -432,19 +446,21 @@ INPUT_PORTS_END
|
||||
|
||||
static READ8_DEVICE_HANDLER(dips1_r)
|
||||
{
|
||||
switch(bmc_input)
|
||||
bmcbowl_state *state = device->machine->driver_data<bmcbowl_state>();
|
||||
switch(state->bmc_input)
|
||||
{
|
||||
case 0x00: return input_port_read(device->machine, "IN1");
|
||||
case 0x40: return input_port_read(device->machine, "IN2");
|
||||
}
|
||||
logerror("%s:unknown input - %X\n",device->machine->describe_context(),bmc_input);
|
||||
logerror("%s:unknown input - %X\n",device->machine->describe_context(),state->bmc_input);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_DEVICE_HANDLER(input_mux_w)
|
||||
{
|
||||
bmc_input=data;
|
||||
bmcbowl_state *state = device->machine->driver_data<bmcbowl_state>();
|
||||
state->bmc_input=data;
|
||||
}
|
||||
|
||||
|
||||
@ -480,7 +496,7 @@ static INTERRUPT_GEN( bmc_interrupt )
|
||||
cpu_set_input_line(device, 2, HOLD_LINE);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( bmcbowl, driver_device )
|
||||
static MACHINE_CONFIG_START( bmcbowl, bmcbowl_state )
|
||||
MCFG_CPU_ADD("maincpu", M68000, 21477270/2 )
|
||||
MCFG_CPU_PROGRAM_MAP(bmcbowl_mem)
|
||||
MCFG_CPU_VBLANK_INT_HACK(bmc_interrupt,2)
|
||||
@ -536,7 +552,8 @@ ROM_END
|
||||
|
||||
static DRIVER_INIT(bmcbowl)
|
||||
{
|
||||
bmc_colorram = auto_alloc_array(machine, UINT8, 768);
|
||||
bmcbowl_state *state = machine->driver_data<bmcbowl_state>();
|
||||
state->bmc_colorram = auto_alloc_array(machine, UINT8, 768);
|
||||
}
|
||||
|
||||
GAME( 1994, bmcbowl, 0, bmcbowl, bmcbowl, bmcbowl, ROT0, "BMC", "BMC Bowling", GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
|
||||
|
@ -46,13 +46,25 @@ TODO:
|
||||
#include "sound/ay8910.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
static UINT8 *sc0_vram,*sc0_attr;
|
||||
static tilemap_t *sc0_tilemap;
|
||||
|
||||
class caswin_state : public driver_device
|
||||
{
|
||||
public:
|
||||
caswin_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *sc0_vram;
|
||||
UINT8 *sc0_attr;
|
||||
tilemap_t *sc0_tilemap;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_sc0_tile_info )
|
||||
{
|
||||
int tile = (sc0_vram[tile_index] | ((sc0_attr[tile_index] & 0x70)<<4)) & 0x7ff;
|
||||
int colour = sc0_attr[tile_index] & 0xf;
|
||||
caswin_state *state = machine->driver_data<caswin_state>();
|
||||
int tile = (state->sc0_vram[tile_index] | ((state->sc0_attr[tile_index] & 0x70)<<4)) & 0x7ff;
|
||||
int colour = state->sc0_attr[tile_index] & 0xf;
|
||||
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
@ -63,25 +75,29 @@ static TILE_GET_INFO( get_sc0_tile_info )
|
||||
|
||||
static VIDEO_START(vvillage)
|
||||
{
|
||||
sc0_tilemap = tilemap_create(machine, get_sc0_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
caswin_state *state = machine->driver_data<caswin_state>();
|
||||
state->sc0_tilemap = tilemap_create(machine, get_sc0_tile_info,tilemap_scan_rows,8,8,32,32);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE(vvillage)
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,sc0_tilemap,0,0);
|
||||
caswin_state *state = screen->machine->driver_data<caswin_state>();
|
||||
tilemap_draw(bitmap,cliprect,state->sc0_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sc0_vram_w )
|
||||
{
|
||||
sc0_vram[offset] = data;
|
||||
tilemap_mark_tile_dirty(sc0_tilemap,offset);
|
||||
caswin_state *state = space->machine->driver_data<caswin_state>();
|
||||
state->sc0_vram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->sc0_tilemap,offset);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( sc0_attr_w )
|
||||
{
|
||||
sc0_attr[offset] = data;
|
||||
tilemap_mark_tile_dirty(sc0_tilemap,offset);
|
||||
caswin_state *state = space->machine->driver_data<caswin_state>();
|
||||
state->sc0_attr[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->sc0_tilemap,offset);
|
||||
}
|
||||
|
||||
/*These two are tested during the two cherry sub-games.I really don't know what is supposed to do...*/
|
||||
@ -137,8 +153,8 @@ static ADDRESS_MAP_START( vvillage_mem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0xa000, 0xa000) AM_READ(vvillage_rng_r) //accessed by caswin only
|
||||
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE("nvram")
|
||||
AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(sc0_vram_w) AM_BASE(&sc0_vram)
|
||||
AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(sc0_attr_w) AM_BASE(&sc0_attr)
|
||||
AM_RANGE(0xf000, 0xf3ff) AM_RAM_WRITE(sc0_vram_w) AM_BASE_MEMBER(caswin_state, sc0_vram)
|
||||
AM_RANGE(0xf800, 0xfbff) AM_RAM_WRITE(sc0_attr_w) AM_BASE_MEMBER(caswin_state, sc0_attr)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( vvillage_io, ADDRESS_SPACE_IO, 8 )
|
||||
@ -275,7 +291,7 @@ static PALETTE_INIT( caswin )
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( vvillage, driver_device )
|
||||
static MACHINE_CONFIG_START( vvillage, caswin_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80,4000000) /* ? MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(vvillage_mem)
|
||||
|
@ -38,7 +38,7 @@ static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x060000, 0x060001) AM_READ_PORT("DSW") AM_WRITE(cchasm_led_w)
|
||||
AM_RANGE(0x070000, 0x070001) AM_WRITE(watchdog_reset16_w)
|
||||
AM_RANGE(0xf80000, 0xf800ff) AM_READWRITE(cchasm_io_r,cchasm_io_w)
|
||||
AM_RANGE(0xffb000, 0xffffff) AM_RAM AM_BASE(&cchasm_ram)
|
||||
AM_RANGE(0xffb000, 0xffffff) AM_RAM AM_BASE_MEMBER(cchasm_state, ram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/*************************************
|
||||
@ -153,7 +153,7 @@ static const z80_daisy_config daisy_chain[] =
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_CONFIG_START( cchasm, driver_device )
|
||||
static MACHINE_CONFIG_START( cchasm, cchasm_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000,CCHASM_68K_CLOCK) /* 8 MHz (from schematics) */
|
||||
|
@ -43,17 +43,6 @@
|
||||
#define MASTER_CLOCK XTAL_19_923MHz
|
||||
|
||||
|
||||
|
||||
static UINT16 *rambase;
|
||||
|
||||
static UINT8 coin_detected;
|
||||
static UINT8 coin_last_reset;
|
||||
|
||||
static UINT8 mux_select;
|
||||
static int gear;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* General machine init
|
||||
@ -62,20 +51,22 @@ static int gear;
|
||||
|
||||
static MACHINE_START( cinemat )
|
||||
{
|
||||
state_save_register_global(machine, coin_detected);
|
||||
state_save_register_global(machine, coin_last_reset);
|
||||
state_save_register_global(machine, mux_select);
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state_save_register_global(machine, state->coin_detected);
|
||||
state_save_register_global(machine, state->coin_last_reset);
|
||||
state_save_register_global(machine, state->mux_select);
|
||||
}
|
||||
|
||||
|
||||
MACHINE_RESET( cinemat )
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
/* reset the coin states */
|
||||
coin_detected = 0;
|
||||
coin_last_reset = 0;
|
||||
state->coin_detected = 0;
|
||||
state->coin_last_reset = 0;
|
||||
|
||||
/* reset mux select */
|
||||
mux_select = 0;
|
||||
state->mux_select = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -108,15 +99,17 @@ static READ8_HANDLER( switches_r )
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
cinemat_state *state = field->port->machine->driver_data<cinemat_state>();
|
||||
/* on the falling edge of a new coin, set the coin_detected flag */
|
||||
if (newval == 0)
|
||||
coin_detected = 1;
|
||||
state->coin_detected = 1;
|
||||
}
|
||||
|
||||
|
||||
static READ8_HANDLER( coin_input_r )
|
||||
{
|
||||
return !coin_detected;
|
||||
cinemat_state *state = space->machine->driver_data<cinemat_state>();
|
||||
return !state->coin_detected;
|
||||
}
|
||||
|
||||
|
||||
@ -129,16 +122,18 @@ static READ8_HANDLER( coin_input_r )
|
||||
|
||||
static WRITE8_HANDLER( coin_reset_w )
|
||||
{
|
||||
cinemat_state *state = space->machine->driver_data<cinemat_state>();
|
||||
/* on the rising edge of a coin reset, clear the coin_detected flag */
|
||||
if (coin_last_reset != data && data != 0)
|
||||
coin_detected = 0;
|
||||
coin_last_reset = data;
|
||||
if (state->coin_last_reset != data && data != 0)
|
||||
state->coin_detected = 0;
|
||||
state->coin_last_reset = data;
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( mux_select_w )
|
||||
{
|
||||
mux_select = data;
|
||||
cinemat_state *state = space->machine->driver_data<cinemat_state>();
|
||||
state->mux_select = data;
|
||||
cinemat_sound_control_w(space, 0x07, data);
|
||||
}
|
||||
|
||||
@ -152,12 +147,13 @@ static WRITE8_HANDLER( mux_select_w )
|
||||
|
||||
static UINT8 joystick_read(device_t *device)
|
||||
{
|
||||
cinemat_state *state = device->machine->driver_data<cinemat_state>();
|
||||
if (device->machine->phase() != MACHINE_PHASE_RUNNING)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
int xval = (INT16)(cpu_get_reg(device, CCPU_X) << 4) >> 4;
|
||||
return (input_port_read_safe(device->machine, mux_select ? "ANALOGX" : "ANALOGY", 0) - xval) < 0x800;
|
||||
return (input_port_read_safe(device->machine, state->mux_select ? "ANALOGX" : "ANALOGY", 0) - xval) < 0x800;
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,17 +183,18 @@ static READ8_HANDLER( speedfrk_wheel_r )
|
||||
|
||||
static READ8_HANDLER( speedfrk_gear_r )
|
||||
{
|
||||
cinemat_state *state = space->machine->driver_data<cinemat_state>();
|
||||
int gearval = input_port_read(space->machine, "GEAR");
|
||||
|
||||
/* check the fake gear input port and determine the bit settings for the gear */
|
||||
if ((gearval & 0x0f) != 0x0f)
|
||||
gear = gearval & 0x0f;
|
||||
state->gear = gearval & 0x0f;
|
||||
|
||||
/* add the start key into the mix -- note that it overlaps 4th gear */
|
||||
/* add the start key into the mix -- note that it overlaps 4th state->gear */
|
||||
if (!(input_port_read(space->machine, "INPUTS") & 0x80))
|
||||
gear &= ~0x08;
|
||||
state->gear &= ~0x08;
|
||||
|
||||
return (gear >> offset) & 1;
|
||||
return (state->gear >> offset) & 1;
|
||||
}
|
||||
|
||||
|
||||
@ -255,8 +252,9 @@ static READ8_HANDLER( sundance_inputs_r )
|
||||
|
||||
static READ8_HANDLER( boxingb_dial_r )
|
||||
{
|
||||
cinemat_state *state = space->machine->driver_data<cinemat_state>();
|
||||
int value = input_port_read(space->machine, "DIAL");
|
||||
if (!mux_select) offset += 4;
|
||||
if (!state->mux_select) offset += 4;
|
||||
return (value >> offset) & 1;
|
||||
}
|
||||
|
||||
@ -319,7 +317,7 @@ static ADDRESS_MAP_START( data_map, ADDRESS_SPACE_DATA, 16 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( data_map_qb3, ADDRESS_SPACE_DATA, 16 )
|
||||
AM_RANGE(0x0000, 0x03ff) AM_RAMBANK("bank1") AM_BASE(&rambase)
|
||||
AM_RANGE(0x0000, 0x03ff) AM_RAMBANK("bank1") AM_BASE_MEMBER(cinemat_state, rambase)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -992,7 +990,7 @@ static const ccpu_config config_jmi =
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static MACHINE_CONFIG_START( cinemat_nojmi_4k, driver_device )
|
||||
static MACHINE_CONFIG_START( cinemat_nojmi_4k, cinemat_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", CCPU, MASTER_CLOCK/4)
|
||||
@ -1459,7 +1457,8 @@ ROM_END
|
||||
|
||||
static DRIVER_INIT( speedfrk )
|
||||
{
|
||||
gear = 0xe;
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state->gear = 0xe;
|
||||
memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x00, 0x03, 0, 0, speedfrk_wheel_r);
|
||||
memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x04, 0x06, 0, 0, speedfrk_gear_r);
|
||||
}
|
||||
@ -1486,10 +1485,11 @@ static DRIVER_INIT( boxingb )
|
||||
|
||||
static DRIVER_INIT( qb3 )
|
||||
{
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
memory_install_read8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x0f, 0x0f, 0, 0, qb3_frame_r);
|
||||
memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_IO), 0x00, 0x00, 0, 0, qb3_ram_bank_w);
|
||||
|
||||
memory_configure_bank(machine, "bank1", 0, 4, rambase, 0x100*2);
|
||||
memory_configure_bank(machine, "bank1", 0, 4, state->rambase, 0x100*2);
|
||||
}
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -21,7 +21,6 @@
|
||||
#include "sound/okim6295.h"
|
||||
#include "includes/darkseal.h"
|
||||
|
||||
static UINT16 *darkseal_ram;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@ -61,18 +60,18 @@ static READ16_HANDLER( darkseal_control_r )
|
||||
|
||||
static ADDRESS_MAP_START( darkseal_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x103fff) AM_RAM AM_BASE(&darkseal_ram)
|
||||
AM_RANGE(0x100000, 0x103fff) AM_RAM AM_BASE_MEMBER(darkseal_state, ram)
|
||||
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(darkseal_palette_24bit_rg_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x141000, 0x141fff) AM_RAM_WRITE(darkseal_palette_24bit_b_w) AM_BASE_GENERIC(paletteram2)
|
||||
AM_RANGE(0x180000, 0x18000f) AM_READWRITE(darkseal_control_r, darkseal_control_w)
|
||||
AM_RANGE(0x200000, 0x200fff) AM_WRITE(darkseal_pf3b_data_w) /* 2nd half of pf3, only used on last level */
|
||||
AM_RANGE(0x202000, 0x203fff) AM_WRITE(darkseal_pf3_data_w) AM_BASE(&darkseal_pf3_data)
|
||||
AM_RANGE(0x220000, 0x220fff) AM_RAM AM_BASE(&darkseal_pf12_row)
|
||||
AM_RANGE(0x222000, 0x222fff) AM_RAM AM_BASE(&darkseal_pf34_row)
|
||||
AM_RANGE(0x202000, 0x203fff) AM_WRITE(darkseal_pf3_data_w) AM_BASE_MEMBER(darkseal_state, pf3_data)
|
||||
AM_RANGE(0x220000, 0x220fff) AM_RAM AM_BASE_MEMBER(darkseal_state, pf12_row)
|
||||
AM_RANGE(0x222000, 0x222fff) AM_RAM AM_BASE_MEMBER(darkseal_state, pf34_row)
|
||||
AM_RANGE(0x240000, 0x24000f) AM_WRITE(darkseal_control_0_w)
|
||||
AM_RANGE(0x260000, 0x261fff) AM_WRITE(darkseal_pf2_data_w) AM_BASE(&darkseal_pf2_data)
|
||||
AM_RANGE(0x262000, 0x263fff) AM_WRITE(darkseal_pf1_data_w) AM_BASE(&darkseal_pf1_data)
|
||||
AM_RANGE(0x260000, 0x261fff) AM_WRITE(darkseal_pf2_data_w) AM_BASE_MEMBER(darkseal_state, pf2_data)
|
||||
AM_RANGE(0x262000, 0x263fff) AM_WRITE(darkseal_pf1_data_w) AM_BASE_MEMBER(darkseal_state, pf1_data)
|
||||
AM_RANGE(0x2a0000, 0x2a000f) AM_WRITE(darkseal_control_1_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -227,7 +226,7 @@ static const ym2151_interface ym2151_config =
|
||||
sound_irq
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( darkseal, driver_device )
|
||||
static MACHINE_CONFIG_START( darkseal, darkseal_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000,12000000) /* Custom chip 59 */
|
||||
|
@ -162,11 +162,7 @@ Notes:
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
|
||||
UINT16 *dec0_ram;
|
||||
UINT8 *robocop_shared_ram;
|
||||
|
||||
static UINT8 automat_adpcm_byte;
|
||||
static int automat_msm5205_vclk_toggle;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@ -205,7 +201,7 @@ static WRITE16_HANDLER( dec0_control_w )
|
||||
break;
|
||||
|
||||
case 0xe: /* Reset Intel 8751? - not sure, all the games write here at startup */
|
||||
dec0_i8751_reset();
|
||||
dec0_i8751_reset(space->machine);
|
||||
logerror("CPU #0 PC %06x: warning - write %02x to unmapped memory address %06x\n",cpu_get_pc(space->cpu),data,0x30c010+(offset<<1));
|
||||
break;
|
||||
|
||||
@ -281,33 +277,33 @@ static ADDRESS_MAP_START( dec0_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x05ffff) AM_ROM
|
||||
AM_RANGE(0x240000, 0x240007) AM_WRITE(dec0_pf1_control_0_w) /* text layer */
|
||||
AM_RANGE(0x240010, 0x240017) AM_WRITE(dec0_pf1_control_1_w)
|
||||
AM_RANGE(0x242000, 0x24207f) AM_WRITEONLY AM_BASE(&dec0_pf1_colscroll)
|
||||
AM_RANGE(0x242400, 0x2427ff) AM_WRITEONLY AM_BASE(&dec0_pf1_rowscroll)
|
||||
AM_RANGE(0x242000, 0x24207f) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf1_colscroll)
|
||||
AM_RANGE(0x242400, 0x2427ff) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf1_rowscroll)
|
||||
AM_RANGE(0x242800, 0x243fff) AM_RAM /* Robocop only */
|
||||
AM_RANGE(0x244000, 0x245fff) AM_RAM_WRITE(dec0_pf1_data_w) AM_BASE(&dec0_pf1_data)
|
||||
AM_RANGE(0x244000, 0x245fff) AM_RAM_WRITE(dec0_pf1_data_w) AM_BASE_MEMBER(dec0_state, pf1_data)
|
||||
AM_RANGE(0x246000, 0x246007) AM_WRITE(dec0_pf2_control_0_w) /* first tile layer */
|
||||
AM_RANGE(0x246010, 0x246017) AM_WRITE(dec0_pf2_control_1_w)
|
||||
AM_RANGE(0x248000, 0x24807f) AM_WRITEONLY AM_BASE(&dec0_pf2_colscroll)
|
||||
AM_RANGE(0x248400, 0x2487ff) AM_WRITEONLY AM_BASE(&dec0_pf2_rowscroll)
|
||||
AM_RANGE(0x24a000, 0x24a7ff) AM_RAM_WRITE(dec0_pf2_data_w) AM_BASE(&dec0_pf2_data)
|
||||
AM_RANGE(0x248000, 0x24807f) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf2_colscroll)
|
||||
AM_RANGE(0x248400, 0x2487ff) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf2_rowscroll)
|
||||
AM_RANGE(0x24a000, 0x24a7ff) AM_RAM_WRITE(dec0_pf2_data_w) AM_BASE_MEMBER(dec0_state, pf2_data)
|
||||
AM_RANGE(0x24c000, 0x24c007) AM_WRITE(dec0_pf3_control_0_w) /* second tile layer */
|
||||
AM_RANGE(0x24c010, 0x24c017) AM_WRITE(dec0_pf3_control_1_w)
|
||||
AM_RANGE(0x24c800, 0x24c87f) AM_RAM AM_BASE(&dec0_pf3_colscroll)
|
||||
AM_RANGE(0x24cc00, 0x24cfff) AM_WRITEONLY AM_BASE(&dec0_pf3_rowscroll)
|
||||
AM_RANGE(0x24d000, 0x24d7ff) AM_RAM_WRITE(dec0_pf3_data_w) AM_BASE(&dec0_pf3_data)
|
||||
AM_RANGE(0x24c800, 0x24c87f) AM_RAM AM_BASE_MEMBER(dec0_state, pf3_colscroll)
|
||||
AM_RANGE(0x24cc00, 0x24cfff) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf3_rowscroll)
|
||||
AM_RANGE(0x24d000, 0x24d7ff) AM_RAM_WRITE(dec0_pf3_data_w) AM_BASE_MEMBER(dec0_state, pf3_data)
|
||||
AM_RANGE(0x300000, 0x30001f) AM_READ(dec0_rotary_r)
|
||||
AM_RANGE(0x30c000, 0x30c00b) AM_READ(dec0_controls_r)
|
||||
AM_RANGE(0x30c010, 0x30c01f) AM_WRITE(dec0_control_w) /* Priority, sound, etc. */
|
||||
AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(dec0_paletteram_rg_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x314000, 0x3147ff) AM_RAM_WRITE(dec0_paletteram_b_w) AM_BASE_GENERIC(paletteram2)
|
||||
AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_BASE(&dec0_ram) /* Main ram */
|
||||
AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_BASE_MEMBER(dec0_state, ram) /* Main ram */
|
||||
AM_RANGE(0xffc000, 0xffc7ff) AM_RAM AM_BASE_GENERIC(spriteram) /* Sprites */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( robocop_sub_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x000000, 0x00ffff) AM_ROM
|
||||
AM_RANGE(0x1f0000, 0x1f1fff) AM_RAM /* Main ram */
|
||||
AM_RANGE(0x1f2000, 0x1f3fff) AM_RAM AM_BASE(&robocop_shared_ram) /* Shared ram */
|
||||
AM_RANGE(0x1f2000, 0x1f3fff) AM_RAM AM_BASE_MEMBER(dec0_state, robocop_shared_ram) /* Shared ram */
|
||||
AM_RANGE(0x1ff400, 0x1ff403) AM_WRITE(h6280_irq_status_w)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -326,12 +322,12 @@ static ADDRESS_MAP_START( slyspy_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x05ffff) AM_ROM
|
||||
|
||||
/* These locations aren't real! They are just there so memory is allocated */
|
||||
AM_RANGE(0x200000, 0x2007ff) AM_WRITENOP AM_BASE(&dec0_pf2_data)
|
||||
AM_RANGE(0x202000, 0x203fff) AM_WRITENOP AM_BASE(&dec0_pf1_data)
|
||||
AM_RANGE(0x232000, 0x23207f) AM_WRITENOP AM_BASE(&dec0_pf2_colscroll)
|
||||
AM_RANGE(0x232400, 0x2327ff) AM_WRITENOP AM_BASE(&dec0_pf2_rowscroll)
|
||||
AM_RANGE(0x23c000, 0x23c07f) AM_WRITENOP AM_BASE(&dec0_pf1_colscroll)
|
||||
AM_RANGE(0x23c400, 0x23c7ff) AM_WRITENOP AM_BASE(&dec0_pf1_rowscroll)
|
||||
AM_RANGE(0x200000, 0x2007ff) AM_WRITENOP AM_BASE_MEMBER(dec0_state, pf2_data)
|
||||
AM_RANGE(0x202000, 0x203fff) AM_WRITENOP AM_BASE_MEMBER(dec0_state, pf1_data)
|
||||
AM_RANGE(0x232000, 0x23207f) AM_WRITENOP AM_BASE_MEMBER(dec0_state, pf2_colscroll)
|
||||
AM_RANGE(0x232400, 0x2327ff) AM_WRITENOP AM_BASE_MEMBER(dec0_state, pf2_rowscroll)
|
||||
AM_RANGE(0x23c000, 0x23c07f) AM_WRITENOP AM_BASE_MEMBER(dec0_state, pf1_colscroll)
|
||||
AM_RANGE(0x23c400, 0x23c7ff) AM_WRITENOP AM_BASE_MEMBER(dec0_state, pf1_rowscroll)
|
||||
|
||||
AM_RANGE(0x244000, 0x244001) AM_READ(slyspy_state_r) AM_WRITENOP /* protection */
|
||||
|
||||
@ -347,11 +343,11 @@ static ADDRESS_MAP_START( slyspy_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
/* Pf3 is unaffected by protection */
|
||||
AM_RANGE(0x300000, 0x300007) AM_WRITE(dec0_pf3_control_0_w)
|
||||
AM_RANGE(0x300010, 0x300017) AM_WRITE(dec0_pf3_control_1_w)
|
||||
AM_RANGE(0x300800, 0x30087f) AM_WRITEONLY AM_BASE(&dec0_pf3_colscroll)
|
||||
AM_RANGE(0x300c00, 0x300fff) AM_WRITEONLY AM_BASE(&dec0_pf3_rowscroll)
|
||||
AM_RANGE(0x301000, 0x3017ff) AM_WRITE(dec0_pf3_data_w) AM_BASE(&dec0_pf3_data)
|
||||
AM_RANGE(0x300800, 0x30087f) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf3_colscroll)
|
||||
AM_RANGE(0x300c00, 0x300fff) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf3_rowscroll)
|
||||
AM_RANGE(0x301000, 0x3017ff) AM_WRITE(dec0_pf3_data_w) AM_BASE_MEMBER(dec0_state, pf3_data)
|
||||
|
||||
AM_RANGE(0x304000, 0x307fff) AM_RAM AM_BASE(&dec0_ram) /* Sly spy main ram */
|
||||
AM_RANGE(0x304000, 0x307fff) AM_RAM AM_BASE_MEMBER(dec0_state, ram) /* Sly spy main ram */
|
||||
AM_RANGE(0x308000, 0x3087ff) AM_RAM AM_BASE_GENERIC(spriteram) /* Sprites */
|
||||
AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x314000, 0x314003) AM_WRITE(slyspy_control_w)
|
||||
@ -361,7 +357,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( midres_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x103fff) AM_RAM AM_BASE(&dec0_ram)
|
||||
AM_RANGE(0x100000, 0x103fff) AM_RAM AM_BASE_MEMBER(dec0_state, ram)
|
||||
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE_GENERIC(spriteram)
|
||||
AM_RANGE(0x140000, 0x1407ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x160000, 0x160001) AM_WRITE(dec0_priority_w)
|
||||
@ -371,22 +367,22 @@ static ADDRESS_MAP_START( midres_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
|
||||
AM_RANGE(0x200000, 0x200007) AM_WRITE(dec0_pf2_control_0_w)
|
||||
AM_RANGE(0x200010, 0x200017) AM_WRITE(dec0_pf2_control_1_w)
|
||||
AM_RANGE(0x220000, 0x2207ff) AM_WRITE(dec0_pf2_data_w) AM_BASE(&dec0_pf2_data)
|
||||
AM_RANGE(0x220000, 0x2207ff) AM_WRITE(dec0_pf2_data_w) AM_BASE_MEMBER(dec0_state, pf2_data)
|
||||
AM_RANGE(0x220800, 0x220fff) AM_WRITE(dec0_pf2_data_w) /* mirror address used in end sequence */
|
||||
AM_RANGE(0x240000, 0x24007f) AM_RAM AM_BASE(&dec0_pf2_colscroll)
|
||||
AM_RANGE(0x240400, 0x2407ff) AM_RAM AM_BASE(&dec0_pf2_rowscroll)
|
||||
AM_RANGE(0x240000, 0x24007f) AM_RAM AM_BASE_MEMBER(dec0_state, pf2_colscroll)
|
||||
AM_RANGE(0x240400, 0x2407ff) AM_RAM AM_BASE_MEMBER(dec0_state, pf2_rowscroll)
|
||||
|
||||
AM_RANGE(0x280000, 0x280007) AM_WRITE(dec0_pf3_control_0_w)
|
||||
AM_RANGE(0x280010, 0x280017) AM_WRITE(dec0_pf3_control_1_w)
|
||||
AM_RANGE(0x2a0000, 0x2a07ff) AM_WRITE(dec0_pf3_data_w) AM_BASE(&dec0_pf3_data)
|
||||
AM_RANGE(0x2c0000, 0x2c007f) AM_RAM AM_BASE(&dec0_pf3_colscroll)
|
||||
AM_RANGE(0x2c0400, 0x2c07ff) AM_RAM AM_BASE(&dec0_pf3_rowscroll)
|
||||
AM_RANGE(0x2a0000, 0x2a07ff) AM_WRITE(dec0_pf3_data_w) AM_BASE_MEMBER(dec0_state, pf3_data)
|
||||
AM_RANGE(0x2c0000, 0x2c007f) AM_RAM AM_BASE_MEMBER(dec0_state, pf3_colscroll)
|
||||
AM_RANGE(0x2c0400, 0x2c07ff) AM_RAM AM_BASE_MEMBER(dec0_state, pf3_rowscroll)
|
||||
|
||||
AM_RANGE(0x300000, 0x300007) AM_WRITE(dec0_pf1_control_0_w)
|
||||
AM_RANGE(0x300010, 0x300017) AM_WRITE(dec0_pf1_control_1_w)
|
||||
AM_RANGE(0x320000, 0x321fff) AM_WRITE(dec0_pf1_data_w) AM_BASE(&dec0_pf1_data)
|
||||
AM_RANGE(0x340000, 0x34007f) AM_RAM AM_BASE(&dec0_pf1_colscroll)
|
||||
AM_RANGE(0x340400, 0x3407ff) AM_RAM AM_BASE(&dec0_pf1_rowscroll)
|
||||
AM_RANGE(0x320000, 0x321fff) AM_WRITE(dec0_pf1_data_w) AM_BASE_MEMBER(dec0_state, pf1_data)
|
||||
AM_RANGE(0x340000, 0x34007f) AM_RAM AM_BASE_MEMBER(dec0_state, pf1_colscroll)
|
||||
AM_RANGE(0x340400, 0x3407ff) AM_RAM AM_BASE_MEMBER(dec0_state, pf1_rowscroll)
|
||||
|
||||
AM_RANGE(0x320000, 0x321fff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
@ -429,25 +425,25 @@ static ADDRESS_MAP_START( secretab_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x05ffff) AM_ROM
|
||||
AM_RANGE(0x240000, 0x240007) AM_WRITE(dec0_pf2_control_0_w)
|
||||
AM_RANGE(0x240010, 0x240017) AM_WRITE(dec0_pf2_control_1_w)
|
||||
AM_RANGE(0x246000, 0x247fff) AM_RAM_WRITE(dec0_pf2_data_w) AM_BASE(&dec0_pf2_data)
|
||||
// AM_RANGE(0x240000, 0x24007f) AM_RAM AM_BASE(&dec0_pf2_colscroll)
|
||||
// AM_RANGE(0x240400, 0x2407ff) AM_RAM AM_BASE(&dec0_pf2_rowscroll)
|
||||
AM_RANGE(0x246000, 0x247fff) AM_RAM_WRITE(dec0_pf2_data_w) AM_BASE_MEMBER(dec0_state, pf2_data)
|
||||
// AM_RANGE(0x240000, 0x24007f) AM_RAM AM_BASE_MEMBER(dec0_state, pf2_colscroll)
|
||||
// AM_RANGE(0x240400, 0x2407ff) AM_RAM AM_BASE_MEMBER(dec0_state, pf2_rowscroll)
|
||||
|
||||
// AM_RANGE(0x200000, 0x300007) AM_WRITE(dec0_pf1_control_0_w)
|
||||
// AM_RANGE(0x300010, 0x300017) AM_WRITE(dec0_pf1_control_1_w)
|
||||
AM_RANGE(0x24e000, 0x24ffff) AM_RAM_WRITE(dec0_pf1_data_w) AM_BASE(&dec0_pf1_data)
|
||||
// AM_RANGE(0x340000, 0x34007f) AM_RAM AM_BASE(&dec0_pf1_colscroll)
|
||||
// AM_RANGE(0x340400, 0x3407ff) AM_RAM AM_BASE(&dec0_pf1_rowscroll)
|
||||
AM_RANGE(0x24e000, 0x24ffff) AM_RAM_WRITE(dec0_pf1_data_w) AM_BASE_MEMBER(dec0_state, pf1_data)
|
||||
// AM_RANGE(0x340000, 0x34007f) AM_RAM AM_BASE_MEMBER(dec0_state, pf1_colscroll)
|
||||
// AM_RANGE(0x340400, 0x3407ff) AM_RAM AM_BASE_MEMBER(dec0_state, pf1_rowscroll)
|
||||
|
||||
AM_RANGE(0x314008, 0x31400f) AM_READ(slyspy_controls_r)
|
||||
// AM_RANGE(0x314000, 0x314003) AM_WRITE(slyspy_control_w)
|
||||
|
||||
AM_RANGE(0x300000, 0x300007) AM_WRITE(dec0_pf3_control_0_w)
|
||||
AM_RANGE(0x300010, 0x300017) AM_WRITE(dec0_pf3_control_1_w)
|
||||
AM_RANGE(0x300800, 0x30087f) AM_RAM AM_BASE(&dec0_pf3_colscroll)
|
||||
AM_RANGE(0x300c00, 0x300fff) AM_RAM AM_BASE(&dec0_pf3_rowscroll)
|
||||
AM_RANGE(0x301000, 0x3017ff) AM_RAM_WRITE(dec0_pf3_data_w) AM_BASE(&dec0_pf3_data)
|
||||
AM_RANGE(0x301800, 0x307fff) AM_RAM AM_BASE(&dec0_ram) /* Sly spy main ram */
|
||||
AM_RANGE(0x300800, 0x30087f) AM_RAM AM_BASE_MEMBER(dec0_state, pf3_colscroll)
|
||||
AM_RANGE(0x300c00, 0x300fff) AM_RAM AM_BASE_MEMBER(dec0_state, pf3_rowscroll)
|
||||
AM_RANGE(0x301000, 0x3017ff) AM_RAM_WRITE(dec0_pf3_data_w) AM_BASE_MEMBER(dec0_state, pf3_data)
|
||||
AM_RANGE(0x301800, 0x307fff) AM_RAM AM_BASE_MEMBER(dec0_state, ram) /* Sly spy main ram */
|
||||
AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xb08000, 0xb087ff) AM_RAM AM_BASE_GENERIC(spriteram) /* Sprites */
|
||||
ADDRESS_MAP_END
|
||||
@ -457,36 +453,37 @@ static ADDRESS_MAP_START( automat_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
|
||||
AM_RANGE(0x240000, 0x240007) AM_WRITE(dec0_pf1_control_0_w) /* text layer */
|
||||
AM_RANGE(0x240010, 0x240017) AM_WRITE(dec0_pf1_control_1_w)
|
||||
AM_RANGE(0x242000, 0x24207f) AM_WRITEONLY AM_BASE(&dec0_pf1_colscroll)
|
||||
AM_RANGE(0x242400, 0x2427ff) AM_WRITEONLY AM_BASE(&dec0_pf1_rowscroll)
|
||||
AM_RANGE(0x242000, 0x24207f) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf1_colscroll)
|
||||
AM_RANGE(0x242400, 0x2427ff) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf1_rowscroll)
|
||||
|
||||
AM_RANGE(0x242800, 0x243fff) AM_RAM /* Robocop only */
|
||||
AM_RANGE(0x244000, 0x245fff) AM_RAM_WRITE(dec0_pf1_data_w) AM_BASE(&dec0_pf1_data)
|
||||
AM_RANGE(0x244000, 0x245fff) AM_RAM_WRITE(dec0_pf1_data_w) AM_BASE_MEMBER(dec0_state, pf1_data)
|
||||
|
||||
AM_RANGE(0x246000, 0x246007) AM_WRITE(dec0_pf2_control_0_w) /* first tile layer */
|
||||
AM_RANGE(0x246010, 0x246017) AM_WRITE(dec0_pf2_control_1_w)
|
||||
AM_RANGE(0x248000, 0x24807f) AM_WRITEONLY AM_BASE(&dec0_pf2_colscroll)
|
||||
AM_RANGE(0x248400, 0x2487ff) AM_WRITEONLY AM_BASE(&dec0_pf2_rowscroll)
|
||||
AM_RANGE(0x248000, 0x24807f) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf2_colscroll)
|
||||
AM_RANGE(0x248400, 0x2487ff) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf2_rowscroll)
|
||||
|
||||
AM_RANGE(0x24a000, 0x24a7ff) AM_RAM_WRITE(dec0_pf2_data_w) AM_BASE(&dec0_pf2_data)
|
||||
AM_RANGE(0x24a000, 0x24a7ff) AM_RAM_WRITE(dec0_pf2_data_w) AM_BASE_MEMBER(dec0_state, pf2_data)
|
||||
AM_RANGE(0x24c000, 0x24c007) AM_WRITE(dec0_pf3_control_0_w) /* second tile layer */
|
||||
AM_RANGE(0x24c010, 0x24c017) AM_WRITE(dec0_pf3_control_1_w)
|
||||
AM_RANGE(0x24c800, 0x24c87f) AM_RAM AM_BASE(&dec0_pf3_colscroll)
|
||||
AM_RANGE(0x24cc00, 0x24cfff) AM_WRITEONLY AM_BASE(&dec0_pf3_rowscroll)
|
||||
AM_RANGE(0x24d000, 0x24d7ff) AM_RAM_WRITE(dec0_pf3_data_w) AM_BASE(&dec0_pf3_data)
|
||||
AM_RANGE(0x24c800, 0x24c87f) AM_RAM AM_BASE_MEMBER(dec0_state, pf3_colscroll)
|
||||
AM_RANGE(0x24cc00, 0x24cfff) AM_WRITEONLY AM_BASE_MEMBER(dec0_state, pf3_rowscroll)
|
||||
AM_RANGE(0x24d000, 0x24d7ff) AM_RAM_WRITE(dec0_pf3_data_w) AM_BASE_MEMBER(dec0_state, pf3_data)
|
||||
AM_RANGE(0x300000, 0x30001f) AM_READ(dec0_rotary_r)
|
||||
AM_RANGE(0x30c000, 0x30c00b) AM_READ(dec0_controls_r)
|
||||
AM_RANGE(0x30c000, 0x30c01f) AM_WRITE(automat_control_w) /* Priority, sound, etc. */
|
||||
AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x314000, 0x3147ff) AM_RAM
|
||||
AM_RANGE(0x400008, 0x400009) AM_WRITE(dec0_priority_w) // NEW
|
||||
AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_BASE(&dec0_ram) /* Main ram */
|
||||
AM_RANGE(0xff8000, 0xffbfff) AM_RAM AM_BASE_MEMBER(dec0_state, ram) /* Main ram */
|
||||
AM_RANGE(0xffc000, 0xffc7ff) AM_RAM AM_BASE_GENERIC(spriteram) /* Sprites */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static WRITE8_HANDLER( automat_adpcm_w )
|
||||
{
|
||||
automat_adpcm_byte = data;
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
state->automat_adpcm_byte = data;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( automat_s_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -1122,17 +1119,18 @@ static const ym3812_interface ym3812b_interface =
|
||||
|
||||
static void automat_vclk_cb(device_t *device)
|
||||
{
|
||||
if (automat_msm5205_vclk_toggle == 0)
|
||||
dec0_state *state = device->machine->driver_data<dec0_state>();
|
||||
if (state->automat_msm5205_vclk_toggle == 0)
|
||||
{
|
||||
msm5205_data_w(device, automat_adpcm_byte & 0xf);
|
||||
msm5205_data_w(device, state->automat_adpcm_byte & 0xf);
|
||||
}
|
||||
else
|
||||
{
|
||||
msm5205_data_w(device, automat_adpcm_byte >> 4);
|
||||
msm5205_data_w(device, state->automat_adpcm_byte >> 4);
|
||||
cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
automat_msm5205_vclk_toggle ^= 1;
|
||||
state->automat_msm5205_vclk_toggle ^= 1;
|
||||
}
|
||||
|
||||
static const msm5205_interface msm5205_config =
|
||||
@ -1142,7 +1140,7 @@ static const msm5205_interface msm5205_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( automat, driver_device )
|
||||
static MACHINE_CONFIG_START( automat, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 10000000)
|
||||
@ -1186,7 +1184,7 @@ static MACHINE_CONFIG_START( automat, driver_device )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( hbarrel, driver_device )
|
||||
static MACHINE_CONFIG_START( hbarrel, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
|
||||
@ -1230,7 +1228,7 @@ static MACHINE_CONFIG_START( hbarrel, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( baddudes, driver_device )
|
||||
static MACHINE_CONFIG_START( baddudes, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
|
||||
@ -1271,7 +1269,7 @@ static MACHINE_CONFIG_START( baddudes, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( birdtry, driver_device )
|
||||
static MACHINE_CONFIG_START( birdtry, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
|
||||
@ -1312,7 +1310,7 @@ static MACHINE_CONFIG_START( birdtry, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( robocop, driver_device )
|
||||
static MACHINE_CONFIG_START( robocop, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
|
||||
@ -1358,7 +1356,7 @@ static MACHINE_CONFIG_START( robocop, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( robocopb, driver_device )
|
||||
static MACHINE_CONFIG_START( robocopb, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 10000000)
|
||||
@ -1399,7 +1397,7 @@ static MACHINE_CONFIG_START( robocopb, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( hippodrm, driver_device )
|
||||
static MACHINE_CONFIG_START( hippodrm, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
|
||||
@ -1445,7 +1443,7 @@ static MACHINE_CONFIG_START( hippodrm, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( slyspy, driver_device )
|
||||
static MACHINE_CONFIG_START( slyspy, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb (20MHZ OSC) 68000P12 running at 10Mhz */
|
||||
@ -1486,7 +1484,7 @@ static MACHINE_CONFIG_START( slyspy, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( secretab, driver_device )
|
||||
static MACHINE_CONFIG_START( secretab, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb (20MHZ OSC) 68000P12 running at 10Mhz */
|
||||
@ -1528,7 +1526,7 @@ static MACHINE_CONFIG_START( secretab, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( midres, driver_device )
|
||||
static MACHINE_CONFIG_START( midres, dec0_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb (20MHZ OSC) 68000P12 running at 10Mhz */
|
||||
|
@ -237,24 +237,22 @@ Notes:
|
||||
#include "sound/okim6295.h"
|
||||
#include "sound/bsmt2000.h"
|
||||
|
||||
static UINT32 *deco32_ram;
|
||||
static int raster_enable;
|
||||
static timer_device *raster_irq_timer;
|
||||
static UINT8 nslasher_sound_irq;
|
||||
|
||||
/**********************************************************************************/
|
||||
|
||||
|
||||
static WRITE32_HANDLER( deco32_pf12_control_w )
|
||||
{
|
||||
COMBINE_DATA(&deco32_pf12_control[offset]);
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
COMBINE_DATA(&state->pf12_control[offset]);
|
||||
space->machine->primary_screen->update_partial(space->machine->primary_screen->vpos());
|
||||
}
|
||||
|
||||
|
||||
static WRITE32_HANDLER( deco32_pf34_control_w )
|
||||
{
|
||||
COMBINE_DATA(&deco32_pf34_control[offset]);
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
COMBINE_DATA(&state->pf34_control[offset]);
|
||||
space->machine->primary_screen->update_partial(space->machine->primary_screen->vpos());
|
||||
}
|
||||
|
||||
@ -303,23 +301,24 @@ static READ32_HANDLER( deco32_irq_controller_r )
|
||||
|
||||
static WRITE32_HANDLER( deco32_irq_controller_w )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
int scanline;
|
||||
|
||||
switch (offset) {
|
||||
case 0: /* IRQ enable - probably an irq mask, but only values used are 0xc8 and 0xca */
|
||||
// logerror("%08x: IRQ write %d %08x\n",cpu_get_pc(space->cpu),offset,data);
|
||||
raster_enable=(data&0xff)==0xc8; /* 0xca seems to be off */
|
||||
state->raster_enable=(data&0xff)==0xc8; /* 0xca seems to be off */
|
||||
break;
|
||||
|
||||
case 1: /* Raster IRQ scanline position, only valid for values between 1 & 239 (0 and 240-256 do NOT generate IRQ's) */
|
||||
scanline=(data&0xff);
|
||||
if (raster_enable && scanline>0 && scanline<240)
|
||||
if (state->raster_enable && scanline>0 && scanline<240)
|
||||
{
|
||||
// needs +16 for the raster to align on captaven intro? (might just be our screen size / visible area / layer offsets need adjusting instead)
|
||||
raster_irq_timer->adjust(space->machine->primary_screen->time_until_pos(scanline+16, 320));
|
||||
state->raster_irq_timer->adjust(space->machine->primary_screen->time_until_pos(scanline+16, 320));
|
||||
}
|
||||
else
|
||||
raster_irq_timer->reset();
|
||||
state->raster_irq_timer->reset();
|
||||
break;
|
||||
case 2: /* VBL irq ack */
|
||||
break;
|
||||
@ -404,42 +403,43 @@ static READ32_HANDLER( lockload_gun_mirror_r )
|
||||
|
||||
static READ32_HANDLER( dragngun_prot_r )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
// logerror("%08x:Read prot %08x (%08x)\n",cpu_get_pc(space->cpu),offset<<1,mem_mask);
|
||||
|
||||
static int strobe=0;
|
||||
if (!strobe) strobe=8;
|
||||
else strobe=0;
|
||||
if (!state->strobe) state->strobe=8;
|
||||
else state->strobe=0;
|
||||
|
||||
//definitely vblank in locked load
|
||||
|
||||
switch (offset<<1) {
|
||||
case 0x140/2: return 0xffff0000 | input_port_read(space->machine, "IN0"); /* IN0 */
|
||||
case 0xadc/2: return 0xffff0000 | input_port_read(space->machine, "IN1") | strobe; /* IN1 */
|
||||
case 0xadc/2: return 0xffff0000 | input_port_read(space->machine, "IN1") | state->strobe; /* IN1 */
|
||||
case 0x6a0/2: return 0xffff0000 | input_port_read(space->machine, "DSW"); /* IN2 (Dip switch) */
|
||||
}
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
static int dragngun_lightgun_port;
|
||||
|
||||
static READ32_HANDLER( dragngun_lightgun_r )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
/* Ports 0-3 are read, but seem unused */
|
||||
switch (dragngun_lightgun_port) {
|
||||
switch (state->dragngun_lightgun_port) {
|
||||
case 4: return input_port_read(space->machine, "LIGHT0_X");
|
||||
case 5: return input_port_read(space->machine, "LIGHT1_X");
|
||||
case 6: return input_port_read(space->machine, "LIGHT0_Y");
|
||||
case 7: return input_port_read(space->machine, "LIGHT1_Y");
|
||||
}
|
||||
|
||||
// logerror("Illegal lightgun port %d read \n",dragngun_lightgun_port);
|
||||
// logerror("Illegal lightgun port %d read \n",state->dragngun_lightgun_port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( dragngun_lightgun_w )
|
||||
{
|
||||
// logerror("Lightgun port %d\n",dragngun_lightgun_port);
|
||||
dragngun_lightgun_port=offset;
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
// logerror("Lightgun port %d\n",state->dragngun_lightgun_port);
|
||||
state->dragngun_lightgun_port=offset;
|
||||
}
|
||||
|
||||
static READ32_DEVICE_HANDLER( dragngun_eeprom_r )
|
||||
@ -460,14 +460,14 @@ static WRITE32_DEVICE_HANDLER( dragngun_eeprom_w )
|
||||
|
||||
/**********************************************************************************/
|
||||
|
||||
static int tattass_eprom_bit;
|
||||
|
||||
static READ32_HANDLER( tattass_prot_r )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
switch (offset<<1) {
|
||||
case 0x280: return input_port_read(space->machine, "IN0") << 16;
|
||||
case 0x4c4: return input_port_read(space->machine, "IN1") << 16;
|
||||
case 0x35a: return tattass_eprom_bit << 16;
|
||||
case 0x35a: return state->tattass_eprom_bit << 16;
|
||||
}
|
||||
|
||||
logerror("%08x:Read prot %08x (%08x)\n",cpu_get_pc(space->cpu),offset<<1,mem_mask);
|
||||
@ -488,12 +488,7 @@ static WRITE32_HANDLER( tattass_prot_w )
|
||||
|
||||
static WRITE32_HANDLER( tattass_control_w )
|
||||
{
|
||||
static int lastClock=0;
|
||||
static char buffer[32];
|
||||
static int bufPtr=0;
|
||||
static int pendingCommand=0; /* 1 = read, 2 = write */
|
||||
static int readBitCount=0;
|
||||
static int byteAddr=0;
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
eeprom_device *eeprom = space->machine->device<eeprom_device>("eeprom");
|
||||
address_space *eeprom_space = eeprom->space();
|
||||
|
||||
@ -520,71 +515,71 @@ static WRITE32_HANDLER( tattass_control_w )
|
||||
|
||||
*/
|
||||
if ((data&0x40)==0) {
|
||||
if (bufPtr) {
|
||||
if (state->bufPtr) {
|
||||
int i;
|
||||
logerror("Eprom reset (bit count %d): ",readBitCount);
|
||||
for (i=0; i<bufPtr; i++)
|
||||
logerror("%s",buffer[i] ? "1" : "0");
|
||||
logerror("Eprom reset (bit count %d): ",state->readBitCount);
|
||||
for (i=0; i<state->bufPtr; i++)
|
||||
logerror("%s",state->buffer[i] ? "1" : "0");
|
||||
logerror("\n");
|
||||
|
||||
}
|
||||
bufPtr=0;
|
||||
pendingCommand=0;
|
||||
readBitCount=0;
|
||||
state->bufPtr=0;
|
||||
state->pendingCommand=0;
|
||||
state->readBitCount=0;
|
||||
}
|
||||
|
||||
/* Eprom has been clocked */
|
||||
if (lastClock==0 && data&0x20 && data&0x40) {
|
||||
if (bufPtr>=32) {
|
||||
if (state->lastClock==0 && data&0x20 && data&0x40) {
|
||||
if (state->bufPtr>=32) {
|
||||
logerror("Eprom overflow!");
|
||||
bufPtr=0;
|
||||
state->bufPtr=0;
|
||||
}
|
||||
|
||||
/* Handle pending read */
|
||||
if (pendingCommand==1) {
|
||||
int d=readBitCount/8;
|
||||
int m=7-(readBitCount%8);
|
||||
int a=(byteAddr+d)%1024;
|
||||
if (state->pendingCommand==1) {
|
||||
int d=state->readBitCount/8;
|
||||
int m=7-(state->readBitCount%8);
|
||||
int a=(state->byteAddr+d)%1024;
|
||||
int b=eeprom_space->read_byte(a);
|
||||
|
||||
tattass_eprom_bit=(b>>m)&1;
|
||||
state->tattass_eprom_bit=(b>>m)&1;
|
||||
|
||||
readBitCount++;
|
||||
lastClock=data&0x20;
|
||||
state->readBitCount++;
|
||||
state->lastClock=data&0x20;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle pending write */
|
||||
if (pendingCommand==2) {
|
||||
buffer[bufPtr++]=(data&0x10)>>4;
|
||||
if (state->pendingCommand==2) {
|
||||
state->buffer[state->bufPtr++]=(data&0x10)>>4;
|
||||
|
||||
if (bufPtr==32) {
|
||||
int b=(buffer[24]<<7)|(buffer[25]<<6)|(buffer[26]<<5)|(buffer[27]<<4)
|
||||
|(buffer[28]<<3)|(buffer[29]<<2)|(buffer[30]<<1)|(buffer[31]<<0);
|
||||
if (state->bufPtr==32) {
|
||||
int b=(state->buffer[24]<<7)|(state->buffer[25]<<6)|(state->buffer[26]<<5)|(state->buffer[27]<<4)
|
||||
|(state->buffer[28]<<3)|(state->buffer[29]<<2)|(state->buffer[30]<<1)|(state->buffer[31]<<0);
|
||||
|
||||
eeprom_space->write_byte(byteAddr, b);
|
||||
eeprom_space->write_byte(state->byteAddr, b);
|
||||
}
|
||||
lastClock=data&0x20;
|
||||
state->lastClock=data&0x20;
|
||||
return;
|
||||
}
|
||||
|
||||
buffer[bufPtr++]=(data&0x10)>>4;
|
||||
if (bufPtr==24) {
|
||||
state->buffer[state->bufPtr++]=(data&0x10)>>4;
|
||||
if (state->bufPtr==24) {
|
||||
/* Decode addr */
|
||||
byteAddr=(buffer[3]<<9)|(buffer[4]<<8)
|
||||
|(buffer[16]<<7)|(buffer[17]<<6)|(buffer[18]<<5)|(buffer[19]<<4)
|
||||
|(buffer[20]<<3)|(buffer[21]<<2)|(buffer[22]<<1)|(buffer[23]<<0);
|
||||
state->byteAddr=(state->buffer[3]<<9)|(state->buffer[4]<<8)
|
||||
|(state->buffer[16]<<7)|(state->buffer[17]<<6)|(state->buffer[18]<<5)|(state->buffer[19]<<4)
|
||||
|(state->buffer[20]<<3)|(state->buffer[21]<<2)|(state->buffer[22]<<1)|(state->buffer[23]<<0);
|
||||
|
||||
/* Check for read command */
|
||||
if (buffer[0] && buffer[1]) {
|
||||
tattass_eprom_bit=(eeprom_space->read_byte(byteAddr)>>7)&1;
|
||||
readBitCount=1;
|
||||
pendingCommand=1;
|
||||
if (state->buffer[0] && state->buffer[1]) {
|
||||
state->tattass_eprom_bit=(eeprom_space->read_byte(state->byteAddr)>>7)&1;
|
||||
state->readBitCount=1;
|
||||
state->pendingCommand=1;
|
||||
}
|
||||
|
||||
/* Check for write command */
|
||||
else if (buffer[0]==0x0 && buffer[1]==0x0) {
|
||||
pendingCommand=2;
|
||||
else if (state->buffer[0]==0x0 && state->buffer[1]==0x0) {
|
||||
state->pendingCommand=2;
|
||||
}
|
||||
else {
|
||||
logerror("Detected unknown eprom command\n");
|
||||
@ -594,11 +589,11 @@ static WRITE32_HANDLER( tattass_control_w )
|
||||
} else {
|
||||
if (!(data&0x40)) {
|
||||
logerror("Cs set low\n");
|
||||
bufPtr=0;
|
||||
state->bufPtr=0;
|
||||
}
|
||||
}
|
||||
|
||||
lastClock=data&0x20;
|
||||
state->lastClock=data&0x20;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -655,6 +650,7 @@ static WRITE32_HANDLER( nslasher_eeprom_w )
|
||||
|
||||
static WRITE32_HANDLER( nslasher_prot_w )
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
//logerror("%08x:write prot %08x (%08x) %08x\n",cpu_get_pc(space->cpu),offset<<1,mem_mask,data);
|
||||
|
||||
/* Only sound port of chip is used - no protection */
|
||||
@ -662,8 +658,8 @@ static WRITE32_HANDLER( nslasher_prot_w )
|
||||
|
||||
/* bit 1 of nslasher_sound_irq specifies IRQ command writes */
|
||||
soundlatch_w(space,0,(data>>16)&0xff);
|
||||
nslasher_sound_irq |= 0x02;
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
|
||||
state->nslasher_sound_irq |= 0x02;
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, (state->nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -676,7 +672,7 @@ static ADDRESS_MAP_START( captaven_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x100000, 0x100003) AM_WRITE(buffer_spriteram32_w)
|
||||
AM_RANGE(0x108000, 0x108003) AM_WRITENOP /* ? */
|
||||
AM_RANGE(0x110000, 0x110fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Sprites */
|
||||
AM_RANGE(0x120000, 0x127fff) AM_RAM AM_BASE(&deco32_ram) /* Main RAM */
|
||||
AM_RANGE(0x120000, 0x127fff) AM_RAM AM_BASE_MEMBER(deco32_state, ram) /* Main RAM */
|
||||
AM_RANGE(0x128000, 0x128fff) AM_READ(captaven_prot_r)
|
||||
AM_RANGE(0x1280c8, 0x1280cb) AM_WRITE(deco32_sound_w)
|
||||
AM_RANGE(0x130000, 0x131fff) AM_RAM_WRITE(deco32_nonbuffered_palette_w) AM_BASE_GENERIC(paletteram) /* Palette RAM */
|
||||
@ -686,22 +682,22 @@ static ADDRESS_MAP_START( captaven_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
|
||||
AM_RANGE(0x178000, 0x178003) AM_WRITE(deco32_pri_w)
|
||||
|
||||
AM_RANGE(0x180000, 0x18001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE(&deco32_pf1_data)
|
||||
AM_RANGE(0x180000, 0x18001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
AM_RANGE(0x192000, 0x193fff) AM_WRITE(deco32_pf1_data_w) /* Mirror address - bug in program code */
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE(&deco32_pf2_data)
|
||||
AM_RANGE(0x1a0000, 0x1a1fff) AM_RAM AM_BASE(&deco32_pf1_rowscroll)
|
||||
AM_RANGE(0x1a4000, 0x1a5fff) AM_RAM AM_BASE(&deco32_pf2_rowscroll)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE_MEMBER(deco32_state, pf2_data)
|
||||
AM_RANGE(0x1a0000, 0x1a1fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf1_rowscroll)
|
||||
AM_RANGE(0x1a4000, 0x1a5fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf2_rowscroll)
|
||||
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1d0000, 0x1d1fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE(&deco32_pf3_data)
|
||||
AM_RANGE(0x1e0000, 0x1e1fff) AM_RAM AM_BASE(&deco32_pf3_rowscroll)
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
AM_RANGE(0x1d0000, 0x1d1fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE_MEMBER(deco32_state, pf3_data)
|
||||
AM_RANGE(0x1e0000, 0x1e1fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf3_rowscroll)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( fghthist_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x001fff) AM_ROM AM_WRITE(deco32_pf1_data_w)
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE(&deco32_ram)
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE_MEMBER(deco32_state, ram)
|
||||
AM_RANGE(0x120020, 0x12002f) AM_READ(fghthist_control_r)
|
||||
AM_RANGE(0x12002c, 0x12002f) AM_WRITE(fghthist_eeprom_w)
|
||||
AM_RANGE(0x1201fc, 0x1201ff) AM_WRITE(deco32_sound_w)
|
||||
@ -715,17 +711,17 @@ static ADDRESS_MAP_START( fghthist_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x179000, 0x179fff) AM_RAM AM_BASE_GENERIC(spriteram2) // ?
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram32_w)
|
||||
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE(&deco32_pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE(&deco32_pf2_data)
|
||||
AM_RANGE(0x192000, 0x192fff) AM_RAM AM_BASE(&deco32_pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x194fff) AM_RAM AM_BASE(&deco32_pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE_MEMBER(deco32_state, pf2_data)
|
||||
AM_RANGE(0x192000, 0x192fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x194fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE(&deco32_pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE(&deco32_pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d2fff) AM_RAM AM_BASE(&deco32_pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d4fff) AM_RAM AM_BASE(&deco32_pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE_MEMBER(deco32_state, pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE_MEMBER(deco32_state, pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d2fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d4fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
|
||||
AM_RANGE(0x16c000, 0x16c01f) AM_READNOP
|
||||
AM_RANGE(0x17c000, 0x17c03f) AM_READNOP
|
||||
@ -736,7 +732,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( fghthsta_memmap, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE(&deco32_ram)
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE_MEMBER(deco32_state, ram)
|
||||
AM_RANGE(0x140000, 0x140003) AM_WRITENOP /* VBL irq ack */
|
||||
AM_RANGE(0x150000, 0x150003) AM_WRITE(fghthist_eeprom_w) /* Volume port/Eprom */
|
||||
|
||||
@ -748,17 +744,17 @@ static ADDRESS_MAP_START( fghthsta_memmap, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram32_w)
|
||||
AM_RANGE(0x17c020, 0x17c023) AM_READNOP
|
||||
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE(&deco32_pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE(&deco32_pf2_data)
|
||||
AM_RANGE(0x192000, 0x192fff) AM_RAM AM_BASE(&deco32_pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x194fff) AM_RAM AM_BASE(&deco32_pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE_MEMBER(deco32_state, pf2_data)
|
||||
AM_RANGE(0x192000, 0x192fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x194fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE(&deco32_pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE(&deco32_pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d2fff) AM_RAM AM_BASE(&deco32_pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d4fff) AM_RAM AM_BASE(&deco32_pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE_MEMBER(deco32_state, pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE_MEMBER(deco32_state, pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d2fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d4fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
|
||||
AM_RANGE(0x200000, 0x200fff) AM_READWRITE(deco16_146_fghthist_prot_r, deco16_146_fghthist_prot_w) AM_BASE(&deco32_prot_ram)
|
||||
ADDRESS_MAP_END
|
||||
@ -767,7 +763,7 @@ ADDRESS_MAP_END
|
||||
// raster effects appear to need some work on it anyway?
|
||||
static ADDRESS_MAP_START( dragngun_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE(&deco32_ram)
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE_MEMBER(deco32_state, ram)
|
||||
AM_RANGE(0x120000, 0x120fff) AM_READ(dragngun_prot_r)
|
||||
AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w)
|
||||
AM_RANGE(0x128000, 0x12800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w)
|
||||
@ -775,27 +771,27 @@ static ADDRESS_MAP_START( dragngun_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x138000, 0x138003) AM_NOP /* Palette dma complete in bit 0x8? ack? return 0 else tight loop */
|
||||
AM_RANGE(0x138008, 0x13800b) AM_WRITE(deco32_palette_dma_w)
|
||||
|
||||
// AM_RANGE(0x180000, 0x18001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x180000, 0x18001f) AM_RAM AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE(&deco32_pf1_data)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE(&deco32_pf2_data)
|
||||
AM_RANGE(0x1a0000, 0x1a0fff) AM_RAM AM_BASE(&deco32_pf1_rowscroll)
|
||||
AM_RANGE(0x1a4000, 0x1a4fff) AM_RAM AM_BASE(&deco32_pf2_rowscroll)
|
||||
// AM_RANGE(0x180000, 0x18001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
AM_RANGE(0x180000, 0x18001f) AM_RAM AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE_MEMBER(deco32_state, pf2_data)
|
||||
AM_RANGE(0x1a0000, 0x1a0fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf1_rowscroll)
|
||||
AM_RANGE(0x1a4000, 0x1a4fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf2_rowscroll)
|
||||
|
||||
// AM_RANGE(0x1c0000, 0x1c001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_RAM AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1d0000, 0x1d1fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE(&deco32_pf3_data)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE(&deco32_pf4_data)
|
||||
AM_RANGE(0x1e0000, 0x1e0fff) AM_RAM AM_BASE(&deco32_pf3_rowscroll)
|
||||
AM_RANGE(0x1e4000, 0x1e4fff) AM_RAM AM_BASE(&deco32_pf4_rowscroll)
|
||||
// AM_RANGE(0x1c0000, 0x1c001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_RAM AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
AM_RANGE(0x1d0000, 0x1d1fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE_MEMBER(deco32_state, pf3_data)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE_MEMBER(deco32_state, pf4_data)
|
||||
AM_RANGE(0x1e0000, 0x1e0fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf3_rowscroll)
|
||||
AM_RANGE(0x1e4000, 0x1e4fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf4_rowscroll)
|
||||
|
||||
AM_RANGE(0x204800, 0x204fff) AM_RAM // ace? 0x10 byte increments only // 13f ff stuff
|
||||
|
||||
|
||||
AM_RANGE(0x208000, 0x208fff) AM_RAM AM_BASE(&dragngun_sprite_layout_0_ram)
|
||||
AM_RANGE(0x20c000, 0x20cfff) AM_RAM AM_BASE(&dragngun_sprite_layout_1_ram)
|
||||
AM_RANGE(0x210000, 0x217fff) AM_RAM AM_BASE(&dragngun_sprite_lookup_0_ram)
|
||||
AM_RANGE(0x218000, 0x21ffff) AM_RAM AM_BASE(&dragngun_sprite_lookup_1_ram)
|
||||
AM_RANGE(0x208000, 0x208fff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_layout_0_ram)
|
||||
AM_RANGE(0x20c000, 0x20cfff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_layout_1_ram)
|
||||
AM_RANGE(0x210000, 0x217fff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_lookup_0_ram)
|
||||
AM_RANGE(0x218000, 0x21ffff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_lookup_1_ram)
|
||||
AM_RANGE(0x220000, 0x221fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Main spriteram */
|
||||
|
||||
AM_RANGE(0x228000, 0x2283ff) AM_RAM //0x10 byte increments only
|
||||
@ -816,7 +812,7 @@ ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( lockload_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE(&deco32_ram)
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE_MEMBER(deco32_state, ram)
|
||||
AM_RANGE(0x120000, 0x120fff) AM_READ(dragngun_prot_r)
|
||||
AM_RANGE(0x1204c0, 0x1204c3) AM_WRITE(deco32_sound_w)
|
||||
AM_RANGE(0x128000, 0x12800f) AM_READWRITE(deco32_irq_controller_r, deco32_irq_controller_w)
|
||||
@ -828,25 +824,25 @@ static ADDRESS_MAP_START( lockload_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x170000, 0x170007) AM_READ(lockload_gun_mirror_r) /* Not on Dragongun */
|
||||
AM_RANGE(0x178008, 0x17800f) AM_WRITENOP /* Gun read ACK's */
|
||||
|
||||
// AM_RANGE(0x180000, 0x18001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x180000, 0x18001f) AM_RAM AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE(&deco32_pf1_data)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE(&deco32_pf2_data)
|
||||
AM_RANGE(0x1a0000, 0x1a0fff) AM_RAM AM_BASE(&deco32_pf1_rowscroll)
|
||||
AM_RANGE(0x1a4000, 0x1a4fff) AM_RAM AM_BASE(&deco32_pf2_rowscroll)
|
||||
// AM_RANGE(0x180000, 0x18001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
AM_RANGE(0x180000, 0x18001f) AM_RAM AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
AM_RANGE(0x190000, 0x191fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE_MEMBER(deco32_state, pf2_data)
|
||||
AM_RANGE(0x1a0000, 0x1a0fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf1_rowscroll)
|
||||
AM_RANGE(0x1a4000, 0x1a4fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf2_rowscroll)
|
||||
|
||||
// AM_RANGE(0x1c0000, 0x1c001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_RAM AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1d0000, 0x1d1fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE(&deco32_pf3_data)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE(&deco32_pf4_data)
|
||||
AM_RANGE(0x1e0000, 0x1e0fff) AM_RAM AM_BASE(&deco32_pf3_rowscroll)
|
||||
AM_RANGE(0x1e4000, 0x1e4fff) AM_RAM AM_BASE(&deco32_pf4_rowscroll)
|
||||
// AM_RANGE(0x1c0000, 0x1c001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
AM_RANGE(0x1c0000, 0x1c001f) AM_RAM AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
AM_RANGE(0x1d0000, 0x1d1fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE_MEMBER(deco32_state, pf3_data)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE_MEMBER(deco32_state, pf4_data)
|
||||
AM_RANGE(0x1e0000, 0x1e0fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf3_rowscroll)
|
||||
AM_RANGE(0x1e4000, 0x1e4fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf4_rowscroll)
|
||||
|
||||
AM_RANGE(0x204800, 0x204fff) AM_RAM //0x10 byte increments only
|
||||
AM_RANGE(0x208000, 0x208fff) AM_RAM AM_BASE(&dragngun_sprite_layout_0_ram)
|
||||
AM_RANGE(0x20c000, 0x20cfff) AM_RAM AM_BASE(&dragngun_sprite_layout_1_ram)
|
||||
AM_RANGE(0x210000, 0x217fff) AM_RAM AM_BASE(&dragngun_sprite_lookup_0_ram)
|
||||
AM_RANGE(0x218000, 0x21ffff) AM_RAM AM_BASE(&dragngun_sprite_lookup_1_ram)
|
||||
AM_RANGE(0x208000, 0x208fff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_layout_0_ram)
|
||||
AM_RANGE(0x20c000, 0x20cfff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_layout_1_ram)
|
||||
AM_RANGE(0x210000, 0x217fff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_lookup_0_ram)
|
||||
AM_RANGE(0x218000, 0x21ffff) AM_RAM AM_BASE_MEMBER(deco32_state, dragngun_sprite_lookup_1_ram)
|
||||
AM_RANGE(0x220000, 0x221fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) /* Main spriteram */
|
||||
|
||||
AM_RANGE(0x228000, 0x2283ff) AM_RAM //0x10 byte increments only
|
||||
@ -866,14 +862,14 @@ static ADDRESS_MAP_START( tattass_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
|
||||
AM_RANGE(0x000000, 0x0f7fff) AM_ROM
|
||||
AM_RANGE(0x0f8000, 0x0fffff) AM_ROM AM_WRITENOP
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE(&deco32_ram)
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE_MEMBER(deco32_state, ram)
|
||||
AM_RANGE(0x120000, 0x120003) AM_NOP /* ACIA (unused) */
|
||||
AM_RANGE(0x130000, 0x130003) AM_WRITENOP /* Coin port (unused?) */
|
||||
AM_RANGE(0x140000, 0x140003) AM_WRITENOP /* Vblank ack */
|
||||
AM_RANGE(0x150000, 0x150003) AM_WRITE(tattass_control_w) /* Volume port/Eprom/Priority */
|
||||
|
||||
AM_RANGE(0x162000, 0x162fff) AM_RAM /* 'Jack' RAM!? */
|
||||
AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(deco32_ace_ram_w) AM_BASE(&deco32_ace_ram)
|
||||
AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(deco32_ace_ram_w) AM_BASE_MEMBER(deco32_state, ace_ram)
|
||||
AM_RANGE(0x164000, 0x164003) AM_WRITENOP /* Palette control BG2/3 ($1a constant) */
|
||||
AM_RANGE(0x164004, 0x164007) AM_WRITENOP /* Palette control Obj1 ($6 constant) */
|
||||
AM_RANGE(0x164008, 0x16400b) AM_WRITENOP /* Palette control Obj2 ($5 constant) */
|
||||
@ -892,29 +888,29 @@ static ADDRESS_MAP_START( tattass_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram32_2_w)
|
||||
AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */
|
||||
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE(&deco32_pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE(&deco32_pf2_data)
|
||||
AM_RANGE(0x192000, 0x193fff) AM_RAM AM_BASE(&deco32_pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM AM_BASE(&deco32_pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE_MEMBER(deco32_state, pf2_data)
|
||||
AM_RANGE(0x192000, 0x193fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE(&deco32_pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE(&deco32_pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM AM_BASE(&deco32_pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM AM_BASE(&deco32_pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE_MEMBER(deco32_state, pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE_MEMBER(deco32_state, pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
|
||||
AM_RANGE(0x200000, 0x200fff) AM_READWRITE(tattass_prot_r, tattass_prot_w) AM_BASE(&deco32_prot_ram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( nslasher_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE(&deco32_ram)
|
||||
AM_RANGE(0x100000, 0x11ffff) AM_RAM AM_BASE_MEMBER(deco32_state, ram)
|
||||
AM_RANGE(0x120000, 0x1200ff) AM_NOP /* ACIA (unused) */
|
||||
AM_RANGE(0x140000, 0x140003) AM_WRITENOP /* Vblank ack */
|
||||
AM_RANGE(0x150000, 0x150003) AM_WRITE(nslasher_eeprom_w) /* Volume port/Eprom/Priority */
|
||||
|
||||
AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(deco32_ace_ram_w) AM_BASE(&deco32_ace_ram) /* 'Ace' RAM!? */
|
||||
AM_RANGE(0x163000, 0x16309f) AM_RAM_WRITE(deco32_ace_ram_w) AM_BASE_MEMBER(deco32_state, ace_ram) /* 'Ace' RAM!? */
|
||||
AM_RANGE(0x164000, 0x164003) AM_WRITENOP /* Palette control BG2/3 ($1a constant) */
|
||||
AM_RANGE(0x164004, 0x164007) AM_WRITENOP /* Palette control Obj1 ($4 constant) */
|
||||
AM_RANGE(0x164008, 0x16400b) AM_WRITENOP /* Palette control Obj2 ($6 constant) */
|
||||
@ -932,37 +928,37 @@ static ADDRESS_MAP_START( nslasher_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x17c010, 0x17c013) AM_WRITE(buffer_spriteram32_2_w)
|
||||
AM_RANGE(0x17c018, 0x17c01b) AM_WRITENOP /* Sprite 'CPU' (unused) */
|
||||
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE(&deco32_pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE(&deco32_pf2_data)
|
||||
AM_RANGE(0x192000, 0x193fff) AM_RAM AM_BASE(&deco32_pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM AM_BASE(&deco32_pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE(&deco32_pf12_control)
|
||||
AM_RANGE(0x182000, 0x183fff) AM_RAM_WRITE(deco32_pf1_data_w) AM_BASE_MEMBER(deco32_state, pf1_data)
|
||||
AM_RANGE(0x184000, 0x185fff) AM_RAM_WRITE(deco32_pf2_data_w) AM_BASE_MEMBER(deco32_state, pf2_data)
|
||||
AM_RANGE(0x192000, 0x193fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf1_rowscroll)
|
||||
AM_RANGE(0x194000, 0x195fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf2_rowscroll)
|
||||
AM_RANGE(0x1a0000, 0x1a001f) AM_RAM_WRITE(deco32_pf12_control_w) AM_BASE_MEMBER(deco32_state, pf12_control)
|
||||
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE(&deco32_pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE(&deco32_pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM AM_BASE(&deco32_pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM AM_BASE(&deco32_pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE(&deco32_pf34_control)
|
||||
AM_RANGE(0x1c2000, 0x1c3fff) AM_RAM_WRITE(deco32_pf3_data_w) AM_BASE_MEMBER(deco32_state, pf3_data)
|
||||
AM_RANGE(0x1c4000, 0x1c5fff) AM_RAM_WRITE(deco32_pf4_data_w) AM_BASE_MEMBER(deco32_state, pf4_data)
|
||||
AM_RANGE(0x1d2000, 0x1d3fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf3_rowscroll)
|
||||
AM_RANGE(0x1d4000, 0x1d5fff) AM_RAM AM_BASE_MEMBER(deco32_state, pf4_rowscroll)
|
||||
AM_RANGE(0x1e0000, 0x1e001f) AM_RAM_WRITE(deco32_pf34_control_w) AM_BASE_MEMBER(deco32_state, pf34_control)
|
||||
|
||||
AM_RANGE(0x200000, 0x200fff) AM_READWRITE(nslasher_prot_r, nslasher_prot_w) AM_BASE(&deco32_prot_ram)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static UINT8 bsmt_latch;
|
||||
static UINT8 bsmt_reset;
|
||||
|
||||
static WRITE8_HANDLER(deco32_bsmt_reset_w)
|
||||
{
|
||||
UINT8 diff = data ^ bsmt_reset;
|
||||
bsmt_reset = data;
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
UINT8 diff = data ^ state->bsmt_reset;
|
||||
state->bsmt_reset = data;
|
||||
if ((diff & 0x80) && !(data & 0x80))
|
||||
devtag_reset(space->machine, "bsmt");
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(deco32_bsmt0_w)
|
||||
{
|
||||
bsmt_latch = data;
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
state->bsmt_latch = data;
|
||||
}
|
||||
|
||||
static void bsmt_ready_callback(bsmt2000_device &device)
|
||||
@ -972,9 +968,10 @@ static void bsmt_ready_callback(bsmt2000_device &device)
|
||||
|
||||
static WRITE8_HANDLER(deco32_bsmt1_w)
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
bsmt2000_device *bsmt = space->machine->device<bsmt2000_device>("bsmt");
|
||||
bsmt->write_reg(offset ^ 0xff);
|
||||
bsmt->write_data((bsmt_latch << 8) | data);
|
||||
bsmt->write_data((state->bsmt_latch << 8) | data);
|
||||
cputag_set_input_line(space->machine, "audiocpu", M6809_IRQ_LINE, CLEAR_LINE); /* BSMT is not ready */
|
||||
}
|
||||
|
||||
@ -1007,9 +1004,10 @@ ADDRESS_MAP_END
|
||||
|
||||
static READ8_HANDLER(latch_r)
|
||||
{
|
||||
deco32_state *state = space->machine->driver_data<deco32_state>();
|
||||
/* bit 1 of nslasher_sound_irq specifies IRQ command writes */
|
||||
nslasher_sound_irq &= ~0x02;
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
|
||||
state->nslasher_sound_irq &= ~0x02;
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, (state->nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
|
||||
return soundlatch_r(space,0);
|
||||
}
|
||||
|
||||
@ -1612,12 +1610,13 @@ static void sound_irq(device_t *device, int state)
|
||||
|
||||
static void sound_irq_nslasher(device_t *device, int state)
|
||||
{
|
||||
deco32_state *drvstate = device->machine->driver_data<deco32_state>();
|
||||
/* bit 0 of nslasher_sound_irq specifies IRQ from sound chip */
|
||||
if (state)
|
||||
nslasher_sound_irq |= 0x01;
|
||||
drvstate->nslasher_sound_irq |= 0x01;
|
||||
else
|
||||
nslasher_sound_irq &= ~0x01;
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, (nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
|
||||
drvstate->nslasher_sound_irq &= ~0x01;
|
||||
cputag_set_input_line(device->machine, "audiocpu", 0, (drvstate->nslasher_sound_irq != 0) ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( sound_bankswitch_w )
|
||||
@ -1650,7 +1649,8 @@ static const eeprom_interface eeprom_interface_tattass =
|
||||
|
||||
static MACHINE_RESET( deco32 )
|
||||
{
|
||||
raster_irq_timer = machine->device<timer_device>("int_timer");
|
||||
deco32_state *state = machine->driver_data<deco32_state>();
|
||||
state->raster_irq_timer = machine->device<timer_device>("int_timer");
|
||||
}
|
||||
|
||||
static INTERRUPT_GEN( deco32_vbl_interrupt )
|
||||
@ -1663,7 +1663,7 @@ static INTERRUPT_GEN( tattass_snd_interrupt )
|
||||
cpu_set_input_line(device, M6809_FIRQ_LINE, HOLD_LINE);
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( captaven, driver_device )
|
||||
static MACHINE_CONFIG_START( captaven, deco32_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM, XTAL_28MHz/4) /* verified on pcb (Data East 101 custom)*/
|
||||
@ -1710,7 +1710,7 @@ static MACHINE_CONFIG_START( captaven, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( fghthist, driver_device )
|
||||
static MACHINE_CONFIG_START( fghthist, deco32_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM, 28000000/4)
|
||||
@ -1754,7 +1754,7 @@ static MACHINE_CONFIG_START( fghthist, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( fghthsta, driver_device )
|
||||
static MACHINE_CONFIG_START( fghthsta, deco32_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM, 28000000/4)
|
||||
@ -1798,7 +1798,7 @@ static MACHINE_CONFIG_START( fghthsta, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( dragngun, driver_device )
|
||||
static MACHINE_CONFIG_START( dragngun, deco32_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM, 28000000/4)
|
||||
@ -1850,7 +1850,7 @@ static MACHINE_CONFIG_START( dragngun, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( lockload, driver_device )
|
||||
static MACHINE_CONFIG_START( lockload, deco32_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM, 28000000/4)
|
||||
@ -1902,7 +1902,7 @@ static MACHINE_CONFIG_START( lockload, driver_device )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( tattass, driver_device )
|
||||
static MACHINE_CONFIG_START( tattass, deco32_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM, 28000000/4) /* Unconfirmed */
|
||||
@ -1939,7 +1939,7 @@ static MACHINE_CONFIG_START( tattass, driver_device )
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( nslasher, driver_device )
|
||||
static MACHINE_CONFIG_START( nslasher, deco32_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM, 28322000/4)
|
||||
|
@ -114,12 +114,13 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
UINT8 vram_bank;
|
||||
device_t *laserdisc;
|
||||
UINT8 laserdisc_data;
|
||||
int nmimask;
|
||||
};
|
||||
|
||||
|
||||
static UINT8 vram_bank;
|
||||
static device_t *laserdisc;
|
||||
static UINT8 laserdisc_data;
|
||||
|
||||
static VIDEO_UPDATE( rblaster )
|
||||
{
|
||||
@ -135,7 +136,7 @@ static VIDEO_UPDATE( rblaster )
|
||||
for (x=0;x<32;x++)
|
||||
{
|
||||
int tile = videoram[count];
|
||||
int colour = (vram_bank & 0x7);
|
||||
int colour = (state->vram_bank & 0x7);
|
||||
drawgfx_opaque(bitmap,cliprect,gfx,tile,colour,0,0,x*8,y*8);
|
||||
|
||||
count++;
|
||||
@ -155,12 +156,14 @@ static WRITE8_HANDLER( rblaster_sound_w )
|
||||
|
||||
static WRITE8_HANDLER( rblaster_vram_bank_w )
|
||||
{
|
||||
vram_bank = data;
|
||||
deco_ld_state *state = space->machine->driver_data<deco_ld_state>();
|
||||
state->vram_bank = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( laserdisc_r )
|
||||
{
|
||||
UINT8 result = laserdisc_data_r(laserdisc);
|
||||
deco_ld_state *state = space->machine->driver_data<deco_ld_state>();
|
||||
UINT8 result = laserdisc_data_r(state->laserdisc);
|
||||
mame_printf_debug("laserdisc_r = %02X\n", result);
|
||||
return result;
|
||||
}
|
||||
@ -168,7 +171,8 @@ static READ8_HANDLER( laserdisc_r )
|
||||
|
||||
static WRITE8_HANDLER( laserdisc_w )
|
||||
{
|
||||
laserdisc_data = data;
|
||||
deco_ld_state *state = space->machine->driver_data<deco_ld_state>();
|
||||
state->laserdisc_data = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( test_r )
|
||||
@ -229,11 +233,17 @@ static ADDRESS_MAP_START( rblaster_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/* sound arrangement is pratically identical to Zero Target. */
|
||||
static int nmimask;
|
||||
|
||||
//static WRITE8_HANDLER( nmimask_w ) { nmimask = data & 0x80; }
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static WRITE8_HANDLER( nmimask_w )
|
||||
{
|
||||
deco_ld_state *state = space->machine->driver_data<deco_ld_state>();
|
||||
state->nmimask = data & 0x80;
|
||||
}
|
||||
#endif
|
||||
|
||||
static INTERRUPT_GEN ( sound_interrupt ) { if (!nmimask) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); }
|
||||
static INTERRUPT_GEN ( sound_interrupt ) {
|
||||
deco_ld_state *state = device->machine->driver_data<deco_ld_state>(); if (!state->nmimask) cpu_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); }
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( rblaster_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
@ -497,7 +507,8 @@ GFXDECODE_END
|
||||
|
||||
static MACHINE_START( rblaster )
|
||||
{
|
||||
laserdisc = machine->device("laserdisc");
|
||||
deco_ld_state *state = machine->driver_data<deco_ld_state>();
|
||||
state->laserdisc = machine->device("laserdisc");
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( rblaster, deco_ld_state )
|
||||
|
@ -104,11 +104,6 @@
|
||||
#include "cpu/sh2/sh2.h"
|
||||
#include "includes/deco_mlc.h"
|
||||
|
||||
static UINT32 *mlc_ram, *irq_ram;
|
||||
static timer_device *raster_irq_timer;
|
||||
static int mainCpuIsArm;
|
||||
static int mlc_raster_table[9][256];
|
||||
static UINT32 vbl_i;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
@ -158,10 +153,11 @@ static WRITE32_HANDLER( avengrs_palette_w )
|
||||
|
||||
static READ32_HANDLER( decomlc_vbl_r )
|
||||
{
|
||||
vbl_i ^=0xffffffff;
|
||||
deco_mlc_state *state = space->machine->driver_data<deco_mlc_state>();
|
||||
state->vbl_i ^=0xffffffff;
|
||||
//logerror("vbl r %08x\n", cpu_get_pc(space->cpu));
|
||||
// Todo: Vblank probably in $10
|
||||
return vbl_i;
|
||||
return state->vbl_i;
|
||||
}
|
||||
|
||||
static READ32_HANDLER( mlc_scanline_r )
|
||||
@ -172,24 +168,25 @@ static READ32_HANDLER( mlc_scanline_r )
|
||||
|
||||
static TIMER_DEVICE_CALLBACK( interrupt_gen )
|
||||
{
|
||||
deco_mlc_state *state = timer.machine->driver_data<deco_mlc_state>();
|
||||
// logerror("hit scanline IRQ %d (%08x)\n", machine->primary_screen->vpos(), info.i);
|
||||
cputag_set_input_line(timer.machine, "maincpu", mainCpuIsArm ? ARM_IRQ_LINE : 1, HOLD_LINE);
|
||||
cputag_set_input_line(timer.machine, "maincpu", state->mainCpuIsArm ? ARM_IRQ_LINE : 1, HOLD_LINE);
|
||||
}
|
||||
|
||||
static WRITE32_HANDLER( mlc_irq_w )
|
||||
{
|
||||
static int lastScanline[9]={ 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
deco_mlc_state *state = space->machine->driver_data<deco_mlc_state>();
|
||||
int scanline=space->machine->primary_screen->vpos();
|
||||
irq_ram[offset]=data&0xffff;
|
||||
state->irq_ram[offset]=data&0xffff;
|
||||
|
||||
switch (offset*4)
|
||||
{
|
||||
case 0x10: /* IRQ ack. Value written doesn't matter */
|
||||
cputag_set_input_line(space->machine, "maincpu", mainCpuIsArm ? ARM_IRQ_LINE : 1, CLEAR_LINE);
|
||||
cputag_set_input_line(space->machine, "maincpu", state->mainCpuIsArm ? ARM_IRQ_LINE : 1, CLEAR_LINE);
|
||||
return;
|
||||
case 0x14: /* Prepare scanline interrupt */
|
||||
raster_irq_timer->adjust(space->machine->primary_screen->time_until_pos(irq_ram[0x14/4]));
|
||||
//logerror("prepare scanline to fire at %d (currently on %d)\n", irq_ram[0x14/4], space->machine->primary_screen->vpos());
|
||||
state->raster_irq_timer->adjust(space->machine->primary_screen->time_until_pos(state->irq_ram[0x14/4]));
|
||||
//logerror("prepare scanline to fire at %d (currently on %d)\n", state->irq_ram[0x14/4], space->machine->primary_screen->vpos());
|
||||
return;
|
||||
case 0x18:
|
||||
case 0x1c:
|
||||
@ -203,17 +200,17 @@ static WRITE32_HANDLER( mlc_irq_w )
|
||||
if (scanline > 255)
|
||||
scanline = 255;
|
||||
/* Update scanlines up to present line */
|
||||
while (lastScanline[offset-6]<scanline)
|
||||
while (state->lastScanline[offset-6]<scanline)
|
||||
{
|
||||
mlc_raster_table[offset-6][lastScanline[offset-6]+1]=mlc_raster_table[offset-6][lastScanline[offset-6]];
|
||||
lastScanline[offset-6]++;
|
||||
state->mlc_raster_table[offset-6][state->lastScanline[offset-6]+1]=state->mlc_raster_table[offset-6][state->lastScanline[offset-6]];
|
||||
state->lastScanline[offset-6]++;
|
||||
}
|
||||
|
||||
if (lastScanline[offset-6] > scanline)
|
||||
lastScanline[offset-6]=0;
|
||||
if (state->lastScanline[offset-6] > scanline)
|
||||
state->lastScanline[offset-6]=0;
|
||||
|
||||
/* Set current scanline value */
|
||||
mlc_raster_table[offset-6][scanline]=data&0xffff;
|
||||
state->mlc_raster_table[offset-6][scanline]=data&0xffff;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -230,7 +227,8 @@ static READ32_HANDLER(mlc_spriteram_r)
|
||||
|
||||
static READ32_HANDLER(mlc_vram_r)
|
||||
{
|
||||
return mlc_vram[offset]&0xffff;
|
||||
deco_mlc_state *state = space->machine->driver_data<deco_mlc_state>();
|
||||
return state->mlc_vram[offset]&0xffff;
|
||||
}
|
||||
|
||||
static READ32_HANDLER(stadhr96_prot_146_r)
|
||||
@ -262,15 +260,15 @@ static READ32_HANDLER(stadhr96_prot_146_r)
|
||||
|
||||
static ADDRESS_MAP_START( decomlc_map, ADDRESS_SPACE_PROGRAM, 32 )
|
||||
AM_RANGE(0x0000000, 0x00fffff) AM_ROM AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0100000, 0x011ffff) AM_RAM AM_BASE(&mlc_ram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0100000, 0x011ffff) AM_RAM AM_BASE_MEMBER(deco_mlc_state, mlc_ram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0200000, 0x020000f) AM_READNOP AM_MIRROR(0xff000000)/* IRQ control? */
|
||||
AM_RANGE(0x0200070, 0x0200073) AM_READ(decomlc_vbl_r) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0200074, 0x0200077) AM_READ(mlc_scanline_r) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0200078, 0x020007f) AM_READ(test2_r) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0200000, 0x020007f) AM_WRITE(mlc_irq_w) AM_BASE(&irq_ram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0200080, 0x02000ff) AM_RAM AM_BASE(&mlc_clip_ram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0200000, 0x020007f) AM_WRITE(mlc_irq_w) AM_BASE_MEMBER(deco_mlc_state, irq_ram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0200080, 0x02000ff) AM_RAM AM_BASE_MEMBER(deco_mlc_state, mlc_clip_ram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0204000, 0x0206fff) AM_RAM_READ(mlc_spriteram_r) AM_BASE_SIZE_GENERIC(spriteram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0280000, 0x029ffff) AM_RAM_READ(mlc_vram_r) AM_BASE(&mlc_vram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0280000, 0x029ffff) AM_RAM_READ(mlc_vram_r) AM_BASE_MEMBER(deco_mlc_state, mlc_vram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0300000, 0x0307fff) AM_RAM_WRITE(avengrs_palette_w) AM_BASE_GENERIC(paletteram) AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0400000, 0x0400003) AM_READ_PORT("INPUTS") AM_MIRROR(0xff000000)
|
||||
AM_RANGE(0x0440000, 0x044001f) AM_READ(test3_r) AM_MIRROR(0xff000000)
|
||||
@ -374,11 +372,12 @@ GFXDECODE_END
|
||||
|
||||
static MACHINE_RESET( mlc )
|
||||
{
|
||||
vbl_i = 0xffffffff;
|
||||
raster_irq_timer = machine->device<timer_device>("int_timer");
|
||||
deco_mlc_state *state = machine->driver_data<deco_mlc_state>();
|
||||
state->vbl_i = 0xffffffff;
|
||||
state->raster_irq_timer = machine->device<timer_device>("int_timer");
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( avengrgs, driver_device )
|
||||
static MACHINE_CONFIG_START( avengrgs, deco_mlc_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", SH2,42000000/2) /* 21 MHz clock confirmed on real board */
|
||||
@ -411,7 +410,7 @@ static MACHINE_CONFIG_START( avengrgs, driver_device )
|
||||
MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
static MACHINE_CONFIG_START( mlc, driver_device )
|
||||
static MACHINE_CONFIG_START( mlc, deco_mlc_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", ARM,42000000/6) /* 42 MHz -> 7MHz clock confirmed on real board */
|
||||
@ -725,7 +724,8 @@ static void descramble_sound( running_machine *machine )
|
||||
|
||||
static READ32_HANDLER( avengrgs_speedup_r )
|
||||
{
|
||||
UINT32 a=mlc_ram[0x89a0/4];
|
||||
deco_mlc_state *state = space->machine->driver_data<deco_mlc_state>();
|
||||
UINT32 a=state->mlc_ram[0x89a0/4];
|
||||
UINT32 p=cpu_get_pc(space->cpu);
|
||||
|
||||
if ((p==0x3234 || p==0x32dc) && (a&1)) cpu_spinuntil_int(space->cpu);
|
||||
@ -735,6 +735,7 @@ static READ32_HANDLER( avengrgs_speedup_r )
|
||||
|
||||
static DRIVER_INIT( avengrgs )
|
||||
{
|
||||
deco_mlc_state *state = machine->driver_data<deco_mlc_state>();
|
||||
// init options
|
||||
sh2drc_set_options(machine->device("maincpu"), SH2DRC_FASTEST_OPTIONS);
|
||||
|
||||
@ -742,18 +743,19 @@ static DRIVER_INIT( avengrgs )
|
||||
sh2drc_add_pcflush(machine->device("maincpu"), 0x3234);
|
||||
sh2drc_add_pcflush(machine->device("maincpu"), 0x32dc);
|
||||
|
||||
mainCpuIsArm = 0;
|
||||
state->mainCpuIsArm = 0;
|
||||
memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x01089a0, 0x01089a3, 0, 0, avengrgs_speedup_r );
|
||||
descramble_sound(machine);
|
||||
}
|
||||
|
||||
static DRIVER_INIT( mlc )
|
||||
{
|
||||
deco_mlc_state *state = machine->driver_data<deco_mlc_state>();
|
||||
/* The timing in the ARM core isn't as accurate as it should be, so bump up the
|
||||
effective clock rate here to compensate otherwise we have slowdowns in
|
||||
Skull Fung where there probably shouldn't be. */
|
||||
machine->device("maincpu")->set_clock_scale(2.0f);
|
||||
mainCpuIsArm = 1;
|
||||
state->mainCpuIsArm = 1;
|
||||
deco156_decrypt(machine);
|
||||
descramble_sound(machine);
|
||||
}
|
||||
|
@ -15,86 +15,101 @@ TODO:
|
||||
#include "emu.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
|
||||
static UINT8 *io_ram;
|
||||
|
||||
class deshoros_state : public driver_device
|
||||
{
|
||||
public:
|
||||
deshoros_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *io_ram;
|
||||
char led_array[21];
|
||||
UINT8 bank;
|
||||
};
|
||||
|
||||
|
||||
/*Temporary,to show something on screen...*/
|
||||
static char led_array[21];
|
||||
|
||||
static VIDEO_START( deshoros )
|
||||
{
|
||||
static UINT8 i;
|
||||
deshoros_state *state = machine->driver_data<deshoros_state>();
|
||||
UINT8 i;
|
||||
for(i=0;i<20;i++)
|
||||
led_array[i] = 0x20;
|
||||
led_array[20] = 0;
|
||||
state->led_array[i] = 0x20;
|
||||
state->led_array[20] = 0;
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( deshoros )
|
||||
{
|
||||
popmessage("%s",led_array);
|
||||
deshoros_state *state = screen->machine->driver_data<deshoros_state>();
|
||||
popmessage("%s",state->led_array);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*I don't know it this is 100% correct,might be different...*/
|
||||
static void update_led_array(UINT8 new_data)
|
||||
static void update_led_array(deshoros_state *state, UINT8 new_data)
|
||||
{
|
||||
static UINT8 i;
|
||||
UINT8 i;
|
||||
/*scroll the data*/
|
||||
for(i=0;i<19;i++)
|
||||
led_array[i] = led_array[i+1];
|
||||
state->led_array[i] = state->led_array[i+1];
|
||||
/*update the data*/
|
||||
led_array[19] = new_data;
|
||||
state->led_array[19] = new_data;
|
||||
}
|
||||
|
||||
static UINT8 bank;
|
||||
|
||||
static void answer_bankswitch(running_machine *machine,UINT8 new_bank)
|
||||
{
|
||||
if(bank!=new_bank)
|
||||
deshoros_state *state = machine->driver_data<deshoros_state>();
|
||||
if(state->bank!=new_bank)
|
||||
{
|
||||
UINT8 *ROM = machine->region("data")->base();
|
||||
UINT32 bankaddress;
|
||||
|
||||
bank = new_bank;
|
||||
bankaddress = 0 + 0x6000 * bank;
|
||||
state->bank = new_bank;
|
||||
bankaddress = 0 + 0x6000 * state->bank;
|
||||
memory_set_bankptr(machine, "bank1", &ROM[bankaddress]);
|
||||
}
|
||||
}
|
||||
|
||||
static READ8_HANDLER( io_r )
|
||||
{
|
||||
deshoros_state *state = space->machine->driver_data<deshoros_state>();
|
||||
switch(offset)
|
||||
{
|
||||
case 0x00: return 0xff; //printer read
|
||||
case 0x03: return input_port_read(space->machine, "KEY0" );
|
||||
case 0x04: return input_port_read(space->machine, "KEY1" );
|
||||
case 0x05: return input_port_read(space->machine, "SYSTEM" );
|
||||
case 0x0a: return io_ram[offset]; //"buzzer" 0 read
|
||||
case 0x0b: return io_ram[offset]; //"buzzer" 1 read
|
||||
case 0x0a: return state->io_ram[offset]; //"buzzer" 0 read
|
||||
case 0x0b: return state->io_ram[offset]; //"buzzer" 1 read
|
||||
}
|
||||
// printf("R -> [%02x]\n",offset);
|
||||
|
||||
return io_ram[offset];
|
||||
return state->io_ram[offset];
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( io_w )
|
||||
{
|
||||
deshoros_state *state = space->machine->driver_data<deshoros_state>();
|
||||
switch(offset)
|
||||
{
|
||||
case 0x00: /*Printer data*/ return;
|
||||
case 0x02: update_led_array(data); return;
|
||||
case 0x05: coin_lockout_w(space->machine, 0,io_ram[offset] & 1);return;
|
||||
case 0x02: update_led_array(state, data); return;
|
||||
case 0x05: coin_lockout_w(space->machine, 0,state->io_ram[offset] & 1);return;
|
||||
case 0x06: /*Printer IRQ enable*/ return;
|
||||
// case 0x0a: "buzzer" 0 write
|
||||
// case 0x0b: "buzzer" 1 write
|
||||
case 0x0c: answer_bankswitch(space->machine,data&0x03); return; //data & 0x10 enabled too,dunno if it is worth to shift the data...
|
||||
}
|
||||
io_ram[offset] = data;
|
||||
state->io_ram[offset] = data;
|
||||
// printf("%02x -> [%02x]\n",data,offset);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x5fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x8000, 0x87ff) AM_RAM
|
||||
AM_RANGE(0x9000, 0x900f) AM_READWRITE(io_r,io_w) AM_BASE(&io_ram) //i/o area
|
||||
AM_RANGE(0x9000, 0x900f) AM_READWRITE(io_r,io_w) AM_BASE_MEMBER(deshoros_state, io_ram) //i/o area
|
||||
AM_RANGE(0xc000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -151,10 +166,11 @@ static INTERRUPT_GEN( deshoros_irq )
|
||||
|
||||
static MACHINE_RESET( deshoros )
|
||||
{
|
||||
bank = -1;
|
||||
deshoros_state *state = machine->driver_data<deshoros_state>();
|
||||
state->bank = -1;
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( deshoros, driver_device )
|
||||
static MACHINE_CONFIG_START( deshoros, deshoros_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu",M6809,2000000)
|
||||
|
@ -51,6 +51,10 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
laserdisc_device *laserdisc;
|
||||
UINT8 last_misc;
|
||||
UINT8 laserdisc_type;
|
||||
UINT8 laserdisc_data;
|
||||
};
|
||||
|
||||
|
||||
@ -76,11 +80,7 @@ public:
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static laserdisc_device *laserdisc;
|
||||
static UINT8 last_misc;
|
||||
|
||||
static UINT8 laserdisc_type;
|
||||
static UINT8 laserdisc_data;
|
||||
|
||||
static const UINT8 led_map[16] =
|
||||
{ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x77,0x7c,0x39,0x5e,0x79,0x00 };
|
||||
@ -101,15 +101,17 @@ static void dleuro_interrupt(device_t *device, int state)
|
||||
|
||||
static WRITE8_DEVICE_HANDLER( serial_transmit )
|
||||
{
|
||||
laserdisc_data_w(laserdisc, data);
|
||||
dlair_state *state = device->machine->driver_data<dlair_state>();
|
||||
laserdisc_data_w(state->laserdisc, data);
|
||||
}
|
||||
|
||||
|
||||
static int serial_receive(device_t *device, int channel)
|
||||
{
|
||||
dlair_state *state = device->machine->driver_data<dlair_state>();
|
||||
/* if we still have data to send, do it now */
|
||||
if (channel == 0 && laserdisc_line_r(laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
|
||||
return laserdisc_data_r(laserdisc);
|
||||
if (channel == 0 && laserdisc_line_r(state->laserdisc, LASERDISC_LINE_DATA_AVAIL) == ASSERT_LINE)
|
||||
return laserdisc_data_r(state->laserdisc);
|
||||
|
||||
return -1;
|
||||
}
|
||||
@ -197,17 +199,19 @@ static VIDEO_UPDATE( dleuro )
|
||||
|
||||
static MACHINE_START( dlair )
|
||||
{
|
||||
laserdisc = machine->device<laserdisc_device>("laserdisc");
|
||||
dlair_state *state = machine->driver_data<dlair_state>();
|
||||
state->laserdisc = machine->device<laserdisc_device>("laserdisc");
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( dlair )
|
||||
{
|
||||
dlair_state *state = machine->driver_data<dlair_state>();
|
||||
/* determine the laserdisc player from the DIP switches */
|
||||
if (laserdisc_type == LASERDISC_TYPE_VARIABLE)
|
||||
if (state->laserdisc_type == LASERDISC_TYPE_VARIABLE)
|
||||
{
|
||||
int newtype = (input_port_read(machine, "DSW2") & 0x08) ? LASERDISC_TYPE_PIONEER_LDV1000 : LASERDISC_TYPE_PIONEER_PR7820;
|
||||
laserdisc_set_type(laserdisc, newtype);
|
||||
laserdisc_set_type(state->laserdisc, newtype);
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,6 +245,7 @@ static INTERRUPT_GEN( vblank_callback )
|
||||
|
||||
static WRITE8_HANDLER( misc_w )
|
||||
{
|
||||
dlair_state *state = space->machine->driver_data<dlair_state>();
|
||||
/*
|
||||
D0-D3 = B0-B3
|
||||
D4 = coin counter
|
||||
@ -248,22 +253,23 @@ static WRITE8_HANDLER( misc_w )
|
||||
D6 = ENTER
|
||||
D7 = INT/EXT
|
||||
*/
|
||||
UINT8 diff = data ^ last_misc;
|
||||
last_misc = data;
|
||||
UINT8 diff = data ^ state->last_misc;
|
||||
state->last_misc = data;
|
||||
|
||||
coin_counter_w(space->machine, 0, (~data >> 4) & 1);
|
||||
|
||||
/* on bit 5 going low, push the data out to the laserdisc player */
|
||||
if ((diff & 0x20) && !(data & 0x20))
|
||||
laserdisc_data_w(laserdisc, laserdisc_data);
|
||||
laserdisc_data_w(state->laserdisc, state->laserdisc_data);
|
||||
|
||||
/* on bit 6 going low, we need to signal enter */
|
||||
laserdisc_line_w(laserdisc, LASERDISC_LINE_ENTER, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
|
||||
laserdisc_line_w(state->laserdisc, LASERDISC_LINE_ENTER, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
static WRITE8_HANDLER( dleuro_misc_w )
|
||||
{
|
||||
dlair_state *state = space->machine->driver_data<dlair_state>();
|
||||
/*
|
||||
D0 = CHAR GEN ON+
|
||||
D1 = KILL VIDEO+
|
||||
@ -274,18 +280,18 @@ static WRITE8_HANDLER( dleuro_misc_w )
|
||||
D6 = ENTER
|
||||
D7 = INT/EXT
|
||||
*/
|
||||
UINT8 diff = data ^ last_misc;
|
||||
last_misc = data;
|
||||
UINT8 diff = data ^ state->last_misc;
|
||||
state->last_misc = data;
|
||||
|
||||
coin_counter_w(space->machine, 1, (~data >> 3) & 1);
|
||||
coin_counter_w(space->machine, 0, (~data >> 4) & 1);
|
||||
|
||||
/* on bit 5 going low, push the data out to the laserdisc player */
|
||||
if ((diff & 0x20) && !(data & 0x20))
|
||||
laserdisc_data_w(laserdisc, laserdisc_data);
|
||||
laserdisc_data_w(state->laserdisc, state->laserdisc_data);
|
||||
|
||||
/* on bit 6 going low, we need to signal enter */
|
||||
laserdisc_line_w(laserdisc, LASERDISC_LINE_ENTER, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
|
||||
laserdisc_line_w(state->laserdisc, LASERDISC_LINE_ENTER, (data & 0x40) ? CLEAR_LINE : ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -310,13 +316,14 @@ static WRITE8_HANDLER( led_den2_w )
|
||||
|
||||
static CUSTOM_INPUT( laserdisc_status_r )
|
||||
{
|
||||
switch (laserdisc_get_type(laserdisc))
|
||||
dlair_state *state = field->port->machine->driver_data<dlair_state>();
|
||||
switch (laserdisc_get_type(state->laserdisc))
|
||||
{
|
||||
case LASERDISC_TYPE_PIONEER_PR7820:
|
||||
return 0;
|
||||
|
||||
case LASERDISC_TYPE_PIONEER_LDV1000:
|
||||
return (laserdisc_line_r(laserdisc, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 0 : 1;
|
||||
return (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_STATUS) == ASSERT_LINE) ? 0 : 1;
|
||||
|
||||
case LASERDISC_TYPE_PHILLIPS_22VP932:
|
||||
return 0;
|
||||
@ -327,13 +334,14 @@ static CUSTOM_INPUT( laserdisc_status_r )
|
||||
|
||||
static CUSTOM_INPUT( laserdisc_command_r )
|
||||
{
|
||||
switch (laserdisc_get_type(laserdisc))
|
||||
dlair_state *state = field->port->machine->driver_data<dlair_state>();
|
||||
switch (laserdisc_get_type(state->laserdisc))
|
||||
{
|
||||
case LASERDISC_TYPE_PIONEER_PR7820:
|
||||
return (laserdisc_line_r(laserdisc, LASERDISC_LINE_READY) == ASSERT_LINE) ? 0 : 1;
|
||||
return (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_READY) == ASSERT_LINE) ? 0 : 1;
|
||||
|
||||
case LASERDISC_TYPE_PIONEER_LDV1000:
|
||||
return (laserdisc_line_r(laserdisc, LASERDISC_LINE_COMMAND) == ASSERT_LINE) ? 0 : 1;
|
||||
return (laserdisc_line_r(state->laserdisc, LASERDISC_LINE_COMMAND) == ASSERT_LINE) ? 0 : 1;
|
||||
|
||||
case LASERDISC_TYPE_PHILLIPS_22VP932:
|
||||
return 0;
|
||||
@ -344,7 +352,8 @@ static CUSTOM_INPUT( laserdisc_command_r )
|
||||
|
||||
static READ8_HANDLER( laserdisc_r )
|
||||
{
|
||||
UINT8 result = laserdisc_data_r(laserdisc);
|
||||
dlair_state *state = space->machine->driver_data<dlair_state>();
|
||||
UINT8 result = laserdisc_data_r(state->laserdisc);
|
||||
mame_printf_debug("laserdisc_r = %02X\n", result);
|
||||
return result;
|
||||
}
|
||||
@ -352,7 +361,8 @@ static READ8_HANDLER( laserdisc_r )
|
||||
|
||||
static WRITE8_HANDLER( laserdisc_w )
|
||||
{
|
||||
laserdisc_data = data;
|
||||
dlair_state *state = space->machine->driver_data<dlair_state>();
|
||||
state->laserdisc_data = data;
|
||||
}
|
||||
|
||||
|
||||
@ -939,13 +949,15 @@ ROM_END
|
||||
|
||||
static DRIVER_INIT( fixed )
|
||||
{
|
||||
laserdisc_type = LASERDISC_TYPE_FIXED;
|
||||
dlair_state *state = machine->driver_data<dlair_state>();
|
||||
state->laserdisc_type = LASERDISC_TYPE_FIXED;
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( variable )
|
||||
{
|
||||
laserdisc_type = LASERDISC_TYPE_VARIABLE;
|
||||
dlair_state *state = machine->driver_data<dlair_state>();
|
||||
state->laserdisc_type = LASERDISC_TYPE_VARIABLE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,14 +34,27 @@ ft5_v6_c4.u58 /
|
||||
#include "sound/okim6295.h"
|
||||
|
||||
|
||||
static UINT16 *bmc_1_videoram, *bmc_2_videoram,*main_ram;
|
||||
static tilemap_t *tilemap_1,*tilemap_2;
|
||||
static UINT8 *bmc_colorram;
|
||||
static int clr_offset=0;
|
||||
class koftball_state : public driver_device
|
||||
{
|
||||
public:
|
||||
koftball_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT16 *bmc_1_videoram;
|
||||
UINT16 *bmc_2_videoram;
|
||||
UINT16 *main_ram;
|
||||
tilemap_t *tilemap_1;
|
||||
tilemap_t *tilemap_2;
|
||||
UINT8 *bmc_colorram;
|
||||
int clr_offset;
|
||||
UINT16 prot_data;
|
||||
};
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_t1_tile_info )
|
||||
{
|
||||
int data = bmc_1_videoram[tile_index];
|
||||
koftball_state *state = machine->driver_data<koftball_state>();
|
||||
int data = state->bmc_1_videoram[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
data,
|
||||
@ -51,7 +64,8 @@ static TILE_GET_INFO( get_t1_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_t2_tile_info )
|
||||
{
|
||||
int data = bmc_2_videoram[tile_index];
|
||||
koftball_state *state = machine->driver_data<koftball_state>();
|
||||
int data = state->bmc_2_videoram[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
data,
|
||||
@ -61,34 +75,39 @@ static TILE_GET_INFO( get_t2_tile_info )
|
||||
|
||||
static VIDEO_START( koftball )
|
||||
{
|
||||
tilemap_1 = tilemap_create(machine, get_t1_tile_info,tilemap_scan_rows,8,8,64,32);
|
||||
tilemap_2 = tilemap_create(machine, get_t2_tile_info,tilemap_scan_rows,8,8,64,32);
|
||||
koftball_state *state = machine->driver_data<koftball_state>();
|
||||
state->tilemap_1 = tilemap_create(machine, get_t1_tile_info,tilemap_scan_rows,8,8,64,32);
|
||||
state->tilemap_2 = tilemap_create(machine, get_t2_tile_info,tilemap_scan_rows,8,8,64,32);
|
||||
|
||||
tilemap_set_transparent_pen(tilemap_1,0);
|
||||
tilemap_set_transparent_pen(state->tilemap_1,0);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( koftball )
|
||||
{
|
||||
tilemap_draw( bitmap, cliprect, tilemap_2, 0, 0);
|
||||
tilemap_draw( bitmap, cliprect, tilemap_1, 0, 0);
|
||||
koftball_state *state = screen->machine->driver_data<koftball_state>();
|
||||
tilemap_draw( bitmap, cliprect, state->tilemap_2, 0, 0);
|
||||
tilemap_draw( bitmap, cliprect, state->tilemap_1, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( bmc_RAMDAC_offset_w )
|
||||
{
|
||||
clr_offset=data*3;
|
||||
koftball_state *state = space->machine->driver_data<koftball_state>();
|
||||
state->clr_offset=data*3;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( bmc_RAMDAC_color_w )
|
||||
{
|
||||
bmc_colorram[clr_offset]=data;
|
||||
palette_set_color_rgb(space->machine,clr_offset/3,pal6bit(bmc_colorram[(clr_offset/3)*3]),pal6bit(bmc_colorram[(clr_offset/3)*3+1]),pal6bit(bmc_colorram[(clr_offset/3)*3+2]));
|
||||
clr_offset=(clr_offset+1)%768;
|
||||
koftball_state *state = space->machine->driver_data<koftball_state>();
|
||||
state->bmc_colorram[state->clr_offset]=data;
|
||||
palette_set_color_rgb(space->machine,state->clr_offset/3,pal6bit(state->bmc_colorram[(state->clr_offset/3)*3]),pal6bit(state->bmc_colorram[(state->clr_offset/3)*3+1]),pal6bit(state->bmc_colorram[(state->clr_offset/3)*3+2]));
|
||||
state->clr_offset=(state->clr_offset+1)%768;
|
||||
}
|
||||
|
||||
static READ16_HANDLER( bmc_RAMDAC_color_r )
|
||||
{
|
||||
return bmc_colorram[clr_offset];
|
||||
koftball_state *state = space->machine->driver_data<koftball_state>();
|
||||
return state->bmc_colorram[state->clr_offset];
|
||||
}
|
||||
|
||||
static READ16_HANDLER(random_number_r)
|
||||
@ -96,11 +115,11 @@ static READ16_HANDLER(random_number_r)
|
||||
return space->machine->rand();
|
||||
}
|
||||
|
||||
static UINT16 prot_data;
|
||||
|
||||
static READ16_HANDLER(prot_r)
|
||||
{
|
||||
switch(prot_data)
|
||||
koftball_state *state = space->machine->driver_data<koftball_state>();
|
||||
switch(state->prot_data)
|
||||
{
|
||||
case 0x0000: return 0x0d00;
|
||||
case 0xff00: return 0x8d00;
|
||||
@ -108,33 +127,36 @@ static READ16_HANDLER(prot_r)
|
||||
case 0x8000: return 0x0f0f;
|
||||
}
|
||||
|
||||
logerror("unk prot r %x %x\n",prot_data, cpu_get_previouspc(space->cpu));
|
||||
logerror("unk prot r %x %x\n",state->prot_data, cpu_get_previouspc(space->cpu));
|
||||
return space->machine->rand();
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER(prot_w)
|
||||
{
|
||||
COMBINE_DATA(&prot_data);
|
||||
koftball_state *state = space->machine->driver_data<koftball_state>();
|
||||
COMBINE_DATA(&state->prot_data);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER(bmc_1_videoram_w)
|
||||
{
|
||||
COMBINE_DATA(&bmc_1_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_1, offset);
|
||||
koftball_state *state = space->machine->driver_data<koftball_state>();
|
||||
COMBINE_DATA(&state->bmc_1_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap_1, offset);
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER(bmc_2_videoram_w)
|
||||
{
|
||||
COMBINE_DATA(&bmc_2_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_2, offset);
|
||||
koftball_state *state = space->machine->driver_data<koftball_state>();
|
||||
COMBINE_DATA(&state->bmc_2_videoram[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap_2, offset);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( koftball_mem, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x01ffff) AM_ROM
|
||||
AM_RANGE(0x220000, 0x22ffff) AM_RAM AM_BASE(&main_ram)
|
||||
AM_RANGE(0x220000, 0x22ffff) AM_RAM AM_BASE_MEMBER(koftball_state, main_ram)
|
||||
|
||||
AM_RANGE(0x260000, 0x260fff) AM_WRITE(bmc_1_videoram_w) AM_BASE(&bmc_1_videoram)
|
||||
AM_RANGE(0x261000, 0x261fff) AM_WRITE(bmc_2_videoram_w) AM_BASE(&bmc_2_videoram)
|
||||
AM_RANGE(0x260000, 0x260fff) AM_WRITE(bmc_1_videoram_w) AM_BASE_MEMBER(koftball_state, bmc_1_videoram)
|
||||
AM_RANGE(0x261000, 0x261fff) AM_WRITE(bmc_2_videoram_w) AM_BASE_MEMBER(koftball_state, bmc_2_videoram)
|
||||
AM_RANGE(0x262000, 0x26ffff) AM_RAM
|
||||
|
||||
AM_RANGE(0x280000, 0x28ffff) AM_RAM /* unused ? */
|
||||
@ -202,7 +224,7 @@ static GFXDECODE_START( koftball )
|
||||
GFXDECODE_END
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( koftball, driver_device )
|
||||
static MACHINE_CONFIG_START( koftball, koftball_state )
|
||||
MCFG_CPU_ADD("maincpu", M68000, 21477270/2 )
|
||||
MCFG_CPU_PROGRAM_MAP(koftball_mem)
|
||||
MCFG_CPU_VBLANK_INT_HACK(bmc_interrupt,3)
|
||||
@ -271,14 +293,15 @@ static const UINT16 nvram[]=
|
||||
#endif
|
||||
static DRIVER_INIT(koftball)
|
||||
{
|
||||
bmc_colorram = auto_alloc_array(machine, UINT8, 768);
|
||||
koftball_state *state = machine->driver_data<koftball_state>();
|
||||
state->bmc_colorram = auto_alloc_array(machine, UINT8, 768);
|
||||
|
||||
#if NVRAM_HACK
|
||||
{
|
||||
int offset=0;
|
||||
while(nvram[offset]!=0xffff)
|
||||
{
|
||||
main_ram[offset]=nvram[offset];
|
||||
state->main_ram[offset]=nvram[offset];
|
||||
++offset;
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,6 @@
|
||||
#define SOUND_CLOCK XTAL_4MHz
|
||||
|
||||
|
||||
static UINT8 *shift_hi;
|
||||
static UINT8 *shift_lo;
|
||||
|
||||
|
||||
static INPUT_CHANGED( coin_inserted )
|
||||
{
|
||||
/* coin insertion causes an NMI */
|
||||
@ -36,13 +32,15 @@ INLINE UINT8 shift_common(running_machine *machine, UINT8 hi, UINT8 lo)
|
||||
|
||||
static READ8_HANDLER( shift_r )
|
||||
{
|
||||
return shift_common(space->machine, *shift_hi, *shift_lo);
|
||||
madalien_state *state = space->machine->driver_data<madalien_state>();
|
||||
return shift_common(space->machine, *state->shift_hi, *state->shift_lo);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( shift_rev_r )
|
||||
{
|
||||
UINT8 hi = *shift_hi ^ 0x07;
|
||||
UINT8 lo = BITSWAP8(*shift_lo,0,1,2,3,4,5,6,7);
|
||||
madalien_state *state = space->machine->driver_data<madalien_state>();
|
||||
UINT8 hi = *state->shift_hi ^ 0x07;
|
||||
UINT8 lo = BITSWAP8(*state->shift_lo,0,1,2,3,4,5,6,7);
|
||||
|
||||
UINT8 ret = shift_common(space->machine, hi, lo);
|
||||
|
||||
@ -83,22 +81,22 @@ static WRITE8_DEVICE_HANDLER( madalien_portB_w )
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x03ff) AM_RAM
|
||||
|
||||
AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(madalien_videoram_w) AM_BASE(&madalien_videoram)
|
||||
AM_RANGE(0x6000, 0x63ff) AM_RAM_WRITE(madalien_videoram_w) AM_BASE_MEMBER(madalien_state, videoram)
|
||||
AM_RANGE(0x6400, 0x67ff) AM_RAM
|
||||
AM_RANGE(0x6800, 0x7fff) AM_RAM_WRITE(madalien_charram_w) AM_BASE(&madalien_charram)
|
||||
AM_RANGE(0x6800, 0x7fff) AM_RAM_WRITE(madalien_charram_w) AM_BASE_MEMBER(madalien_state, charram)
|
||||
|
||||
AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ff0) AM_DEVWRITE("crtc", mc6845_address_w)
|
||||
AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_DEVREADWRITE("crtc", mc6845_register_r, mc6845_register_w)
|
||||
AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x0ff0) AM_WRITEONLY AM_BASE(&madalien_video_control)
|
||||
AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x0ff0) AM_WRITEONLY AM_BASE_MEMBER(madalien_state, video_control)
|
||||
AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x0ff0) AM_WRITE(madalien_output_w)
|
||||
AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x0ff0) AM_READWRITE(soundlatch2_r, madalien_sound_command_w)
|
||||
AM_RANGE(0x8008, 0x8008) AM_MIRROR(0x07f0) AM_RAM_READ(shift_r) AM_BASE(&shift_hi)
|
||||
AM_RANGE(0x8009, 0x8009) AM_MIRROR(0x07f0) AM_RAM_READ(shift_rev_r) AM_BASE(&shift_lo)
|
||||
AM_RANGE(0x800b, 0x800b) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE(&madalien_video_flags)
|
||||
AM_RANGE(0x800c, 0x800c) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE(&madalien_headlight_pos)
|
||||
AM_RANGE(0x800d, 0x800d) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE(&madalien_edge1_pos)
|
||||
AM_RANGE(0x800e, 0x800e) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE(&madalien_edge2_pos)
|
||||
AM_RANGE(0x800f, 0x800f) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE(&madalien_scroll)
|
||||
AM_RANGE(0x8008, 0x8008) AM_MIRROR(0x07f0) AM_RAM_READ(shift_r) AM_BASE_MEMBER(madalien_state, shift_hi)
|
||||
AM_RANGE(0x8009, 0x8009) AM_MIRROR(0x07f0) AM_RAM_READ(shift_rev_r) AM_BASE_MEMBER(madalien_state, shift_lo)
|
||||
AM_RANGE(0x800b, 0x800b) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE_MEMBER(madalien_state, video_flags)
|
||||
AM_RANGE(0x800c, 0x800c) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE_MEMBER(madalien_state, headlight_pos)
|
||||
AM_RANGE(0x800d, 0x800d) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE_MEMBER(madalien_state, edge1_pos)
|
||||
AM_RANGE(0x800e, 0x800e) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE_MEMBER(madalien_state, edge2_pos)
|
||||
AM_RANGE(0x800f, 0x800f) AM_MIRROR(0x07f0) AM_WRITEONLY AM_BASE_MEMBER(madalien_state, scroll)
|
||||
|
||||
AM_RANGE(0x9000, 0x9000) AM_MIRROR(0x0ff0) AM_READ_PORT("PLAYER1")
|
||||
AM_RANGE(0x9001, 0x9001) AM_MIRROR(0x0ff0) AM_READ_PORT("DSW")
|
||||
@ -172,7 +170,7 @@ static const ay8910_interface ay8910_config =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( madalien, driver_device )
|
||||
static MACHINE_CONFIG_START( madalien, madalien_state )
|
||||
|
||||
/* main CPU */
|
||||
MCFG_CPU_ADD("maincpu", M6502, MADALIEN_MAIN_CLOCK / 8) /* 1324kHz */
|
||||
|
@ -93,22 +93,20 @@ static const eeprom_interface eeprom_intf =
|
||||
"0111" /* erase command */
|
||||
};
|
||||
|
||||
static UINT8 *nvram;
|
||||
static size_t nvram_size;
|
||||
|
||||
static NVRAM_HANDLER( mitchell )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
if (read_or_write)
|
||||
{
|
||||
if (nvram_size) /* Super Pang, Block Block */
|
||||
file->write(nvram,nvram_size); /* NVRAM */
|
||||
if (state->nvram_size) /* Super Pang, Block Block */
|
||||
file->write(state->nvram,state->nvram_size); /* NVRAM */
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file)
|
||||
{
|
||||
if (nvram_size) /* Super Pang, Block Block */
|
||||
file->read(nvram,nvram_size); /* NVRAM */
|
||||
if (state->nvram_size) /* Super Pang, Block Block */
|
||||
file->read(state->nvram,state->nvram_size); /* NVRAM */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2117,7 +2115,7 @@ static DRIVER_INIT( dokaben )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 0;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
mgakuen2_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2125,7 +2123,7 @@ static DRIVER_INIT( pang )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 0;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
pang_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2133,7 +2131,7 @@ static DRIVER_INIT( pangb )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 0;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
bootleg_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2141,7 +2139,7 @@ static DRIVER_INIT( cworld )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 0;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
cworld_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2149,7 +2147,7 @@ static DRIVER_INIT( hatena )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 0;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
hatena_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2157,8 +2155,8 @@ static DRIVER_INIT( spang )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 3;
|
||||
nvram_size = 0x80;
|
||||
nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
state->nvram_size = 0x80;
|
||||
state->nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
spang_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2167,8 +2165,8 @@ static DRIVER_INIT( spangbl )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 3;
|
||||
nvram_size = 0x80;
|
||||
nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
state->nvram_size = 0x80;
|
||||
state->nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
bootleg_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2177,8 +2175,8 @@ static DRIVER_INIT( spangj )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 3;
|
||||
nvram_size = 0x80;
|
||||
nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
state->nvram_size = 0x80;
|
||||
state->nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
spangj_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2186,8 +2184,8 @@ static DRIVER_INIT( sbbros )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 3;
|
||||
nvram_size = 0x80;
|
||||
nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
state->nvram_size = 0x80;
|
||||
state->nvram = &machine->region("maincpu")->base()[0xe000]; /* NVRAM */
|
||||
sbbros_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2195,7 +2193,7 @@ static DRIVER_INIT( qtono1 )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 0;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
qtono1_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2203,7 +2201,7 @@ static DRIVER_INIT( qsangoku )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 0;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
qsangoku_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2219,7 +2217,7 @@ static DRIVER_INIT( mgakuen2 )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 1;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
mgakuen2_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2227,7 +2225,7 @@ static DRIVER_INIT( pkladies )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 1;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
mgakuen2_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2235,7 +2233,7 @@ static DRIVER_INIT( pkladiesbl )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 1;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
bootleg_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2243,7 +2241,7 @@ static DRIVER_INIT( marukin )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 1;
|
||||
nvram_size = 0;
|
||||
state->nvram_size = 0;
|
||||
marukin_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2251,8 +2249,8 @@ static DRIVER_INIT( block )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 2;
|
||||
nvram_size = 0x80;
|
||||
nvram = &machine->region("maincpu")->base()[0xff80]; /* NVRAM */
|
||||
state->nvram_size = 0x80;
|
||||
state->nvram = &machine->region("maincpu")->base()[0xff80]; /* NVRAM */
|
||||
block_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
@ -2260,8 +2258,8 @@ static DRIVER_INIT( blockbl )
|
||||
{
|
||||
mitchell_state *state = machine->driver_data<mitchell_state>();
|
||||
state->input_type = 2;
|
||||
nvram_size = 0x80;
|
||||
nvram = &machine->region("maincpu")->base()[0xff80]; /* NVRAM */
|
||||
state->nvram_size = 0x80;
|
||||
state->nvram = &machine->region("maincpu")->base()[0xff80]; /* NVRAM */
|
||||
bootleg_decode(machine);
|
||||
configure_banks(machine);
|
||||
}
|
||||
|
@ -43,23 +43,23 @@ static WRITE8_HANDLER( pcktgal_sound_w )
|
||||
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
static int msm5205next;
|
||||
|
||||
static void pcktgal_adpcm_int(device_t *device)
|
||||
{
|
||||
static int toggle;
|
||||
pcktgal_state *state = device->machine->driver_data<pcktgal_state>();
|
||||
|
||||
msm5205_data_w(device,msm5205next >> 4);
|
||||
msm5205next<<=4;
|
||||
msm5205_data_w(device,state->msm5205next >> 4);
|
||||
state->msm5205next<<=4;
|
||||
|
||||
toggle = 1 - toggle;
|
||||
if (toggle)
|
||||
state->toggle = 1 - state->toggle;
|
||||
if (state->toggle)
|
||||
cputag_set_input_line(device->machine, "audiocpu", M6502_IRQ_LINE, HOLD_LINE);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( pcktgal_adpcm_data_w )
|
||||
{
|
||||
msm5205next=data;
|
||||
pcktgal_state *state = space->machine->driver_data<pcktgal_state>();
|
||||
state->msm5205next=data;
|
||||
}
|
||||
|
||||
static READ8_DEVICE_HANDLER( pcktgal_adpcm_reset_r )
|
||||
|
@ -43,18 +43,18 @@ TODO:
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
static int oki_bank;
|
||||
|
||||
static WRITE16_HANDLER( powerins_okibank_w )
|
||||
{
|
||||
powerins_state *state = space->machine->driver_data<powerins_state>();
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
UINT8 *RAM = space->machine->region("oki1")->base();
|
||||
int new_bank = data & 0x7;
|
||||
|
||||
if (new_bank != oki_bank)
|
||||
if (new_bank != state->oki_bank)
|
||||
{
|
||||
oki_bank = new_bank;
|
||||
state->oki_bank = new_bank;
|
||||
memcpy(&RAM[0x30000],&RAM[0x40000 + 0x10000*new_bank],0x10000);
|
||||
}
|
||||
}
|
||||
@ -84,9 +84,9 @@ static ADDRESS_MAP_START( powerins_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x10001e, 0x10001f) AM_WRITE(powerins_soundlatch_w) // Sound Latch
|
||||
AM_RANGE(0x100030, 0x100031) AM_WRITE(powerins_okibank_w) // Sound
|
||||
AM_RANGE(0x120000, 0x120fff) AM_RAM_WRITE(powerins_paletteram16_w) AM_BASE_GENERIC(paletteram) // Palette
|
||||
AM_RANGE(0x130000, 0x130007) AM_RAM AM_BASE(&powerins_vctrl_0) // VRAM 0 Control
|
||||
AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(powerins_vram_0_w) AM_BASE(&powerins_vram_0) // VRAM 0
|
||||
AM_RANGE(0x170000, 0x170fff) AM_RAM_WRITE(powerins_vram_1_w) AM_BASE(&powerins_vram_1) // VRAM 1
|
||||
AM_RANGE(0x130000, 0x130007) AM_RAM AM_BASE_MEMBER(powerins_state, vctrl_0) // VRAM 0 Control
|
||||
AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(powerins_vram_0_w) AM_BASE_MEMBER(powerins_state, vram_0) // VRAM 0
|
||||
AM_RANGE(0x170000, 0x170fff) AM_RAM_WRITE(powerins_vram_1_w) AM_BASE_MEMBER(powerins_state, vram_1) // VRAM 1
|
||||
AM_RANGE(0x171000, 0x171fff) AM_WRITE(powerins_vram_1_w) // Mirror of VRAM 1?
|
||||
AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_BASE_GENERIC(spriteram) // RAM + Sprites
|
||||
ADDRESS_MAP_END
|
||||
@ -105,9 +105,9 @@ static ADDRESS_MAP_START( powerina_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x100030, 0x100031) AM_WRITE(powerins_okibank_w) // Sound
|
||||
AM_RANGE(0x10003e, 0x10003f) AM_DEVREADWRITE8_MODERN("oki1", okim6295_device, read, write, 0x00ff) // (used by powerina)
|
||||
AM_RANGE(0x120000, 0x120fff) AM_RAM_WRITE(powerins_paletteram16_w) AM_BASE_GENERIC(paletteram) // Palette
|
||||
AM_RANGE(0x130000, 0x130007) AM_RAM AM_BASE(&powerins_vctrl_0) // VRAM 0 Control
|
||||
AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(powerins_vram_0_w) AM_BASE(&powerins_vram_0) // VRAM 0
|
||||
AM_RANGE(0x170000, 0x170fff) AM_RAM_WRITE(powerins_vram_1_w) AM_BASE(&powerins_vram_1) // VRAM 1
|
||||
AM_RANGE(0x130000, 0x130007) AM_RAM AM_BASE_MEMBER(powerins_state, vctrl_0) // VRAM 0 Control
|
||||
AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(powerins_vram_0_w) AM_BASE_MEMBER(powerins_state, vram_0) // VRAM 0
|
||||
AM_RANGE(0x170000, 0x170fff) AM_RAM_WRITE(powerins_vram_1_w) AM_BASE_MEMBER(powerins_state, vram_1) // VRAM 1
|
||||
AM_RANGE(0x171000, 0x171fff) AM_WRITE(powerins_vram_1_w) // Mirror of VRAM 1?
|
||||
AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_BASE_GENERIC(spriteram) // RAM + Sprites
|
||||
ADDRESS_MAP_END
|
||||
@ -315,7 +315,8 @@ GFXDECODE_END
|
||||
|
||||
static MACHINE_RESET( powerins )
|
||||
{
|
||||
oki_bank = -1; // samples bank "unitialised"
|
||||
powerins_state *state = machine->driver_data<powerins_state>();
|
||||
state->oki_bank = -1; // samples bank "unitialised"
|
||||
}
|
||||
|
||||
static void irqhandler(device_t *device, int irq)
|
||||
@ -339,7 +340,7 @@ static const nmk112_interface powerins_nmk112_intf =
|
||||
};
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( powerins, driver_device )
|
||||
static MACHINE_CONFIG_START( powerins, powerins_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 12000000) /* 12MHz */
|
||||
|
@ -63,25 +63,26 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
UINT8 char_pen;
|
||||
UINT8 char_pen_vreg;
|
||||
UINT8 *fg_fb;
|
||||
UINT8 *fbram;
|
||||
UINT8 scrollx_hi;
|
||||
UINT8 scrollx_lo;
|
||||
UINT8 gfx_switch;
|
||||
UINT8 sound_cmd;
|
||||
};
|
||||
|
||||
|
||||
static UINT8 char_pen,char_pen_vreg;
|
||||
static UINT8 *progolf_fg_fb;
|
||||
static UINT8 *progolf_fbram;
|
||||
static UINT8 scrollx_hi;
|
||||
static UINT8 scrollx_lo;
|
||||
static UINT8 progolf_gfx_switch;
|
||||
|
||||
static UINT8 sound_cmd;
|
||||
|
||||
static VIDEO_START( progolf )
|
||||
{
|
||||
progolf_state *state = machine->driver_data<progolf_state>();
|
||||
scrollx_hi = 0;
|
||||
scrollx_lo = 0;
|
||||
state->scrollx_hi = 0;
|
||||
state->scrollx_lo = 0;
|
||||
|
||||
progolf_fg_fb = auto_alloc_array(machine, UINT8, 0x2000*8);
|
||||
state->fg_fb = auto_alloc_array(machine, UINT8, 0x2000*8);
|
||||
state->videoram = auto_alloc_array(machine, UINT8, 0x1000);
|
||||
}
|
||||
|
||||
@ -93,7 +94,7 @@ static VIDEO_UPDATE( progolf )
|
||||
int count,color,x,y,xi,yi;
|
||||
|
||||
{
|
||||
int scroll = (scrollx_lo | ((scrollx_hi & 0x03) << 8));
|
||||
int scroll = (state->scrollx_lo | ((state->scrollx_hi & 0x03) << 8));
|
||||
|
||||
count = 0;
|
||||
|
||||
@ -124,7 +125,7 @@ static VIDEO_UPDATE( progolf )
|
||||
{
|
||||
for (xi=0;xi<8;xi++)
|
||||
{
|
||||
color = progolf_fg_fb[(xi+yi*8)+count*0x40];
|
||||
color = state->fg_fb[(xi+yi*8)+count*0x40];
|
||||
|
||||
if((x+yi) <= cliprect->max_x && (256-y+xi) <= cliprect->max_y && color != 0)
|
||||
*BITMAP_ADDR16(bitmap, x+yi, 256-y+xi) = screen->machine->pens[(color & 0x7)];
|
||||
@ -141,41 +142,45 @@ static VIDEO_UPDATE( progolf )
|
||||
|
||||
static WRITE8_HANDLER( progolf_charram_w )
|
||||
{
|
||||
progolf_state *state = space->machine->driver_data<progolf_state>();
|
||||
int i;
|
||||
progolf_fbram[offset] = data;
|
||||
state->fbram[offset] = data;
|
||||
|
||||
if(char_pen == 7)
|
||||
if(state->char_pen == 7)
|
||||
{
|
||||
for(i=0;i<8;i++)
|
||||
progolf_fg_fb[offset*8+i] = 0;
|
||||
state->fg_fb[offset*8+i] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(i=0;i<8;i++)
|
||||
{
|
||||
if(progolf_fg_fb[offset*8+i] == char_pen)
|
||||
progolf_fg_fb[offset*8+i] = data & (1<<(7-i)) ? char_pen : 0;
|
||||
if(state->fg_fb[offset*8+i] == state->char_pen)
|
||||
state->fg_fb[offset*8+i] = data & (1<<(7-i)) ? state->char_pen : 0;
|
||||
else
|
||||
progolf_fg_fb[offset*8+i] = data & (1<<(7-i)) ? progolf_fg_fb[offset*8+i]|char_pen : progolf_fg_fb[offset*8+i];
|
||||
state->fg_fb[offset*8+i] = data & (1<<(7-i)) ? state->fg_fb[offset*8+i]|state->char_pen : state->fg_fb[offset*8+i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( progolf_char_vregs_w )
|
||||
{
|
||||
char_pen = data & 0x07;
|
||||
progolf_gfx_switch = data & 0xf0;
|
||||
char_pen_vreg = data & 0x30;
|
||||
progolf_state *state = space->machine->driver_data<progolf_state>();
|
||||
state->char_pen = data & 0x07;
|
||||
state->gfx_switch = data & 0xf0;
|
||||
state->char_pen_vreg = data & 0x30;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( progolf_scrollx_lo_w )
|
||||
{
|
||||
scrollx_lo = data;
|
||||
progolf_state *state = space->machine->driver_data<progolf_state>();
|
||||
state->scrollx_lo = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( progolf_scrollx_hi_w )
|
||||
{
|
||||
scrollx_hi = data;
|
||||
progolf_state *state = space->machine->driver_data<progolf_state>();
|
||||
state->scrollx_hi = data;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( progolf_flip_screen_w )
|
||||
@ -187,14 +192,16 @@ static WRITE8_HANDLER( progolf_flip_screen_w )
|
||||
|
||||
static WRITE8_HANDLER( audio_command_w )
|
||||
{
|
||||
sound_cmd = data;
|
||||
progolf_state *state = space->machine->driver_data<progolf_state>();
|
||||
state->sound_cmd = data;
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, ASSERT_LINE);
|
||||
}
|
||||
|
||||
static READ8_HANDLER( audio_command_r )
|
||||
{
|
||||
progolf_state *state = space->machine->driver_data<progolf_state>();
|
||||
cputag_set_input_line(space->machine, "audiocpu", 0, CLEAR_LINE);
|
||||
return sound_cmd;
|
||||
return state->sound_cmd;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( progolf_videoram_r )
|
||||
@ -205,20 +212,20 @@ static READ8_HANDLER( progolf_videoram_r )
|
||||
|
||||
if (offset >= 0x0800)
|
||||
{
|
||||
if (progolf_gfx_switch == 0x50)
|
||||
if (state->gfx_switch == 0x50)
|
||||
return gfx_rom[offset];
|
||||
else if (progolf_gfx_switch == 0x60)
|
||||
else if (state->gfx_switch == 0x60)
|
||||
return gfx_rom[offset + 0x1000];
|
||||
else if (progolf_gfx_switch == 0x70)
|
||||
else if (state->gfx_switch == 0x70)
|
||||
return gfx_rom[offset + 0x2000];
|
||||
else
|
||||
return videoram[offset];
|
||||
} else {
|
||||
if (progolf_gfx_switch == 0x10)
|
||||
if (state->gfx_switch == 0x10)
|
||||
return gfx_rom[offset];
|
||||
else if (progolf_gfx_switch == 0x20)
|
||||
else if (state->gfx_switch == 0x20)
|
||||
return gfx_rom[offset + 0x1000];
|
||||
else if (progolf_gfx_switch == 0x30)
|
||||
else if (state->gfx_switch == 0x30)
|
||||
return gfx_rom[offset + 0x2000];
|
||||
else
|
||||
return videoram[offset];
|
||||
@ -229,13 +236,13 @@ static WRITE8_HANDLER( progolf_videoram_w )
|
||||
{
|
||||
progolf_state *state = space->machine->driver_data<progolf_state>();
|
||||
UINT8 *videoram = state->videoram;
|
||||
//if(progolf_gfx_switch & 0x40)
|
||||
//if(state->gfx_switch & 0x40)
|
||||
videoram[offset] = data;
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( main_cpu, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x5fff) AM_RAM
|
||||
AM_RANGE(0x6000, 0x7fff) AM_RAM_WRITE(progolf_charram_w) AM_BASE(&progolf_fbram)
|
||||
AM_RANGE(0x6000, 0x7fff) AM_RAM_WRITE(progolf_charram_w) AM_BASE_MEMBER(progolf_state, fbram)
|
||||
AM_RANGE(0x8000, 0x8fff) AM_READWRITE(progolf_videoram_r,progolf_videoram_w)
|
||||
AM_RANGE(0x9000, 0x9000) AM_READ_PORT("IN2") AM_WRITE(progolf_char_vregs_w)
|
||||
AM_RANGE(0x9200, 0x9200) AM_READ_PORT("P1") AM_WRITE(progolf_scrollx_hi_w) //p1 inputs
|
||||
|
@ -33,50 +33,66 @@ TODO:
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/msm5205.h"
|
||||
|
||||
static int gfxbank;
|
||||
static UINT8 *videoram;
|
||||
static UINT8 *colorram;
|
||||
static tilemap_t *bg_tilemap;
|
||||
|
||||
class rmhaihai_state : public driver_device
|
||||
{
|
||||
public:
|
||||
rmhaihai_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
int gfxbank;
|
||||
UINT8 *videoram;
|
||||
UINT8 *colorram;
|
||||
tilemap_t *bg_tilemap;
|
||||
int keyboard_cmd;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static WRITE8_HANDLER( rmhaihai_videoram_w )
|
||||
{
|
||||
videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
rmhaihai_state *state = space->machine->driver_data<rmhaihai_state>();
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( rmhaihai_colorram_w )
|
||||
{
|
||||
colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset);
|
||||
rmhaihai_state *state = space->machine->driver_data<rmhaihai_state>();
|
||||
state->colorram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
int attr = colorram[tile_index];
|
||||
int code = videoram[tile_index] + (gfxbank << 12) + ((attr & 0x07) << 8) + ((attr & 0x80) << 4);
|
||||
int color = (gfxbank << 5) + (attr >> 3);
|
||||
rmhaihai_state *state = machine->driver_data<rmhaihai_state>();
|
||||
int attr = state->colorram[tile_index];
|
||||
int code = state->videoram[tile_index] + (state->gfxbank << 12) + ((attr & 0x07) << 8) + ((attr & 0x80) << 4);
|
||||
int color = (state->gfxbank << 5) + (attr >> 3);
|
||||
|
||||
SET_TILE_INFO(0, code, color, 0);
|
||||
}
|
||||
|
||||
static VIDEO_START( rmhaihai )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
rmhaihai_state *state = machine->driver_data<rmhaihai_state>();
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 64, 32);
|
||||
}
|
||||
|
||||
static VIDEO_UPDATE( rmhaihai )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
rmhaihai_state *state = screen->machine->driver_data<rmhaihai_state>();
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int keyboard_cmd;
|
||||
|
||||
static READ8_HANDLER( keyboard_r )
|
||||
{
|
||||
rmhaihai_state *state = space->machine->driver_data<rmhaihai_state>();
|
||||
static const char *const keynames[] = { "KEY0", "KEY1" };
|
||||
|
||||
logerror("%04x: keyboard_r\n",cpu_get_pc(space->cpu));
|
||||
@ -100,24 +116,24 @@ static READ8_HANDLER( keyboard_r )
|
||||
case 0x5c7b: // rmhaihai, rmhaisei, rmhaijin
|
||||
case 0x5950: // rmhaihib
|
||||
case 0x5bf3: // themj, but the test is NOPed out!
|
||||
return 0xcc; /* keyboard_cmd = 0xcb */
|
||||
return 0xcc; /* state->keyboard_cmd = 0xcb */
|
||||
|
||||
|
||||
case 0x13a: // additional checks done by rmhaijin
|
||||
if (keyboard_cmd == 0x3b) return 0xdd;
|
||||
if (keyboard_cmd == 0x85) return 0xdc;
|
||||
if (keyboard_cmd == 0xf2) return 0xd6;
|
||||
if (keyboard_cmd == 0xc1) return 0x8f;
|
||||
if (keyboard_cmd == 0xd0) return 0x08;
|
||||
if (state->keyboard_cmd == 0x3b) return 0xdd;
|
||||
if (state->keyboard_cmd == 0x85) return 0xdc;
|
||||
if (state->keyboard_cmd == 0xf2) return 0xd6;
|
||||
if (state->keyboard_cmd == 0xc1) return 0x8f;
|
||||
if (state->keyboard_cmd == 0xd0) return 0x08;
|
||||
return 0;
|
||||
|
||||
case 0x140: // additional checks done by rmhaisei
|
||||
case 0x155: // additional checks done by themj, but they are patched out!
|
||||
if (keyboard_cmd == 0x11) return 0x57;
|
||||
if (keyboard_cmd == 0x3e) return 0xda;
|
||||
if (keyboard_cmd == 0x48) return 0x74;
|
||||
if (keyboard_cmd == 0x5d) return 0x46;
|
||||
if (keyboard_cmd == 0xd0) return 0x08;
|
||||
if (state->keyboard_cmd == 0x11) return 0x57;
|
||||
if (state->keyboard_cmd == 0x3e) return 0xda;
|
||||
if (state->keyboard_cmd == 0x48) return 0x74;
|
||||
if (state->keyboard_cmd == 0x5d) return 0x46;
|
||||
if (state->keyboard_cmd == 0xd0) return 0x08;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -127,8 +143,9 @@ static READ8_HANDLER( keyboard_r )
|
||||
|
||||
static WRITE8_HANDLER( keyboard_w )
|
||||
{
|
||||
rmhaihai_state *state = space->machine->driver_data<rmhaihai_state>();
|
||||
logerror("%04x: keyboard_w %02x\n",cpu_get_pc(space->cpu),data);
|
||||
keyboard_cmd = data;
|
||||
state->keyboard_cmd = data;
|
||||
}
|
||||
|
||||
static READ8_HANDLER( samples_r )
|
||||
@ -145,6 +162,7 @@ static WRITE8_DEVICE_HANDLER( adpcm_w )
|
||||
|
||||
static WRITE8_HANDLER( ctrl_w )
|
||||
{
|
||||
rmhaihai_state *state = space->machine->driver_data<rmhaihai_state>();
|
||||
flip_screen_set(space->machine, data & 0x01);
|
||||
|
||||
// (data & 0x02) is switched on and off in service mode
|
||||
@ -154,7 +172,7 @@ static WRITE8_HANDLER( ctrl_w )
|
||||
|
||||
// (data & 0x10) is medal in service mode
|
||||
|
||||
gfxbank = (data & 0x40) >> 6; /* rmhaisei only */
|
||||
state->gfxbank = (data & 0x40) >> 6; /* rmhaisei only */
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER( themj_rombank_w )
|
||||
@ -176,8 +194,8 @@ static MACHINE_RESET( themj )
|
||||
static ADDRESS_MAP_START( rmhaihai_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x9fff) AM_ROM
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_BASE(&colorram)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_BASE(&videoram)
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_BASE_MEMBER(rmhaihai_state, colorram)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_BASE_MEMBER(rmhaihai_state, videoram)
|
||||
AM_RANGE(0xb83c, 0xb83c) AM_WRITENOP // ??
|
||||
AM_RANGE(0xbc00, 0xbc00) AM_WRITENOP // ??
|
||||
AM_RANGE(0xc000, 0xdfff) AM_ROM
|
||||
@ -201,8 +219,8 @@ static ADDRESS_MAP_START( themj_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x7fff) AM_ROM
|
||||
AM_RANGE(0x8000, 0x9fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0xa000, 0xa7ff) AM_RAM
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_BASE(&colorram)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_BASE(&videoram)
|
||||
AM_RANGE(0xa800, 0xafff) AM_RAM_WRITE(rmhaihai_colorram_w) AM_BASE_MEMBER(rmhaihai_state, colorram)
|
||||
AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(rmhaihai_videoram_w) AM_BASE_MEMBER(rmhaihai_state, videoram)
|
||||
AM_RANGE(0xc000, 0xdfff) AM_ROMBANK("bank2")
|
||||
AM_RANGE(0xe000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -437,7 +455,7 @@ static const msm5205_interface msm5205_config =
|
||||
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( rmhaihai, driver_device )
|
||||
static MACHINE_CONFIG_START( rmhaihai, rmhaihai_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu",Z80,20000000/4) /* 5 MHz ??? */
|
||||
|
@ -72,7 +72,7 @@ Ignore the warnings about writing to unmapped memory.
|
||||
static ADDRESS_MAP_START( srumbler_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1dff) AM_RAM /* RAM (of 1 sort or another) */
|
||||
AM_RANGE(0x1e00, 0x1fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_RAM_WRITE(srumbler_background_w) AM_BASE(&srumbler_backgroundram)
|
||||
AM_RANGE(0x2000, 0x3fff) AM_RAM_WRITE(srumbler_background_w) AM_BASE_MEMBER(srumbler_state, backgroundram)
|
||||
AM_RANGE(0x4008, 0x4008) AM_READ_PORT("SYSTEM") AM_WRITE(srumbler_bankswitch_w)
|
||||
AM_RANGE(0x4009, 0x4009) AM_READ_PORT("P1") AM_WRITE(srumbler_4009_w)
|
||||
AM_RANGE(0x400a, 0x400a) AM_READ_PORT("P2")
|
||||
@ -80,7 +80,7 @@ static ADDRESS_MAP_START( srumbler_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x400c, 0x400c) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0x400a, 0x400d) AM_WRITE(srumbler_scroll_w)
|
||||
AM_RANGE(0x400e, 0x400e) AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0x5000, 0x5fff) AM_ROMBANK("5000") AM_WRITE(srumbler_foreground_w) AM_BASE(&srumbler_foregroundram) /* Banked ROM */
|
||||
AM_RANGE(0x5000, 0x5fff) AM_ROMBANK("5000") AM_WRITE(srumbler_foreground_w) AM_BASE_MEMBER(srumbler_state, foregroundram) /* Banked ROM */
|
||||
AM_RANGE(0x6000, 0x6fff) AM_ROMBANK("6000") /* Banked ROM */
|
||||
AM_RANGE(0x6000, 0x6fff) AM_WRITENOP /* Video RAM 2 ??? (not used) */
|
||||
AM_RANGE(0x7000, 0x7fff) AM_ROMBANK("7000") /* Banked ROM */
|
||||
@ -231,7 +231,7 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( srumbler, driver_device )
|
||||
static MACHINE_CONFIG_START( srumbler, srumbler_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6809, 1500000) /* 1.5 MHz (?) */
|
||||
|
@ -60,15 +60,14 @@ Stephh's notes (based on the games M68000 code and some tests) :
|
||||
|
||||
#define SSHANGHA_HACK 0
|
||||
|
||||
static UINT16 *sshangha_prot_data;
|
||||
|
||||
static UINT16 *sshangha_sound_shared_ram;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static WRITE16_HANDLER( sshangha_protection16_w )
|
||||
{
|
||||
COMBINE_DATA(&sshangha_prot_data[offset]);
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
COMBINE_DATA(&state->prot_data[offset]);
|
||||
|
||||
logerror("CPU #0 PC %06x: warning - write unmapped control address %06x %04x\n",cpu_get_pc(space->cpu),offset<<1,data);
|
||||
}
|
||||
@ -76,6 +75,7 @@ static WRITE16_HANDLER( sshangha_protection16_w )
|
||||
/* Protection/IO chip 146 */
|
||||
static READ16_HANDLER( sshangha_protection16_r )
|
||||
{
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
switch (offset)
|
||||
{
|
||||
case 0x050 >> 1:
|
||||
@ -89,11 +89,12 @@ static READ16_HANDLER( sshangha_protection16_r )
|
||||
}
|
||||
|
||||
logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",cpu_get_pc(space->cpu),offset<<1);
|
||||
return sshangha_prot_data[offset];
|
||||
return state->prot_data[offset];
|
||||
}
|
||||
|
||||
static READ16_HANDLER( sshanghb_protection16_r )
|
||||
{
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
switch (offset)
|
||||
{
|
||||
case 0x050 >> 1:
|
||||
@ -104,7 +105,7 @@ static READ16_HANDLER( sshanghb_protection16_r )
|
||||
return input_port_read(space->machine, "DSW");
|
||||
}
|
||||
|
||||
return sshangha_prot_data[offset];
|
||||
return state->prot_data[offset];
|
||||
}
|
||||
|
||||
/* Probably returns 0xffff when sprite DMA is complete, the game waits on it */
|
||||
@ -131,12 +132,12 @@ static MACHINE_RESET( sshangha )
|
||||
|
||||
static ADDRESS_MAP_START( sshangha_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_ROM
|
||||
AM_RANGE(0x100000, 0x10000f) AM_RAM AM_BASE(&sshangha_sound_shared_ram)
|
||||
AM_RANGE(0x100000, 0x10000f) AM_RAM AM_BASE_MEMBER(sshangha_state, sound_shared_ram)
|
||||
|
||||
AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(sshangha_pf1_data_w) AM_BASE(&sshangha_pf1_data)
|
||||
AM_RANGE(0x202000, 0x203fff) AM_RAM_WRITE(sshangha_pf2_data_w) AM_BASE(&sshangha_pf2_data)
|
||||
AM_RANGE(0x204000, 0x2047ff) AM_RAM AM_BASE(&sshangha_pf1_rowscroll)
|
||||
AM_RANGE(0x206000, 0x2067ff) AM_RAM AM_BASE(&sshangha_pf2_rowscroll)
|
||||
AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(sshangha_pf1_data_w) AM_BASE_MEMBER(sshangha_state, pf1_data)
|
||||
AM_RANGE(0x202000, 0x203fff) AM_RAM_WRITE(sshangha_pf2_data_w) AM_BASE_MEMBER(sshangha_state, pf2_data)
|
||||
AM_RANGE(0x204000, 0x2047ff) AM_RAM AM_BASE_MEMBER(sshangha_state, pf1_rowscroll)
|
||||
AM_RANGE(0x206000, 0x2067ff) AM_RAM AM_BASE_MEMBER(sshangha_state, pf2_rowscroll)
|
||||
AM_RANGE(0x206800, 0x207fff) AM_RAM
|
||||
AM_RANGE(0x300000, 0x30000f) AM_WRITE(sshangha_control_0_w)
|
||||
AM_RANGE(0x320000, 0x320001) AM_WRITE(sshangha_video_w)
|
||||
@ -152,18 +153,18 @@ static ADDRESS_MAP_START( sshangha_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x380000, 0x383fff) AM_RAM_WRITE(paletteram16_xbgr_word_be_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x3c0000, 0x3c0fff) AM_RAM /* Sprite ram buffer on bootleg only?? */
|
||||
AM_RANGE(0xfec000, 0xff3fff) AM_RAM
|
||||
AM_RANGE(0xff4000, 0xff47ff) AM_READWRITE(sshangha_protection16_r,sshangha_protection16_w) AM_BASE(&sshangha_prot_data)
|
||||
AM_RANGE(0xff4000, 0xff47ff) AM_READWRITE(sshangha_protection16_r,sshangha_protection16_w) AM_BASE_MEMBER(sshangha_state, prot_data)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( sshanghb_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x03ffff) AM_ROM
|
||||
AM_RANGE(0x084000, 0x0847ff) AM_READ(sshanghb_protection16_r)
|
||||
AM_RANGE(0x101000, 0x10100f) AM_RAM AM_BASE(&sshangha_sound_shared_ram) /* the bootleg writes here */
|
||||
AM_RANGE(0x101000, 0x10100f) AM_RAM AM_BASE_MEMBER(sshangha_state, sound_shared_ram) /* the bootleg writes here */
|
||||
|
||||
AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(sshangha_pf1_data_w) AM_BASE(&sshangha_pf1_data)
|
||||
AM_RANGE(0x202000, 0x203fff) AM_RAM_WRITE(sshangha_pf2_data_w) AM_BASE(&sshangha_pf2_data)
|
||||
AM_RANGE(0x204000, 0x2047ff) AM_RAM AM_BASE(&sshangha_pf1_rowscroll)
|
||||
AM_RANGE(0x206000, 0x2067ff) AM_RAM AM_BASE(&sshangha_pf2_rowscroll)
|
||||
AM_RANGE(0x200000, 0x201fff) AM_RAM_WRITE(sshangha_pf1_data_w) AM_BASE_MEMBER(sshangha_state, pf1_data)
|
||||
AM_RANGE(0x202000, 0x203fff) AM_RAM_WRITE(sshangha_pf2_data_w) AM_BASE_MEMBER(sshangha_state, pf2_data)
|
||||
AM_RANGE(0x204000, 0x2047ff) AM_RAM AM_BASE_MEMBER(sshangha_state, pf1_rowscroll)
|
||||
AM_RANGE(0x206000, 0x2067ff) AM_RAM AM_BASE_MEMBER(sshangha_state, pf2_rowscroll)
|
||||
AM_RANGE(0x206800, 0x207fff) AM_RAM
|
||||
AM_RANGE(0x300000, 0x30000f) AM_WRITE(sshangha_control_0_w)
|
||||
AM_RANGE(0x320000, 0x320001) AM_WRITE(sshangha_video_w)
|
||||
@ -188,12 +189,14 @@ ADDRESS_MAP_END
|
||||
|
||||
static READ8_HANDLER(sshangha_sound_shared_r)
|
||||
{
|
||||
return sshangha_sound_shared_ram[offset] & 0xff;
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
return state->sound_shared_ram[offset] & 0xff;
|
||||
}
|
||||
|
||||
static WRITE8_HANDLER(sshangha_sound_shared_w)
|
||||
{
|
||||
sshangha_sound_shared_ram[offset] = data & 0xff;
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
state->sound_shared_ram[offset] = data & 0xff;
|
||||
}
|
||||
|
||||
/* Note: there's rom data after 0x8000 but the game never seem to call a rom bank, left-over? */
|
||||
@ -342,7 +345,7 @@ static const ym2203_interface ym2203_config =
|
||||
irqhandler
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( sshangha, driver_device )
|
||||
static MACHINE_CONFIG_START( sshangha, sshangha_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 28000000/2)
|
||||
|
@ -55,9 +55,9 @@ static WRITE16_HANDLER( stadhero_control_w )
|
||||
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0x000000, 0x01ffff) AM_ROM
|
||||
AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(stadhero_pf1_data_w) AM_BASE(&stadhero_pf1_data)
|
||||
AM_RANGE(0x240000, 0x240007) AM_RAM AM_BASE(&stadhero_pf2_control_0)
|
||||
AM_RANGE(0x240010, 0x240017) AM_WRITEONLY AM_BASE(&stadhero_pf2_control_1)
|
||||
AM_RANGE(0x200000, 0x2007ff) AM_RAM_WRITE(stadhero_pf1_data_w) AM_BASE_MEMBER(stadhero_state, pf1_data)
|
||||
AM_RANGE(0x240000, 0x240007) AM_RAM AM_BASE_MEMBER(stadhero_state, pf2_control_0)
|
||||
AM_RANGE(0x240010, 0x240017) AM_WRITEONLY AM_BASE_MEMBER(stadhero_state, pf2_control_1)
|
||||
AM_RANGE(0x260000, 0x261fff) AM_READWRITE(stadhero_pf2_data_r, stadhero_pf2_data_w)
|
||||
AM_RANGE(0x30c000, 0x30c00b) AM_READWRITE(stadhero_control_r, stadhero_control_w)
|
||||
AM_RANGE(0x310000, 0x3107ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
|
||||
@ -208,7 +208,7 @@ static const ym3812_interface ym3812_config =
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static MACHINE_CONFIG_START( stadhero, driver_device )
|
||||
static MACHINE_CONFIG_START( stadhero, stadhero_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 10000000)
|
||||
|
@ -27,7 +27,6 @@ Memory Overview:
|
||||
#include "includes/tigeroad.h"
|
||||
|
||||
|
||||
static UINT16 *ram16;
|
||||
|
||||
/*
|
||||
F1 Dream protection code written by Eric Hustvedt (hustvedt@ma.ultranet.com).
|
||||
@ -82,6 +81,7 @@ static const int f1dream_2450_lookup[32] = {
|
||||
|
||||
static void f1dream_protection_w(address_space *space)
|
||||
{
|
||||
tigeroad_state *state = space->machine->driver_data<tigeroad_state>();
|
||||
int indx;
|
||||
int value = 255;
|
||||
int prevpc = cpu_get_previouspc(space->cpu);
|
||||
@ -89,63 +89,64 @@ static void f1dream_protection_w(address_space *space)
|
||||
if (prevpc == 0x244c)
|
||||
{
|
||||
/* Called once, when a race is started.*/
|
||||
indx = ram16[0x3ff0/2];
|
||||
ram16[0x3fe6/2] = f1dream_2450_lookup[indx];
|
||||
ram16[0x3fe8/2] = f1dream_2450_lookup[++indx];
|
||||
ram16[0x3fea/2] = f1dream_2450_lookup[++indx];
|
||||
ram16[0x3fec/2] = f1dream_2450_lookup[++indx];
|
||||
indx = state->ram16[0x3ff0/2];
|
||||
state->ram16[0x3fe6/2] = f1dream_2450_lookup[indx];
|
||||
state->ram16[0x3fe8/2] = f1dream_2450_lookup[++indx];
|
||||
state->ram16[0x3fea/2] = f1dream_2450_lookup[++indx];
|
||||
state->ram16[0x3fec/2] = f1dream_2450_lookup[++indx];
|
||||
}
|
||||
else if (prevpc == 0x613a)
|
||||
{
|
||||
/* Called for every sprite on-screen.*/
|
||||
if (ram16[0x3ff6/2] < 15)
|
||||
if (state->ram16[0x3ff6/2] < 15)
|
||||
{
|
||||
indx = f1dream_613ea_lookup[ram16[0x3ff6/2]] - ram16[0x3ff4/2];
|
||||
indx = f1dream_613ea_lookup[state->ram16[0x3ff6/2]] - state->ram16[0x3ff4/2];
|
||||
if (indx > 255)
|
||||
{
|
||||
indx <<= 4;
|
||||
indx += ram16[0x3ff6/2] & 0x00ff;
|
||||
indx += state->ram16[0x3ff6/2] & 0x00ff;
|
||||
value = f1dream_613eb_lookup[indx];
|
||||
}
|
||||
}
|
||||
|
||||
ram16[0x3ff2/2] = value;
|
||||
state->ram16[0x3ff2/2] = value;
|
||||
}
|
||||
else if (prevpc == 0x17b70)
|
||||
{
|
||||
/* Called only before a real race, not a time trial.*/
|
||||
if (ram16[0x3ff0/2] >= 0x04) indx = 128;
|
||||
else if (ram16[0x3ff0/2] > 0x02) indx = 96;
|
||||
else if (ram16[0x3ff0/2] == 0x02) indx = 64;
|
||||
else if (ram16[0x3ff0/2] == 0x01) indx = 32;
|
||||
if (state->ram16[0x3ff0/2] >= 0x04) indx = 128;
|
||||
else if (state->ram16[0x3ff0/2] > 0x02) indx = 96;
|
||||
else if (state->ram16[0x3ff0/2] == 0x02) indx = 64;
|
||||
else if (state->ram16[0x3ff0/2] == 0x01) indx = 32;
|
||||
else indx = 0;
|
||||
|
||||
indx += ram16[0x3fee/2];
|
||||
indx += state->ram16[0x3fee/2];
|
||||
if (indx < 128)
|
||||
{
|
||||
ram16[0x3fe6/2] = f1dream_17b74_lookup[indx];
|
||||
ram16[0x3fe8/2] = f1dream_17b74_lookup[++indx];
|
||||
ram16[0x3fea/2] = f1dream_17b74_lookup[++indx];
|
||||
ram16[0x3fec/2] = f1dream_17b74_lookup[++indx];
|
||||
state->ram16[0x3fe6/2] = f1dream_17b74_lookup[indx];
|
||||
state->ram16[0x3fe8/2] = f1dream_17b74_lookup[++indx];
|
||||
state->ram16[0x3fea/2] = f1dream_17b74_lookup[++indx];
|
||||
state->ram16[0x3fec/2] = f1dream_17b74_lookup[++indx];
|
||||
}
|
||||
else
|
||||
{
|
||||
ram16[0x3fe6/2] = 0x00ff;
|
||||
ram16[0x3fe8/2] = 0x00ff;
|
||||
ram16[0x3fea/2] = 0x00ff;
|
||||
ram16[0x3fec/2] = 0x00ff;
|
||||
state->ram16[0x3fe6/2] = 0x00ff;
|
||||
state->ram16[0x3fe8/2] = 0x00ff;
|
||||
state->ram16[0x3fea/2] = 0x00ff;
|
||||
state->ram16[0x3fec/2] = 0x00ff;
|
||||
}
|
||||
}
|
||||
else if ((prevpc == 0x27f8) || (prevpc == 0x511a) || (prevpc == 0x5142) || (prevpc == 0x516a))
|
||||
{
|
||||
/* The main CPU stuffs the byte for the soundlatch into 0xfffffd.*/
|
||||
soundlatch_w(space,2,ram16[0x3ffc/2]);
|
||||
soundlatch_w(space,2,state->ram16[0x3ffc/2]);
|
||||
}
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( f1dream_control_w )
|
||||
{
|
||||
logerror("protection write, PC: %04x FFE1 Value:%01x\n",cpu_get_pc(space->cpu), ram16[0x3fe0/2]);
|
||||
tigeroad_state *state = space->machine->driver_data<tigeroad_state>();
|
||||
logerror("protection write, PC: %04x FFE1 Value:%01x\n",cpu_get_pc(space->cpu), state->ram16[0x3fe0/2]);
|
||||
f1dream_protection_w(space);
|
||||
}
|
||||
|
||||
@ -178,7 +179,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
AM_RANGE(0xfe8000, 0xfe8003) AM_WRITE(tigeroad_scroll_w)
|
||||
AM_RANGE(0xfe800e, 0xfe800f) AM_WRITEONLY /* fe800e = watchdog or IRQ acknowledge */
|
||||
AM_RANGE(0xff8200, 0xff867f) AM_RAM_WRITE(paletteram16_xxxxRRRRGGGGBBBB_word_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_BASE(&ram16)
|
||||
AM_RANGE(0xffc000, 0xffffff) AM_RAM AM_BASE_MEMBER(tigeroad_state, ram16)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
|
@ -67,7 +67,7 @@ static ADDRESS_MAP_START( main_cpu, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xe301, 0xe301) AM_WRITE(tryout_flipscreen_w)
|
||||
AM_RANGE(0xe302, 0xe302) AM_WRITE(tryout_bankswitch_w)
|
||||
AM_RANGE(0xe401, 0xe401) AM_WRITE(tryout_vram_bankswitch_w)
|
||||
AM_RANGE(0xe402, 0xe404) AM_WRITEONLY AM_BASE(&tryout_gfx_control)
|
||||
AM_RANGE(0xe402, 0xe404) AM_WRITEONLY AM_BASE_MEMBER(tryout_state, gfx_control)
|
||||
AM_RANGE(0xe414, 0xe414) AM_WRITE(tryout_sound_w)
|
||||
AM_RANGE(0xe417, 0xe417) AM_WRITE(tryout_nmi_ack_w)
|
||||
AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("maincpu", 0xbff0) /* reset vectors */
|
||||
|
@ -888,8 +888,6 @@ static READ8_HANDLER( prot_io_r )
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
static UINT8 semicom_prot_offset = 0x00;
|
||||
static UINT16 protbase = 0x0000;
|
||||
|
||||
// probably not endian safe
|
||||
static WRITE8_HANDLER( prot_io_w )
|
||||
@ -900,25 +898,25 @@ static WRITE8_HANDLER( prot_io_w )
|
||||
{
|
||||
case 0x00:
|
||||
{
|
||||
UINT16 word = state->mainram[(protbase/2) + semicom_prot_offset];
|
||||
UINT16 word = state->mainram[(state->protbase/2) + state->semicom_prot_offset];
|
||||
word = (word & 0xff00) | (data << 0);
|
||||
state->mainram[(protbase/2) + semicom_prot_offset] = word;
|
||||
state->mainram[(state->protbase/2) + state->semicom_prot_offset] = word;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x01:
|
||||
{
|
||||
UINT16 word = state->mainram[(protbase/2) + semicom_prot_offset];
|
||||
UINT16 word = state->mainram[(state->protbase/2) + state->semicom_prot_offset];
|
||||
word = (word & 0x00ff) | (data << 8);
|
||||
state->mainram[(protbase/2) + semicom_prot_offset] = word;
|
||||
state->mainram[(state->protbase/2) + state->semicom_prot_offset] = word;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x02: // offset
|
||||
{
|
||||
semicom_prot_offset = data;
|
||||
state->semicom_prot_offset = data;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3443,7 +3441,7 @@ static DRIVER_INIT( htchctch )
|
||||
int i, len = machine->region("user1")->bytes();
|
||||
/* simulate RAM initialization done by the protection MCU */
|
||||
/* verified on real hardware */
|
||||
// static UINT16 htchctch_mcu68k[] =
|
||||
// static const UINT16 htchctch_mcu68k[] =
|
||||
// {
|
||||
// /* moved to protdata.bin file .. */
|
||||
// };
|
||||
@ -3744,18 +3742,20 @@ static DRIVER_INIT( chokchok )
|
||||
|
||||
static DRIVER_INIT( wlstar )
|
||||
{
|
||||
tumbleb_state *state = machine->driver_data<tumbleb_state>();
|
||||
tumblepb_gfx1_rearrange(machine);
|
||||
|
||||
/* slightly different banking */
|
||||
memory_install_write16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x100002, 0x100003, 0, 0, wlstar_tilebank_w);
|
||||
|
||||
protbase = 0x0000;
|
||||
state->protbase = 0x0000;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( wondl96 )
|
||||
{
|
||||
tumbleb_state *state = machine->driver_data<tumbleb_state>();
|
||||
DRIVER_INIT_CALL( wlstar );
|
||||
protbase = 0x0200;
|
||||
state->protbase = 0x0200;
|
||||
}
|
||||
|
||||
static DRIVER_INIT ( dquizgo )
|
||||
|
@ -63,13 +63,13 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
|
||||
AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
|
||||
AM_RANGE(0xc800, 0xc800) AM_WRITE(soundlatch_w)
|
||||
AM_RANGE(0xc802, 0xc803) AM_RAM AM_BASE(&vulgus_scroll_low)
|
||||
AM_RANGE(0xc802, 0xc803) AM_RAM AM_BASE_MEMBER(vulgus_state, scroll_low)
|
||||
AM_RANGE(0xc804, 0xc804) AM_WRITE(vulgus_c804_w)
|
||||
AM_RANGE(0xc805, 0xc805) AM_WRITE(vulgus_palette_bank_w)
|
||||
AM_RANGE(0xc902, 0xc903) AM_RAM AM_BASE(&vulgus_scroll_high)
|
||||
AM_RANGE(0xc902, 0xc903) AM_RAM AM_BASE_MEMBER(vulgus_state, scroll_high)
|
||||
AM_RANGE(0xcc00, 0xcc7f) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(vulgus_fgvideoram_w) AM_BASE(&vulgus_fgvideoram)
|
||||
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(vulgus_bgvideoram_w) AM_BASE(&vulgus_bgvideoram)
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(vulgus_fgvideoram_w) AM_BASE_MEMBER(vulgus_state, fgvideoram)
|
||||
AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(vulgus_bgvideoram_w) AM_BASE_MEMBER(vulgus_state, bgvideoram)
|
||||
AM_RANGE(0xe000, 0xefff) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -217,7 +217,7 @@ GFXDECODE_END
|
||||
|
||||
|
||||
|
||||
static MACHINE_CONFIG_START( vulgus, driver_device )
|
||||
static MACHINE_CONFIG_START( vulgus, vulgus_state )
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz (?) */
|
||||
|
@ -1,3 +1,31 @@
|
||||
class battlera_state : public driver_device
|
||||
{
|
||||
public:
|
||||
battlera_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
int control_port_select;
|
||||
int msm5205next;
|
||||
int toggle;
|
||||
int HuC6270_registers[20];
|
||||
int VDC_register;
|
||||
int vram_ptr;
|
||||
UINT8 *HuC6270_vram;
|
||||
UINT8 *vram_dirty;
|
||||
bitmap_t *tile_bitmap;
|
||||
bitmap_t *front_bitmap;
|
||||
UINT32 tile_dirtyseq;
|
||||
int current_scanline;
|
||||
int inc_value;
|
||||
int irq_enable;
|
||||
int rcr_enable;
|
||||
int sb_enable;
|
||||
int bb_enable;
|
||||
int bldwolf_vblank;
|
||||
UINT8 blank_tile[32];
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/battlera.c -----------*/
|
||||
|
||||
VIDEO_UPDATE( battlera );
|
||||
|
@ -6,6 +6,23 @@
|
||||
|
||||
#include "machine/z80ctc.h"
|
||||
|
||||
class cchasm_state : public driver_device
|
||||
{
|
||||
public:
|
||||
cchasm_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
int sound_flags;
|
||||
int coin_flag;
|
||||
device_t *ctc;
|
||||
int channel_active[2];
|
||||
int output[2];
|
||||
UINT16 *ram;
|
||||
int xcenter;
|
||||
int ycenter;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in machine/cchasm.c -----------*/
|
||||
|
||||
WRITE16_HANDLER( cchasm_led_w );
|
||||
@ -28,8 +45,6 @@ SOUND_START( cchasm );
|
||||
|
||||
/*----------- defined in video/cchasm.c -----------*/
|
||||
|
||||
extern UINT16 *cchasm_ram;
|
||||
|
||||
WRITE16_HANDLER( cchasm_refresh_control_w );
|
||||
VIDEO_START( cchasm );
|
||||
|
||||
|
@ -5,6 +5,39 @@
|
||||
*************************************************************************/
|
||||
|
||||
|
||||
class cinemat_state : public driver_device
|
||||
{
|
||||
public:
|
||||
cinemat_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 sound_control;
|
||||
UINT32 current_shift;
|
||||
UINT32 last_shift;
|
||||
UINT32 last_shift2;
|
||||
UINT32 current_pitch;
|
||||
UINT32 last_frame;
|
||||
UINT8 sound_fifo[16];
|
||||
UINT8 sound_fifo_in;
|
||||
UINT8 sound_fifo_out;
|
||||
UINT8 last_portb_write;
|
||||
float target_volume;
|
||||
float current_volume;
|
||||
UINT16 *rambase;
|
||||
UINT8 coin_detected;
|
||||
UINT8 coin_last_reset;
|
||||
UINT8 mux_select;
|
||||
int gear;
|
||||
int color_mode;
|
||||
rgb_t vector_color;
|
||||
INT16 lastx;
|
||||
INT16 lasty;
|
||||
UINT8 last_control;
|
||||
int qb3_lastx;
|
||||
int qb3_lasty;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in drivers/cinemat.c -----------*/
|
||||
|
||||
MACHINE_RESET( cinemat );
|
||||
|
@ -5,10 +5,60 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "devlegcy.h"
|
||||
#include "machine/intelfsh.h"
|
||||
|
||||
/*----------- defined in drivers/cps3.c -----------*/
|
||||
class cps3_state : public driver_device
|
||||
{
|
||||
public:
|
||||
cps3_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT8* cps3_user5region;
|
||||
fujitsu_29f016a_device *simm[7][8];
|
||||
UINT32* decrypted_bios;
|
||||
UINT32* decrypted_gamerom;
|
||||
UINT32 cram_gfxflash_bank;
|
||||
UINT32* nops;
|
||||
UINT32* tilemap20_regs_base;
|
||||
UINT32* tilemap30_regs_base;
|
||||
UINT32* tilemap40_regs_base;
|
||||
UINT32* tilemap50_regs_base;
|
||||
UINT32* _0xc0000000_ram;
|
||||
UINT32* _0xc0000000_ram_decrypted;
|
||||
UINT32* char_ram;
|
||||
UINT32* spriteram;
|
||||
UINT32* eeprom;
|
||||
UINT32* fullscreenzoom;
|
||||
UINT32 ss_pal_base;
|
||||
UINT32* colourram;
|
||||
UINT32 unk_vidregs[0x20/4];
|
||||
UINT32 ss_bank_base;
|
||||
UINT32 screenwidth;
|
||||
UINT32* mame_colours;
|
||||
bitmap_t *renderbuffer_bitmap;
|
||||
rectangle renderbuffer_clip;
|
||||
UINT8* user4region;
|
||||
UINT32 key1;
|
||||
UINT32 key2;
|
||||
int altEncryption;
|
||||
UINT32* ss_ram;
|
||||
UINT32 cram_bank;
|
||||
UINT16 current_eeprom_read;
|
||||
UINT32 paldma_source;
|
||||
UINT32 paldma_realsource;
|
||||
UINT32 paldma_dest;
|
||||
UINT32 paldma_fade;
|
||||
UINT32 paldma_other2;
|
||||
UINT32 paldma_length;
|
||||
UINT32 chardma_source;
|
||||
UINT32 chardma_other;
|
||||
UINT32 current_table_address;
|
||||
int rle_length;
|
||||
int last_normal_byte;
|
||||
unsigned short lastb;
|
||||
unsigned short lastb2;
|
||||
UINT32* mainram;
|
||||
UINT8* user5region;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in audio/cps3.c -----------*/
|
||||
|
@ -1,7 +1,25 @@
|
||||
/*----------- defined in video/darkseal.c -----------*/
|
||||
class darkseal_state : public driver_device
|
||||
{
|
||||
public:
|
||||
darkseal_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT16 *darkseal_pf12_row, *darkseal_pf34_row;
|
||||
extern UINT16 *darkseal_pf1_data,*darkseal_pf2_data,*darkseal_pf3_data;
|
||||
UINT16 *ram;
|
||||
UINT16 *pf12_row;
|
||||
UINT16 *pf34_row;
|
||||
UINT16 *pf1_data;
|
||||
UINT16 *pf2_data;
|
||||
UINT16 *pf3_data;
|
||||
UINT16 control_0[8];
|
||||
UINT16 control_1[8];
|
||||
tilemap_t *pf1_tilemap;
|
||||
tilemap_t *pf2_tilemap;
|
||||
tilemap_t *pf3_tilemap;
|
||||
int flipscreen;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/darkseal.c -----------*/
|
||||
|
||||
VIDEO_START( darkseal );
|
||||
VIDEO_UPDATE( darkseal );
|
||||
|
@ -1,7 +1,50 @@
|
||||
/*----------- defined in drivers/dec0.c -----------*/
|
||||
class dec0_state : public driver_device
|
||||
{
|
||||
public:
|
||||
dec0_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 automat_adpcm_byte;
|
||||
int automat_msm5205_vclk_toggle;
|
||||
UINT16 *ram;
|
||||
UINT8 *robocop_shared_ram;
|
||||
UINT16 *pf1_rowscroll;
|
||||
UINT16 *pf2_rowscroll;
|
||||
UINT16 *pf3_rowscroll;
|
||||
UINT16 *pf1_colscroll;
|
||||
UINT16 *pf2_colscroll;
|
||||
UINT16 *pf3_colscroll;
|
||||
UINT16 *pf1_data;
|
||||
UINT16 *pf2_data;
|
||||
UINT16 *pf3_data;
|
||||
int GAME;
|
||||
int i8751_return;
|
||||
int i8751_command;
|
||||
int slyspy_state;
|
||||
int share[0xff];
|
||||
int hippodrm_msb;
|
||||
int hippodrm_lsb;
|
||||
UINT8 i8751_ports[4];
|
||||
tilemap_t *pf1_tilemap_0;
|
||||
tilemap_t *pf1_tilemap_1;
|
||||
tilemap_t *pf1_tilemap_2;
|
||||
tilemap_t *pf2_tilemap_0;
|
||||
tilemap_t *pf2_tilemap_1;
|
||||
tilemap_t *pf2_tilemap_2;
|
||||
tilemap_t *pf3_tilemap_0;
|
||||
tilemap_t *pf3_tilemap_1;
|
||||
tilemap_t *pf3_tilemap_2;
|
||||
UINT16 pf1_control_0[4];
|
||||
UINT16 pf1_control_1[4];
|
||||
UINT16 pf2_control_0[4];
|
||||
UINT16 pf2_control_1[4];
|
||||
UINT16 pf3_control_0[4];
|
||||
UINT16 pf3_control_1[4];
|
||||
UINT16 *spriteram;
|
||||
UINT16 pri;
|
||||
int buffer[0x20];
|
||||
};
|
||||
|
||||
extern UINT16 *dec0_ram;
|
||||
extern UINT8 *robocop_shared_ram;
|
||||
|
||||
/*----------- defined in video/dec0.c -----------*/
|
||||
|
||||
@ -16,9 +59,6 @@ VIDEO_UPDATE( hippodrm );
|
||||
VIDEO_UPDATE( slyspy );
|
||||
VIDEO_UPDATE( midres );
|
||||
|
||||
extern UINT16 *dec0_pf1_rowscroll,*dec0_pf2_rowscroll,*dec0_pf3_rowscroll;
|
||||
extern UINT16 *dec0_pf1_colscroll,*dec0_pf2_colscroll,*dec0_pf3_colscroll;
|
||||
extern UINT16 *dec0_pf1_data,*dec0_pf2_data,*dec0_pf3_data;
|
||||
|
||||
WRITE16_HANDLER( dec0_pf1_control_0_w );
|
||||
WRITE16_HANDLER( dec0_pf1_control_1_w );
|
||||
@ -63,7 +103,7 @@ DRIVER_INIT( hbarrel );
|
||||
DRIVER_INIT( birdtry );
|
||||
|
||||
extern void dec0_i8751_write(running_machine *machine, int data);
|
||||
extern void dec0_i8751_reset(void);
|
||||
extern void dec0_i8751_reset(running_machine *machine);
|
||||
READ8_HANDLER( hippodrm_prot_r );
|
||||
WRITE8_HANDLER( dec0_mcu_port_w );
|
||||
READ8_HANDLER( dec0_mcu_port_r );
|
||||
|
@ -1,3 +1,69 @@
|
||||
class deco32_state : public driver_device
|
||||
{
|
||||
public:
|
||||
deco32_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT32 *ram;
|
||||
int raster_enable;
|
||||
timer_device *raster_irq_timer;
|
||||
UINT8 nslasher_sound_irq;
|
||||
int strobe;
|
||||
int dragngun_lightgun_port;
|
||||
int tattass_eprom_bit;
|
||||
int lastClock;
|
||||
char buffer[32];
|
||||
int bufPtr;
|
||||
int pendingCommand;
|
||||
int readBitCount;
|
||||
int byteAddr;
|
||||
UINT8 bsmt_latch;
|
||||
UINT8 bsmt_reset;
|
||||
UINT32 *pf1_data;
|
||||
UINT32 *pf2_data;
|
||||
UINT32 *pf3_data;
|
||||
UINT32 *pf4_data;
|
||||
UINT32 *pf12_control;
|
||||
UINT32 *pf34_control;
|
||||
UINT32 *pf1_rowscroll;
|
||||
UINT32 *pf2_rowscroll;
|
||||
UINT32 *pf3_rowscroll;
|
||||
UINT32 *pf4_rowscroll;
|
||||
UINT32 *dragngun_sprite_layout_0_ram;
|
||||
UINT32 *dragngun_sprite_layout_1_ram;
|
||||
UINT32 *dragngun_sprite_lookup_0_ram;
|
||||
UINT32 *dragngun_sprite_lookup_1_ram;
|
||||
UINT32 *ace_ram;
|
||||
UINT16 *raster_display_list;
|
||||
int raster_display_position;
|
||||
UINT8 *dirty_palette;
|
||||
tilemap_t *pf1_tilemap;
|
||||
tilemap_t *pf1a_tilemap;
|
||||
tilemap_t *pf2_tilemap;
|
||||
tilemap_t *pf3_tilemap;
|
||||
tilemap_t *pf4_tilemap;
|
||||
int pf1_bank;
|
||||
int pf2_bank;
|
||||
int pf3_bank;
|
||||
int pf4_bank;
|
||||
int pf1_flip;
|
||||
int pf2_flip;
|
||||
int pf3_flip;
|
||||
int pf4_flip;
|
||||
int pf2_colourbank;
|
||||
int pf4_colourbank;
|
||||
int pri;
|
||||
bitmap_t *sprite0_mix_bitmap;
|
||||
bitmap_t *sprite1_mix_bitmap;
|
||||
bitmap_t *tilemap_alpha_bitmap;
|
||||
UINT32 dragngun_sprite_ctrl;
|
||||
int ace_ram_dirty;
|
||||
int has_ace_ram;
|
||||
bitmap_t *sprite_priority_bitmap;
|
||||
int last_pf3_bank;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/deco32.c -----------*/
|
||||
|
||||
VIDEO_START( captaven );
|
||||
@ -14,14 +80,6 @@ VIDEO_UPDATE( fghthist );
|
||||
VIDEO_UPDATE( dragngun );
|
||||
VIDEO_UPDATE( nslasher );
|
||||
|
||||
extern UINT32 *deco32_pf1_data,*deco32_pf2_data,*deco32_pf3_data,*deco32_pf4_data;
|
||||
extern UINT32 *deco32_pf12_control,*deco32_pf34_control;
|
||||
extern UINT32 *deco32_pf1_rowscroll,*deco32_pf2_rowscroll,*deco32_pf3_rowscroll,*deco32_pf4_rowscroll;
|
||||
extern UINT32 *dragngun_sprite_layout_0_ram, *dragngun_sprite_layout_1_ram;
|
||||
extern UINT32 *dragngun_sprite_lookup_0_ram, *dragngun_sprite_lookup_1_ram;
|
||||
extern UINT32 *deco32_ace_ram;
|
||||
extern UINT16 *deco32_raster_display_list;
|
||||
extern int deco32_raster_display_position;
|
||||
|
||||
WRITE32_HANDLER( deco32_pf1_data_w );
|
||||
WRITE32_HANDLER( deco32_pf2_data_w );
|
||||
|
@ -1,6 +1,24 @@
|
||||
/*----------- defined in video/deco_mlc.c -----------*/
|
||||
class deco_mlc_state : public driver_device
|
||||
{
|
||||
public:
|
||||
deco_mlc_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT32 *mlc_vram, *mlc_clip_ram;
|
||||
UINT32 *mlc_ram;
|
||||
UINT32 *irq_ram;
|
||||
timer_device *raster_irq_timer;
|
||||
int mainCpuIsArm;
|
||||
int mlc_raster_table[9][256];
|
||||
UINT32 vbl_i;
|
||||
int lastScanline[9];
|
||||
UINT32 *mlc_vram;
|
||||
UINT32 *mlc_clip_ram;
|
||||
UINT32 colour_mask;
|
||||
UINT32 *mlc_buffered_spriteram;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/deco_mlc.c -----------*/
|
||||
|
||||
VIDEO_START( mlc );
|
||||
VIDEO_UPDATE( mlc );
|
||||
|
@ -12,18 +12,31 @@
|
||||
#define MADALIEN_MAIN_CLOCK XTAL_10_595MHz
|
||||
|
||||
|
||||
class madalien_state : public driver_device
|
||||
{
|
||||
public:
|
||||
madalien_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *shift_hi;
|
||||
UINT8 *shift_lo;
|
||||
UINT8 *videoram;
|
||||
UINT8 *charram;
|
||||
UINT8 *video_flags;
|
||||
UINT8 *video_control;
|
||||
UINT8 *scroll;
|
||||
UINT8 *edge1_pos;
|
||||
UINT8 *edge2_pos;
|
||||
UINT8 *headlight_pos;
|
||||
tilemap_t *tilemap_fg;
|
||||
tilemap_t *tilemap_edge1[4];
|
||||
tilemap_t *tilemap_edge2[4];
|
||||
bitmap_t *headlight_bitmap;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/madalien.c -----------*/
|
||||
|
||||
extern UINT8 *madalien_videoram;
|
||||
extern UINT8 *madalien_charram;
|
||||
|
||||
extern UINT8 *madalien_video_flags;
|
||||
extern UINT8 *madalien_video_control;
|
||||
extern UINT8 *madalien_scroll;
|
||||
extern UINT8 *madalien_edge1_pos;
|
||||
extern UINT8 *madalien_edge2_pos;
|
||||
extern UINT8 *madalien_headlight_pos;
|
||||
|
||||
MACHINE_CONFIG_EXTERN( madalien_video );
|
||||
|
||||
WRITE8_HANDLER( madalien_videoram_w );
|
||||
|
@ -39,6 +39,8 @@ public:
|
||||
/* devices */
|
||||
optional_device<cpu_device> audiocpu;
|
||||
optional_device<okim6295_device> oki;
|
||||
UINT8 *nvram;
|
||||
size_t nvram_size;
|
||||
};
|
||||
|
||||
|
||||
|
@ -5,6 +5,9 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
int msm5205next;
|
||||
int toggle;
|
||||
tilemap_t *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,21 @@
|
||||
/*----------- defined in video/powerins.c -----------*/
|
||||
class powerins_state : public driver_device
|
||||
{
|
||||
public:
|
||||
powerins_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT16 *powerins_vram_0, *powerins_vctrl_0;
|
||||
extern UINT16 *powerins_vram_1, *powerins_vctrl_1;
|
||||
int oki_bank;
|
||||
UINT16 *vram_0;
|
||||
UINT16 *vctrl_0;
|
||||
UINT16 *vram_1;
|
||||
UINT16 *vctrl_1;
|
||||
tilemap_t *tilemap_0;
|
||||
tilemap_t *tilemap_1;
|
||||
int tile_bank;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/powerins.c -----------*/
|
||||
|
||||
WRITE16_HANDLER( powerins_flipscreen_w );
|
||||
WRITE16_HANDLER( powerins_tilebank_w );
|
||||
|
@ -1,6 +1,18 @@
|
||||
/*----------- defined in video/srumbler.c -----------*/
|
||||
class srumbler_state : public driver_device
|
||||
{
|
||||
public:
|
||||
srumbler_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT8 *srumbler_backgroundram,*srumbler_foregroundram;
|
||||
UINT8 *backgroundram;
|
||||
UINT8 *foregroundram;
|
||||
tilemap_t *bg_tilemap;
|
||||
tilemap_t *fg_tilemap;
|
||||
int scroll[4];
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/srumbler.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( srumbler_background_w );
|
||||
WRITE8_HANDLER( srumbler_foreground_w );
|
||||
|
@ -1,8 +1,28 @@
|
||||
/*----------- defined in video/sshangha.c -----------*/
|
||||
class sshangha_state : public driver_device
|
||||
{
|
||||
public:
|
||||
sshangha_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT16 *sshangha_pf1_data;
|
||||
extern UINT16 *sshangha_pf2_data;
|
||||
extern UINT16 *sshangha_pf1_rowscroll, *sshangha_pf2_rowscroll;
|
||||
UINT16 *prot_data;
|
||||
UINT16 *sound_shared_ram;
|
||||
UINT16 *pf1_data;
|
||||
UINT16 *pf2_data;
|
||||
UINT16 *pf1_rowscroll;
|
||||
UINT16 *pf2_rowscroll;
|
||||
UINT16 control_0[8];
|
||||
tilemap_t *pf1_8x8_tilemap;
|
||||
tilemap_t *pf1_16x16_tilemap;
|
||||
tilemap_t *pf2_tilemap;
|
||||
int pf1_bank;
|
||||
int pf2_bank;
|
||||
int video_control;
|
||||
int last_pf1_bank;
|
||||
int last_pf2_bank;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/sshangha.c -----------*/
|
||||
|
||||
VIDEO_START( sshangha );
|
||||
VIDEO_UPDATE( sshangha );
|
||||
|
@ -1,8 +1,20 @@
|
||||
/*----------- defined in video/stadhero.c -----------*/
|
||||
class stadhero_state : public driver_device
|
||||
{
|
||||
public:
|
||||
stadhero_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT16 *stadhero_pf1_data;
|
||||
extern UINT16 *stadhero_pf2_control_0;
|
||||
extern UINT16 *stadhero_pf2_control_1;
|
||||
UINT16 *pf1_data;
|
||||
UINT16 *pf2_control_0;
|
||||
UINT16 *pf2_control_1;
|
||||
UINT16 *pf2_data;
|
||||
tilemap_t *pf1_tilemap;
|
||||
tilemap_t *pf2_tilemap;
|
||||
int flipscreen;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/stadhero.c -----------*/
|
||||
|
||||
VIDEO_START( stadhero );
|
||||
VIDEO_UPDATE( stadhero );
|
||||
|
@ -5,6 +5,10 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT16 *videoram;
|
||||
UINT16 *ram16;
|
||||
int bgcharbank;
|
||||
tilemap_t *bg_tilemap;
|
||||
tilemap_t *fg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
|
@ -5,13 +5,17 @@ public:
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
UINT8 *videoram;
|
||||
UINT8 *gfx_control;
|
||||
tilemap_t *fg_tilemap;
|
||||
tilemap_t *bg_tilemap;
|
||||
UINT8 vram_bank;
|
||||
UINT8 *vram;
|
||||
UINT8 *vram_gfx;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/tryout.c -----------*/
|
||||
|
||||
extern UINT8 *tryout_gfx_control;
|
||||
|
||||
READ8_HANDLER( tryout_vram_r );
|
||||
WRITE8_HANDLER( tryout_videoram_w );
|
||||
WRITE8_HANDLER( tryout_vram_w );
|
||||
|
@ -31,6 +31,8 @@ public:
|
||||
device_t *maincpu;
|
||||
device_t *audiocpu;
|
||||
device_t *oki;
|
||||
UINT8 semicom_prot_offset;
|
||||
UINT16 protbase;
|
||||
};
|
||||
|
||||
/*----------- defined in video/tumbleb.c -----------*/
|
||||
|
@ -1,8 +1,20 @@
|
||||
/*----------- defined in video/vulgus.c -----------*/
|
||||
class vulgus_state : public driver_device
|
||||
{
|
||||
public:
|
||||
vulgus_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
extern UINT8 *vulgus_fgvideoram;
|
||||
extern UINT8 *vulgus_bgvideoram;
|
||||
extern UINT8 *vulgus_scroll_low,*vulgus_scroll_high;
|
||||
UINT8 *fgvideoram;
|
||||
UINT8 *bgvideoram;
|
||||
UINT8 *scroll_low;
|
||||
UINT8 *scroll_high;
|
||||
int palette_bank;
|
||||
tilemap_t *fg_tilemap;
|
||||
tilemap_t *bg_tilemap;
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in video/vulgus.c -----------*/
|
||||
|
||||
WRITE8_HANDLER( vulgus_fgvideoram_w );
|
||||
WRITE8_HANDLER( vulgus_bgvideoram_w );
|
||||
|
@ -11,12 +11,12 @@ Data East machine functions - Bryan McPhail, mish@tendril.co.uk
|
||||
#include "cpu/h6280/h6280.h"
|
||||
#include "cpu/mcs51/mcs51.h"
|
||||
|
||||
static int GAME,i8751_return,i8751_command,slyspy_state;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
READ16_HANDLER( dec0_controls_r )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (offset<<1)
|
||||
{
|
||||
case 0: /* Player 1 & 2 joystick & buttons */
|
||||
@ -29,8 +29,8 @@ READ16_HANDLER( dec0_controls_r )
|
||||
return input_port_read(space->machine, "DSW");
|
||||
|
||||
case 8: /* Intel 8751 mc, Bad Dudes & Heavy Barrel only */
|
||||
//logerror("CPU #0 PC %06x: warning - read i8751 %06x - %04x\n", cpu_get_pc(space->cpu), 0x30c000+offset, i8751_return);
|
||||
return i8751_return;
|
||||
//logerror("CPU #0 PC %06x: warning - read i8751 %06x - %04x\n", cpu_get_pc(space->cpu), 0x30c000+offset, state->i8751_return);
|
||||
return state->i8751_return;
|
||||
}
|
||||
|
||||
logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", cpu_get_pc(space->cpu), 0x30c000+offset);
|
||||
@ -154,19 +154,22 @@ READ16_HANDLER( slyspy_protection_r )
|
||||
|
||||
WRITE16_HANDLER( slyspy_state_w )
|
||||
{
|
||||
slyspy_state=0;
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
state->slyspy_state=0;
|
||||
}
|
||||
|
||||
READ16_HANDLER( slyspy_state_r )
|
||||
{
|
||||
slyspy_state++;
|
||||
slyspy_state=slyspy_state%4;
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
state->slyspy_state++;
|
||||
state->slyspy_state=state->slyspy_state%4;
|
||||
return 0; /* Value doesn't mater */
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( slyspy_240000_w )
|
||||
{
|
||||
switch (slyspy_state) {
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (state->slyspy_state) {
|
||||
case 0x3:
|
||||
dec0_pf1_data_w(space,offset,data,mem_mask);
|
||||
return;
|
||||
@ -178,36 +181,39 @@ WRITE16_HANDLER( slyspy_240000_w )
|
||||
else if (offset<0x10) dec0_pf2_control_1_w(space,offset-0x8,data,mem_mask);
|
||||
return;
|
||||
}
|
||||
logerror("Wrote to 240000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,slyspy_state);
|
||||
logerror("Wrote to 240000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,state->slyspy_state);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( slyspy_242000_w )
|
||||
{
|
||||
switch (slyspy_state) {
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (state->slyspy_state) {
|
||||
case 0x2: /* Trap A */
|
||||
dec0_pf1_data_w(space,offset,data,mem_mask);
|
||||
return;
|
||||
case 0x0: /* Trap C */
|
||||
if (offset<0x40) COMBINE_DATA(&dec0_pf2_colscroll[offset]);
|
||||
else if (offset<0x300) COMBINE_DATA(&dec0_pf2_rowscroll[offset-0x200]);
|
||||
if (offset<0x40) COMBINE_DATA(&state->pf2_colscroll[offset]);
|
||||
else if (offset<0x300) COMBINE_DATA(&state->pf2_rowscroll[offset-0x200]);
|
||||
return;
|
||||
}
|
||||
logerror("Wrote to 242000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,slyspy_state);
|
||||
logerror("Wrote to 242000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,state->slyspy_state);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( slyspy_246000_w )
|
||||
{
|
||||
switch (slyspy_state) {
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (state->slyspy_state) {
|
||||
case 0x0:
|
||||
dec0_pf2_data_w(space,offset,data,mem_mask);
|
||||
return;
|
||||
}
|
||||
logerror("Wrote to 246000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,slyspy_state);
|
||||
logerror("Wrote to 246000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,state->slyspy_state);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( slyspy_248000_w )
|
||||
{
|
||||
switch (slyspy_state) {
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (state->slyspy_state) {
|
||||
case 0x1:
|
||||
dec0_pf1_data_w(space,offset,data,mem_mask);
|
||||
return;
|
||||
@ -219,75 +225,81 @@ WRITE16_HANDLER( slyspy_248000_w )
|
||||
else if (offset<0x10) dec0_pf1_control_1_w(space,offset-0x8,data,mem_mask);
|
||||
return;
|
||||
}
|
||||
logerror("Wrote to 248000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,slyspy_state);
|
||||
logerror("Wrote to 248000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,state->slyspy_state);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( slyspy_24c000_w )
|
||||
{
|
||||
switch (slyspy_state) {
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (state->slyspy_state) {
|
||||
case 0x1: /* Trap 9 */
|
||||
dec0_pf2_data_w(space,offset,data,mem_mask);
|
||||
return;
|
||||
case 0x0: /* Trap C */
|
||||
if (offset<0x40) COMBINE_DATA(&dec0_pf1_colscroll[offset]);
|
||||
else if (offset<0x300) COMBINE_DATA(&dec0_pf1_rowscroll[offset-0x200]);
|
||||
if (offset<0x40) COMBINE_DATA(&state->pf1_colscroll[offset]);
|
||||
else if (offset<0x300) COMBINE_DATA(&state->pf1_rowscroll[offset-0x200]);
|
||||
return;
|
||||
}
|
||||
logerror("Wrote to 24c000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,slyspy_state);
|
||||
logerror("Wrote to 24c000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,state->slyspy_state);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( slyspy_24e000_w )
|
||||
{
|
||||
switch (slyspy_state) {
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (state->slyspy_state) {
|
||||
case 0x2:
|
||||
case 0x0:
|
||||
dec0_pf1_data_w(space,offset,data,mem_mask);
|
||||
return;
|
||||
}
|
||||
logerror("Wrote to 24e000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,slyspy_state);
|
||||
logerror("Wrote to 24e000 %02x at %04x %04x (Trap %02x)\n",offset,cpu_get_pc(space->cpu),data,state->slyspy_state);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static int share[0xff];
|
||||
static int hippodrm_msb,hippodrm_lsb;
|
||||
|
||||
READ8_HANDLER( hippodrm_prot_r )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
//logerror("6280 PC %06x - Read %06x\n",cpu_getpc(),offset+0x1d0000);
|
||||
if (hippodrm_lsb==0x45) return 0x4e;
|
||||
if (hippodrm_lsb==0x92) return 0x15;
|
||||
if (state->hippodrm_lsb==0x45) return 0x4e;
|
||||
if (state->hippodrm_lsb==0x92) return 0x15;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( hippodrm_prot_w )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
switch (offset) {
|
||||
case 4: hippodrm_msb=data; break;
|
||||
case 5: hippodrm_lsb=data; break;
|
||||
case 4: state->hippodrm_msb=data; break;
|
||||
case 5: state->hippodrm_lsb=data; break;
|
||||
}
|
||||
//logerror("6280 PC %06x - Wrote %06x to %04x\n",cpu_getpc(),data,offset+0x1d0000);
|
||||
}
|
||||
|
||||
READ8_HANDLER( hippodrm_shared_r )
|
||||
{
|
||||
return share[offset];
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
return state->share[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( hippodrm_shared_w )
|
||||
{
|
||||
share[offset]=data;
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
state->share[offset]=data;
|
||||
}
|
||||
|
||||
static READ16_HANDLER( hippodrm_68000_share_r )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
if (offset==0) cpu_yield(space->cpu); /* A wee helper */
|
||||
return share[offset]&0xff;
|
||||
return state->share[offset]&0xff;
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( hippodrm_68000_share_w )
|
||||
{
|
||||
share[offset]=data&0xff;
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
state->share[offset]=data&0xff;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -326,23 +338,23 @@ static WRITE16_HANDLER( hippodrm_68000_share_w )
|
||||
values are not known to change after bootup.
|
||||
*/
|
||||
|
||||
static UINT8 i8751_ports[4];
|
||||
|
||||
READ8_HANDLER(dec0_mcu_port_r )
|
||||
{
|
||||
int latchEnable=i8751_ports[2]>>4;
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
int latchEnable=state->i8751_ports[2]>>4;
|
||||
|
||||
// P0 connected to 4 latches
|
||||
if (offset==0)
|
||||
{
|
||||
if ((latchEnable&1)==0)
|
||||
return i8751_command>>8;
|
||||
return state->i8751_command>>8;
|
||||
else if ((latchEnable&2)==0)
|
||||
return i8751_command&0xff;
|
||||
return state->i8751_command&0xff;
|
||||
else if ((latchEnable&4)==0)
|
||||
return i8751_return>>8;
|
||||
return state->i8751_return>>8;
|
||||
else if ((latchEnable&8)==0)
|
||||
return i8751_return&0xff;
|
||||
return state->i8751_return&0xff;
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
@ -350,7 +362,8 @@ READ8_HANDLER(dec0_mcu_port_r )
|
||||
|
||||
WRITE8_HANDLER(dec0_mcu_port_w )
|
||||
{
|
||||
i8751_ports[offset]=data;
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
state->i8751_ports[offset]=data;
|
||||
|
||||
if (offset==2)
|
||||
{
|
||||
@ -359,58 +372,60 @@ WRITE8_HANDLER(dec0_mcu_port_w )
|
||||
if ((data&0x8)==0)
|
||||
cputag_set_input_line(space->machine, "mcu", MCS51_INT1_LINE, CLEAR_LINE);
|
||||
if ((data&0x40)==0)
|
||||
i8751_return=(i8751_return&0xff00)|(i8751_ports[0]);
|
||||
state->i8751_return=(state->i8751_return&0xff00)|(state->i8751_ports[0]);
|
||||
if ((data&0x80)==0)
|
||||
i8751_return=(i8751_return&0xff)|(i8751_ports[0]<<8);
|
||||
state->i8751_return=(state->i8751_return&0xff)|(state->i8751_ports[0]<<8);
|
||||
}
|
||||
}
|
||||
|
||||
static void baddudes_i8751_write(running_machine *machine, int data)
|
||||
{
|
||||
i8751_return=0;
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
state->i8751_return=0;
|
||||
|
||||
switch (data&0xffff) {
|
||||
case 0x714: i8751_return=0x700; break;
|
||||
case 0x73b: i8751_return=0x701; break;
|
||||
case 0x72c: i8751_return=0x702; break;
|
||||
case 0x73f: i8751_return=0x703; break;
|
||||
case 0x755: i8751_return=0x704; break;
|
||||
case 0x722: i8751_return=0x705; break;
|
||||
case 0x72b: i8751_return=0x706; break;
|
||||
case 0x724: i8751_return=0x707; break;
|
||||
case 0x728: i8751_return=0x708; break;
|
||||
case 0x735: i8751_return=0x709; break;
|
||||
case 0x71d: i8751_return=0x70a; break;
|
||||
case 0x721: i8751_return=0x70b; break;
|
||||
case 0x73e: i8751_return=0x70c; break;
|
||||
case 0x761: i8751_return=0x70d; break;
|
||||
case 0x753: i8751_return=0x70e; break;
|
||||
case 0x75b: i8751_return=0x70f; break;
|
||||
case 0x714: state->i8751_return=0x700; break;
|
||||
case 0x73b: state->i8751_return=0x701; break;
|
||||
case 0x72c: state->i8751_return=0x702; break;
|
||||
case 0x73f: state->i8751_return=0x703; break;
|
||||
case 0x755: state->i8751_return=0x704; break;
|
||||
case 0x722: state->i8751_return=0x705; break;
|
||||
case 0x72b: state->i8751_return=0x706; break;
|
||||
case 0x724: state->i8751_return=0x707; break;
|
||||
case 0x728: state->i8751_return=0x708; break;
|
||||
case 0x735: state->i8751_return=0x709; break;
|
||||
case 0x71d: state->i8751_return=0x70a; break;
|
||||
case 0x721: state->i8751_return=0x70b; break;
|
||||
case 0x73e: state->i8751_return=0x70c; break;
|
||||
case 0x761: state->i8751_return=0x70d; break;
|
||||
case 0x753: state->i8751_return=0x70e; break;
|
||||
case 0x75b: state->i8751_return=0x70f; break;
|
||||
}
|
||||
|
||||
if (!i8751_return) logerror("%s: warning - write unknown command %02x to 8571\n",machine->describe_context(),data);
|
||||
if (!state->i8751_return) logerror("%s: warning - write unknown command %02x to 8571\n",machine->describe_context(),data);
|
||||
cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE);
|
||||
}
|
||||
|
||||
static void birdtry_i8751_write(running_machine *machine, int data)
|
||||
{
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
static int pwr,
|
||||
hgt;
|
||||
|
||||
i8751_return=0;
|
||||
state->i8751_return=0;
|
||||
|
||||
switch(data&0xffff) {
|
||||
/*"Sprite control"*/
|
||||
case 0x22a: i8751_return = 0x200; break;
|
||||
case 0x22a: state->i8751_return = 0x200; break;
|
||||
|
||||
/* Gives an O.B. otherwise (it must be > 0xb0 )*/
|
||||
case 0x3c7: i8751_return = 0x7ff; break;
|
||||
case 0x3c7: state->i8751_return = 0x7ff; break;
|
||||
|
||||
/*Enables shot checks*/
|
||||
case 0x33c: i8751_return = 0x200; break;
|
||||
case 0x33c: state->i8751_return = 0x200; break;
|
||||
|
||||
/*Used on the title screen only(???)*/
|
||||
case 0x31e: i8751_return = 0x200; break;
|
||||
case 0x31e: state->i8751_return = 0x200; break;
|
||||
|
||||
/* 0x100-0x10d values are for club power meters(1W=0x100<<-->>PT=0x10d). *
|
||||
* Returned value to i8751 doesn't matter,but send the result to 0x481. *
|
||||
@ -429,7 +444,7 @@ static void birdtry_i8751_write(running_machine *machine, int data)
|
||||
case 0x10b: pwr = 0x5c; break; /*PW*/
|
||||
case 0x10c: pwr = 0x60; break; /*SW*/
|
||||
case 0x10d: pwr = 0x80; break; /*PT*/
|
||||
case 0x481: i8751_return = pwr; break; /*Power meter*/
|
||||
case 0x481: state->i8751_return = pwr; break; /*Power meter*/
|
||||
|
||||
/* 0x200-0x20f values are for shot height(STRONG=0x200<<-->>WEAK=0x20f). *
|
||||
* Returned value to i8751 doesn't matter,but send the result to 0x534. *
|
||||
@ -450,14 +465,14 @@ static void birdtry_i8751_write(running_machine *machine, int data)
|
||||
case 0x20d: hgt = 0x280; break; /*|*/
|
||||
case 0x20e: hgt = 0x240; break; /*|*/
|
||||
case 0x20f: hgt = 0x200; break; /*L*/
|
||||
case 0x534: i8751_return = hgt; break; /*Shot height*/
|
||||
case 0x534: state->i8751_return = hgt; break; /*Shot height*/
|
||||
|
||||
/*At the ending screen(???)*/
|
||||
//case 0x3b4: i8751_return = 0; break;
|
||||
//case 0x3b4: state->i8751_return = 0; break;
|
||||
|
||||
/*These are activated after a shot (???)*/
|
||||
case 0x6ca: i8751_return = 0xff; break;
|
||||
case 0x7ff: i8751_return = 0x200; break;
|
||||
case 0x6ca: state->i8751_return = 0xff; break;
|
||||
case 0x7ff: state->i8751_return = 0x200; break;
|
||||
default: logerror("%s: warning - write unknown command %02x to 8571\n",machine->describe_context(),data);
|
||||
}
|
||||
cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE);
|
||||
@ -465,19 +480,21 @@ static void birdtry_i8751_write(running_machine *machine, int data)
|
||||
|
||||
void dec0_i8751_write(running_machine *machine, int data)
|
||||
{
|
||||
i8751_command=data;
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
state->i8751_command=data;
|
||||
|
||||
/* Writes to this address cause an IRQ to the i8751 microcontroller */
|
||||
if (GAME == 1) cputag_set_input_line(machine, "mcu", MCS51_INT1_LINE, ASSERT_LINE);
|
||||
if (GAME == 2) baddudes_i8751_write(machine, data);
|
||||
if (GAME == 3) birdtry_i8751_write(machine, data);
|
||||
if (state->GAME == 1) cputag_set_input_line(machine, "mcu", MCS51_INT1_LINE, ASSERT_LINE);
|
||||
if (state->GAME == 2) baddudes_i8751_write(machine, data);
|
||||
if (state->GAME == 3) birdtry_i8751_write(machine, data);
|
||||
|
||||
//logerror("%s: warning - write %02x to i8751\n",machine->describe_context(),data);
|
||||
}
|
||||
|
||||
void dec0_i8751_reset(void)
|
||||
void dec0_i8751_reset(running_machine *machine)
|
||||
{
|
||||
i8751_return=i8751_command=0;
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
state->i8751_return=state->i8751_command=0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -491,16 +508,18 @@ static WRITE16_HANDLER( sprite_mirror_w )
|
||||
|
||||
static READ16_HANDLER( robocop_68000_share_r )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
//logerror("%08x: Share read %04x\n",cpu_get_pc(space->cpu),offset);
|
||||
|
||||
return robocop_shared_ram[offset];
|
||||
return state->robocop_shared_ram[offset];
|
||||
}
|
||||
|
||||
static WRITE16_HANDLER( robocop_68000_share_w )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
// logerror("%08x: Share write %04x %04x\n",cpu_get_pc(space->cpu),offset,data);
|
||||
|
||||
robocop_shared_ram[offset]=data&0xff;
|
||||
state->robocop_shared_ram[offset]=data&0xff;
|
||||
|
||||
if (offset == 0x7ff) /* A control address - not standard ram */
|
||||
cputag_set_input_line(space->machine, "sub", 0, HOLD_LINE);
|
||||
@ -552,20 +571,23 @@ DRIVER_INIT( robocop )
|
||||
|
||||
DRIVER_INIT( baddudes )
|
||||
{
|
||||
GAME = 2;
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
state->GAME = 2;
|
||||
}
|
||||
|
||||
DRIVER_INIT( hbarrel )
|
||||
{
|
||||
GAME = 1;
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
state->GAME = 1;
|
||||
}
|
||||
|
||||
DRIVER_INIT( birdtry )
|
||||
{
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
UINT8 *src, tmp;
|
||||
int i, j, k;
|
||||
|
||||
GAME=3;
|
||||
state->GAME=3;
|
||||
|
||||
src = machine->region("gfx4")->base();
|
||||
|
||||
|
@ -9290,7 +9290,7 @@ MACHINE_CONFIG_START( megadpal, driver_device )
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
static int _32x_fifo_available_callback(UINT32 src, UINT32 dst, UINT32 data, int size)
|
||||
static int _32x_fifo_available_callback(device_t *device, UINT32 src, UINT32 dst, UINT32 data, int size)
|
||||
{
|
||||
if (src==0x4012)
|
||||
{
|
||||
|
@ -381,9 +381,9 @@ $(MAMEOBJ)/amiga.a: \
|
||||
|
||||
$(MAMEOBJ)/aristocr.a: \
|
||||
$(DRIVERS)/86lions.o \
|
||||
$(DRIVERS)/caswin.o \
|
||||
$(DRIVERS)/aristmk4.o \
|
||||
$(DRIVERS)/aristmk5.o \
|
||||
$(DRIVERS)/caswin.o \
|
||||
$(MACHINE)/archimds.o \
|
||||
$(VIDEO)/archimds.o \
|
||||
|
||||
@ -514,10 +514,10 @@ $(MAMEOBJ)/capcom.a: \
|
||||
$(DRIVERS)/cps2.o \
|
||||
$(DRIVERS)/cps3.o $(AUDIO)/cps3.o \
|
||||
$(DRIVERS)/egghunt.o \
|
||||
$(DRIVERS)/exedexes.o $(VIDEO)/exedexes.o \
|
||||
$(DRIVERS)/fcrash.o \
|
||||
$(DRIVERS)/gng.o $(VIDEO)/gng.o \
|
||||
$(DRIVERS)/gunsmoke.o $(VIDEO)/gunsmoke.o \
|
||||
$(DRIVERS)/exedexes.o $(VIDEO)/exedexes.o \
|
||||
$(DRIVERS)/higemaru.o $(VIDEO)/higemaru.o \
|
||||
$(DRIVERS)/lastduel.o $(VIDEO)/lastduel.o \
|
||||
$(DRIVERS)/lwings.o $(VIDEO)/lwings.o \
|
||||
@ -526,8 +526,8 @@ $(MAMEOBJ)/capcom.a: \
|
||||
$(DRIVERS)/sidearms.o $(VIDEO)/sidearms.o \
|
||||
$(DRIVERS)/sonson.o $(VIDEO)/sonson.o \
|
||||
$(DRIVERS)/srumbler.o $(VIDEO)/srumbler.o \
|
||||
$(DRIVERS)/vulgus.o $(VIDEO)/vulgus.o \
|
||||
$(DRIVERS)/tigeroad.o $(VIDEO)/tigeroad.o \
|
||||
$(DRIVERS)/vulgus.o $(VIDEO)/vulgus.o \
|
||||
$(DRIVERS)/zn.o $(MACHINE)/znsec.o \
|
||||
$(DRIVERS)/taitogn.o \
|
||||
$(MACHINE)/cps2crpt.o \
|
||||
@ -560,10 +560,9 @@ $(MAMEOBJ)/dataeast.a: \
|
||||
$(DRIVERS)/boogwing.o $(VIDEO)/boogwing.o \
|
||||
$(DRIVERS)/brkthru.o $(VIDEO)/brkthru.o \
|
||||
$(DRIVERS)/btime.o $(MACHINE)/btime.o $(VIDEO)/btime.o \
|
||||
$(DRIVERS)/chanbara.o \
|
||||
$(DRIVERS)/bwing.o $(VIDEO)/bwing.o \
|
||||
$(DRIVERS)/deshoros.o \
|
||||
$(DRIVERS)/cbuster.o $(VIDEO)/cbuster.o \
|
||||
$(DRIVERS)/chanbara.o \
|
||||
$(DRIVERS)/cninja.o $(VIDEO)/cninja.o \
|
||||
$(DRIVERS)/cntsteer.o \
|
||||
$(DRIVERS)/compgolf.o $(VIDEO)/compgolf.o \
|
||||
@ -577,6 +576,7 @@ $(MAMEOBJ)/dataeast.a: \
|
||||
$(DRIVERS)/deco156.o $(MACHINE)/deco156.o \
|
||||
$(DRIVERS)/deco32.o $(VIDEO)/deco32.o \
|
||||
$(DRIVERS)/decocass.o $(MACHINE)/decocass.o $(VIDEO)/decocass.o \
|
||||
$(DRIVERS)/deshoros.o \
|
||||
$(DRIVERS)/dietgo.o $(VIDEO)/dietgo.o \
|
||||
$(DRIVERS)/exprraid.o $(VIDEO)/exprraid.o \
|
||||
$(DRIVERS)/firetrap.o $(VIDEO)/firetrap.o \
|
||||
|
@ -12,39 +12,29 @@
|
||||
#include "cpu/h6280/h6280.h"
|
||||
#include "includes/battlera.h"
|
||||
|
||||
static int HuC6270_registers[20];
|
||||
static int VDC_register,vram_ptr;
|
||||
static UINT8 *HuC6270_vram,*vram_dirty;
|
||||
static bitmap_t *tile_bitmap,*front_bitmap;
|
||||
static UINT32 tile_dirtyseq;
|
||||
|
||||
static int current_scanline,inc_value;
|
||||
static int irq_enable,rcr_enable,sb_enable,bb_enable,bldwolf_vblank;
|
||||
|
||||
static UINT8 blank_tile[32];
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_START( battlera )
|
||||
{
|
||||
HuC6270_vram=auto_alloc_array(machine, UINT8, 0x20000);
|
||||
vram_dirty=auto_alloc_array(machine, UINT8, 0x1000);
|
||||
battlera_state *state = machine->driver_data<battlera_state>();
|
||||
state->HuC6270_vram=auto_alloc_array(machine, UINT8, 0x20000);
|
||||
state->vram_dirty=auto_alloc_array(machine, UINT8, 0x1000);
|
||||
|
||||
memset(HuC6270_vram,0,0x20000);
|
||||
memset(vram_dirty,1,0x1000);
|
||||
memset(state->HuC6270_vram,0,0x20000);
|
||||
memset(state->vram_dirty,1,0x1000);
|
||||
|
||||
tile_bitmap=auto_bitmap_alloc(machine,512,512,machine->primary_screen->format());
|
||||
front_bitmap=auto_bitmap_alloc(machine,512,512,machine->primary_screen->format());
|
||||
state->tile_bitmap=auto_bitmap_alloc(machine,512,512,machine->primary_screen->format());
|
||||
state->front_bitmap=auto_bitmap_alloc(machine,512,512,machine->primary_screen->format());
|
||||
|
||||
vram_ptr=0;
|
||||
inc_value=1;
|
||||
current_scanline=0;
|
||||
irq_enable=rcr_enable=sb_enable=bb_enable=0;
|
||||
state->vram_ptr=0;
|
||||
state->inc_value=1;
|
||||
state->current_scanline=0;
|
||||
state->irq_enable=state->rcr_enable=state->sb_enable=state->bb_enable=0;
|
||||
|
||||
gfx_element_set_source(machine->gfx[0], HuC6270_vram);
|
||||
gfx_element_set_source(machine->gfx[1], HuC6270_vram);
|
||||
gfx_element_set_source(machine->gfx[2], blank_tile);
|
||||
gfx_element_set_source(machine->gfx[0], state->HuC6270_vram);
|
||||
gfx_element_set_source(machine->gfx[1], state->HuC6270_vram);
|
||||
gfx_element_set_source(machine->gfx[2], state->blank_tile);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -64,34 +54,38 @@ WRITE8_HANDLER( battlera_palette_w )
|
||||
|
||||
READ8_HANDLER( HuC6270_debug_r )
|
||||
{
|
||||
return HuC6270_vram[offset];
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
return state->HuC6270_vram[offset];
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( HuC6270_debug_w )
|
||||
{
|
||||
HuC6270_vram[offset]=data;
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
state->HuC6270_vram[offset]=data;
|
||||
}
|
||||
READ8_HANDLER( HuC6270_register_r )
|
||||
{
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
int rr;
|
||||
|
||||
if ((current_scanline+56)==HuC6270_registers[6]) rr=1; else rr=0;
|
||||
if ((state->current_scanline+56)==state->HuC6270_registers[6]) rr=1; else rr=0;
|
||||
|
||||
return 0 /* CR flag */
|
||||
| (0 << 1) /* OR flag */
|
||||
| (rr << 2) /* RR flag */
|
||||
| (0 << 3) /* DS flag */
|
||||
| (0 << 4) /* DV flag */
|
||||
| (bldwolf_vblank << 5) /* VD flag (1 when vblank else 0) */
|
||||
| (state->bldwolf_vblank << 5) /* VD flag (1 when vblank else 0) */
|
||||
| (0 << 6) /* BSY flag (1 when dma active, else 0) */
|
||||
| (0 << 7); /* Always zero */
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( HuC6270_register_w )
|
||||
{
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
switch (offset) {
|
||||
case 0: /* Select data region */
|
||||
VDC_register=data;
|
||||
state->VDC_register=data;
|
||||
break;
|
||||
case 1: /* Unused */
|
||||
break;
|
||||
@ -103,15 +97,16 @@ WRITE8_HANDLER( HuC6270_register_w )
|
||||
#ifdef UNUSED_FUNCTION
|
||||
READ8_HANDLER( HuC6270_data_r )
|
||||
{
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
int result;
|
||||
|
||||
switch (offset) {
|
||||
case 0: /* LSB */
|
||||
return HuC6270_vram[(HuC6270_registers[1]<<1)|1];
|
||||
return state->HuC6270_vram[(state->HuC6270_registers[1]<<1)|1];
|
||||
|
||||
case 1:/* MSB */
|
||||
result=HuC6270_vram[(HuC6270_registers[1]<<1)|0];
|
||||
HuC6270_registers[1]=(HuC6270_registers[1]+inc_value)&0xffff;
|
||||
result=state->HuC6270_vram[(state->HuC6270_registers[1]<<1)|0];
|
||||
state->HuC6270_registers[1]=(state->HuC6270_registers[1]+state->inc_value)&0xffff;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -121,25 +116,26 @@ READ8_HANDLER( HuC6270_data_r )
|
||||
|
||||
WRITE8_HANDLER( HuC6270_data_w )
|
||||
{
|
||||
battlera_state *state = space->machine->driver_data<battlera_state>();
|
||||
switch (offset) {
|
||||
case 0: /* LSB */
|
||||
switch (VDC_register) {
|
||||
switch (state->VDC_register) {
|
||||
|
||||
case 0: /* MAWR */
|
||||
HuC6270_registers[0]=(HuC6270_registers[0]&0xff00) | (data);
|
||||
state->HuC6270_registers[0]=(state->HuC6270_registers[0]&0xff00) | (data);
|
||||
return;
|
||||
|
||||
case 1: /* MARR */
|
||||
HuC6270_registers[0]=(HuC6270_registers[1]&0xff00) | (data);
|
||||
state->HuC6270_registers[0]=(state->HuC6270_registers[1]&0xff00) | (data);
|
||||
return;
|
||||
|
||||
case 2: /* VRAM */
|
||||
if (HuC6270_vram[(HuC6270_registers[0]<<1)|1]!=data) {
|
||||
HuC6270_vram[(HuC6270_registers[0]<<1)|1]=data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[0], HuC6270_registers[0]>>4);
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], HuC6270_registers[0]>>6);
|
||||
if (state->HuC6270_vram[(state->HuC6270_registers[0]<<1)|1]!=data) {
|
||||
state->HuC6270_vram[(state->HuC6270_registers[0]<<1)|1]=data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[0], state->HuC6270_registers[0]>>4);
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], state->HuC6270_registers[0]>>6);
|
||||
}
|
||||
if (HuC6270_registers[0]<0x1000) vram_dirty[HuC6270_registers[0]]=1;
|
||||
if (state->HuC6270_registers[0]<0x1000) state->vram_dirty[state->HuC6270_registers[0]]=1;
|
||||
return;
|
||||
|
||||
case 3: break; /* Unused */
|
||||
@ -147,23 +143,23 @@ WRITE8_HANDLER( HuC6270_data_w )
|
||||
|
||||
case 5: /* CR - Control register */
|
||||
/* Bits 0,1 unknown */
|
||||
rcr_enable=data&0x4; /* Raster interrupt enable */
|
||||
irq_enable=data&0x8; /* VBL interrupt enable */
|
||||
state->rcr_enable=data&0x4; /* Raster interrupt enable */
|
||||
state->irq_enable=data&0x8; /* VBL interrupt enable */
|
||||
/* Bits 4,5 unknown (EX) */
|
||||
sb_enable=data&0x40; /* Sprites enable */
|
||||
bb_enable=data&0x80; /* Background enable */
|
||||
state->sb_enable=data&0x40; /* Sprites enable */
|
||||
state->bb_enable=data&0x80; /* Background enable */
|
||||
return;
|
||||
|
||||
case 6: /* RCR - Raster counter register */
|
||||
HuC6270_registers[6]=(HuC6270_registers[6]&0xff00) | (data);
|
||||
state->HuC6270_registers[6]=(state->HuC6270_registers[6]&0xff00) | (data);
|
||||
return;
|
||||
|
||||
case 7: /* BXR - X scroll */
|
||||
HuC6270_registers[7]=(HuC6270_registers[7]&0xff00) | (data);
|
||||
state->HuC6270_registers[7]=(state->HuC6270_registers[7]&0xff00) | (data);
|
||||
return;
|
||||
|
||||
case 8: /* BYR - Y scroll */
|
||||
HuC6270_registers[8]=(HuC6270_registers[8]&0xff00) | (data);
|
||||
state->HuC6270_registers[8]=(state->HuC6270_registers[8]&0xff00) | (data);
|
||||
return;
|
||||
|
||||
case 15: /* DMA */
|
||||
@ -174,7 +170,7 @@ WRITE8_HANDLER( HuC6270_data_w )
|
||||
break;
|
||||
|
||||
case 19: /* SATB */
|
||||
HuC6270_registers[19]=(HuC6270_registers[19]&0xff00) | (data);
|
||||
state->HuC6270_registers[19]=(state->HuC6270_registers[19]&0xff00) | (data);
|
||||
return;
|
||||
|
||||
}
|
||||
@ -183,49 +179,49 @@ WRITE8_HANDLER( HuC6270_data_w )
|
||||
/*********************************************/
|
||||
|
||||
case 1: /* MSB (Autoincrement on this write) */
|
||||
switch (VDC_register) {
|
||||
switch (state->VDC_register) {
|
||||
|
||||
case 0: /* MAWR - Memory Address Write Register */
|
||||
HuC6270_registers[0]=(HuC6270_registers[0]&0xff) | (data<<8);
|
||||
state->HuC6270_registers[0]=(state->HuC6270_registers[0]&0xff) | (data<<8);
|
||||
return;
|
||||
|
||||
case 1: /* MARR */
|
||||
HuC6270_registers[1]=(HuC6270_registers[1]&0xff) | (data<<8);
|
||||
state->HuC6270_registers[1]=(state->HuC6270_registers[1]&0xff) | (data<<8);
|
||||
return;
|
||||
|
||||
case 2: /* VWR - VRAM */
|
||||
if (HuC6270_vram[(HuC6270_registers[0]<<1)|0]!=data) {
|
||||
HuC6270_vram[(HuC6270_registers[0]<<1)|0]=data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[0], HuC6270_registers[0]>>4);
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], HuC6270_registers[0]>>6);
|
||||
if (HuC6270_registers[0]<0x1000) vram_dirty[HuC6270_registers[0]]=1;
|
||||
if (state->HuC6270_vram[(state->HuC6270_registers[0]<<1)|0]!=data) {
|
||||
state->HuC6270_vram[(state->HuC6270_registers[0]<<1)|0]=data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[0], state->HuC6270_registers[0]>>4);
|
||||
gfx_element_mark_dirty(space->machine->gfx[1], state->HuC6270_registers[0]>>6);
|
||||
if (state->HuC6270_registers[0]<0x1000) state->vram_dirty[state->HuC6270_registers[0]]=1;
|
||||
}
|
||||
HuC6270_registers[0]+=inc_value;
|
||||
HuC6270_registers[0]=HuC6270_registers[0]&0xffff;
|
||||
state->HuC6270_registers[0]+=state->inc_value;
|
||||
state->HuC6270_registers[0]=state->HuC6270_registers[0]&0xffff;
|
||||
return;
|
||||
|
||||
case 5: /* CR */
|
||||
/* IW - Auto-increment values */
|
||||
switch ((data>>3)&3) {
|
||||
case 0: inc_value=1; break;
|
||||
case 1: inc_value=32;break;
|
||||
case 2: inc_value=64; break;
|
||||
case 3: inc_value=128; break;
|
||||
case 0: state->inc_value=1; break;
|
||||
case 1: state->inc_value=32;break;
|
||||
case 2: state->inc_value=64; break;
|
||||
case 3: state->inc_value=128; break;
|
||||
}
|
||||
|
||||
/* DR, TE unknown */
|
||||
return;
|
||||
|
||||
case 6: /* RCR - Raster counter register */
|
||||
HuC6270_registers[6]=(HuC6270_registers[6]&0xff) | (data<<8);
|
||||
state->HuC6270_registers[6]=(state->HuC6270_registers[6]&0xff) | (data<<8);
|
||||
return;
|
||||
|
||||
case 7: /* BXR - X scroll */
|
||||
HuC6270_registers[7]=(HuC6270_registers[7]&0xff) | (data<<8);
|
||||
state->HuC6270_registers[7]=(state->HuC6270_registers[7]&0xff) | (data<<8);
|
||||
return;
|
||||
|
||||
case 8: /* BYR - Y scroll */
|
||||
HuC6270_registers[8]=(HuC6270_registers[8]&0xff) | (data<<8);
|
||||
state->HuC6270_registers[8]=(state->HuC6270_registers[8]&0xff) | (data<<8);
|
||||
return;
|
||||
|
||||
case 15: /* DMA */
|
||||
@ -236,41 +232,42 @@ WRITE8_HANDLER( HuC6270_data_w )
|
||||
break;
|
||||
|
||||
case 19: /* SATB - Sprites */
|
||||
HuC6270_registers[19]=(HuC6270_registers[19]&0xff) | (data<<8);
|
||||
state->HuC6270_registers[19]=(state->HuC6270_registers[19]&0xff) | (data<<8);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
logerror("%04x: unknown write to VDC_register %02x (%02x) at %02x\n",cpu_get_pc(space->cpu),VDC_register,data,offset);
|
||||
logerror("%04x: unknown write to state->VDC_register %02x (%02x) at %02x\n",cpu_get_pc(space->cpu),state->VDC_register,data,offset);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *clip,int pri)
|
||||
{
|
||||
battlera_state *state = machine->driver_data<battlera_state>();
|
||||
int offs,my,mx,code,code2,fx,fy,cgy=0,cgx,colour,i,yinc;
|
||||
|
||||
/* Draw sprites, starting at SATB, draw in _reverse_ order */
|
||||
for (offs=(HuC6270_registers[19]<<1)+0x200-8; offs>=(HuC6270_registers[19]<<1); offs-=8)
|
||||
for (offs=(state->HuC6270_registers[19]<<1)+0x200-8; offs>=(state->HuC6270_registers[19]<<1); offs-=8)
|
||||
{
|
||||
if ((HuC6270_vram[offs+7]&0x80) && !pri) continue;
|
||||
if (!(HuC6270_vram[offs+7]&0x80) && pri) continue;
|
||||
if ((state->HuC6270_vram[offs+7]&0x80) && !pri) continue;
|
||||
if (!(state->HuC6270_vram[offs+7]&0x80) && pri) continue;
|
||||
|
||||
code=HuC6270_vram[offs+5] + (HuC6270_vram[offs+4]<<8);
|
||||
code=state->HuC6270_vram[offs+5] + (state->HuC6270_vram[offs+4]<<8);
|
||||
code=code>>1;
|
||||
|
||||
my=HuC6270_vram[offs+1] + (HuC6270_vram[offs+0]<<8);
|
||||
mx=HuC6270_vram[offs+3] + (HuC6270_vram[offs+2]<<8);
|
||||
my=state->HuC6270_vram[offs+1] + (state->HuC6270_vram[offs+0]<<8);
|
||||
mx=state->HuC6270_vram[offs+3] + (state->HuC6270_vram[offs+2]<<8);
|
||||
|
||||
mx-=32;
|
||||
my-=57;
|
||||
|
||||
fx=HuC6270_vram[offs+6]&0x8;
|
||||
fy=HuC6270_vram[offs+6]&0x80;
|
||||
cgx=HuC6270_vram[offs+6]&1;
|
||||
colour=HuC6270_vram[offs+7]&0xf;
|
||||
fx=state->HuC6270_vram[offs+6]&0x8;
|
||||
fy=state->HuC6270_vram[offs+6]&0x80;
|
||||
cgx=state->HuC6270_vram[offs+6]&1;
|
||||
colour=state->HuC6270_vram[offs+7]&0xf;
|
||||
|
||||
switch ((HuC6270_vram[offs+6]>>4)&3) {
|
||||
switch ((state->HuC6270_vram[offs+6]>>4)&3) {
|
||||
case 0: cgy=1; break;
|
||||
case 1: cgy=2; break;
|
||||
case 2: cgy=0; break; /* Illegal */
|
||||
@ -312,13 +309,14 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( battlera )
|
||||
{
|
||||
battlera_state *state = screen->machine->driver_data<battlera_state>();
|
||||
int offs,code,scrollx,scrolly,mx,my;
|
||||
|
||||
/* if any tiles changed, redraw the VRAM */
|
||||
if (screen->machine->gfx[0]->dirtyseq != tile_dirtyseq)
|
||||
if (screen->machine->gfx[0]->dirtyseq != state->tile_dirtyseq)
|
||||
{
|
||||
tile_dirtyseq = screen->machine->gfx[0]->dirtyseq;
|
||||
memset(vram_dirty, 1, 0x1000);
|
||||
state->tile_dirtyseq = screen->machine->gfx[0]->dirtyseq;
|
||||
memset(state->vram_dirty, 1, 0x1000);
|
||||
}
|
||||
|
||||
mx=-1;
|
||||
@ -327,45 +325,45 @@ VIDEO_UPDATE( battlera )
|
||||
{
|
||||
mx++;
|
||||
if (mx==64) {mx=0; my++;}
|
||||
code=HuC6270_vram[offs+1] + ((HuC6270_vram[offs] & 0x0f) << 8);
|
||||
code=state->HuC6270_vram[offs+1] + ((state->HuC6270_vram[offs] & 0x0f) << 8);
|
||||
|
||||
/* If this tile was changed OR tilemap was changed, redraw */
|
||||
if (vram_dirty[offs/2]) {
|
||||
vram_dirty[offs/2]=0;
|
||||
drawgfx_opaque(tile_bitmap,0,screen->machine->gfx[0],
|
||||
if (state->vram_dirty[offs/2]) {
|
||||
state->vram_dirty[offs/2]=0;
|
||||
drawgfx_opaque(state->tile_bitmap,0,screen->machine->gfx[0],
|
||||
code,
|
||||
HuC6270_vram[offs] >> 4,
|
||||
state->HuC6270_vram[offs] >> 4,
|
||||
0,0,
|
||||
8*mx,8*my);
|
||||
drawgfx_opaque(front_bitmap,0,screen->machine->gfx[2],
|
||||
drawgfx_opaque(state->front_bitmap,0,screen->machine->gfx[2],
|
||||
0,
|
||||
0, /* fill the spot with pen 256 */
|
||||
0,0,
|
||||
8*mx,8*my);
|
||||
drawgfx_transmask(front_bitmap,0,screen->machine->gfx[0],
|
||||
drawgfx_transmask(state->front_bitmap,0,screen->machine->gfx[0],
|
||||
code,
|
||||
HuC6270_vram[offs] >> 4,
|
||||
state->HuC6270_vram[offs] >> 4,
|
||||
0,0,
|
||||
8*mx,8*my,0x1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Render bitmap */
|
||||
scrollx=-HuC6270_registers[7];
|
||||
scrolly=-HuC6270_registers[8]+cliprect->min_y-1;
|
||||
scrollx=-state->HuC6270_registers[7];
|
||||
scrolly=-state->HuC6270_registers[8]+cliprect->min_y-1;
|
||||
|
||||
copyscrollbitmap(bitmap,tile_bitmap,1,&scrollx,1,&scrolly,cliprect);
|
||||
copyscrollbitmap(bitmap,state->tile_bitmap,1,&scrollx,1,&scrolly,cliprect);
|
||||
|
||||
/* Todo: Background enable (not used anyway) */
|
||||
|
||||
/* Render low priority sprites, if enabled */
|
||||
if (sb_enable) draw_sprites(screen->machine,bitmap,cliprect,0);
|
||||
if (state->sb_enable) draw_sprites(screen->machine,bitmap,cliprect,0);
|
||||
|
||||
/* Render background over sprites */
|
||||
copyscrollbitmap_trans(bitmap,front_bitmap,1,&scrollx,1,&scrolly,cliprect,256);
|
||||
copyscrollbitmap_trans(bitmap,state->front_bitmap,1,&scrollx,1,&scrolly,cliprect,256);
|
||||
|
||||
/* Render high priority sprites, if enabled */
|
||||
if (sb_enable) draw_sprites(screen->machine,bitmap,cliprect,1);
|
||||
if (state->sb_enable) draw_sprites(screen->machine,bitmap,cliprect,1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -374,24 +372,25 @@ VIDEO_UPDATE( battlera )
|
||||
|
||||
INTERRUPT_GEN( battlera_interrupt )
|
||||
{
|
||||
current_scanline=255-cpu_getiloops(device); /* 8 lines clipped at top */
|
||||
battlera_state *state = device->machine->driver_data<battlera_state>();
|
||||
state->current_scanline=255-cpu_getiloops(device); /* 8 lines clipped at top */
|
||||
|
||||
/* If raster interrupt occurs, refresh screen _up_ to this point */
|
||||
if (rcr_enable && (current_scanline+56)==HuC6270_registers[6]) {
|
||||
device->machine->primary_screen->update_partial(current_scanline);
|
||||
if (state->rcr_enable && (state->current_scanline+56)==state->HuC6270_registers[6]) {
|
||||
device->machine->primary_screen->update_partial(state->current_scanline);
|
||||
cpu_set_input_line(device, 0, HOLD_LINE); /* RCR interrupt */
|
||||
}
|
||||
|
||||
/* Start of vblank */
|
||||
else if (current_scanline==240) {
|
||||
bldwolf_vblank=1;
|
||||
else if (state->current_scanline==240) {
|
||||
state->bldwolf_vblank=1;
|
||||
device->machine->primary_screen->update_partial(240);
|
||||
if (irq_enable)
|
||||
if (state->irq_enable)
|
||||
cpu_set_input_line(device, 0, HOLD_LINE); /* VBL */
|
||||
}
|
||||
|
||||
/* End of vblank */
|
||||
if (current_scanline==254) {
|
||||
bldwolf_vblank=0;
|
||||
if (state->current_scanline==254) {
|
||||
state->bldwolf_vblank=0;
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ Standard dm01 memorymap
|
||||
#include "bfm_dm01.h"
|
||||
// local prototypes ///////////////////////////////////////////////////////
|
||||
|
||||
extern void Scorpion2_SetSwitchState(int strobe, int data, int state);
|
||||
extern int Scorpion2_GetSwitchState(int strobe, int data);
|
||||
extern void Scorpion2_SetSwitchState(running_machine *machine, int strobe, int data, int state);
|
||||
extern int Scorpion2_GetSwitchState(running_machine *machine, int strobe, int data);
|
||||
|
||||
// local vars /////////////////////////////////////////////////////////////
|
||||
|
||||
@ -110,7 +110,7 @@ static WRITE8_HANDLER( control_w )
|
||||
if ( data & 8 ) busy = 0;
|
||||
else busy = 1;
|
||||
|
||||
Scorpion2_SetSwitchState(FEEDBACK_STROBE,FEEDBACK_DATA, busy?0:1);
|
||||
Scorpion2_SetSwitchState(space->machine, FEEDBACK_STROBE,FEEDBACK_DATA, busy?0:1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,12 +247,12 @@ int BFM_dm01_busy(void)
|
||||
return data_avail;
|
||||
}
|
||||
|
||||
void BFM_dm01_reset(void)
|
||||
void BFM_dm01_reset(running_machine *machine)
|
||||
{
|
||||
busy = 0;
|
||||
control = 0;
|
||||
xcounter = 0;
|
||||
data_avail = 0;
|
||||
|
||||
Scorpion2_SetSwitchState(FEEDBACK_STROBE,FEEDBACK_DATA, busy?0:1);
|
||||
Scorpion2_SetSwitchState(machine, FEEDBACK_STROBE,FEEDBACK_DATA, busy?0:1);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ ADDRESS_MAP_EXTERN( bfm_dm01_memmap,8 );
|
||||
|
||||
INTERRUPT_GEN( bfm_dm01_vbl );
|
||||
|
||||
void BFM_dm01_reset(void);
|
||||
void BFM_dm01_reset(running_machine *machine);
|
||||
|
||||
void BFM_dm01_writedata(running_machine *machine,UINT8 data);
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
#define POSX 6
|
||||
#define LENGTH 7
|
||||
|
||||
UINT16 *cchasm_ram;
|
||||
|
||||
static int xcenter, ycenter;
|
||||
|
||||
static TIMER_CALLBACK( cchasm_refresh_end )
|
||||
{
|
||||
@ -28,6 +26,7 @@ static TIMER_CALLBACK( cchasm_refresh_end )
|
||||
|
||||
static void cchasm_refresh (running_machine *machine)
|
||||
{
|
||||
cchasm_state *state = machine->driver_data<cchasm_state>();
|
||||
|
||||
int pc = 0;
|
||||
int done = 0;
|
||||
@ -42,7 +41,7 @@ static void cchasm_refresh (running_machine *machine)
|
||||
|
||||
while (!done)
|
||||
{
|
||||
data = cchasm_ram[pc];
|
||||
data = state->ram[pc];
|
||||
opcode = data >> 12;
|
||||
data &= 0xfff;
|
||||
if ((opcode > COLOR) && (data & 0x800))
|
||||
@ -67,14 +66,14 @@ static void cchasm_refresh (running_machine *machine)
|
||||
break;
|
||||
case POSY:
|
||||
move = 1;
|
||||
currenty = ycenter + (data << 16);
|
||||
currenty = state->ycenter + (data << 16);
|
||||
break;
|
||||
case SCALEX:
|
||||
scalex = data << 5;
|
||||
break;
|
||||
case POSX:
|
||||
move = 1;
|
||||
currentx = xcenter - (data << 16);
|
||||
currentx = state->xcenter - (data << 16);
|
||||
break;
|
||||
case LENGTH:
|
||||
if (move)
|
||||
@ -122,10 +121,11 @@ WRITE16_HANDLER( cchasm_refresh_control_w )
|
||||
|
||||
VIDEO_START( cchasm )
|
||||
{
|
||||
cchasm_state *state = machine->driver_data<cchasm_state>();
|
||||
const rectangle &visarea = machine->primary_screen->visible_area();
|
||||
|
||||
xcenter=((visarea.max_x + visarea.min_x)/2) << 16;
|
||||
ycenter=((visarea.max_y + visarea.min_y)/2) << 16;
|
||||
state->xcenter=((visarea.max_x + visarea.min_x)/2) << 16;
|
||||
state->ycenter=((visarea.max_y + visarea.min_y)/2) << 16;
|
||||
|
||||
VIDEO_START_CALL(vector);
|
||||
}
|
||||
|
@ -27,19 +27,6 @@ enum
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Local variables
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static int color_mode;
|
||||
static rgb_t vector_color;
|
||||
static INT16 lastx, lasty;
|
||||
static UINT8 last_control;
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* Vector rendering
|
||||
@ -48,6 +35,7 @@ static UINT8 last_control;
|
||||
|
||||
void cinemat_vector_callback(device_t *device, INT16 sx, INT16 sy, INT16 ex, INT16 ey, UINT8 shift)
|
||||
{
|
||||
cinemat_state *state = device->machine->driver_data<cinemat_state>();
|
||||
const rectangle &visarea = device->machine->primary_screen->visible_area();
|
||||
int intensity = 0xff;
|
||||
|
||||
@ -62,15 +50,15 @@ void cinemat_vector_callback(device_t *device, INT16 sx, INT16 sy, INT16 ex, INT
|
||||
intensity = 0x1ff * shift / 8;
|
||||
|
||||
/* move to the starting position if we're not there already */
|
||||
if (sx != lastx || sy != lasty)
|
||||
if (sx != state->lastx || sy != state->lasty)
|
||||
vector_add_point(device->machine, sx << 16, sy << 16, 0, 0);
|
||||
|
||||
/* draw the vector */
|
||||
vector_add_point(device->machine, ex << 16, ey << 16, vector_color, intensity);
|
||||
vector_add_point(device->machine, ex << 16, ey << 16, state->vector_color, intensity);
|
||||
|
||||
/* remember the last point */
|
||||
lastx = ex;
|
||||
lasty = ey;
|
||||
state->lastx = ex;
|
||||
state->lasty = ey;
|
||||
}
|
||||
|
||||
|
||||
@ -83,43 +71,44 @@ void cinemat_vector_callback(device_t *device, INT16 sx, INT16 sy, INT16 ex, INT
|
||||
|
||||
WRITE8_HANDLER(cinemat_vector_control_w)
|
||||
{
|
||||
cinemat_state *state = space->machine->driver_data<cinemat_state>();
|
||||
int r, g, b, i;
|
||||
cpu_device *cpu = space->machine->device<cpu_device>("maincpu");
|
||||
|
||||
switch (color_mode)
|
||||
switch (state->color_mode)
|
||||
{
|
||||
case COLOR_BILEVEL:
|
||||
/* color is either bright or dim, selected by the value sent to the port */
|
||||
vector_color = (data & 1) ? MAKE_RGB(0x80,0x80,0x80) : MAKE_RGB(0xff,0xff,0xff);
|
||||
state->vector_color = (data & 1) ? MAKE_RGB(0x80,0x80,0x80) : MAKE_RGB(0xff,0xff,0xff);
|
||||
break;
|
||||
|
||||
case COLOR_16LEVEL:
|
||||
/* on the rising edge of the data value, latch bits 0-3 of the */
|
||||
/* X register as the intensity */
|
||||
if (data != last_control && data)
|
||||
if (data != state->last_control && data)
|
||||
{
|
||||
int xval = cpu->state(CCPU_X) & 0x0f;
|
||||
i = (xval + 1) * 255 / 16;
|
||||
vector_color = MAKE_RGB(i,i,i);
|
||||
state->vector_color = MAKE_RGB(i,i,i);
|
||||
}
|
||||
break;
|
||||
|
||||
case COLOR_64LEVEL:
|
||||
/* on the rising edge of the data value, latch bits 2-7 of the */
|
||||
/* X register as the intensity */
|
||||
if (data != last_control && data)
|
||||
if (data != state->last_control && data)
|
||||
{
|
||||
int xval = cpu->state(CCPU_X);
|
||||
xval = (~xval >> 2) & 0x3f;
|
||||
i = (xval + 1) * 255 / 64;
|
||||
vector_color = MAKE_RGB(i,i,i);
|
||||
state->vector_color = MAKE_RGB(i,i,i);
|
||||
}
|
||||
break;
|
||||
|
||||
case COLOR_RGB:
|
||||
/* on the rising edge of the data value, latch the X register */
|
||||
/* as 4-4-4 BGR values */
|
||||
if (data != last_control && data)
|
||||
if (data != state->last_control && data)
|
||||
{
|
||||
int xval = cpu->state(CCPU_X);
|
||||
r = (~xval >> 0) & 0x0f;
|
||||
@ -128,27 +117,25 @@ WRITE8_HANDLER(cinemat_vector_control_w)
|
||||
g = g * 255 / 15;
|
||||
b = (~xval >> 8) & 0x0f;
|
||||
b = b * 255 / 15;
|
||||
vector_color = MAKE_RGB(r,g,b);
|
||||
state->vector_color = MAKE_RGB(r,g,b);
|
||||
}
|
||||
break;
|
||||
|
||||
case COLOR_QB3:
|
||||
{
|
||||
static int lastx, lasty;
|
||||
|
||||
/* on the falling edge of the data value, remember the original X,Y values */
|
||||
/* they will be restored on the rising edge; this is to simulate the fact */
|
||||
/* that the Rockola color hardware did not overwrite the beam X,Y position */
|
||||
/* on an IV instruction if data == 0 here */
|
||||
if (data != last_control && !data)
|
||||
if (data != state->last_control && !data)
|
||||
{
|
||||
lastx = cpu->state(CCPU_X);
|
||||
lasty = cpu->state(CCPU_Y);
|
||||
state->qb3_lastx = cpu->state(CCPU_X);
|
||||
state->qb3_lasty = cpu->state(CCPU_Y);
|
||||
}
|
||||
|
||||
/* on the rising edge of the data value, latch the Y register */
|
||||
/* as 2-3-3 BGR values */
|
||||
if (data != last_control && data)
|
||||
if (data != state->last_control && data)
|
||||
{
|
||||
int yval = cpu->state(CCPU_Y);
|
||||
r = (~yval >> 0) & 0x07;
|
||||
@ -157,18 +144,18 @@ WRITE8_HANDLER(cinemat_vector_control_w)
|
||||
g = g * 255 / 7;
|
||||
b = (~yval >> 6) & 0x03;
|
||||
b = b * 255 / 3;
|
||||
vector_color = MAKE_RGB(r,g,b);
|
||||
state->vector_color = MAKE_RGB(r,g,b);
|
||||
|
||||
/* restore the original X,Y values */
|
||||
cpu->set_state(CCPU_X, lastx);
|
||||
cpu->set_state(CCPU_Y, lasty);
|
||||
cpu->set_state(CCPU_X, state->qb3_lastx);
|
||||
cpu->set_state(CCPU_Y, state->qb3_lasty);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* remember the last value */
|
||||
last_control = data;
|
||||
state->last_control = data;
|
||||
}
|
||||
|
||||
|
||||
@ -181,35 +168,40 @@ WRITE8_HANDLER(cinemat_vector_control_w)
|
||||
|
||||
VIDEO_START( cinemat_bilevel )
|
||||
{
|
||||
color_mode = COLOR_BILEVEL;
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state->color_mode = COLOR_BILEVEL;
|
||||
VIDEO_START_CALL(vector);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( cinemat_16level )
|
||||
{
|
||||
color_mode = COLOR_16LEVEL;
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state->color_mode = COLOR_16LEVEL;
|
||||
VIDEO_START_CALL(vector);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( cinemat_64level )
|
||||
{
|
||||
color_mode = COLOR_64LEVEL;
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state->color_mode = COLOR_64LEVEL;
|
||||
VIDEO_START_CALL(vector);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( cinemat_color )
|
||||
{
|
||||
color_mode = COLOR_RGB;
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state->color_mode = COLOR_RGB;
|
||||
VIDEO_START_CALL(vector);
|
||||
}
|
||||
|
||||
|
||||
VIDEO_START( cinemat_qb3color )
|
||||
{
|
||||
color_mode = COLOR_QB3;
|
||||
cinemat_state *state = machine->driver_data<cinemat_state>();
|
||||
state->color_mode = COLOR_QB3;
|
||||
VIDEO_START_CALL(vector);
|
||||
}
|
||||
|
||||
|
@ -88,14 +88,8 @@ Sprites - Data East custom chip 52
|
||||
#include "emu.h"
|
||||
#include "includes/darkseal.h"
|
||||
|
||||
UINT16 *darkseal_pf12_row,*darkseal_pf34_row;
|
||||
UINT16 *darkseal_pf1_data,*darkseal_pf2_data,*darkseal_pf3_data;
|
||||
|
||||
static UINT16 darkseal_control_0[8];
|
||||
static UINT16 darkseal_control_1[8];
|
||||
|
||||
static tilemap_t *pf1_tilemap,*pf2_tilemap,*pf3_tilemap;
|
||||
static int flipscreen;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
@ -121,12 +115,22 @@ INLINE void get_bg_tile_info(running_machine *machine,tile_data *tileinfo,int ti
|
||||
0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info2 ) { get_bg_tile_info(machine,tileinfo,tile_index,1,darkseal_pf2_data); }
|
||||
static TILE_GET_INFO( get_bg_tile_info3 ) { get_bg_tile_info(machine,tileinfo,tile_index,2,darkseal_pf3_data); }
|
||||
static TILE_GET_INFO( get_bg_tile_info2 )
|
||||
{
|
||||
darkseal_state *state = machine->driver_data<darkseal_state>();
|
||||
get_bg_tile_info(machine,tileinfo,tile_index,1,state->pf2_data);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info3 )
|
||||
{
|
||||
darkseal_state *state = machine->driver_data<darkseal_state>();
|
||||
get_bg_tile_info(machine,tileinfo,tile_index,2,state->pf3_data);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
int tile=darkseal_pf1_data[tile_index];
|
||||
darkseal_state *state = machine->driver_data<darkseal_state>();
|
||||
int tile=state->pf1_data[tile_index];
|
||||
int color=tile >> 12;
|
||||
|
||||
tile=tile&0xfff;
|
||||
@ -166,6 +170,7 @@ WRITE16_HANDLER( darkseal_palette_24bit_b_w )
|
||||
|
||||
static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
darkseal_state *state = machine->driver_data<darkseal_state>();
|
||||
UINT16 *buffered_spriteram16 = machine->generic.buffered_spriteram.u16;
|
||||
int offs;
|
||||
|
||||
@ -206,7 +211,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flipscreen)
|
||||
if (state->flipscreen)
|
||||
{
|
||||
y=240-y;
|
||||
x=240-x;
|
||||
@ -233,20 +238,23 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const recta
|
||||
|
||||
WRITE16_HANDLER( darkseal_pf1_data_w )
|
||||
{
|
||||
COMBINE_DATA(&darkseal_pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf1_tilemap,offset);
|
||||
darkseal_state *state = space->machine->driver_data<darkseal_state>();
|
||||
COMBINE_DATA(&state->pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf1_tilemap,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( darkseal_pf2_data_w )
|
||||
{
|
||||
COMBINE_DATA(&darkseal_pf2_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf2_tilemap,offset);
|
||||
darkseal_state *state = space->machine->driver_data<darkseal_state>();
|
||||
COMBINE_DATA(&state->pf2_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf2_tilemap,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( darkseal_pf3_data_w )
|
||||
{
|
||||
COMBINE_DATA(&darkseal_pf3_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf3_tilemap,offset);
|
||||
darkseal_state *state = space->machine->driver_data<darkseal_state>();
|
||||
COMBINE_DATA(&state->pf3_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf3_tilemap,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( darkseal_pf3b_data_w ) /* Mirror */
|
||||
@ -256,56 +264,60 @@ WRITE16_HANDLER( darkseal_pf3b_data_w ) /* Mirror */
|
||||
|
||||
WRITE16_HANDLER( darkseal_control_0_w )
|
||||
{
|
||||
COMBINE_DATA(&darkseal_control_0[offset]);
|
||||
darkseal_state *state = space->machine->driver_data<darkseal_state>();
|
||||
COMBINE_DATA(&state->control_0[offset]);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( darkseal_control_1_w )
|
||||
{
|
||||
COMBINE_DATA(&darkseal_control_1[offset]);
|
||||
darkseal_state *state = space->machine->driver_data<darkseal_state>();
|
||||
COMBINE_DATA(&state->control_1[offset]);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_START( darkseal )
|
||||
{
|
||||
pf1_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8,64,64);
|
||||
pf2_tilemap = tilemap_create(machine, get_bg_tile_info2,darkseal_scan, 16,16,64,64);
|
||||
pf3_tilemap = tilemap_create(machine, get_bg_tile_info3,darkseal_scan, 16,16,64,64);
|
||||
darkseal_state *state = machine->driver_data<darkseal_state>();
|
||||
state->pf1_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8,64,64);
|
||||
state->pf2_tilemap = tilemap_create(machine, get_bg_tile_info2,darkseal_scan, 16,16,64,64);
|
||||
state->pf3_tilemap = tilemap_create(machine, get_bg_tile_info3,darkseal_scan, 16,16,64,64);
|
||||
|
||||
tilemap_set_transparent_pen(pf1_tilemap,0);
|
||||
tilemap_set_transparent_pen(pf2_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf1_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf2_tilemap,0);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_UPDATE( darkseal )
|
||||
{
|
||||
flipscreen=!(darkseal_control_0[0]&0x80);
|
||||
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
darkseal_state *state = screen->machine->driver_data<darkseal_state>();
|
||||
state->flipscreen=!(state->control_0[0]&0x80);
|
||||
tilemap_set_flip_all(screen->machine,state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
/* Update scroll registers */
|
||||
tilemap_set_scrollx( pf1_tilemap,0, darkseal_control_1[3] );
|
||||
tilemap_set_scrolly( pf1_tilemap,0, darkseal_control_1[4] );
|
||||
tilemap_set_scrollx( pf2_tilemap,0, darkseal_control_1[1]);
|
||||
tilemap_set_scrolly( pf2_tilemap,0, darkseal_control_1[2] );
|
||||
tilemap_set_scrollx( state->pf1_tilemap,0, state->control_1[3] );
|
||||
tilemap_set_scrolly( state->pf1_tilemap,0, state->control_1[4] );
|
||||
tilemap_set_scrollx( state->pf2_tilemap,0, state->control_1[1]);
|
||||
tilemap_set_scrolly( state->pf2_tilemap,0, state->control_1[2] );
|
||||
|
||||
if (darkseal_control_0[6]&0x4000) { /* Rowscroll enable */
|
||||
int offs,scrollx=darkseal_control_0[3];
|
||||
if (state->control_0[6]&0x4000) { /* Rowscroll enable */
|
||||
int offs,scrollx=state->control_0[3];
|
||||
|
||||
tilemap_set_scroll_rows(pf3_tilemap,512);
|
||||
tilemap_set_scroll_rows(state->pf3_tilemap,512);
|
||||
for (offs = 0;offs < 512;offs++)
|
||||
tilemap_set_scrollx( pf3_tilemap,offs, scrollx + darkseal_pf34_row[offs+0x40] );
|
||||
tilemap_set_scrollx( state->pf3_tilemap,offs, scrollx + state->pf34_row[offs+0x40] );
|
||||
}
|
||||
else {
|
||||
tilemap_set_scroll_rows(pf3_tilemap,1);
|
||||
tilemap_set_scrollx( pf3_tilemap,0, darkseal_control_0[3] );
|
||||
tilemap_set_scroll_rows(state->pf3_tilemap,1);
|
||||
tilemap_set_scrollx( state->pf3_tilemap,0, state->control_0[3] );
|
||||
}
|
||||
tilemap_set_scrolly( pf3_tilemap,0, darkseal_control_0[4] );
|
||||
tilemap_set_scrolly( state->pf3_tilemap,0, state->control_0[4] );
|
||||
|
||||
tilemap_draw(bitmap,cliprect,pf3_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,pf2_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf3_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_tilemap,0,0);
|
||||
draw_sprites(screen->machine,bitmap,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,pf1_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -97,27 +97,14 @@ Todo:
|
||||
#include "emu.h"
|
||||
#include "includes/dec0.h"
|
||||
|
||||
static tilemap_t *pf1_tilemap_0,*pf1_tilemap_1,*pf1_tilemap_2;
|
||||
static tilemap_t *pf2_tilemap_0,*pf2_tilemap_1,*pf2_tilemap_2;
|
||||
static tilemap_t *pf3_tilemap_0,*pf3_tilemap_1,*pf3_tilemap_2;
|
||||
|
||||
UINT16 *dec0_pf1_data,*dec0_pf2_data,*dec0_pf3_data;
|
||||
UINT16 *dec0_pf1_rowscroll,*dec0_pf2_rowscroll,*dec0_pf3_rowscroll;
|
||||
UINT16 *dec0_pf1_colscroll,*dec0_pf2_colscroll,*dec0_pf3_colscroll;
|
||||
static UINT16 dec0_pf1_control_0[4];
|
||||
static UINT16 dec0_pf1_control_1[4];
|
||||
static UINT16 dec0_pf2_control_0[4];
|
||||
static UINT16 dec0_pf2_control_1[4];
|
||||
static UINT16 dec0_pf3_control_0[4];
|
||||
static UINT16 dec0_pf3_control_1[4];
|
||||
static UINT16 *dec0_spriteram;
|
||||
static UINT16 dec0_pri;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
WRITE16_HANDLER( dec0_update_sprites_w )
|
||||
{
|
||||
memcpy(dec0_spriteram,space->machine->generic.spriteram.u16,0x800);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
memcpy(state->spriteram,space->machine->generic.spriteram.u16,0x800);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -149,16 +136,17 @@ WRITE16_HANDLER( dec0_paletteram_b_w )
|
||||
|
||||
static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
|
||||
{
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < 0x400;offs += 4)
|
||||
{
|
||||
int x,y,sprite,colour,multi,fx,fy,inc,flash,mult;
|
||||
|
||||
y = dec0_spriteram[offs];
|
||||
y = state->spriteram[offs];
|
||||
if ((y&0x8000) == 0) continue;
|
||||
|
||||
x = dec0_spriteram[offs+2];
|
||||
x = state->spriteram[offs+2];
|
||||
colour = x >> 12;
|
||||
if ((colour & pri_mask) != pri_val) continue;
|
||||
|
||||
@ -170,7 +158,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan
|
||||
multi = (1 << ((y & 0x1800) >> 11)) - 1; /* 1x, 2x, 4x, 8x height */
|
||||
/* multi = 0 1 3 7 */
|
||||
|
||||
sprite = dec0_spriteram[offs+1] & 0x0fff;
|
||||
sprite = state->spriteram[offs+1] & 0x0fff;
|
||||
|
||||
x = x & 0x01ff;
|
||||
y = y & 0x01ff;
|
||||
@ -299,48 +287,51 @@ static void custom_tilemap_draw(running_machine *machine,
|
||||
|
||||
static void dec0_pf1_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags)
|
||||
{
|
||||
switch (dec0_pf1_control_0[3]&0x3) {
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
switch (state->pf1_control_0[3]&0x3) {
|
||||
case 0: /* 4x1 */
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf1_tilemap_0,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf1_tilemap_0,state->pf1_rowscroll,state->pf1_colscroll,state->pf1_control_0,state->pf1_control_1,flags);
|
||||
break;
|
||||
case 1: /* 2x2 */
|
||||
default:
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf1_tilemap_1,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf1_tilemap_1,state->pf1_rowscroll,state->pf1_colscroll,state->pf1_control_0,state->pf1_control_1,flags);
|
||||
break;
|
||||
case 2: /* 1x4 */
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf1_tilemap_2,dec0_pf1_rowscroll,dec0_pf1_colscroll,dec0_pf1_control_0,dec0_pf1_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf1_tilemap_2,state->pf1_rowscroll,state->pf1_colscroll,state->pf1_control_0,state->pf1_control_1,flags);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
static void dec0_pf2_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags)
|
||||
{
|
||||
switch (dec0_pf2_control_0[3]&0x3) {
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
switch (state->pf2_control_0[3]&0x3) {
|
||||
case 0: /* 4x1 */
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf2_tilemap_0,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf2_tilemap_0,state->pf2_rowscroll,state->pf2_colscroll,state->pf2_control_0,state->pf2_control_1,flags);
|
||||
break;
|
||||
case 1: /* 2x2 */
|
||||
default:
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf2_tilemap_1,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf2_tilemap_1,state->pf2_rowscroll,state->pf2_colscroll,state->pf2_control_0,state->pf2_control_1,flags);
|
||||
break;
|
||||
case 2: /* 1x4 */
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf2_tilemap_2,dec0_pf2_rowscroll,dec0_pf2_colscroll,dec0_pf2_control_0,dec0_pf2_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf2_tilemap_2,state->pf2_rowscroll,state->pf2_colscroll,state->pf2_control_0,state->pf2_control_1,flags);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
static void dec0_pf3_draw(running_machine *machine,bitmap_t *bitmap,const rectangle *cliprect,int flags)
|
||||
{
|
||||
switch (dec0_pf3_control_0[3]&0x3) {
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
switch (state->pf3_control_0[3]&0x3) {
|
||||
case 0: /* 4x1 */
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf3_tilemap_0,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf3_tilemap_0,state->pf3_rowscroll,state->pf3_colscroll,state->pf3_control_0,state->pf3_control_1,flags);
|
||||
break;
|
||||
case 1: /* 2x2 */
|
||||
default:
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf3_tilemap_1,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf3_tilemap_1,state->pf3_rowscroll,state->pf3_colscroll,state->pf3_control_0,state->pf3_control_1,flags);
|
||||
break;
|
||||
case 2: /* 1x4 */
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,pf3_tilemap_2,dec0_pf3_rowscroll,dec0_pf3_colscroll,dec0_pf3_control_0,dec0_pf3_control_1,flags);
|
||||
custom_tilemap_draw(machine,bitmap,cliprect,state->pf3_tilemap_2,state->pf3_rowscroll,state->pf3_colscroll,state->pf3_control_0,state->pf3_control_1,flags);
|
||||
break;
|
||||
};
|
||||
}
|
||||
@ -349,7 +340,8 @@ static void dec0_pf3_draw(running_machine *machine,bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( hbarrel )
|
||||
{
|
||||
flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
|
||||
dec0_state *state = screen->machine->driver_data<dec0_state>();
|
||||
flip_screen_set(screen->machine, state->pf1_control_0[0]&0x80);
|
||||
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x08,0x08);
|
||||
@ -366,20 +358,21 @@ VIDEO_UPDATE( hbarrel )
|
||||
|
||||
VIDEO_UPDATE( baddudes )
|
||||
{
|
||||
flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
|
||||
dec0_state *state = screen->machine->driver_data<dec0_state>();
|
||||
flip_screen_set(screen->machine, state->pf1_control_0[0]&0x80);
|
||||
|
||||
/* WARNING: inverted wrt Midnight Resistance */
|
||||
if ((dec0_pri & 0x01) == 0)
|
||||
if ((state->pri & 0x01) == 0)
|
||||
{
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
|
||||
|
||||
if (dec0_pri & 2)
|
||||
if (state->pri & 2)
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
|
||||
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
|
||||
|
||||
if (dec0_pri & 4)
|
||||
if (state->pri & 4)
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
|
||||
}
|
||||
else
|
||||
@ -387,12 +380,12 @@ VIDEO_UPDATE( baddudes )
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
|
||||
|
||||
if (dec0_pri & 2)
|
||||
if (state->pri & 2)
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
|
||||
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
|
||||
|
||||
if (dec0_pri & 4)
|
||||
if (state->pri & 4)
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0); /* Foreground pens only */
|
||||
}
|
||||
|
||||
@ -404,16 +397,17 @@ VIDEO_UPDATE( baddudes )
|
||||
|
||||
VIDEO_UPDATE( robocop )
|
||||
{
|
||||
dec0_state *state = screen->machine->driver_data<dec0_state>();
|
||||
int trans;
|
||||
|
||||
flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
|
||||
flip_screen_set(screen->machine, state->pf1_control_0[0]&0x80);
|
||||
|
||||
if (dec0_pri & 0x04)
|
||||
if (state->pri & 0x04)
|
||||
trans = 0x08;
|
||||
else
|
||||
trans = 0x00;
|
||||
|
||||
if (dec0_pri & 0x01)
|
||||
if (state->pri & 0x01)
|
||||
{
|
||||
/* WARNING: inverted wrt Midnight Resistance */
|
||||
/* Robocop uses it only for the title screen, so this might be just */
|
||||
@ -421,7 +415,7 @@ VIDEO_UPDATE( robocop )
|
||||
/* something (they are 0x80 in midres, 0x00 here) */
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER1|TILEMAP_DRAW_OPAQUE);
|
||||
|
||||
if (dec0_pri & 0x02)
|
||||
if (state->pri & 0x02)
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
|
||||
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
|
||||
@ -430,13 +424,13 @@ VIDEO_UPDATE( robocop )
|
||||
{
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
|
||||
if (dec0_pri & 0x02)
|
||||
if (state->pri & 0x02)
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
|
||||
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
|
||||
}
|
||||
|
||||
if (dec0_pri & 0x02)
|
||||
if (state->pri & 0x02)
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x08,trans ^ 0x08);
|
||||
else
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
|
||||
@ -449,7 +443,8 @@ VIDEO_UPDATE( robocop )
|
||||
|
||||
VIDEO_UPDATE( birdtry )
|
||||
{
|
||||
flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
|
||||
dec0_state *state = screen->machine->driver_data<dec0_state>();
|
||||
flip_screen_set(screen->machine, state->pf1_control_0[0]&0x80);
|
||||
|
||||
/* This game doesn't have the extra playfield chip on the game board, but
|
||||
the palette does show through. */
|
||||
@ -464,9 +459,10 @@ VIDEO_UPDATE( birdtry )
|
||||
|
||||
VIDEO_UPDATE( hippodrm )
|
||||
{
|
||||
flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
|
||||
dec0_state *state = screen->machine->driver_data<dec0_state>();
|
||||
flip_screen_set(screen->machine, state->pf1_control_0[0]&0x80);
|
||||
|
||||
if (dec0_pri & 0x01)
|
||||
if (state->pri & 0x01)
|
||||
{
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
|
||||
@ -486,7 +482,8 @@ VIDEO_UPDATE( hippodrm )
|
||||
|
||||
VIDEO_UPDATE( slyspy )
|
||||
{
|
||||
flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
|
||||
dec0_state *state = screen->machine->driver_data<dec0_state>();
|
||||
flip_screen_set(screen->machine, state->pf1_control_0[0]&0x80);
|
||||
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
|
||||
@ -494,7 +491,7 @@ VIDEO_UPDATE( slyspy )
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
|
||||
|
||||
/* Redraw top 8 pens of top 8 palettes over sprites */
|
||||
if (dec0_pri&0x80)
|
||||
if (state->pri&0x80)
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_LAYER0);
|
||||
|
||||
dec0_pf1_draw(screen->machine,bitmap,cliprect,0);
|
||||
@ -505,19 +502,20 @@ VIDEO_UPDATE( slyspy )
|
||||
|
||||
VIDEO_UPDATE( midres )
|
||||
{
|
||||
dec0_state *state = screen->machine->driver_data<dec0_state>();
|
||||
int trans;
|
||||
|
||||
flip_screen_set(screen->machine, dec0_pf1_control_0[0]&0x80);
|
||||
flip_screen_set(screen->machine, state->pf1_control_0[0]&0x80);
|
||||
|
||||
if (dec0_pri & 0x04)
|
||||
if (state->pri & 0x04)
|
||||
trans = 0x00;
|
||||
else trans = 0x08;
|
||||
|
||||
if (dec0_pri & 0x01)
|
||||
if (state->pri & 0x01)
|
||||
{
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
|
||||
if (dec0_pri & 0x02)
|
||||
if (state->pri & 0x02)
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
|
||||
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,0);
|
||||
@ -526,13 +524,13 @@ VIDEO_UPDATE( midres )
|
||||
{
|
||||
dec0_pf3_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE);
|
||||
|
||||
if (dec0_pri & 0x02)
|
||||
if (state->pri & 0x02)
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x08,trans);
|
||||
|
||||
dec0_pf2_draw(screen->machine,bitmap,cliprect,0);
|
||||
}
|
||||
|
||||
if (dec0_pri & 0x02)
|
||||
if (state->pri & 0x02)
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x08,trans ^ 0x08);
|
||||
else
|
||||
draw_sprites(screen->machine,bitmap,cliprect,0x00,0x00);
|
||||
@ -545,73 +543,83 @@ VIDEO_UPDATE( midres )
|
||||
|
||||
WRITE16_HANDLER( dec0_pf1_control_0_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf1_control_0[offset]);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf1_control_0[offset]);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf1_control_1_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf1_control_1[offset]);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf1_control_1[offset]);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf1_data_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf1_tilemap_0,offset);
|
||||
tilemap_mark_tile_dirty(pf1_tilemap_1,offset);
|
||||
tilemap_mark_tile_dirty(pf1_tilemap_2,offset);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf1_tilemap_0,offset);
|
||||
tilemap_mark_tile_dirty(state->pf1_tilemap_1,offset);
|
||||
tilemap_mark_tile_dirty(state->pf1_tilemap_2,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf2_control_0_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf2_control_0[offset]);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf2_control_0[offset]);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf2_control_1_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf2_control_1[offset]);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf2_control_1[offset]);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf2_data_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf2_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf2_tilemap_0,offset);
|
||||
tilemap_mark_tile_dirty(pf2_tilemap_1,offset);
|
||||
tilemap_mark_tile_dirty(pf2_tilemap_2,offset);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf2_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf2_tilemap_0,offset);
|
||||
tilemap_mark_tile_dirty(state->pf2_tilemap_1,offset);
|
||||
tilemap_mark_tile_dirty(state->pf2_tilemap_2,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf3_control_0_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf3_control_0[offset]);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf3_control_0[offset]);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf3_control_1_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf3_control_1[offset]);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf3_control_1[offset]);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_pf3_data_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pf3_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf3_tilemap_0,offset);
|
||||
tilemap_mark_tile_dirty(pf3_tilemap_1,offset);
|
||||
tilemap_mark_tile_dirty(pf3_tilemap_2,offset);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pf3_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf3_tilemap_0,offset);
|
||||
tilemap_mark_tile_dirty(state->pf3_tilemap_1,offset);
|
||||
tilemap_mark_tile_dirty(state->pf3_tilemap_2,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( dec0_priority_w )
|
||||
{
|
||||
COMBINE_DATA(&dec0_pri);
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
COMBINE_DATA(&state->pri);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( dec0_pf3_control_8bit_w )
|
||||
{
|
||||
static int buffer[0x20];
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
UINT16 myword;
|
||||
|
||||
buffer[offset]=data;
|
||||
state->buffer[offset]=data;
|
||||
|
||||
/* Rearrange little endian bytes from H6280 into big endian words for 68k */
|
||||
offset&=0xffe;
|
||||
myword=buffer[offset] + (buffer[offset+1]<<8);
|
||||
myword=state->buffer[offset] + (state->buffer[offset+1]<<8);
|
||||
|
||||
if (offset<0x10) dec0_pf3_control_0_w(space,offset/2,myword,0xffff);
|
||||
else dec0_pf3_control_1_w(space,(offset-0x10)/2,myword,0xffff);
|
||||
@ -619,27 +627,29 @@ WRITE8_HANDLER( dec0_pf3_control_8bit_w )
|
||||
|
||||
WRITE8_HANDLER( dec0_pf3_data_8bit_w )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
if (offset&1) { /* MSB has changed */
|
||||
UINT16 lsb=dec0_pf3_data[offset>>1];
|
||||
UINT16 lsb=state->pf3_data[offset>>1];
|
||||
UINT16 newword=(lsb&0xff) | (data<<8);
|
||||
dec0_pf3_data[offset>>1]=newword;
|
||||
state->pf3_data[offset>>1]=newword;
|
||||
}
|
||||
else { /* LSB has changed */
|
||||
UINT16 msb=dec0_pf3_data[offset>>1];
|
||||
UINT16 msb=state->pf3_data[offset>>1];
|
||||
UINT16 newword=(msb&0xff00) | data;
|
||||
dec0_pf3_data[offset>>1]=newword;
|
||||
state->pf3_data[offset>>1]=newword;
|
||||
}
|
||||
tilemap_mark_tile_dirty(pf3_tilemap_0,offset>>1);
|
||||
tilemap_mark_tile_dirty(pf3_tilemap_1,offset>>1);
|
||||
tilemap_mark_tile_dirty(pf3_tilemap_2,offset>>1);
|
||||
tilemap_mark_tile_dirty(state->pf3_tilemap_0,offset>>1);
|
||||
tilemap_mark_tile_dirty(state->pf3_tilemap_1,offset>>1);
|
||||
tilemap_mark_tile_dirty(state->pf3_tilemap_2,offset>>1);
|
||||
}
|
||||
|
||||
READ8_HANDLER( dec0_pf3_data_8bit_r )
|
||||
{
|
||||
dec0_state *state = space->machine->driver_data<dec0_state>();
|
||||
if (offset&1) /* MSB */
|
||||
return dec0_pf3_data[offset>>1]>>8;
|
||||
return state->pf3_data[offset>>1]>>8;
|
||||
|
||||
return dec0_pf3_data[offset>>1]&0xff;
|
||||
return state->pf3_data[offset>>1]&0xff;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -676,13 +686,15 @@ static TILEMAP_MAPPER( tile_shape2_8x8_scan )
|
||||
|
||||
static TILE_GET_INFO( get_pf1_tile_info )
|
||||
{
|
||||
int tile=dec0_pf1_data[tile_index];
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
int tile=state->pf1_data[tile_index];
|
||||
SET_TILE_INFO(0,tile&0xfff,tile>>12,0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_pf2_tile_info )
|
||||
{
|
||||
int tile=dec0_pf2_data[tile_index];
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
int tile=state->pf2_data[tile_index];
|
||||
int pri=((tile>>12)>7);
|
||||
SET_TILE_INFO(1,tile&0xfff,tile>>12,0);
|
||||
tileinfo->group = pri;
|
||||
@ -690,7 +702,8 @@ static TILE_GET_INFO( get_pf2_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_pf3_tile_info )
|
||||
{
|
||||
int tile=dec0_pf3_data[tile_index];
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
int tile=state->pf3_data[tile_index];
|
||||
int pri=((tile>>12)>7);
|
||||
SET_TILE_INFO(2,tile&0xfff,tile>>12,0);
|
||||
tileinfo->group = pri;
|
||||
@ -698,23 +711,25 @@ static TILE_GET_INFO( get_pf3_tile_info )
|
||||
|
||||
VIDEO_START( dec0_nodma )
|
||||
{
|
||||
pf1_tilemap_0 = tilemap_create(machine, get_pf1_tile_info,tile_shape0_8x8_scan, 8, 8,128, 32);
|
||||
pf1_tilemap_1 = tilemap_create(machine, get_pf1_tile_info,tile_shape1_8x8_scan, 8, 8, 64, 64);
|
||||
pf1_tilemap_2 = tilemap_create(machine, get_pf1_tile_info,tile_shape2_8x8_scan, 8, 8, 32,128);
|
||||
pf2_tilemap_0 = tilemap_create(machine, get_pf2_tile_info,tile_shape0_scan, 16,16, 64, 16);
|
||||
pf2_tilemap_1 = tilemap_create(machine, get_pf2_tile_info,tile_shape1_scan, 16,16, 32, 32);
|
||||
pf2_tilemap_2 = tilemap_create(machine, get_pf2_tile_info,tile_shape2_scan, 16,16, 16, 64);
|
||||
pf3_tilemap_0 = tilemap_create(machine, get_pf3_tile_info,tile_shape0_scan, 16,16, 64, 16);
|
||||
pf3_tilemap_1 = tilemap_create(machine, get_pf3_tile_info,tile_shape1_scan, 16,16, 32, 32);
|
||||
pf3_tilemap_2 = tilemap_create(machine, get_pf3_tile_info,tile_shape2_scan, 16,16, 16, 64);
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
state->pf1_tilemap_0 = tilemap_create(machine, get_pf1_tile_info,tile_shape0_8x8_scan, 8, 8,128, 32);
|
||||
state->pf1_tilemap_1 = tilemap_create(machine, get_pf1_tile_info,tile_shape1_8x8_scan, 8, 8, 64, 64);
|
||||
state->pf1_tilemap_2 = tilemap_create(machine, get_pf1_tile_info,tile_shape2_8x8_scan, 8, 8, 32,128);
|
||||
state->pf2_tilemap_0 = tilemap_create(machine, get_pf2_tile_info,tile_shape0_scan, 16,16, 64, 16);
|
||||
state->pf2_tilemap_1 = tilemap_create(machine, get_pf2_tile_info,tile_shape1_scan, 16,16, 32, 32);
|
||||
state->pf2_tilemap_2 = tilemap_create(machine, get_pf2_tile_info,tile_shape2_scan, 16,16, 16, 64);
|
||||
state->pf3_tilemap_0 = tilemap_create(machine, get_pf3_tile_info,tile_shape0_scan, 16,16, 64, 16);
|
||||
state->pf3_tilemap_1 = tilemap_create(machine, get_pf3_tile_info,tile_shape1_scan, 16,16, 32, 32);
|
||||
state->pf3_tilemap_2 = tilemap_create(machine, get_pf3_tile_info,tile_shape2_scan, 16,16, 16, 64);
|
||||
|
||||
dec0_spriteram=machine->generic.spriteram.u16;
|
||||
state->spriteram=machine->generic.spriteram.u16;
|
||||
}
|
||||
|
||||
VIDEO_START( dec0 )
|
||||
{
|
||||
dec0_state *state = machine->driver_data<dec0_state>();
|
||||
VIDEO_START_CALL(dec0_nodma);
|
||||
dec0_spriteram=auto_alloc_array(machine, UINT16, 0x800/2);
|
||||
state->spriteram=auto_alloc_array(machine, UINT16, 0x800/2);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,33 +14,33 @@
|
||||
//extern int mlc_raster_table[9][256];
|
||||
//extern UINT32 mlc_clipper[32];
|
||||
//static bitmap_t *temp_bitmap;
|
||||
static UINT32 colour_mask, *mlc_buffered_spriteram;
|
||||
UINT32 *mlc_vram, *mlc_clip_ram;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_START( mlc )
|
||||
{
|
||||
deco_mlc_state *state = machine->driver_data<deco_mlc_state>();
|
||||
if (machine->gfx[0]->color_granularity==16)
|
||||
colour_mask=0x7f;
|
||||
state->colour_mask=0x7f;
|
||||
else if (machine->gfx[0]->color_granularity==32)
|
||||
colour_mask=0x3f;
|
||||
state->colour_mask=0x3f;
|
||||
else
|
||||
colour_mask=0x1f;
|
||||
state->colour_mask=0x1f;
|
||||
|
||||
// temp_bitmap = auto_bitmap_alloc( machine, 512, 512, BITMAP_FORMAT_RGB32 );
|
||||
mlc_buffered_spriteram = auto_alloc_array(machine, UINT32, 0x3000/4);
|
||||
state->mlc_buffered_spriteram = auto_alloc_array(machine, UINT32, 0x3000/4);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static void blitRaster(running_machine *machine, bitmap_t *bitmap, int rasterMode)
|
||||
{
|
||||
deco_mlc_state *state = machine->driver_data<deco_mlc_state>();
|
||||
int x,y;
|
||||
for (y=0; y<256; y++) //todo
|
||||
{
|
||||
UINT32* src=BITMAP_ADDR32(temp_bitmap, y&0x1ff, 0);
|
||||
UINT32* dst=BITMAP_ADDR32(bitmap, y, 0);
|
||||
UINT32 xptr=(mlc_raster_table[0][y]<<13);
|
||||
UINT32 xptr=(state->mlc_raster_table[0][y]<<13);
|
||||
|
||||
if (input_code_pressed(machine, KEYCODE_X))
|
||||
xptr=0;
|
||||
@ -53,9 +53,9 @@ static void blitRaster(running_machine *machine, bitmap_t *bitmap, int rasterMod
|
||||
//if (input_code_pressed(machine, KEYCODE_X))
|
||||
// xptr+=0x10000;
|
||||
//else if(rasterHackTest[0][y]<0)
|
||||
xptr+=0x10000 - ((mlc_raster_table[2][y]&0x3ff)<<5);
|
||||
xptr+=0x10000 - ((state->mlc_raster_table[2][y]&0x3ff)<<5);
|
||||
//else
|
||||
// xptr+=0x10000 + (mlc_raster_table[0][y]<<5);
|
||||
// xptr+=0x10000 + (state->mlc_raster_table[0][y]<<5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,6 +227,7 @@ static void mlc_drawgfxzoom(
|
||||
|
||||
static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
{
|
||||
deco_mlc_state *state = machine->driver_data<deco_mlc_state>();
|
||||
UINT32 *index_ptr=0;
|
||||
int offs,fx=0,fy=0,x,y,color,colorOffset,sprite,indx,h,w,bx,by,fx1,fy1;
|
||||
int xoffs,yoffs;
|
||||
@ -245,7 +246,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan
|
||||
// int rasterDirty=0;
|
||||
int clipper=0;
|
||||
rectangle user_clip;
|
||||
UINT32* mlc_spriteram=mlc_buffered_spriteram; // spriteram32
|
||||
UINT32* mlc_spriteram=state->mlc_buffered_spriteram; // spriteram32
|
||||
|
||||
for (offs = (0x3000/4)-8; offs>=0; offs-=8)
|
||||
{
|
||||
@ -312,19 +313,19 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan
|
||||
however there are space for 8 clipping windows, where is the high bit? (Or is it ~0x400?) */
|
||||
clipper=((clipper&2)>>1)|((clipper&1)<<1); // Swap low two bits
|
||||
|
||||
user_clip.min_y=mlc_clip_ram[(clipper*4)+0];
|
||||
user_clip.max_y=mlc_clip_ram[(clipper*4)+1];
|
||||
user_clip.min_x=mlc_clip_ram[(clipper*4)+2];
|
||||
user_clip.max_x=mlc_clip_ram[(clipper*4)+3];
|
||||
user_clip.min_y=state->mlc_clip_ram[(clipper*4)+0];
|
||||
user_clip.max_y=state->mlc_clip_ram[(clipper*4)+1];
|
||||
user_clip.min_x=state->mlc_clip_ram[(clipper*4)+2];
|
||||
user_clip.max_x=state->mlc_clip_ram[(clipper*4)+3];
|
||||
|
||||
sect_rect(&user_clip, cliprect);
|
||||
|
||||
/* Any colours out of range (for the bpp value) trigger 'shadow' mode */
|
||||
if (color & (colour_mask+1))
|
||||
if (color & (state->colour_mask+1))
|
||||
alpha=0x80;
|
||||
else
|
||||
alpha=0xff;
|
||||
color&=colour_mask;
|
||||
color&=state->colour_mask;
|
||||
|
||||
/* If this bit is set, combine this block with the next one */
|
||||
if (mlc_spriteram[offs+1]&0x1000) {
|
||||
@ -371,7 +372,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
} else {
|
||||
indx&=0x1fff;
|
||||
index_ptr=mlc_vram + indx*4;
|
||||
index_ptr=state->mlc_vram + indx*4;
|
||||
h=(index_ptr[0]>>8)&0xf;
|
||||
w=(index_ptr[1]>>8)&0xf;
|
||||
|
||||
@ -379,7 +380,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan
|
||||
if (!w) w=16;
|
||||
|
||||
if (use8bppMode) {
|
||||
UINT32* index_ptr2=mlc_vram + ((indx2*4)&0x7fff);
|
||||
UINT32* index_ptr2=state->mlc_vram + ((indx2*4)&0x7fff);
|
||||
sprite2=((index_ptr2[2]&0x3)<<16) | (index_ptr2[3]&0xffff);
|
||||
}
|
||||
|
||||
@ -459,7 +460,7 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan
|
||||
}
|
||||
else
|
||||
{
|
||||
const UINT32* ptr=mlc_vram + ((sprite)&0x7fff);
|
||||
const UINT32* ptr=state->mlc_vram + ((sprite)&0x7fff);
|
||||
tile=(*ptr)&0xffff;
|
||||
|
||||
if (tileFormat)
|
||||
@ -510,12 +511,13 @@ static void draw_sprites(running_machine* machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_EOF( mlc )
|
||||
{
|
||||
deco_mlc_state *state = machine->driver_data<deco_mlc_state>();
|
||||
/* Spriteram is definitely double buffered, as the vram lookup tables
|
||||
are often updated a frame after spriteram is setup to point to a new
|
||||
lookup table. Without buffering incorrect one frame glitches are seen
|
||||
in several places, especially in Hoops.
|
||||
*/
|
||||
memcpy(mlc_buffered_spriteram, machine->generic.spriteram.u32, 0x3000);
|
||||
memcpy(state->mlc_buffered_spriteram, machine->generic.spriteram.u32, 0x3000);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( mlc )
|
||||
|
@ -14,24 +14,6 @@
|
||||
#define PIXEL_CLOCK (MADALIEN_MAIN_CLOCK / 2)
|
||||
|
||||
|
||||
UINT8 *madalien_videoram;
|
||||
UINT8 *madalien_charram;
|
||||
|
||||
UINT8 *madalien_video_flags;
|
||||
UINT8 *madalien_video_control; /* bit #0 is set during player 2's turn, bit #3 is set during CRTC initialization */
|
||||
UINT8 *madalien_scroll;
|
||||
UINT8 *madalien_edge1_pos;
|
||||
UINT8 *madalien_edge2_pos;
|
||||
UINT8 *madalien_headlight_pos;
|
||||
|
||||
static tilemap_t *tilemap_fg;
|
||||
|
||||
static tilemap_t *tilemap_edge1[4];
|
||||
static tilemap_t *tilemap_edge2[4];
|
||||
|
||||
static bitmap_t *headlight_bitmap;
|
||||
|
||||
|
||||
static PALETTE_INIT( madalien )
|
||||
{
|
||||
int i;
|
||||
@ -108,34 +90,39 @@ static TILEMAP_MAPPER( scan_mode3 )
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_BG_1 )
|
||||
{
|
||||
UINT8 *map = machine->region("user1")->base() + ((*madalien_video_flags & 0x08) << 6);
|
||||
madalien_state *state = machine->driver_data<madalien_state>();
|
||||
UINT8 *map = machine->region("user1")->base() + ((*state->video_flags & 0x08) << 6);
|
||||
|
||||
SET_TILE_INFO(1, map[tile_index], BIT(*madalien_video_flags, 2) ? 2 : 0, 0);
|
||||
SET_TILE_INFO(1, map[tile_index], BIT(*state->video_flags, 2) ? 2 : 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_BG_2 )
|
||||
{
|
||||
UINT8 *map = machine->region("user1")->base() + ((*madalien_video_flags & 0x08) << 6) + 0x80;
|
||||
madalien_state *state = machine->driver_data<madalien_state>();
|
||||
UINT8 *map = machine->region("user1")->base() + ((*state->video_flags & 0x08) << 6) + 0x80;
|
||||
|
||||
SET_TILE_INFO(1, map[tile_index], BIT(*madalien_video_flags, 2) ? 2 : 0, 0);
|
||||
SET_TILE_INFO(1, map[tile_index], BIT(*state->video_flags, 2) ? 2 : 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_FG )
|
||||
{
|
||||
SET_TILE_INFO(0, madalien_videoram[tile_index], 0, 0);
|
||||
madalien_state *state = machine->driver_data<madalien_state>();
|
||||
SET_TILE_INFO(0, state->videoram[tile_index], 0, 0);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( madalien_videoram_w )
|
||||
{
|
||||
madalien_videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(tilemap_fg, offset);
|
||||
madalien_state *state = space->machine->driver_data<madalien_state>();
|
||||
state->videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->tilemap_fg, offset);
|
||||
}
|
||||
|
||||
|
||||
static VIDEO_START( madalien )
|
||||
{
|
||||
madalien_state *state = machine->driver_data<madalien_state>();
|
||||
int i;
|
||||
|
||||
static const tilemap_mapper_func scan_functions[4] =
|
||||
@ -148,33 +135,34 @@ static VIDEO_START( madalien )
|
||||
16, 16, 32, 32
|
||||
};
|
||||
|
||||
tilemap_fg = tilemap_create(machine, get_tile_info_FG, tilemap_scan_cols_flip_x, 8, 8, 32, 32);
|
||||
tilemap_set_transparent_pen(tilemap_fg, 0);
|
||||
tilemap_set_scrolldx(tilemap_fg, 0, 0x50);
|
||||
tilemap_set_scrolldy(tilemap_fg, 0, 0x20);
|
||||
state->tilemap_fg = tilemap_create(machine, get_tile_info_FG, tilemap_scan_cols_flip_x, 8, 8, 32, 32);
|
||||
tilemap_set_transparent_pen(state->tilemap_fg, 0);
|
||||
tilemap_set_scrolldx(state->tilemap_fg, 0, 0x50);
|
||||
tilemap_set_scrolldy(state->tilemap_fg, 0, 0x20);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
tilemap_edge1[i] = tilemap_create(machine, get_tile_info_BG_1, scan_functions[i], 16, 16, tilemap_cols[i], 8);
|
||||
tilemap_set_scrolldx(tilemap_edge1[i], 0, 0x50);
|
||||
tilemap_set_scrolldy(tilemap_edge1[i], 0, 0x20);
|
||||
state->tilemap_edge1[i] = tilemap_create(machine, get_tile_info_BG_1, scan_functions[i], 16, 16, tilemap_cols[i], 8);
|
||||
tilemap_set_scrolldx(state->tilemap_edge1[i], 0, 0x50);
|
||||
tilemap_set_scrolldy(state->tilemap_edge1[i], 0, 0x20);
|
||||
|
||||
tilemap_edge2[i] = tilemap_create(machine, get_tile_info_BG_2, scan_functions[i], 16, 16, tilemap_cols[i], 8);
|
||||
tilemap_set_scrolldx(tilemap_edge2[i], 0, 0x50);
|
||||
tilemap_set_scrolldy(tilemap_edge2[i], 0, machine->primary_screen->height() - 256);
|
||||
state->tilemap_edge2[i] = tilemap_create(machine, get_tile_info_BG_2, scan_functions[i], 16, 16, tilemap_cols[i], 8);
|
||||
tilemap_set_scrolldx(state->tilemap_edge2[i], 0, 0x50);
|
||||
tilemap_set_scrolldy(state->tilemap_edge2[i], 0, machine->primary_screen->height() - 256);
|
||||
}
|
||||
|
||||
headlight_bitmap = auto_bitmap_alloc(machine, 128, 128, BITMAP_FORMAT_INDEXED16);
|
||||
state->headlight_bitmap = auto_bitmap_alloc(machine, 128, 128, BITMAP_FORMAT_INDEXED16);
|
||||
|
||||
gfx_element_set_source(machine->gfx[0], madalien_charram);
|
||||
gfx_element_set_source(machine->gfx[0], state->charram);
|
||||
|
||||
drawgfx_opaque(headlight_bitmap, NULL, machine->gfx[2], 0, 0, 0, 0, 0x00, 0x00);
|
||||
drawgfx_opaque(headlight_bitmap, NULL, machine->gfx[2], 0, 0, 0, 1, 0x00, 0x40);
|
||||
drawgfx_opaque(state->headlight_bitmap, NULL, machine->gfx[2], 0, 0, 0, 0, 0x00, 0x00);
|
||||
drawgfx_opaque(state->headlight_bitmap, NULL, machine->gfx[2], 0, 0, 0, 1, 0x00, 0x40);
|
||||
}
|
||||
|
||||
|
||||
static void draw_edges(bitmap_t *bitmap, const rectangle *cliprect, int flip, int scroll_mode)
|
||||
static void draw_edges(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int flip, int scroll_mode)
|
||||
{
|
||||
madalien_state *state = machine->driver_data<madalien_state>();
|
||||
rectangle clip_edge1;
|
||||
rectangle clip_edge2;
|
||||
|
||||
@ -183,44 +171,45 @@ static void draw_edges(bitmap_t *bitmap, const rectangle *cliprect, int flip, in
|
||||
|
||||
if (flip)
|
||||
{
|
||||
clip_edge1.min_y = *madalien_edge1_pos | 0x80;
|
||||
clip_edge2.max_y = (*madalien_edge2_pos & 0x7f) ^ 0x7f;
|
||||
clip_edge1.min_y = *state->edge1_pos | 0x80;
|
||||
clip_edge2.max_y = (*state->edge2_pos & 0x7f) ^ 0x7f;
|
||||
}
|
||||
else
|
||||
{
|
||||
clip_edge1.max_y = (*madalien_edge1_pos & 0x7f) ^ 0x7f;
|
||||
clip_edge2.min_y = *madalien_edge2_pos | 0x80;
|
||||
clip_edge1.max_y = (*state->edge1_pos & 0x7f) ^ 0x7f;
|
||||
clip_edge2.min_y = *state->edge2_pos | 0x80;
|
||||
}
|
||||
|
||||
sect_rect(&clip_edge1, cliprect);
|
||||
sect_rect(&clip_edge2, cliprect);
|
||||
|
||||
tilemap_mark_all_tiles_dirty(tilemap_edge1[scroll_mode]);
|
||||
tilemap_mark_all_tiles_dirty(tilemap_edge2[scroll_mode]);
|
||||
tilemap_mark_all_tiles_dirty(state->tilemap_edge1[scroll_mode]);
|
||||
tilemap_mark_all_tiles_dirty(state->tilemap_edge2[scroll_mode]);
|
||||
|
||||
tilemap_set_flip(tilemap_edge1[scroll_mode], flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
|
||||
tilemap_set_scrollx(tilemap_edge1[scroll_mode], 0, -(*madalien_scroll & 0xfc));
|
||||
tilemap_set_scrolly(tilemap_edge1[scroll_mode], 0, *madalien_edge1_pos & 0x7f);
|
||||
tilemap_set_flip(state->tilemap_edge1[scroll_mode], flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
|
||||
tilemap_set_scrollx(state->tilemap_edge1[scroll_mode], 0, -(*state->scroll & 0xfc));
|
||||
tilemap_set_scrolly(state->tilemap_edge1[scroll_mode], 0, *state->edge1_pos & 0x7f);
|
||||
|
||||
tilemap_set_flip(tilemap_edge2[scroll_mode], flip ? TILEMAP_FLIPX : TILEMAP_FLIPY);
|
||||
tilemap_set_scrollx(tilemap_edge2[scroll_mode], 0, -(*madalien_scroll & 0xfc));
|
||||
tilemap_set_scrolly(tilemap_edge2[scroll_mode], 0, *madalien_edge2_pos & 0x7f);
|
||||
tilemap_set_flip(state->tilemap_edge2[scroll_mode], flip ? TILEMAP_FLIPX : TILEMAP_FLIPY);
|
||||
tilemap_set_scrollx(state->tilemap_edge2[scroll_mode], 0, -(*state->scroll & 0xfc));
|
||||
tilemap_set_scrolly(state->tilemap_edge2[scroll_mode], 0, *state->edge2_pos & 0x7f);
|
||||
|
||||
tilemap_draw(bitmap, &clip_edge1, tilemap_edge1[scroll_mode], 0, 0);
|
||||
tilemap_draw(bitmap, &clip_edge2, tilemap_edge2[scroll_mode], 0, 0);
|
||||
tilemap_draw(bitmap, &clip_edge1, state->tilemap_edge1[scroll_mode], 0, 0);
|
||||
tilemap_draw(bitmap, &clip_edge2, state->tilemap_edge2[scroll_mode], 0, 0);
|
||||
}
|
||||
|
||||
|
||||
static void draw_headlight(bitmap_t *bitmap, const rectangle *cliprect, int flip)
|
||||
static void draw_headlight(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int flip)
|
||||
{
|
||||
if (BIT(*madalien_video_flags, 0))
|
||||
madalien_state *state = machine->driver_data<madalien_state>();
|
||||
if (BIT(*state->video_flags, 0))
|
||||
{
|
||||
UINT8 y;
|
||||
|
||||
for (y = 0; y < 0x80; y++)
|
||||
{
|
||||
UINT8 x;
|
||||
UINT8 hy = y - *madalien_headlight_pos;
|
||||
UINT8 hy = y - *state->headlight_pos;
|
||||
|
||||
if (flip)
|
||||
hy = ~hy;
|
||||
@ -238,7 +227,7 @@ static void draw_headlight(bitmap_t *bitmap, const rectangle *cliprect, int flip
|
||||
if ((hx < cliprect->min_x) || (hx > cliprect->max_x))
|
||||
continue;
|
||||
|
||||
if (*BITMAP_ADDR16(headlight_bitmap, y, x) != 0)
|
||||
if (*BITMAP_ADDR16(state->headlight_bitmap, y, x) != 0)
|
||||
*BITMAP_ADDR16(bitmap, hy, hx) |= 8;
|
||||
}
|
||||
}
|
||||
@ -248,21 +237,24 @@ static void draw_headlight(bitmap_t *bitmap, const rectangle *cliprect, int flip
|
||||
|
||||
static void draw_foreground(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int flip)
|
||||
{
|
||||
tilemap_set_flip(tilemap_fg, flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
|
||||
tilemap_draw(bitmap, cliprect, tilemap_fg, 0, 0);
|
||||
madalien_state *state = machine->driver_data<madalien_state>();
|
||||
tilemap_set_flip(state->tilemap_fg, flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
|
||||
tilemap_draw(bitmap, cliprect, state->tilemap_fg, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
WRITE8_HANDLER( madalien_charram_w )
|
||||
{
|
||||
madalien_charram[offset] = data;
|
||||
madalien_state *state = space->machine->driver_data<madalien_state>();
|
||||
state->charram[offset] = data;
|
||||
gfx_element_mark_dirty(space->machine->gfx[0], (offset/8) & 0xff);
|
||||
}
|
||||
|
||||
|
||||
static VIDEO_UPDATE( madalien )
|
||||
{
|
||||
int flip = BIT(input_port_read(screen->machine, "DSW"), 6) && BIT(*madalien_video_control, 0);
|
||||
madalien_state *state = screen->machine->driver_data<madalien_state>();
|
||||
int flip = BIT(input_port_read(screen->machine, "DSW"), 6) && BIT(*state->video_control, 0);
|
||||
|
||||
// bits #0 and #1 define scrolling mode
|
||||
//
|
||||
@ -271,18 +263,18 @@ static VIDEO_UPDATE( madalien )
|
||||
//
|
||||
// mode 2 - transition from B to A
|
||||
// mode 3 - transition from A to B
|
||||
int scroll_mode = *madalien_scroll & 3;
|
||||
int scroll_mode = *state->scroll & 3;
|
||||
|
||||
bitmap_fill(bitmap, cliprect, 0);
|
||||
draw_edges(bitmap, cliprect, flip, scroll_mode);
|
||||
draw_edges(screen->machine, bitmap, cliprect, flip, scroll_mode);
|
||||
draw_foreground(screen->machine, bitmap, cliprect, flip);
|
||||
|
||||
/* highlight section A (outside of tunnels).
|
||||
* also, bit 1 of the madalien_video_flags register (6A) is
|
||||
* also, bit 1 of the state->video_flags register (6A) is
|
||||
* combined with the headlight signal through NOR gate 1A,
|
||||
* which is used to light up the tunnel when an alien explodes
|
||||
*/
|
||||
if (scroll_mode != 1 || *madalien_video_flags & 2)
|
||||
if (scroll_mode != 1 || *state->video_flags & 2)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
@ -290,10 +282,10 @@ static VIDEO_UPDATE( madalien )
|
||||
int min_x = 0;
|
||||
int max_x = 0xff;
|
||||
|
||||
if (!(*madalien_video_flags & 2))
|
||||
if (!(*state->video_flags & 2))
|
||||
{
|
||||
if (scroll_mode == 2) min_x = (*madalien_scroll & 0xfc);
|
||||
else if (scroll_mode == 3) max_x = (*madalien_scroll & 0xfc) - 1;
|
||||
if (scroll_mode == 2) min_x = (*state->scroll & 0xfc);
|
||||
else if (scroll_mode == 3) max_x = (*state->scroll & 0xfc) - 1;
|
||||
}
|
||||
|
||||
if (flip)
|
||||
@ -309,7 +301,7 @@ static VIDEO_UPDATE( madalien )
|
||||
*BITMAP_ADDR16(bitmap, y, x) |= 8;
|
||||
}
|
||||
|
||||
draw_headlight(bitmap, cliprect, flip);
|
||||
draw_headlight(screen->machine, bitmap, cliprect, flip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "emu.h"
|
||||
#include "includes/pcktgal.h"
|
||||
|
||||
static tilemap_t *bg_tilemap;
|
||||
|
||||
PALETTE_INIT( pcktgal )
|
||||
{
|
||||
@ -36,7 +35,7 @@ WRITE8_HANDLER( pcktgal_videoram_w )
|
||||
pcktgal_state *state = space->machine->driver_data<pcktgal_state>();
|
||||
UINT8 *videoram = state->videoram;
|
||||
videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap, offset / 2);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( pcktgal_flipscreen_w )
|
||||
@ -60,7 +59,8 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( pcktgal )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
pcktgal_state *state = machine->driver_data<pcktgal_state>();
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 32);
|
||||
}
|
||||
|
||||
@ -99,7 +99,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( pcktgal )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
|
||||
pcktgal_state *state = screen->machine->driver_data<pcktgal_state>();
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect);
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,16 +40,6 @@ Note: if MAME_DEBUG is defined, pressing Z with:
|
||||
#include "emu.h"
|
||||
#include "includes/powerins.h"
|
||||
|
||||
/* Variables that driver has access to: */
|
||||
UINT16 *powerins_vram_0, *powerins_vctrl_0;
|
||||
UINT16 *powerins_vram_1, *powerins_vctrl_1;
|
||||
//UINT16 *powerins_vregs;
|
||||
|
||||
/* Variables only used here: */
|
||||
static tilemap_t *tilemap_0, *tilemap_1;
|
||||
static int tile_bank;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -65,12 +55,13 @@ WRITE16_HANDLER( powerins_flipscreen_w )
|
||||
|
||||
WRITE16_HANDLER( powerins_tilebank_w )
|
||||
{
|
||||
powerins_state *state = space->machine->driver_data<powerins_state>();
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
if (data != tile_bank)
|
||||
if (data != state->tile_bank)
|
||||
{
|
||||
tile_bank = data; // Tiles Bank (VRAM 0)
|
||||
tilemap_mark_all_tiles_dirty(tilemap_0);
|
||||
state->tile_bank = data; // Tiles Bank (VRAM 0)
|
||||
tilemap_mark_all_tiles_dirty(state->tilemap_0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,18 +121,20 @@ Offset:
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_0 )
|
||||
{
|
||||
UINT16 code = powerins_vram_0[tile_index];
|
||||
powerins_state *state = machine->driver_data<powerins_state>();
|
||||
UINT16 code = state->vram_0[tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
(code & 0x07ff) + (tile_bank*0x800),
|
||||
(code & 0x07ff) + (state->tile_bank*0x800),
|
||||
((code & 0xf000) >> (16-4)) + ((code & 0x0800) >> (11-4)),
|
||||
0);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( powerins_vram_0_w )
|
||||
{
|
||||
COMBINE_DATA(&powerins_vram_0[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_0, offset);
|
||||
powerins_state *state = space->machine->driver_data<powerins_state>();
|
||||
COMBINE_DATA(&state->vram_0[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap_0, offset);
|
||||
}
|
||||
|
||||
static TILEMAP_MAPPER( powerins_get_memory_offset_0 )
|
||||
@ -170,7 +163,8 @@ Offset:
|
||||
|
||||
static TILE_GET_INFO( get_tile_info_1 )
|
||||
{
|
||||
UINT16 code = powerins_vram_1[tile_index];
|
||||
powerins_state *state = machine->driver_data<powerins_state>();
|
||||
UINT16 code = state->vram_1[tile_index];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
code & 0x0fff,
|
||||
@ -180,8 +174,9 @@ static TILE_GET_INFO( get_tile_info_1 )
|
||||
|
||||
WRITE16_HANDLER( powerins_vram_1_w )
|
||||
{
|
||||
COMBINE_DATA(&powerins_vram_1[offset]);
|
||||
tilemap_mark_tile_dirty(tilemap_1, offset);
|
||||
powerins_state *state = space->machine->driver_data<powerins_state>();
|
||||
COMBINE_DATA(&state->vram_1[offset]);
|
||||
tilemap_mark_tile_dirty(state->tilemap_1, offset);
|
||||
}
|
||||
|
||||
|
||||
@ -198,24 +193,25 @@ WRITE16_HANDLER( powerins_vram_1_w )
|
||||
|
||||
VIDEO_START( powerins )
|
||||
{
|
||||
tilemap_0 = tilemap_create( machine, get_tile_info_0,
|
||||
powerins_state *state = machine->driver_data<powerins_state>();
|
||||
state->tilemap_0 = tilemap_create( machine, get_tile_info_0,
|
||||
powerins_get_memory_offset_0,
|
||||
|
||||
16,16,
|
||||
DIM_NX_0, DIM_NY_0 );
|
||||
|
||||
tilemap_1 = tilemap_create( machine, get_tile_info_1,
|
||||
state->tilemap_1 = tilemap_create( machine, get_tile_info_1,
|
||||
tilemap_scan_cols,
|
||||
|
||||
8,8,
|
||||
DIM_NX_1, DIM_NY_1 );
|
||||
|
||||
tilemap_set_scroll_rows(tilemap_0,1);
|
||||
tilemap_set_scroll_cols(tilemap_0,1);
|
||||
tilemap_set_scroll_rows(state->tilemap_0,1);
|
||||
tilemap_set_scroll_cols(state->tilemap_0,1);
|
||||
|
||||
tilemap_set_scroll_rows(tilemap_1,1);
|
||||
tilemap_set_scroll_cols(tilemap_1,1);
|
||||
tilemap_set_transparent_pen(tilemap_1,15);
|
||||
tilemap_set_scroll_rows(state->tilemap_1,1);
|
||||
tilemap_set_scroll_cols(state->tilemap_1,1);
|
||||
tilemap_set_transparent_pen(state->tilemap_1,15);
|
||||
}
|
||||
|
||||
|
||||
@ -345,16 +341,17 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( powerins )
|
||||
{
|
||||
powerins_state *state = screen->machine->driver_data<powerins_state>();
|
||||
int layers_ctrl = -1;
|
||||
|
||||
int scrollx = (powerins_vctrl_0[2/2]&0xff) + (powerins_vctrl_0[0/2]&0xff)*256;
|
||||
int scrolly = (powerins_vctrl_0[6/2]&0xff) + (powerins_vctrl_0[4/2]&0xff)*256;
|
||||
int scrollx = (state->vctrl_0[2/2]&0xff) + (state->vctrl_0[0/2]&0xff)*256;
|
||||
int scrolly = (state->vctrl_0[6/2]&0xff) + (state->vctrl_0[4/2]&0xff)*256;
|
||||
|
||||
tilemap_set_scrollx( tilemap_0, 0, scrollx - 0x20);
|
||||
tilemap_set_scrolly( tilemap_0, 0, scrolly );
|
||||
tilemap_set_scrollx( state->tilemap_0, 0, scrollx - 0x20);
|
||||
tilemap_set_scrolly( state->tilemap_0, 0, scrolly );
|
||||
|
||||
tilemap_set_scrollx( tilemap_1, 0, -0x20); // fixed offset
|
||||
tilemap_set_scrolly( tilemap_1, 0, 0x00);
|
||||
tilemap_set_scrollx( state->tilemap_1, 0, -0x20); // fixed offset
|
||||
tilemap_set_scrolly( state->tilemap_1, 0, 0x00);
|
||||
|
||||
#ifdef MAME_DEBUG
|
||||
if (input_code_pressed(screen->machine, KEYCODE_Z))
|
||||
@ -369,9 +366,9 @@ if (input_code_pressed(screen->machine, KEYCODE_Z))
|
||||
}
|
||||
#endif
|
||||
|
||||
if (layers_ctrl&1) tilemap_draw(bitmap,cliprect, tilemap_0, 0, 0);
|
||||
if (layers_ctrl&1) tilemap_draw(bitmap,cliprect, state->tilemap_0, 0, 0);
|
||||
else bitmap_fill(bitmap,cliprect,0);
|
||||
if (layers_ctrl&8) draw_sprites(screen->machine,bitmap,cliprect);
|
||||
if (layers_ctrl&2) tilemap_draw(bitmap,cliprect, tilemap_1, 0, 0);
|
||||
if (layers_ctrl&2) tilemap_draw(bitmap,cliprect, state->tilemap_1, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,10 +9,6 @@
|
||||
#include "emu.h"
|
||||
#include "includes/srumbler.h"
|
||||
|
||||
UINT8 *srumbler_backgroundram,*srumbler_foregroundram;
|
||||
static tilemap_t *bg_tilemap,*fg_tilemap;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -22,20 +18,22 @@ static tilemap_t *bg_tilemap,*fg_tilemap;
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
UINT8 attr = srumbler_foregroundram[2*tile_index];
|
||||
srumbler_state *state = machine->driver_data<srumbler_state>();
|
||||
UINT8 attr = state->foregroundram[2*tile_index];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
srumbler_foregroundram[2*tile_index + 1] + ((attr & 0x03) << 8),
|
||||
state->foregroundram[2*tile_index + 1] + ((attr & 0x03) << 8),
|
||||
(attr & 0x3c) >> 2,
|
||||
(attr & 0x40) ? TILE_FORCE_LAYER0 : 0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
UINT8 attr = srumbler_backgroundram[2*tile_index];
|
||||
srumbler_state *state = machine->driver_data<srumbler_state>();
|
||||
UINT8 attr = state->backgroundram[2*tile_index];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
srumbler_backgroundram[2*tile_index + 1] + ((attr & 0x07) << 8),
|
||||
state->backgroundram[2*tile_index + 1] + ((attr & 0x07) << 8),
|
||||
(attr & 0xe0) >> 5,
|
||||
((attr & 0x08) ? TILE_FLIPY : 0));
|
||||
tileinfo->group = (attr & 0x10) >> 4;
|
||||
@ -51,13 +49,14 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( srumbler )
|
||||
{
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_cols,8,8,64,32);
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols, 16,16,64,64);
|
||||
srumbler_state *state = machine->driver_data<srumbler_state>();
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_cols,8,8,64,32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols, 16,16,64,64);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,3);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap,3);
|
||||
|
||||
tilemap_set_transmask(bg_tilemap,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */
|
||||
tilemap_set_transmask(bg_tilemap,1,0x07ff,0xf800); /* split type 1 has pens 0-10 transparent in front half */
|
||||
tilemap_set_transmask(state->bg_tilemap,0,0xffff,0x0000); /* split type 0 is totally transparent in front half */
|
||||
tilemap_set_transmask(state->bg_tilemap,1,0x07ff,0xf800); /* split type 1 has pens 0-10 transparent in front half */
|
||||
}
|
||||
|
||||
|
||||
@ -70,14 +69,16 @@ VIDEO_START( srumbler )
|
||||
|
||||
WRITE8_HANDLER( srumbler_foreground_w )
|
||||
{
|
||||
srumbler_foregroundram[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap,offset/2);
|
||||
srumbler_state *state = space->machine->driver_data<srumbler_state>();
|
||||
state->foregroundram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap,offset/2);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( srumbler_background_w )
|
||||
{
|
||||
srumbler_backgroundram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset/2);
|
||||
srumbler_state *state = space->machine->driver_data<srumbler_state>();
|
||||
state->backgroundram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap,offset/2);
|
||||
}
|
||||
|
||||
|
||||
@ -96,12 +97,12 @@ WRITE8_HANDLER( srumbler_4009_w )
|
||||
|
||||
WRITE8_HANDLER( srumbler_scroll_w )
|
||||
{
|
||||
static int scroll[4];
|
||||
srumbler_state *state = space->machine->driver_data<srumbler_state>();
|
||||
|
||||
scroll[offset] = data;
|
||||
state->scroll[offset] = data;
|
||||
|
||||
tilemap_set_scrollx(bg_tilemap,0,scroll[0] | (scroll[1] << 8));
|
||||
tilemap_set_scrolly(bg_tilemap,0,scroll[2] | (scroll[3] << 8));
|
||||
tilemap_set_scrollx(state->bg_tilemap,0,state->scroll[0] | (state->scroll[1] << 8));
|
||||
tilemap_set_scrolly(state->bg_tilemap,0,state->scroll[2] | (state->scroll[3] << 8));
|
||||
}
|
||||
|
||||
|
||||
@ -161,10 +162,11 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
VIDEO_UPDATE( srumbler )
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER1,0);
|
||||
srumbler_state *state = screen->machine->driver_data<srumbler_state>();
|
||||
tilemap_draw(bitmap,cliprect,state->bg_tilemap,TILEMAP_DRAW_LAYER1,0);
|
||||
draw_sprites(screen->machine, bitmap,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_LAYER0,0);
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->bg_tilemap,TILEMAP_DRAW_LAYER0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->fg_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,18 +8,14 @@
|
||||
#include "emu.h"
|
||||
#include "includes/sshangha.h"
|
||||
|
||||
UINT16 *sshangha_pf2_data,*sshangha_pf1_data;
|
||||
UINT16 *sshangha_pf1_rowscroll,*sshangha_pf2_rowscroll;
|
||||
static UINT16 sshangha_control_0[8];
|
||||
static tilemap_t *pf1_8x8_tilemap,*pf1_16x16_tilemap,*pf2_tilemap;
|
||||
static int sshangha_pf1_bank,sshangha_pf2_bank,sshangha_video_control;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void sshangha_tilemap_draw(bitmap_t *bitmap, const rectangle *cliprect)
|
||||
static void sshangha_tilemap_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
const bitmap_t *bitmap0 = tilemap_get_pixmap(pf1_16x16_tilemap);
|
||||
const bitmap_t *bitmap1 = tilemap_get_pixmap(pf2_tilemap);
|
||||
sshangha_state *state = machine->driver_data<sshangha_state>();
|
||||
const bitmap_t *bitmap0 = tilemap_get_pixmap(state->pf1_16x16_tilemap);
|
||||
const bitmap_t *bitmap1 = tilemap_get_pixmap(state->pf2_tilemap);
|
||||
int x,y,p;
|
||||
|
||||
for (y=0; y<240; y++) {
|
||||
@ -34,8 +30,9 @@ static void sshangha_tilemap_draw(bitmap_t *bitmap, const rectangle *cliprect)
|
||||
|
||||
WRITE16_HANDLER (sshangha_video_w)
|
||||
{
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
/* 0x4: Special video mode, other bits unknown */
|
||||
sshangha_video_control=data;
|
||||
state->video_control=data;
|
||||
// popmessage("%04x",data);
|
||||
}
|
||||
|
||||
@ -112,20 +109,23 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
WRITE16_HANDLER( sshangha_pf2_data_w )
|
||||
{
|
||||
COMBINE_DATA(&sshangha_pf2_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf2_tilemap,offset);
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
COMBINE_DATA(&state->pf2_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf2_tilemap,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( sshangha_pf1_data_w )
|
||||
{
|
||||
COMBINE_DATA(&sshangha_pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf1_8x8_tilemap,offset);
|
||||
tilemap_mark_tile_dirty(pf1_16x16_tilemap,offset);
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
COMBINE_DATA(&state->pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf1_8x8_tilemap,offset);
|
||||
tilemap_mark_tile_dirty(state->pf1_16x16_tilemap,offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( sshangha_control_0_w )
|
||||
{
|
||||
COMBINE_DATA(&sshangha_control_0[offset]);
|
||||
sshangha_state *state = space->machine->driver_data<sshangha_state>();
|
||||
COMBINE_DATA(&state->control_0[offset]);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
@ -140,102 +140,106 @@ static UINT32 sshangha_scan(UINT32 col,UINT32 row,UINT32 num_cols,UINT32 num_row
|
||||
|
||||
static TILE_GET_INFO( get_pf2_tile_info )
|
||||
{
|
||||
UINT16 tile=sshangha_pf2_data[tile_index];
|
||||
SET_TILE_INFO(1,(tile&0xfff)|sshangha_pf2_bank,(tile>>12)|32,0);
|
||||
sshangha_state *state = machine->driver_data<sshangha_state>();
|
||||
UINT16 tile=state->pf2_data[tile_index];
|
||||
SET_TILE_INFO(1,(tile&0xfff)|state->pf2_bank,(tile>>12)|32,0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_pf1_16x16_tile_info )
|
||||
{
|
||||
UINT16 tile=sshangha_pf1_data[tile_index];
|
||||
SET_TILE_INFO(1,(tile&0xfff)|sshangha_pf1_bank,tile>>12,0);
|
||||
sshangha_state *state = machine->driver_data<sshangha_state>();
|
||||
UINT16 tile=state->pf1_data[tile_index];
|
||||
SET_TILE_INFO(1,(tile&0xfff)|state->pf1_bank,tile>>12,0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_pf1_8x8_tile_info )
|
||||
{
|
||||
UINT16 tile=sshangha_pf1_data[tile_index];
|
||||
SET_TILE_INFO(0,(tile&0xfff)|sshangha_pf1_bank,tile>>12,0);
|
||||
sshangha_state *state = machine->driver_data<sshangha_state>();
|
||||
UINT16 tile=state->pf1_data[tile_index];
|
||||
SET_TILE_INFO(0,(tile&0xfff)|state->pf1_bank,tile>>12,0);
|
||||
}
|
||||
|
||||
VIDEO_START( sshangha )
|
||||
{
|
||||
pf1_8x8_tilemap = tilemap_create(machine, get_pf1_8x8_tile_info, tilemap_scan_rows, 8, 8,64,32);
|
||||
pf1_16x16_tilemap = tilemap_create(machine, get_pf1_16x16_tile_info,tilemap_scan_rows,16,16,32,32);
|
||||
pf2_tilemap = tilemap_create(machine, get_pf2_tile_info,tilemap_scan_rows, 16,16,32,32);
|
||||
sshangha_state *state = machine->driver_data<sshangha_state>();
|
||||
state->pf1_8x8_tilemap = tilemap_create(machine, get_pf1_8x8_tile_info, tilemap_scan_rows, 8, 8,64,32);
|
||||
state->pf1_16x16_tilemap = tilemap_create(machine, get_pf1_16x16_tile_info,tilemap_scan_rows,16,16,32,32);
|
||||
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info,tilemap_scan_rows, 16,16,32,32);
|
||||
|
||||
tilemap_set_transparent_pen(pf1_8x8_tilemap,0);
|
||||
tilemap_set_transparent_pen(pf1_16x16_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf1_8x8_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf1_16x16_tilemap,0);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
VIDEO_UPDATE( sshangha )
|
||||
{
|
||||
static int last_pf1_bank,last_pf2_bank;
|
||||
sshangha_state *state = screen->machine->driver_data<sshangha_state>();
|
||||
int offs;
|
||||
|
||||
flip_screen_set_no_update(screen->machine, sshangha_control_0[0]&0x80);
|
||||
flip_screen_set_no_update(screen->machine, state->control_0[0]&0x80);
|
||||
tilemap_set_flip_all(screen->machine,flip_screen_x_get(screen->machine) ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
|
||||
tilemap_set_enable( pf2_tilemap, sshangha_control_0[5]&0x8000);
|
||||
tilemap_set_enable( pf1_8x8_tilemap, sshangha_control_0[5]&0x0080);
|
||||
tilemap_set_enable( pf1_16x16_tilemap, sshangha_control_0[5]&0x0080);
|
||||
tilemap_set_enable( state->pf2_tilemap, state->control_0[5]&0x8000);
|
||||
tilemap_set_enable( state->pf1_8x8_tilemap, state->control_0[5]&0x0080);
|
||||
tilemap_set_enable( state->pf1_16x16_tilemap, state->control_0[5]&0x0080);
|
||||
|
||||
sshangha_pf1_bank=((sshangha_control_0[7]>> 4)&0xf)*0x1000;
|
||||
sshangha_pf2_bank=((sshangha_control_0[7]>>12)&0xf)*0x1000;
|
||||
state->pf1_bank=((state->control_0[7]>> 4)&0xf)*0x1000;
|
||||
state->pf2_bank=((state->control_0[7]>>12)&0xf)*0x1000;
|
||||
|
||||
if (sshangha_pf1_bank!=last_pf1_bank) tilemap_mark_all_tiles_dirty(pf1_8x8_tilemap);
|
||||
if (sshangha_pf1_bank!=last_pf1_bank) tilemap_mark_all_tiles_dirty(pf1_16x16_tilemap);
|
||||
if (sshangha_pf2_bank!=last_pf2_bank) tilemap_mark_all_tiles_dirty(pf2_tilemap);
|
||||
last_pf1_bank=sshangha_pf1_bank;
|
||||
last_pf2_bank=sshangha_pf2_bank;
|
||||
if (state->pf1_bank!=state->last_pf1_bank) tilemap_mark_all_tiles_dirty(state->pf1_8x8_tilemap);
|
||||
if (state->pf1_bank!=state->last_pf1_bank) tilemap_mark_all_tiles_dirty(state->pf1_16x16_tilemap);
|
||||
if (state->pf2_bank!=state->last_pf2_bank) tilemap_mark_all_tiles_dirty(state->pf2_tilemap);
|
||||
state->last_pf1_bank=state->pf1_bank;
|
||||
state->last_pf2_bank=state->pf2_bank;
|
||||
|
||||
/* Rowscroll - todo, this might actually be col scroll, or both row & col combined. Check.. */
|
||||
if (sshangha_control_0[6]&0x40) {
|
||||
tilemap_set_scroll_rows(pf1_8x8_tilemap,256);
|
||||
tilemap_set_scroll_rows(pf1_16x16_tilemap,256);
|
||||
if (state->control_0[6]&0x40) {
|
||||
tilemap_set_scroll_rows(state->pf1_8x8_tilemap,256);
|
||||
tilemap_set_scroll_rows(state->pf1_16x16_tilemap,256);
|
||||
for (offs=0; offs<256; offs++) {
|
||||
tilemap_set_scrollx( pf1_8x8_tilemap,0, sshangha_control_0[1] + sshangha_pf1_rowscroll[offs+0x200] );
|
||||
tilemap_set_scrollx( pf1_16x16_tilemap,0, sshangha_control_0[1] + sshangha_pf1_rowscroll[offs+0x200] );
|
||||
tilemap_set_scrollx( state->pf1_8x8_tilemap,0, state->control_0[1] + state->pf1_rowscroll[offs+0x200] );
|
||||
tilemap_set_scrollx( state->pf1_16x16_tilemap,0, state->control_0[1] + state->pf1_rowscroll[offs+0x200] );
|
||||
}
|
||||
} else {
|
||||
tilemap_set_scroll_rows(pf1_16x16_tilemap,1);
|
||||
tilemap_set_scroll_rows(pf1_8x8_tilemap,1);
|
||||
tilemap_set_scrollx( pf1_8x8_tilemap,0, sshangha_control_0[1] );
|
||||
tilemap_set_scrollx( pf1_16x16_tilemap,0, sshangha_control_0[1] );
|
||||
tilemap_set_scroll_rows(state->pf1_16x16_tilemap,1);
|
||||
tilemap_set_scroll_rows(state->pf1_8x8_tilemap,1);
|
||||
tilemap_set_scrollx( state->pf1_8x8_tilemap,0, state->control_0[1] );
|
||||
tilemap_set_scrollx( state->pf1_16x16_tilemap,0, state->control_0[1] );
|
||||
}
|
||||
|
||||
if (sshangha_control_0[6]&0x4000) {
|
||||
tilemap_set_scroll_rows(pf2_tilemap,256);
|
||||
if (state->control_0[6]&0x4000) {
|
||||
tilemap_set_scroll_rows(state->pf2_tilemap,256);
|
||||
for (offs=0; offs<256; offs++) {
|
||||
tilemap_set_scrollx( pf2_tilemap,0, sshangha_control_0[3] - 3 + sshangha_pf2_rowscroll[offs+0x200] );
|
||||
tilemap_set_scrollx( state->pf2_tilemap,0, state->control_0[3] - 3 + state->pf2_rowscroll[offs+0x200] );
|
||||
}
|
||||
} else {
|
||||
tilemap_set_scroll_rows(pf2_tilemap,1);
|
||||
tilemap_set_scrollx( pf2_tilemap,0, sshangha_control_0[3] - 3 );
|
||||
tilemap_set_scroll_rows(state->pf2_tilemap,1);
|
||||
tilemap_set_scrollx( state->pf2_tilemap,0, state->control_0[3] - 3 );
|
||||
}
|
||||
|
||||
tilemap_set_scrolly( pf2_tilemap,0, sshangha_control_0[4] );
|
||||
tilemap_set_scrolly( pf1_8x8_tilemap,0, sshangha_control_0[2] );
|
||||
tilemap_set_scrolly( pf1_16x16_tilemap,0, sshangha_control_0[2] );
|
||||
tilemap_set_scrolly( state->pf2_tilemap,0, state->control_0[4] );
|
||||
tilemap_set_scrolly( state->pf1_8x8_tilemap,0, state->control_0[2] );
|
||||
tilemap_set_scrolly( state->pf1_16x16_tilemap,0, state->control_0[2] );
|
||||
|
||||
//if ((sshangha_control_0[5]&0x8000)==0) /* <- used on hot-b logo and girl presentation screens */
|
||||
//if ((state->control_0[5]&0x8000)==0) /* <- used on hot-b logo and girl presentation screens */
|
||||
bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
|
||||
|
||||
/* Super Shanghai has a mode where the two tilemaps are combined to
|
||||
produce a 6bpp tilemap. We can't precompute this as any tiles can be
|
||||
used in any tilemap, so we plot it on the fly */
|
||||
if ((sshangha_video_control&4)==0) {
|
||||
sshangha_tilemap_draw(bitmap, cliprect);
|
||||
if ((state->video_control&4)==0) {
|
||||
sshangha_tilemap_draw(screen->machine, bitmap, cliprect);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.spriteram.u16,0x4000,0x4000);
|
||||
}
|
||||
else {
|
||||
tilemap_draw(bitmap,cliprect,pf2_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_tilemap,0,0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.spriteram.u16,0x4000,0x4000);
|
||||
|
||||
if (sshangha_control_0[6]&0x80)
|
||||
tilemap_draw(bitmap,cliprect,pf1_8x8_tilemap,0,0);
|
||||
if (state->control_0[6]&0x80)
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_8x8_tilemap,0,0);
|
||||
else
|
||||
tilemap_draw(bitmap,cliprect,pf1_16x16_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_16x16_tilemap,0,0);
|
||||
}
|
||||
|
||||
draw_sprites(screen->machine, bitmap, cliprect, screen->machine->generic.spriteram2.u16,0x0000,0x0000);
|
||||
|
@ -12,17 +12,12 @@
|
||||
#include "emu.h"
|
||||
#include "includes/stadhero.h"
|
||||
|
||||
UINT16 *stadhero_pf1_data;
|
||||
static UINT16 *stadhero_pf2_data;
|
||||
UINT16 *stadhero_pf2_control_0;
|
||||
UINT16 *stadhero_pf2_control_1;
|
||||
static tilemap_t *pf1_tilemap,*pf2_tilemap;
|
||||
static int flipscreen;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int pri_mask,int pri_val)
|
||||
{
|
||||
stadhero_state *state = machine->driver_data<stadhero_state>();
|
||||
UINT16 *spriteram16 = machine->generic.spriteram.u16;
|
||||
int offs;
|
||||
|
||||
@ -63,7 +58,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (flipscreen) {
|
||||
if (state->flipscreen) {
|
||||
y=240-y;
|
||||
x=240-x;
|
||||
if (fx) fx=0; else fx=1;
|
||||
@ -88,14 +83,15 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( stadhero )
|
||||
{
|
||||
flipscreen=stadhero_pf2_control_0[0]&0x80;
|
||||
tilemap_set_flip_all(screen->machine,flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
tilemap_set_scrollx( pf2_tilemap,0, stadhero_pf2_control_1[0] );
|
||||
tilemap_set_scrolly( pf2_tilemap,0, stadhero_pf2_control_1[1] );
|
||||
stadhero_state *state = screen->machine->driver_data<stadhero_state>();
|
||||
state->flipscreen=state->pf2_control_0[0]&0x80;
|
||||
tilemap_set_flip_all(screen->machine,state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
|
||||
tilemap_set_scrollx( state->pf2_tilemap,0, state->pf2_control_1[0] );
|
||||
tilemap_set_scrolly( state->pf2_tilemap,0, state->pf2_control_1[1] );
|
||||
|
||||
tilemap_draw(bitmap,cliprect,pf2_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf2_tilemap,0,0);
|
||||
draw_sprites(screen->machine, bitmap,cliprect,0x00,0x00);
|
||||
tilemap_draw(bitmap,cliprect,pf1_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->pf1_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -103,19 +99,22 @@ VIDEO_UPDATE( stadhero )
|
||||
|
||||
WRITE16_HANDLER( stadhero_pf1_data_w )
|
||||
{
|
||||
COMBINE_DATA(&stadhero_pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(pf1_tilemap,offset);
|
||||
stadhero_state *state = space->machine->driver_data<stadhero_state>();
|
||||
COMBINE_DATA(&state->pf1_data[offset]);
|
||||
tilemap_mark_tile_dirty(state->pf1_tilemap,offset);
|
||||
}
|
||||
|
||||
READ16_HANDLER( stadhero_pf2_data_r )
|
||||
{
|
||||
return stadhero_pf2_data[((stadhero_pf2_control_0[2] & 0x01) ? 0x1000 : 0) | offset];
|
||||
stadhero_state *state = space->machine->driver_data<stadhero_state>();
|
||||
return state->pf2_data[((state->pf2_control_0[2] & 0x01) ? 0x1000 : 0) | offset];
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( stadhero_pf2_data_w )
|
||||
{
|
||||
COMBINE_DATA(&stadhero_pf2_data[((stadhero_pf2_control_0[2] & 0x01) ? 0x1000 : 0) | offset]);
|
||||
tilemap_mark_tile_dirty(pf2_tilemap,offset);
|
||||
stadhero_state *state = space->machine->driver_data<stadhero_state>();
|
||||
COMBINE_DATA(&state->pf2_data[((state->pf2_control_0[2] & 0x01) ? 0x1000 : 0) | offset]);
|
||||
tilemap_mark_tile_dirty(state->pf2_tilemap,offset);
|
||||
}
|
||||
|
||||
|
||||
@ -129,9 +128,10 @@ static TILEMAP_MAPPER( stadhero_scan )
|
||||
|
||||
static TILE_GET_INFO( get_pf2_tile_info )
|
||||
{
|
||||
stadhero_state *state = machine->driver_data<stadhero_state>();
|
||||
int tile,color;
|
||||
|
||||
tile=stadhero_pf2_data[((stadhero_pf2_control_0[2] & 0x01) ? 0x1000 : 0) | tile_index];
|
||||
tile=state->pf2_data[((state->pf2_control_0[2] & 0x01) ? 0x1000 : 0) | tile_index];
|
||||
color=tile >> 12;
|
||||
tile=tile&0xfff;
|
||||
|
||||
@ -144,7 +144,8 @@ static TILE_GET_INFO( get_pf2_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_pf1_tile_info )
|
||||
{
|
||||
int tile=stadhero_pf1_data[tile_index];
|
||||
stadhero_state *state = machine->driver_data<stadhero_state>();
|
||||
int tile=state->pf1_data[tile_index];
|
||||
int color=tile >> 12;
|
||||
|
||||
tile=tile&0xfff;
|
||||
@ -157,12 +158,13 @@ static TILE_GET_INFO( get_pf1_tile_info )
|
||||
|
||||
VIDEO_START( stadhero )
|
||||
{
|
||||
pf1_tilemap = tilemap_create(machine, get_pf1_tile_info,tilemap_scan_rows, 8, 8,32,32);
|
||||
pf2_tilemap = tilemap_create(machine, get_pf2_tile_info,stadhero_scan, 16,16,64,64);
|
||||
stadhero_state *state = machine->driver_data<stadhero_state>();
|
||||
state->pf1_tilemap = tilemap_create(machine, get_pf1_tile_info,tilemap_scan_rows, 8, 8,32,32);
|
||||
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info,stadhero_scan, 16,16,64,64);
|
||||
|
||||
stadhero_pf2_data = auto_alloc_array(machine, UINT16, 0x2000);
|
||||
state->pf2_data = auto_alloc_array(machine, UINT16, 0x2000);
|
||||
|
||||
tilemap_set_transparent_pen(pf1_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->pf1_tilemap,0);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -1,19 +1,18 @@
|
||||
#include "emu.h"
|
||||
#include "includes/tigeroad.h"
|
||||
|
||||
static int bgcharbank;
|
||||
static tilemap_t *bg_tilemap, *fg_tilemap;
|
||||
|
||||
WRITE16_HANDLER( tigeroad_videoram_w )
|
||||
{
|
||||
tigeroad_state *state = space->machine->driver_data<tigeroad_state>();
|
||||
UINT16 *videoram = state->videoram;
|
||||
COMBINE_DATA(&videoram[offset]);
|
||||
tilemap_mark_tile_dirty(fg_tilemap, offset);
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( tigeroad_videoctrl_w )
|
||||
{
|
||||
tigeroad_state *state = space->machine->driver_data<tigeroad_state>();
|
||||
int bank;
|
||||
|
||||
if (ACCESSING_BITS_8_15)
|
||||
@ -32,10 +31,10 @@ WRITE16_HANDLER( tigeroad_videoctrl_w )
|
||||
|
||||
bank = (data & 0x04) >> 2;
|
||||
|
||||
if (bgcharbank != bank)
|
||||
if (state->bgcharbank != bank)
|
||||
{
|
||||
bgcharbank = bank;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->bgcharbank = bank;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
|
||||
/* bits 4-5 are coin lockouts */
|
||||
@ -52,6 +51,7 @@ WRITE16_HANDLER( tigeroad_videoctrl_w )
|
||||
|
||||
WRITE16_HANDLER( tigeroad_scroll_w )
|
||||
{
|
||||
tigeroad_state *state = space->machine->driver_data<tigeroad_state>();
|
||||
int scroll = 0;
|
||||
|
||||
COMBINE_DATA(&scroll);
|
||||
@ -59,10 +59,10 @@ WRITE16_HANDLER( tigeroad_scroll_w )
|
||||
switch (offset)
|
||||
{
|
||||
case 0:
|
||||
tilemap_set_scrollx(bg_tilemap, 0, scroll);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, scroll);
|
||||
break;
|
||||
case 1:
|
||||
tilemap_set_scrolly(bg_tilemap, 0, -scroll - 32 * 8);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, -scroll - 32 * 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -113,11 +113,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
tigeroad_state *state = machine->driver_data<tigeroad_state>();
|
||||
UINT8 *tilerom = machine->region("gfx4")->base();
|
||||
|
||||
int data = tilerom[tile_index];
|
||||
int attr = tilerom[tile_index + 1];
|
||||
int code = data + ((attr & 0xc0) << 2) + (bgcharbank << 10);
|
||||
int code = data + ((attr & 0xc0) << 2) + (state->bgcharbank << 10);
|
||||
int color = attr & 0x0f;
|
||||
int flags = (attr & 0x20) ? TILE_FLIPX : 0;
|
||||
|
||||
@ -146,25 +147,27 @@ static TILEMAP_MAPPER( tigeroad_tilemap_scan )
|
||||
|
||||
VIDEO_START( tigeroad )
|
||||
{
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tigeroad_tilemap_scan,
|
||||
tigeroad_state *state = machine->driver_data<tigeroad_state>();
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tigeroad_tilemap_scan,
|
||||
32, 32, 128, 128);
|
||||
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,
|
||||
8, 8, 32, 32);
|
||||
|
||||
tilemap_set_transmask(bg_tilemap, 0, 0xffff, 0);
|
||||
tilemap_set_transmask(bg_tilemap, 1, 0x1ff, 0xfe00);
|
||||
tilemap_set_transmask(state->bg_tilemap, 0, 0xffff, 0);
|
||||
tilemap_set_transmask(state->bg_tilemap, 1, 0x1ff, 0xfe00);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap, 3);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap, 3);
|
||||
}
|
||||
|
||||
VIDEO_UPDATE( tigeroad )
|
||||
{
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_LAYER1, 0);
|
||||
tigeroad_state *state = screen->machine->driver_data<tigeroad_state>();
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER1, 0);
|
||||
draw_sprites(screen->machine, bitmap, cliprect, 0);
|
||||
tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_LAYER0, 1);
|
||||
tilemap_draw(bitmap, cliprect, state->bg_tilemap, TILEMAP_DRAW_LAYER0, 1);
|
||||
//draw_sprites(screen->machine, bitmap, cliprect, 1); draw priority sprites?
|
||||
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 2);
|
||||
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 2);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,6 @@
|
||||
#include "emu.h"
|
||||
#include "includes/tryout.h"
|
||||
|
||||
static tilemap_t *fg_tilemap, *bg_tilemap;
|
||||
static UINT8 vram_bank;
|
||||
static UINT8 *tryout_vram, *tryout_vram_gfx;
|
||||
UINT8 *tryout_gfx_control;
|
||||
|
||||
PALETTE_INIT( tryout )
|
||||
{
|
||||
@ -57,12 +53,14 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
SET_TILE_INFO(2, tryout_vram[tile_index] & 0x7f, 2, 0);
|
||||
tryout_state *state = machine->driver_data<tryout_state>();
|
||||
SET_TILE_INFO(2, state->vram[tile_index] & 0x7f, 2, 0);
|
||||
}
|
||||
|
||||
READ8_HANDLER( tryout_vram_r )
|
||||
{
|
||||
return tryout_vram[offset]; // debug only
|
||||
tryout_state *state = space->machine->driver_data<tryout_state>();
|
||||
return state->vram[offset]; // debug only
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( tryout_videoram_w )
|
||||
@ -70,11 +68,12 @@ WRITE8_HANDLER( tryout_videoram_w )
|
||||
tryout_state *state = space->machine->driver_data<tryout_state>();
|
||||
UINT8 *videoram = state->videoram;
|
||||
videoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap, offset & 0x3ff);
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap, offset & 0x3ff);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( tryout_vram_w )
|
||||
{
|
||||
tryout_state *state = space->machine->driver_data<tryout_state>();
|
||||
/* There are eight banks of vram - in bank 0 the first 0x400 bytes
|
||||
is reserved for the tilemap. In banks 2, 4 and 6 the game never
|
||||
writes to the first 0x400 bytes - I suspect it's either
|
||||
@ -88,14 +87,14 @@ WRITE8_HANDLER( tryout_vram_w )
|
||||
gfx data and then set high from that point onwards.
|
||||
|
||||
*/
|
||||
const UINT8 bank=(vram_bank>>1)&0x7;
|
||||
const UINT8 bank=(state->vram_bank>>1)&0x7;
|
||||
|
||||
|
||||
if ((bank==0 || bank==2 || bank==4 || bank==6) && (offset&0x7ff)<0x400) {
|
||||
int newoff=offset&0x3ff;
|
||||
|
||||
tryout_vram[newoff]=data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,newoff);
|
||||
state->vram[newoff]=data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap,newoff);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -109,32 +108,32 @@ WRITE8_HANDLER( tryout_vram_w )
|
||||
*/
|
||||
|
||||
offset=(offset&0x7ff) | (bank<<11);
|
||||
tryout_vram[offset]=data;
|
||||
state->vram[offset]=data;
|
||||
|
||||
switch (offset&0x1c00) {
|
||||
case 0x0400:
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x0000 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x2000 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
state->vram_gfx[(offset&0x3ff) + 0x0000 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
state->vram_gfx[(offset&0x3ff) + 0x2000 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
break;
|
||||
case 0x0800:
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x4000 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x4400 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
state->vram_gfx[(offset&0x3ff) + 0x4000 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
state->vram_gfx[(offset&0x3ff) + 0x4400 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
break;
|
||||
case 0x0c00:
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x0400 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x2400 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
state->vram_gfx[(offset&0x3ff) + 0x0400 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
state->vram_gfx[(offset&0x3ff) + 0x2400 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
break;
|
||||
case 0x1400:
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x0800 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x2800 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
state->vram_gfx[(offset&0x3ff) + 0x0800 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
state->vram_gfx[(offset&0x3ff) + 0x2800 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
break;
|
||||
case 0x1800:
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x4800 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x4c00 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
state->vram_gfx[(offset&0x3ff) + 0x4800 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
state->vram_gfx[(offset&0x3ff) + 0x4c00 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
break;
|
||||
case 0x1c00:
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x0c00 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
tryout_vram_gfx[(offset&0x3ff) + 0x2c00 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
state->vram_gfx[(offset&0x3ff) + 0x0c00 + ((offset&0x2000)>>1)]=(~data&0xf);
|
||||
state->vram_gfx[(offset&0x3ff) + 0x2c00 + ((offset&0x2000)>>1)]=(~data&0xf0)>>4;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -143,7 +142,8 @@ WRITE8_HANDLER( tryout_vram_w )
|
||||
|
||||
WRITE8_HANDLER( tryout_vram_bankswitch_w )
|
||||
{
|
||||
vram_bank = data;
|
||||
tryout_state *state = space->machine->driver_data<tryout_state>();
|
||||
state->vram_bank = data;
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( tryout_flipscreen_w )
|
||||
@ -170,15 +170,16 @@ static TILEMAP_MAPPER( get_bg_memory_offset )
|
||||
|
||||
VIDEO_START( tryout )
|
||||
{
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,get_fg_memory_offset,8,8,32,32);
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,get_bg_memory_offset,16,16,64,16);
|
||||
tryout_state *state = machine->driver_data<tryout_state>();
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info,get_fg_memory_offset,8,8,32,32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info,get_bg_memory_offset,16,16,64,16);
|
||||
|
||||
tryout_vram=auto_alloc_array(machine, UINT8, 8 * 0x800);
|
||||
tryout_vram_gfx=auto_alloc_array(machine, UINT8, 0x6000);
|
||||
state->vram=auto_alloc_array(machine, UINT8, 8 * 0x800);
|
||||
state->vram_gfx=auto_alloc_array(machine, UINT8, 0x6000);
|
||||
|
||||
gfx_element_set_source(machine->gfx[2], tryout_vram_gfx);
|
||||
gfx_element_set_source(machine->gfx[2], state->vram_gfx);
|
||||
|
||||
tilemap_set_transparent_pen(fg_tilemap,0);
|
||||
tilemap_set_transparent_pen(state->fg_tilemap,0);
|
||||
}
|
||||
|
||||
static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
|
||||
@ -233,33 +234,34 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( tryout )
|
||||
{
|
||||
tryout_state *state = screen->machine->driver_data<tryout_state>();
|
||||
int scrollx = 0;
|
||||
|
||||
if (!flip_screen_get(screen->machine))
|
||||
tilemap_set_scrollx(fg_tilemap, 0, 16); /* Assumed hard-wired */
|
||||
tilemap_set_scrollx(state->fg_tilemap, 0, 16); /* Assumed hard-wired */
|
||||
else
|
||||
tilemap_set_scrollx(fg_tilemap, 0, -8); /* Assumed hard-wired */
|
||||
tilemap_set_scrollx(state->fg_tilemap, 0, -8); /* Assumed hard-wired */
|
||||
|
||||
scrollx = tryout_gfx_control[1] + ((tryout_gfx_control[0]&1)<<8) + ((tryout_gfx_control[0]&4)<<7) - ((tryout_gfx_control[0] & 2) ? 0 : 0x100);
|
||||
scrollx = state->gfx_control[1] + ((state->gfx_control[0]&1)<<8) + ((state->gfx_control[0]&4)<<7) - ((state->gfx_control[0] & 2) ? 0 : 0x100);
|
||||
|
||||
/* wrap-around */
|
||||
if(tryout_gfx_control[1] == 0) { scrollx+=0x100; }
|
||||
if(state->gfx_control[1] == 0) { scrollx+=0x100; }
|
||||
|
||||
tilemap_set_scrollx(bg_tilemap, 0, scrollx+2); /* why +2? hard-wired? */
|
||||
tilemap_set_scrolly(bg_tilemap, 0, -tryout_gfx_control[2]);
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, scrollx+2); /* why +2? hard-wired? */
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, -state->gfx_control[2]);
|
||||
|
||||
if(!(tryout_gfx_control[0] & 0x8)) // screen disable
|
||||
if(!(state->gfx_control[0] & 0x8)) // screen disable
|
||||
{
|
||||
/* TODO: Color might be different, needs a video from an original pcb. */
|
||||
bitmap_fill(bitmap, cliprect, screen->machine->pens[0x10]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->fg_tilemap,0,0);
|
||||
draw_sprites(screen->machine, bitmap,cliprect);
|
||||
}
|
||||
|
||||
// popmessage("%02x %02x %02x %02x",tryout_gfx_control[0],tryout_gfx_control[1],tryout_gfx_control[2],scrollx);
|
||||
// popmessage("%02x %02x %02x %02x",state->gfx_control[0],state->gfx_control[1],state->gfx_control[2],scrollx);
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,12 +9,6 @@
|
||||
#include "emu.h"
|
||||
#include "includes/vulgus.h"
|
||||
|
||||
UINT8 *vulgus_fgvideoram,*vulgus_bgvideoram;
|
||||
UINT8 *vulgus_scroll_low,*vulgus_scroll_high;
|
||||
|
||||
static int vulgus_palette_bank;
|
||||
static tilemap_t *fg_tilemap, *bg_tilemap;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
@ -84,10 +78,11 @@ PALETTE_INIT( vulgus )
|
||||
|
||||
static TILE_GET_INFO( get_fg_tile_info )
|
||||
{
|
||||
vulgus_state *state = machine->driver_data<vulgus_state>();
|
||||
int code, color;
|
||||
|
||||
code = vulgus_fgvideoram[tile_index];
|
||||
color = vulgus_fgvideoram[tile_index + 0x400];
|
||||
code = state->fgvideoram[tile_index];
|
||||
color = state->fgvideoram[tile_index + 0x400];
|
||||
SET_TILE_INFO(
|
||||
0,
|
||||
code + ((color & 0x80) << 1),
|
||||
@ -98,14 +93,15 @@ static TILE_GET_INFO( get_fg_tile_info )
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
{
|
||||
vulgus_state *state = machine->driver_data<vulgus_state>();
|
||||
int code, color;
|
||||
|
||||
code = vulgus_bgvideoram[tile_index];
|
||||
color = vulgus_bgvideoram[tile_index + 0x400];
|
||||
code = state->bgvideoram[tile_index];
|
||||
color = state->bgvideoram[tile_index + 0x400];
|
||||
SET_TILE_INFO(
|
||||
1,
|
||||
code + ((color & 0x80) << 1),
|
||||
(color & 0x1f) + (0x20 * vulgus_palette_bank),
|
||||
(color & 0x1f) + (0x20 * state->palette_bank),
|
||||
TILE_FLIPYX((color & 0x60) >> 5));
|
||||
}
|
||||
|
||||
@ -118,10 +114,11 @@ static TILE_GET_INFO( get_bg_tile_info )
|
||||
|
||||
VIDEO_START( vulgus )
|
||||
{
|
||||
fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows, 8, 8,32,32);
|
||||
bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,16,16,32,32);
|
||||
vulgus_state *state = machine->driver_data<vulgus_state>();
|
||||
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info,tilemap_scan_rows, 8, 8,32,32);
|
||||
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info,tilemap_scan_cols,16,16,32,32);
|
||||
|
||||
colortable_configure_tilemap_groups(machine->colortable, fg_tilemap, machine->gfx[0], 47);
|
||||
colortable_configure_tilemap_groups(machine->colortable, state->fg_tilemap, machine->gfx[0], 47);
|
||||
}
|
||||
|
||||
|
||||
@ -133,14 +130,16 @@ VIDEO_START( vulgus )
|
||||
|
||||
WRITE8_HANDLER( vulgus_fgvideoram_w )
|
||||
{
|
||||
vulgus_fgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(fg_tilemap,offset & 0x3ff);
|
||||
vulgus_state *state = space->machine->driver_data<vulgus_state>();
|
||||
state->fgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->fg_tilemap,offset & 0x3ff);
|
||||
}
|
||||
|
||||
WRITE8_HANDLER( vulgus_bgvideoram_w )
|
||||
{
|
||||
vulgus_bgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff);
|
||||
vulgus_state *state = space->machine->driver_data<vulgus_state>();
|
||||
state->bgvideoram[offset] = data;
|
||||
tilemap_mark_tile_dirty(state->bg_tilemap,offset & 0x3ff);
|
||||
}
|
||||
|
||||
|
||||
@ -157,10 +156,11 @@ WRITE8_HANDLER( vulgus_c804_w )
|
||||
|
||||
WRITE8_HANDLER( vulgus_palette_bank_w )
|
||||
{
|
||||
if (vulgus_palette_bank != (data & 3))
|
||||
vulgus_state *state = space->machine->driver_data<vulgus_state>();
|
||||
if (state->palette_bank != (data & 3))
|
||||
{
|
||||
vulgus_palette_bank = data & 3;
|
||||
tilemap_mark_all_tiles_dirty(bg_tilemap);
|
||||
state->palette_bank = data & 3;
|
||||
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -218,11 +218,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
|
||||
|
||||
VIDEO_UPDATE( vulgus )
|
||||
{
|
||||
tilemap_set_scrollx(bg_tilemap, 0, vulgus_scroll_low[1] + 256 * vulgus_scroll_high[1]);
|
||||
tilemap_set_scrolly(bg_tilemap, 0, vulgus_scroll_low[0] + 256 * vulgus_scroll_high[0]);
|
||||
vulgus_state *state = screen->machine->driver_data<vulgus_state>();
|
||||
tilemap_set_scrollx(state->bg_tilemap, 0, state->scroll_low[1] + 256 * state->scroll_high[1]);
|
||||
tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll_low[0] + 256 * state->scroll_high[0]);
|
||||
|
||||
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0);
|
||||
draw_sprites(screen->machine, bitmap,cliprect);
|
||||
tilemap_draw(bitmap,cliprect,fg_tilemap,0,0);
|
||||
tilemap_draw(bitmap,cliprect,state->fg_tilemap,0,0);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user