mirror of
https://github.com/holub/mame
synced 2025-06-06 12:53:46 +03:00
Changed atarijsa sound implementation to auto-detect CPU and input port.
Cleaned up atarijsa memory maps. Added save state support to atarirle, and cleaned it up a bit. Added save state support to atarig1 driver. Fixed pitfight0109u2gre
This commit is contained in:
parent
1465aa81d5
commit
ae478066d7
@ -51,6 +51,9 @@ do { \
|
||||
#define state_save_register_item_2d_array(_mod, _inst, _val) \
|
||||
state_save_register_item_pointer(_mod, _inst, _val[0], sizeof(_val)/sizeof(_val[0][0]))
|
||||
|
||||
#define state_save_register_item_bitmap(_mod, _inst, _val) \
|
||||
state_save_register_bitmap(_mod, _inst, #_val, _val)
|
||||
|
||||
#define state_save_register_global(_val) \
|
||||
state_save_register_item("globals", 0, _val)
|
||||
|
||||
|
@ -39,14 +39,17 @@ Static Program ROM (48K bytes) 4000-FFFF R D0-D7
|
||||
#include "machine/atarigen.h"
|
||||
#include "audio/atarijsa.h"
|
||||
|
||||
|
||||
#define JSA_MASTER_CLOCK XTAL_3_579545MHz
|
||||
|
||||
|
||||
static UINT8 *bank_base;
|
||||
static UINT8 *bank_source_data;
|
||||
|
||||
static UINT8 speech_data;
|
||||
static UINT8 last_ctl;
|
||||
|
||||
static UINT8 cpu_num;
|
||||
static UINT8 input_port;
|
||||
static int cpu_num;
|
||||
static UINT8 test_port;
|
||||
static UINT16 test_mask;
|
||||
|
||||
@ -101,19 +104,19 @@ static void init_save_state(void)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void atarijsa_init(int cpunum, int inputport, int testport, int testmask)
|
||||
void atarijsa_init(running_machine *machine, int testport, int testmask)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* copy in the parameters */
|
||||
cpu_num = cpunum;
|
||||
input_port = inputport;
|
||||
cpu_num = mame_find_cpu_index(machine, "jsa");
|
||||
assert_always(cpu_num != -1, "Could not find JSA CPU!");
|
||||
test_port = testport;
|
||||
test_mask = testmask;
|
||||
|
||||
/* predetermine the bank base */
|
||||
bank_base = &memory_region(REGION_CPU1+cpunum)[0x03000];
|
||||
bank_source_data = &memory_region(REGION_CPU1+cpunum)[0x10000];
|
||||
bank_base = &memory_region(REGION_CPU1+cpu_num)[0x03000];
|
||||
bank_source_data = &memory_region(REGION_CPU1+cpu_num)[0x10000];
|
||||
|
||||
/* determine which sound hardware is installed */
|
||||
has_tms5220 = has_oki6295 = has_pokey = has_ym2151 = 0;
|
||||
@ -141,8 +144,8 @@ void atarijsa_init(int cpunum, int inputport, int testport, int testmask)
|
||||
/* install POKEY memory handlers */
|
||||
if (has_pokey)
|
||||
{
|
||||
memory_install_read8_handler(cpunum, ADDRESS_SPACE_PROGRAM, 0x2c00, 0x2c0f, 0, 0, pokey1_r);
|
||||
memory_install_write8_handler(cpunum, ADDRESS_SPACE_PROGRAM, 0x2c00, 0x2c0f, 0, 0, pokey1_w);
|
||||
memory_install_read8_handler(cpu_num, ADDRESS_SPACE_PROGRAM, 0x2c00, 0x2c0f, 0, 0, pokey1_r);
|
||||
memory_install_write8_handler(cpu_num, ADDRESS_SPACE_PROGRAM, 0x2c00, 0x2c0f, 0, 0, pokey1_w);
|
||||
}
|
||||
|
||||
init_save_state();
|
||||
@ -218,7 +221,7 @@ static READ8_HANDLER( jsa1_io_r )
|
||||
0x02 = coin 2
|
||||
0x01 = coin 1
|
||||
*/
|
||||
result = readinputport(input_port);
|
||||
result = readinputportbytag("JSAI");
|
||||
if (!(readinputport(test_port) & test_mask)) result ^= 0x80;
|
||||
if (atarigen_cpu_to_sound_ready) result ^= 0x40;
|
||||
if (atarigen_sound_to_cpu_ready) result ^= 0x20;
|
||||
@ -282,7 +285,7 @@ static WRITE8_HANDLER( jsa1_io_w )
|
||||
if (((data ^ last_ctl) & 0x02) && (data & 0x02))
|
||||
tms5220_data_w(0, speech_data);
|
||||
count = 5 | ((data >> 2) & 2);
|
||||
tms5220_set_frequency(ATARI_CLOCK_3MHz*2 / (16 - count));
|
||||
tms5220_set_frequency(JSA_MASTER_CLOCK*2 / (16 - count));
|
||||
}
|
||||
|
||||
/* coin counters */
|
||||
@ -345,7 +348,7 @@ static READ8_HANDLER( jsa2_io_r )
|
||||
0x02 = coin 2
|
||||
0x01 = coin 1
|
||||
*/
|
||||
result = readinputport(input_port);
|
||||
result = readinputportbytag("JSAII");
|
||||
if (!(readinputport(test_port) & test_mask)) result ^= 0x80;
|
||||
if (atarigen_cpu_to_sound_ready) result ^= 0x40;
|
||||
if (atarigen_sound_to_cpu_ready) result ^= 0x20;
|
||||
@ -464,7 +467,7 @@ static READ8_HANDLER( jsa3_io_r )
|
||||
0x02 = coin L (active high)
|
||||
0x01 = coin R (active high)
|
||||
*/
|
||||
result = readinputport(input_port);
|
||||
result = readinputportbytag("JSAIII");
|
||||
if (!(readinputport(test_port) & test_mask)) result ^= 0x90;
|
||||
if (atarigen_cpu_to_sound_ready) result ^= 0x40;
|
||||
if (atarigen_sound_to_cpu_ready) result ^= 0x20;
|
||||
@ -601,7 +604,7 @@ static READ8_HANDLER( jsa3s_io_r )
|
||||
0x02 = coin L (active high)
|
||||
0x01 = coin R (active high)
|
||||
*/
|
||||
result = readinputport(input_port);
|
||||
result = readinputportbytag("JSAIII");
|
||||
if (!(readinputport(test_port) & test_mask)) result ^= 0x90;
|
||||
if (atarigen_cpu_to_sound_ready) result ^= 0x40;
|
||||
if (atarigen_sound_to_cpu_ready) result ^= 0x20;
|
||||
@ -729,37 +732,23 @@ static void update_all_volumes(running_machine *machine )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static ADDRESS_MAP_START( atarijsa1_readmem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_RAM)
|
||||
AM_RANGE(0x2000, 0x2001) AM_READ(YM2151_status_port_0_r)
|
||||
AM_RANGE(0x2800, 0x2bff) AM_READ(jsa1_io_r)
|
||||
AM_RANGE(0x3000, 0xffff) AM_READ(MRA8_ROM)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( atarijsa1_writemem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_RAM)
|
||||
static ADDRESS_MAP_START( atarijsa1_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_RAM
|
||||
AM_RANGE(0x2000, 0x2000) AM_WRITE(YM2151_register_port_0_w)
|
||||
AM_RANGE(0x2001, 0x2001) AM_WRITE(YM2151_data_port_0_w)
|
||||
AM_RANGE(0x2800, 0x2bff) AM_WRITE(jsa1_io_w)
|
||||
AM_RANGE(0x3000, 0xffff) AM_WRITE(MWA8_ROM)
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( atarijsa2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_RAM)
|
||||
AM_RANGE(0x2000, 0x2001) AM_READ(YM2151_status_port_0_r)
|
||||
AM_RANGE(0x2800, 0x2bff) AM_READ(jsa2_io_r)
|
||||
AM_RANGE(0x3000, 0xffff) AM_READ(MRA8_ROM)
|
||||
AM_RANGE(0x2800, 0x2bff) AM_READWRITE(jsa1_io_r, jsa1_io_w)
|
||||
AM_RANGE(0x3000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
static ADDRESS_MAP_START( atarijsa2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_RAM)
|
||||
static ADDRESS_MAP_START( atarijsa2_map, ADDRESS_SPACE_PROGRAM, 8 )
|
||||
AM_RANGE(0x0000, 0x1fff) AM_RAM
|
||||
AM_RANGE(0x2000, 0x2000) AM_WRITE(YM2151_register_port_0_w)
|
||||
AM_RANGE(0x2001, 0x2001) AM_WRITE(YM2151_data_port_0_w)
|
||||
AM_RANGE(0x2800, 0x2bff) AM_WRITE(jsa2_io_w)
|
||||
AM_RANGE(0x3000, 0xffff) AM_WRITE(MWA8_ROM)
|
||||
AM_RANGE(0x2000, 0x2001) AM_READ(YM2151_status_port_0_r)
|
||||
AM_RANGE(0x2800, 0x2bff) AM_READWRITE(jsa2_io_r, jsa2_io_w)
|
||||
AM_RANGE(0x3000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -808,14 +797,14 @@ static const struct YM2151interface ym2151_interface =
|
||||
MACHINE_DRIVER_START( jsa_i_stereo )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, ATARI_CLOCK_3MHz/2)
|
||||
MDRV_CPU_PROGRAM_MAP(atarijsa1_readmem,atarijsa1_writemem)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)ATARI_CLOCK_3MHz/4/16/16/14)
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, JSA_MASTER_CLOCK/2)
|
||||
MDRV_CPU_PROGRAM_MAP(atarijsa1_map,0)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)JSA_MASTER_CLOCK/4/16/16/14)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
|
||||
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, ATARI_CLOCK_3MHz)
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, JSA_MASTER_CLOCK)
|
||||
MDRV_SOUND_CONFIG(ym2151_interface)
|
||||
MDRV_SOUND_ROUTE(0, "left", 0.60)
|
||||
MDRV_SOUND_ROUTE(1, "right", 0.60)
|
||||
@ -829,7 +818,7 @@ MACHINE_DRIVER_START( jsa_i_stereo_swapped )
|
||||
MDRV_IMPORT_FROM(jsa_i_stereo)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SOUND_REPLACE("ym", YM2151, ATARI_CLOCK_3MHz)
|
||||
MDRV_SOUND_REPLACE("ym", YM2151, JSA_MASTER_CLOCK)
|
||||
MDRV_SOUND_CONFIG(ym2151_interface)
|
||||
MDRV_SOUND_ROUTE(0, "right", 0.60)
|
||||
MDRV_SOUND_ROUTE(1, "left", 0.60)
|
||||
@ -843,7 +832,7 @@ MACHINE_DRIVER_START( jsa_i_stereo_pokey )
|
||||
MDRV_IMPORT_FROM(jsa_i_stereo)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SOUND_ADD(POKEY, ATARI_CLOCK_3MHz/2)
|
||||
MDRV_SOUND_ADD(POKEY, JSA_MASTER_CLOCK/2)
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.40)
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.40)
|
||||
MACHINE_DRIVER_END
|
||||
@ -853,19 +842,19 @@ MACHINE_DRIVER_END
|
||||
MACHINE_DRIVER_START( jsa_i_mono_speech )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, ATARI_CLOCK_3MHz/2)
|
||||
MDRV_CPU_PROGRAM_MAP(atarijsa1_readmem,atarijsa1_writemem)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)ATARI_CLOCK_3MHz/4/16/16/14)
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, JSA_MASTER_CLOCK/2)
|
||||
MDRV_CPU_PROGRAM_MAP(atarijsa1_map,0)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)JSA_MASTER_CLOCK/4/16/16/14)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, ATARI_CLOCK_3MHz)
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, JSA_MASTER_CLOCK)
|
||||
MDRV_SOUND_CONFIG(ym2151_interface)
|
||||
MDRV_SOUND_ROUTE(0, "mono", 0.60)
|
||||
MDRV_SOUND_ROUTE(1, "mono", 0.60)
|
||||
|
||||
MDRV_SOUND_ADD(TMS5220, ATARI_CLOCK_3MHz*2/11) /* potentially ATARI_CLOCK_3MHz/9 as well */
|
||||
MDRV_SOUND_ADD(TMS5220, JSA_MASTER_CLOCK*2/11) /* potentially JSA_MASTER_CLOCK/9 as well */
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
MACHINE_DRIVER_END
|
||||
|
||||
@ -874,19 +863,19 @@ MACHINE_DRIVER_END
|
||||
MACHINE_DRIVER_START( jsa_ii_mono )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, ATARI_CLOCK_3MHz/2)
|
||||
MDRV_CPU_PROGRAM_MAP(atarijsa2_readmem,atarijsa2_writemem)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)ATARI_CLOCK_3MHz/4/16/16/14)
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, JSA_MASTER_CLOCK/2)
|
||||
MDRV_CPU_PROGRAM_MAP(atarijsa2_map,0)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)JSA_MASTER_CLOCK/4/16/16/14)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_MONO("mono")
|
||||
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, ATARI_CLOCK_3MHz)
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, JSA_MASTER_CLOCK)
|
||||
MDRV_SOUND_CONFIG(ym2151_interface)
|
||||
MDRV_SOUND_ROUTE(0, "mono", 0.60)
|
||||
MDRV_SOUND_ROUTE(1, "mono", 0.60)
|
||||
|
||||
MDRV_SOUND_ADD_TAG("adpcm", OKIM6295, ATARI_CLOCK_3MHz/3)
|
||||
MDRV_SOUND_ADD_TAG("adpcm", OKIM6295, JSA_MASTER_CLOCK/3)
|
||||
MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75)
|
||||
MACHINE_DRIVER_END
|
||||
@ -917,23 +906,23 @@ MACHINE_DRIVER_END
|
||||
MACHINE_DRIVER_START( jsa_iiis_stereo )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, ATARI_CLOCK_3MHz/2)
|
||||
MDRV_CPU_ADD_TAG("jsa", M6502, JSA_MASTER_CLOCK/2)
|
||||
MDRV_CPU_PROGRAM_MAP(atarijsa3s_map,0)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)ATARI_CLOCK_3MHz/4/16/16/14)
|
||||
MDRV_CPU_PERIODIC_INT(atarigen_6502_irq_gen, (double)JSA_MASTER_CLOCK/4/16/16/14)
|
||||
|
||||
/* sound hardware */
|
||||
MDRV_SPEAKER_STANDARD_STEREO("left", "right")
|
||||
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, ATARI_CLOCK_3MHz)
|
||||
MDRV_SOUND_ADD_TAG("ym", YM2151, JSA_MASTER_CLOCK)
|
||||
MDRV_SOUND_CONFIG(ym2151_interface)
|
||||
MDRV_SOUND_ROUTE(0, "left", 0.60)
|
||||
MDRV_SOUND_ROUTE(1, "right", 0.60)
|
||||
|
||||
MDRV_SOUND_ADD(OKIM6295, ATARI_CLOCK_3MHz/3)
|
||||
MDRV_SOUND_ADD(OKIM6295, JSA_MASTER_CLOCK/3)
|
||||
MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "left", 0.75)
|
||||
|
||||
MDRV_SOUND_ADD(OKIM6295, ATARI_CLOCK_3MHz/3)
|
||||
MDRV_SOUND_ADD(OKIM6295, JSA_MASTER_CLOCK/3)
|
||||
MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high)
|
||||
MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.75)
|
||||
MACHINE_DRIVER_END
|
||||
|
@ -5,11 +5,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#define ATARI_CLOCK_3MHz 3579000
|
||||
|
||||
|
||||
void atarijsa_init(int cpunum, int inputport, int testport, int testmask);
|
||||
void atarijsa_init(running_machine *machine, int testport, int testmask);
|
||||
void atarijsa3_init_adpcm(int region);
|
||||
void atarijsa_reset(void);
|
||||
|
||||
|
@ -64,6 +64,12 @@ static void update_interrupts(void)
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_START( atarig1 )
|
||||
{
|
||||
state_save_register_global(which_input);
|
||||
}
|
||||
|
||||
|
||||
static MACHINE_RESET( atarig1 )
|
||||
{
|
||||
atarigen_eeprom_reset();
|
||||
@ -155,6 +161,14 @@ INLINE void update_bank(int bank)
|
||||
}
|
||||
|
||||
|
||||
static void pitfighb_state_postload(void)
|
||||
{
|
||||
int bank = bslapstic_bank;
|
||||
bslapstic_bank = -1;
|
||||
update_bank(bank);
|
||||
}
|
||||
|
||||
|
||||
static READ16_HANDLER( pitfighb_cheap_slapstic_r )
|
||||
{
|
||||
int result = bslapstic_base[offset & 0xfff];
|
||||
@ -412,6 +426,7 @@ static MACHINE_DRIVER_START( atarig1 )
|
||||
MDRV_CPU_PROGRAM_MAP(main_map,0)
|
||||
MDRV_CPU_VBLANK_INT(atarigen_video_int_gen,1)
|
||||
|
||||
MDRV_MACHINE_START(atarig1)
|
||||
MDRV_MACHINE_RESET(atarig1)
|
||||
MDRV_NVRAM_HANDLER(atarigen)
|
||||
|
||||
@ -938,24 +953,29 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static void init_g1_common(offs_t slapstic_base, int slapstic, int is_pitfight)
|
||||
static void init_g1_common(running_machine *machine, offs_t slapstic_base, int slapstic, int is_pitfight)
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
if (slapstic == -1)
|
||||
{
|
||||
pitfighb_cheap_slapstic_init();
|
||||
state_save_register_global(bslapstic_bank);
|
||||
state_save_register_global(bslapstic_primed);
|
||||
state_save_register_func_postload(pitfighb_state_postload);
|
||||
}
|
||||
else if (slapstic != 0)
|
||||
atarigen_slapstic_init(0, slapstic_base, 0, slapstic);
|
||||
atarijsa_init(1, 4, 0, 0x8000);
|
||||
atarijsa_init(machine, 0, 0x4000);
|
||||
|
||||
atarig1_pitfight = is_pitfight;
|
||||
}
|
||||
|
||||
static DRIVER_INIT( hydra ) { init_g1_common(0x078000, 116, 0); }
|
||||
static DRIVER_INIT( hydrap ) { init_g1_common(0x000000, 0, 0); }
|
||||
static DRIVER_INIT( hydra ) { init_g1_common(machine, 0x078000, 116, 0); }
|
||||
static DRIVER_INIT( hydrap ) { init_g1_common(machine, 0x000000, 0, 0); }
|
||||
|
||||
static DRIVER_INIT( pitfight ) { init_g1_common(0x038000, 111, 1); }
|
||||
static DRIVER_INIT( pitfighj ) { init_g1_common(0x038000, 113, 1); }
|
||||
static DRIVER_INIT( pitfighb ) { init_g1_common(0x038000, -1, 1); }
|
||||
static DRIVER_INIT( pitfight ) { init_g1_common(machine, 0x038000, 111, 1); }
|
||||
static DRIVER_INIT( pitfighj ) { init_g1_common(machine, 0x038000, 113, 1); }
|
||||
static DRIVER_INIT( pitfighb ) { init_g1_common(machine, 0x038000, -1, 1); }
|
||||
|
||||
|
||||
|
||||
@ -965,12 +985,12 @@ static DRIVER_INIT( pitfighb ) { init_g1_common(0x038000, -1, 1); }
|
||||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1990, hydra, 0, atarig1, hydra, hydra, ROT0, "Atari Games", "Hydra", 0 )
|
||||
GAME( 1990, hydrap, hydra, atarig1, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/14/90)", 0 )
|
||||
GAME( 1990, hydrap2, hydra, atarig1, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/25/90)", 0 )
|
||||
GAME( 1990, hydra, 0, atarig1, hydra, hydra, ROT0, "Atari Games", "Hydra", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, hydrap, hydra, atarig1, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/14/90)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, hydrap2, hydra, atarig1, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/25/90)", GAME_SUPPORTS_SAVE )
|
||||
|
||||
GAME( 1990, pitfight, 0, atarig1, pitfight, pitfighj, ROT0, "Atari Games", "Pit Fighter (rev 5)", 0 )
|
||||
GAME( 1990, pitfigh4, pitfight, atarig1, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 4)", 0 )
|
||||
GAME( 1990, pitfigh3, pitfight, atarig1, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 3)", 0 )
|
||||
GAME( 1990, pitfighj, pitfight, atarig1, pitfighj, pitfighj, ROT0, "Atari Games", "Pit Fighter (Japan, 2 players)", 0 )
|
||||
GAME( 1990, pitfighb, pitfight, atarig1, pitfight, pitfighb, ROT0, "Atari Games", "Pit Fighter (bootleg)", 0 )
|
||||
GAME( 1990, pitfight, 0, atarig1, pitfight, pitfighj, ROT0, "Atari Games", "Pit Fighter (rev 5)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, pitfigh4, pitfight, atarig1, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 4)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, pitfigh3, pitfight, atarig1, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 3)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, pitfighj, pitfight, atarig1, pitfighj, pitfighj, ROT0, "Atari Games", "Pit Fighter (Japan, 2 players)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, pitfighb, pitfight, atarig1, pitfight, pitfighb, ROT0, "Atari Games", "Pit Fighter (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -687,7 +687,7 @@ static DRIVER_INIT( roadriot )
|
||||
0x0118,0x0100,0x01C8,0x01D0,0x0000
|
||||
};
|
||||
atarigen_eeprom_default = default_eeprom;
|
||||
atarijsa_init(2, 3, 2, 0x0040);
|
||||
atarijsa_init(machine, 2, 0x0040);
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
|
||||
atarig42_playfield_base = 0x400;
|
||||
@ -738,7 +738,7 @@ static DRIVER_INIT( guardian )
|
||||
0x0109,0x0100,0x0108,0x0134,0x0105,0x0148,0x1400,0x0000
|
||||
};
|
||||
atarigen_eeprom_default = default_eeprom;
|
||||
atarijsa_init(2, 3, 2, 0x0040);
|
||||
atarijsa_init(machine, 2, 0x0040);
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
|
||||
atarig42_playfield_base = 0x000;
|
||||
|
@ -2036,7 +2036,7 @@ ROM_END
|
||||
static DRIVER_INIT( spclords )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 4, 2, 0x0040);
|
||||
atarijsa_init(machine, 2, 0x0040);
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
|
||||
atarigx2_playfield_base = 0x000;
|
||||
@ -2048,7 +2048,7 @@ static DRIVER_INIT( spclords )
|
||||
static DRIVER_INIT( motofren )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 4, 2, 0x0040);
|
||||
atarijsa_init(machine, 2, 0x0040);
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
|
||||
atarigx2_playfield_base = 0x400;
|
||||
@ -2086,7 +2086,7 @@ static READ32_HANDLER( rrreveng_prot_r )
|
||||
static DRIVER_INIT( rrreveng )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 4, 2, 0x0040);
|
||||
atarijsa_init(machine, 2, 0x0040);
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
|
||||
atarigx2_playfield_base = 0x000;
|
||||
|
@ -334,7 +334,7 @@ static DRIVER_INIT( batman )
|
||||
0x01D0,0x02C8,0x0000
|
||||
};
|
||||
atarigen_eeprom_default = default_eeprom;
|
||||
atarijsa_init(1, 3, 2, 0x0040);
|
||||
atarijsa_init(machine, 2, 0x0040);
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
}
|
||||
|
||||
|
@ -530,7 +530,7 @@ static DRIVER_INIT( beathead )
|
||||
{
|
||||
/* initialize the common systems */
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 4, 2, 0x0040);
|
||||
atarijsa_init(machine, 2, 0x0040);
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
|
||||
/* prepare the speedups */
|
||||
|
@ -422,7 +422,7 @@ ROM_END
|
||||
static DRIVER_INIT( blstroid )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 4, 2, 0x80);
|
||||
atarijsa_init(machine, 2, 0x80);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1020,7 +1020,7 @@ static DRIVER_INIT( cyberbt )
|
||||
static DRIVER_INIT( cyberb2p )
|
||||
{
|
||||
atarigen_eeprom_default = default_eeprom;
|
||||
atarijsa_init(1, 3, 2, 0x8000);
|
||||
atarijsa_init(machine, 2, 0x8000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -730,7 +730,7 @@ ROM_END
|
||||
static DRIVER_INIT( eprom )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(2, 6, 1, 0x0002);
|
||||
atarijsa_init(machine, 1, 0x0002);
|
||||
|
||||
/* install CPU synchronization handlers */
|
||||
sync_data = memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x16cc00, 0x16cc01, 0, 0, sync_r);
|
||||
@ -743,14 +743,14 @@ static DRIVER_INIT( eprom )
|
||||
static DRIVER_INIT( klaxp )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 2, 1, 0x0002);
|
||||
atarijsa_init(machine, 1, 0x0002);
|
||||
}
|
||||
|
||||
|
||||
static DRIVER_INIT( guts )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 6, 1, 0x0002);
|
||||
atarijsa_init(machine, 1, 0x0002);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3652,7 +3652,7 @@ static DRIVER_INIT( stunrun )
|
||||
/* initialize the boards */
|
||||
init_multisync(machine, 0);
|
||||
init_adsp();
|
||||
atarijsa_init(hdcpu_jsa, 14, 0, 0x0020);
|
||||
atarijsa_init(machine, 0, 0x0020);
|
||||
|
||||
/* set up gsp speedup handler */
|
||||
hdgsp_speedup_addr[0] = memory_install_write16_handler(hdcpu_gsp, ADDRESS_SPACE_PROGRAM, 0xfff9fc00, 0xfff9fc0f, 0, 0, hdgsp_speedup1_w);
|
||||
@ -3765,7 +3765,7 @@ static void steeltal_init_common(running_machine *machine, offs_t ds3_transfer_p
|
||||
init_ds3(machine);
|
||||
init_dspcom();
|
||||
atarijsa3_init_adpcm(REGION_SOUND1);
|
||||
atarijsa_init(hdcpu_jsa, 14, 0, 0x0020);
|
||||
atarijsa_init(machine, 0, 0x0020);
|
||||
|
||||
memory_install_read16_handler(hdcpu_main, ADDRESS_SPACE_PROGRAM, 0x908000, 0x908001, 0, 0, steeltal_dummy_r);
|
||||
|
||||
|
@ -484,7 +484,7 @@ static const UINT16 default_eeprom[] =
|
||||
static DRIVER_INIT( offtwall )
|
||||
{
|
||||
atarigen_eeprom_default = default_eeprom;
|
||||
atarijsa_init(1, 2, 3, 0x0040);
|
||||
atarijsa_init(machine, 3, 0x0040);
|
||||
|
||||
/* install son-of-slapstic workarounds */
|
||||
spritecache_count = memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
|
||||
@ -496,7 +496,7 @@ static DRIVER_INIT( offtwall )
|
||||
static DRIVER_INIT( offtwalc )
|
||||
{
|
||||
atarigen_eeprom_default = default_eeprom;
|
||||
atarijsa_init(1, 2, 3, 0x0040);
|
||||
atarijsa_init(machine, 3, 0x0040);
|
||||
|
||||
/* install son-of-slapstic workarounds */
|
||||
spritecache_count = memory_install_read16_handler(0, ADDRESS_SPACE_PROGRAM, 0x3fde42, 0x3fde43, 0, 0, spritecache_count_r);
|
||||
|
@ -611,7 +611,7 @@ ROM_END
|
||||
static DRIVER_INIT( skullxbo )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 2, 1, 0x0080);
|
||||
atarijsa_init(machine, 1, 0x0080);
|
||||
memset(memory_region(REGION_GFX1) + 0x170000, 0, 0x20000);
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ ROM_END
|
||||
static DRIVER_INIT( thunderj )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(2, 3, 2, 0x0002);
|
||||
atarijsa_init(machine, 2, 0x0002);
|
||||
}
|
||||
|
||||
|
||||
|
@ -617,7 +617,7 @@ ROM_END
|
||||
static DRIVER_INIT( toobin )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 2, 1, 0x1000);
|
||||
atarijsa_init(machine, 1, 0x1000);
|
||||
}
|
||||
|
||||
|
||||
|
@ -540,7 +540,7 @@ ROM_END
|
||||
static DRIVER_INIT( vindictr )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarijsa_init(1, 3, 1, 0x0002);
|
||||
atarijsa_init(machine, 1, 0x0002);
|
||||
}
|
||||
|
||||
|
||||
|
@ -387,7 +387,7 @@ static DRIVER_INIT( xybots )
|
||||
{
|
||||
atarigen_eeprom_default = NULL;
|
||||
atarigen_slapstic_init(0, 0x008000, 0, 107);
|
||||
atarijsa_init(1, 2, 1, 0x0100);
|
||||
atarijsa_init(machine, 1, 0x0100);
|
||||
}
|
||||
|
||||
|
||||
|
@ -731,6 +731,10 @@ static TIMER_CALLBACK( delayed_sound_reset )
|
||||
/* reset the sound write state */
|
||||
atarigen_sound_to_cpu_ready = 0;
|
||||
atarigen_sound_int_ack_w(0, 0, 0);
|
||||
|
||||
/* allocate a high frequency timer until a response is generated */
|
||||
/* the main CPU is *very* sensistive to the timing of the response */
|
||||
cpu_boost_interleave(SOUND_TIMER_RATE, SOUND_TIMER_BOOST);
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ static TILE_GET_INFO( get_playfield_tile_info )
|
||||
|
||||
VIDEO_START( atarig1 )
|
||||
{
|
||||
static const struct atarirle_desc modesc_hydra =
|
||||
static const atarirle_desc modesc_hydra =
|
||||
{
|
||||
REGION_GFX3,/* region where the GFX data lives */
|
||||
256, /* number of entries in sprite RAM */
|
||||
@ -89,7 +89,7 @@ VIDEO_START( atarig1 )
|
||||
{{ 0 }} /* mask for the VRAM target */
|
||||
};
|
||||
|
||||
static const struct atarirle_desc modesc_pitfight =
|
||||
static const atarirle_desc modesc_pitfight =
|
||||
{
|
||||
REGION_GFX3,/* region where the GFX data lives */
|
||||
256, /* number of entries in sprite RAM */
|
||||
@ -129,6 +129,12 @@ VIDEO_START( atarig1 )
|
||||
playfield_tile_bank = 0;
|
||||
playfield_xscroll = 0;
|
||||
playfield_yscroll = 0;
|
||||
|
||||
/* state saving */
|
||||
state_save_register_global(current_control);
|
||||
state_save_register_global(playfield_tile_bank);
|
||||
state_save_register_global(playfield_xscroll);
|
||||
state_save_register_global(playfield_yscroll);
|
||||
}
|
||||
|
||||
|
||||
@ -158,6 +164,7 @@ void atarig1_scanline_update(running_machine *machine, int scrnum, int scanline)
|
||||
/* keep in range */
|
||||
if (base >= &atarigen_alpha[0x800])
|
||||
return;
|
||||
video_screen_update_partial(0, scanline - 1);
|
||||
|
||||
/* update the playfield scrolls */
|
||||
for (i = 0; i < 8; i++)
|
||||
|
@ -93,7 +93,7 @@ static TILEMAP_MAPPER( atarig42_playfield_scan )
|
||||
|
||||
VIDEO_START( atarig42 )
|
||||
{
|
||||
static const struct atarirle_desc modesc =
|
||||
static const atarirle_desc modesc =
|
||||
{
|
||||
REGION_GFX3,/* region where the GFX data lives */
|
||||
256, /* number of entries in sprite RAM */
|
||||
@ -113,7 +113,7 @@ VIDEO_START( atarig42 )
|
||||
{{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */
|
||||
{{ 0 }} /* mask for the VRAM target */
|
||||
};
|
||||
struct atarirle_desc adjusted_modesc = modesc;
|
||||
atarirle_desc adjusted_modesc = modesc;
|
||||
int i;
|
||||
|
||||
/* blend the playfields and free the temporary one */
|
||||
|
@ -113,7 +113,7 @@ static TILEMAP_MAPPER( atarigt_playfield_scan )
|
||||
|
||||
VIDEO_START( atarigt )
|
||||
{
|
||||
static const struct atarirle_desc modesc =
|
||||
static const atarirle_desc modesc =
|
||||
{
|
||||
REGION_GFX3,/* region where the GFX data lives */
|
||||
256, /* number of entries in sprite RAM */
|
||||
@ -133,7 +133,7 @@ VIDEO_START( atarigt )
|
||||
{{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */
|
||||
{{ 0,0x8000,0,0,0,0,0,0 }} /* mask for the VRAM target */
|
||||
};
|
||||
struct atarirle_desc adjusted_modesc = modesc;
|
||||
atarirle_desc adjusted_modesc = modesc;
|
||||
int i;
|
||||
|
||||
/* blend the playfields and free the temporary one */
|
||||
|
@ -93,7 +93,7 @@ static TILEMAP_MAPPER( atarigx2_playfield_scan )
|
||||
|
||||
VIDEO_START( atarigx2 )
|
||||
{
|
||||
static const struct atarirle_desc modesc =
|
||||
static const atarirle_desc modesc =
|
||||
{
|
||||
REGION_GFX3,/* region where the GFX data lives */
|
||||
256, /* number of entries in sprite RAM */
|
||||
@ -113,7 +113,7 @@ VIDEO_START( atarigx2 )
|
||||
{{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */
|
||||
{{ 0 }} /* mask for the VRAM target */
|
||||
};
|
||||
struct atarirle_desc adjusted_modesc = modesc;
|
||||
atarirle_desc adjusted_modesc = modesc;
|
||||
int i;
|
||||
|
||||
/* blend the playfields and free the temporary one */
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
|
||||
atarirle.c
|
||||
|
||||
RLE sprite handling for early-to-mid 90's Atari raster games.
|
||||
|
||||
############################################################################
|
||||
****************************************************************************
|
||||
|
||||
Description:
|
||||
|
||||
@ -16,146 +16,144 @@
|
||||
See the bottom of the source for more details on the operation of these
|
||||
components.
|
||||
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
#include "driver.h"
|
||||
#include "atarirle.h"
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
TYPES & STRUCTURES
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
/* internal structure containing a word index, shift and mask */
|
||||
typedef struct atarirle_mask atarirle_mask;
|
||||
struct atarirle_mask
|
||||
{
|
||||
int word; /* word index */
|
||||
int shift; /* shift amount */
|
||||
int mask; /* final mask */
|
||||
int word; /* word index */
|
||||
int shift; /* shift amount */
|
||||
int mask; /* final mask */
|
||||
};
|
||||
|
||||
/* internal structure for sorting the motion objects */
|
||||
typedef struct mo_sort_entry mo_sort_entry;
|
||||
struct mo_sort_entry
|
||||
{
|
||||
struct mo_sort_entry *next;
|
||||
int entry;
|
||||
mo_sort_entry * next;
|
||||
int entry;
|
||||
};
|
||||
|
||||
/* internal structure describing each object in the ROMs */
|
||||
typedef struct atarirle_info atarirle_info;
|
||||
struct atarirle_info
|
||||
{
|
||||
INT16 width;
|
||||
INT16 height;
|
||||
INT16 xoffs;
|
||||
INT16 yoffs;
|
||||
UINT8 bpp;
|
||||
INT16 width;
|
||||
INT16 height;
|
||||
INT16 xoffs;
|
||||
INT16 yoffs;
|
||||
UINT8 bpp;
|
||||
const UINT16 * table;
|
||||
const UINT16 * data;
|
||||
};
|
||||
|
||||
/* internal structure containing the state of the motion objects */
|
||||
typedef struct atarirle_data atarirle_data;
|
||||
struct atarirle_data
|
||||
{
|
||||
int bitmapwidth; /* width of the full playfield bitmap */
|
||||
int bitmapheight; /* height of the full playfield bitmap */
|
||||
int bitmapxmask; /* x coordinate mask for the playfield bitmap */
|
||||
int bitmapymask; /* y coordinate mask for the playfield bitmap */
|
||||
int bitmapwidth; /* width of the full playfield bitmap */
|
||||
int bitmapheight; /* height of the full playfield bitmap */
|
||||
int bitmapxmask; /* x coordinate mask for the playfield bitmap */
|
||||
int bitmapymask; /* y coordinate mask for the playfield bitmap */
|
||||
|
||||
int spriterammask; /* combined mask when accessing sprite RAM with raw addresses */
|
||||
int spriteramsize; /* total size of sprite RAM, in entries */
|
||||
int spriterammask; /* combined mask when accessing sprite RAM with raw addresses */
|
||||
int spriteramsize; /* total size of sprite RAM, in entries */
|
||||
|
||||
int palettebase; /* base palette entry */
|
||||
int maxcolors; /* maximum number of colors */
|
||||
int palettebase; /* base palette entry */
|
||||
int maxcolors; /* maximum number of colors */
|
||||
|
||||
rectangle cliprect; /* clipping rectangle */
|
||||
rectangle cliprect; /* clipping rectangle */
|
||||
|
||||
struct atarirle_mask codemask; /* mask for the code index */
|
||||
struct atarirle_mask colormask; /* mask for the color */
|
||||
struct atarirle_mask xposmask; /* mask for the X position */
|
||||
struct atarirle_mask yposmask; /* mask for the Y position */
|
||||
struct atarirle_mask scalemask; /* mask for the scale factor */
|
||||
struct atarirle_mask hflipmask; /* mask for the horizontal flip */
|
||||
struct atarirle_mask ordermask; /* mask for the order */
|
||||
struct atarirle_mask prioritymask; /* mask for the priority */
|
||||
struct atarirle_mask vrammask; /* mask for the VRAM target */
|
||||
atarirle_mask codemask; /* mask for the code index */
|
||||
atarirle_mask colormask; /* mask for the color */
|
||||
atarirle_mask xposmask; /* mask for the X position */
|
||||
atarirle_mask yposmask; /* mask for the Y position */
|
||||
atarirle_mask scalemask; /* mask for the scale factor */
|
||||
atarirle_mask hflipmask; /* mask for the horizontal flip */
|
||||
atarirle_mask ordermask; /* mask for the order */
|
||||
atarirle_mask prioritymask; /* mask for the priority */
|
||||
atarirle_mask vrammask; /* mask for the VRAM target */
|
||||
|
||||
const UINT16 * rombase; /* pointer to the base of the GFX ROM */
|
||||
int romlength; /* length of the GFX ROM */
|
||||
int objectcount; /* number of objects in the ROM */
|
||||
struct atarirle_info *info; /* list of info records */
|
||||
struct atarirle_entry *spriteram; /* pointer to sprite RAM */
|
||||
int romlength; /* length of the GFX ROM */
|
||||
int objectcount; /* number of objects in the ROM */
|
||||
atarirle_info * info; /* list of info records */
|
||||
atarirle_entry *spriteram; /* pointer to sprite RAM */
|
||||
|
||||
mame_bitmap *vram[2][2]; /* pointers to VRAM bitmaps and backbuffers */
|
||||
int partial_scanline; /* partial update scanline */
|
||||
mame_bitmap * vram[2][2]; /* pointers to VRAM bitmaps and backbuffers */
|
||||
int partial_scanline; /* partial update scanline */
|
||||
|
||||
UINT8 control_bits; /* current control bits */
|
||||
UINT8 command; /* current command */
|
||||
UINT8 is32bit; /* 32-bit or 16-bit? */
|
||||
UINT16 checksums[256]; /* checksums for each 0x40000 bytes */
|
||||
UINT8 control_bits; /* current control bits */
|
||||
UINT8 command; /* current command */
|
||||
UINT8 is32bit; /* 32-bit or 16-bit? */
|
||||
UINT16 checksums[256]; /* checksums for each 0x40000 bytes */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
MACROS
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
/* data extraction */
|
||||
#define EXTRACT_DATA(_input, _mask) (((_input)->data[(_mask).word] >> (_mask).shift) & (_mask).mask)
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
GLOBAL VARIABLES
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
UINT16 *atarirle_0_spriteram;
|
||||
UINT32 *atarirle_0_spriteram32;
|
||||
|
||||
//UINT16 *atarirle_0_command;
|
||||
//UINT32 *atarirle_0_command32;
|
||||
|
||||
//UINT16 *atarirle_0_table;
|
||||
//UINT32 *atarirle_0_table32;
|
||||
|
||||
static int atarirle_hilite_index = -1;
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
STATIC VARIABLES
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
static struct atarirle_data atarirle[ATARIRLE_MAX];
|
||||
static atarirle_data atarirle[ATARIRLE_MAX];
|
||||
|
||||
static UINT8 rle_bpp[8];
|
||||
static UINT16 *rle_table[8];
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
STATIC FUNCTION DECLARATIONS
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
static void build_rle_tables(void);
|
||||
static int count_objects(const UINT16 *base, int length);
|
||||
static void prescan_rle(const struct atarirle_data *mo, int which);
|
||||
static void sort_and_render(struct atarirle_data *mo);
|
||||
static void compute_checksum(struct atarirle_data *mo);
|
||||
static void draw_rle(struct atarirle_data *mo, mame_bitmap *bitmap, int code, int color, int hflip, int vflip,
|
||||
static void prescan_rle(const atarirle_data *mo, int which);
|
||||
static void sort_and_render(atarirle_data *mo);
|
||||
static void compute_checksum(atarirle_data *mo);
|
||||
static void draw_rle(atarirle_data *mo, mame_bitmap *bitmap, int code, int color, int hflip, int vflip,
|
||||
int x, int y, int xscale, int yscale, const rectangle *clip);
|
||||
static void draw_rle_zoom(mame_bitmap *bitmap, const struct atarirle_info *gfx,
|
||||
static void draw_rle_zoom(mame_bitmap *bitmap, const atarirle_info *gfx,
|
||||
UINT32 palette, int sx, int sy, int scalex, int scaley,
|
||||
const rectangle *clip);
|
||||
static void draw_rle_zoom_hflip(mame_bitmap *bitmap, const struct atarirle_info *gfx,
|
||||
static void draw_rle_zoom_hflip(mame_bitmap *bitmap, const atarirle_info *gfx,
|
||||
UINT32 palette, int sx, int sy, int scalex, int scaley,
|
||||
const rectangle *clip);
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
INLINE FUNCTIONS
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
compute_log: Computes the number of bits necessary to
|
||||
@ -222,7 +220,7 @@ INLINE int collapse_bits(int value, int mask)
|
||||
shift, and adjusted mask. Returns 0 if invalid.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
INLINE int convert_mask(const struct atarirle_entry *input, struct atarirle_mask *result)
|
||||
INLINE int convert_mask(const atarirle_entry *input, atarirle_mask *result)
|
||||
{
|
||||
int i, temp;
|
||||
|
||||
@ -258,9 +256,9 @@ INLINE int convert_mask(const struct atarirle_entry *input, struct atarirle_mask
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
GLOBAL FUNCTIONS
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
atarirle_init: Configures the motion objects using the input
|
||||
@ -268,10 +266,10 @@ INLINE int convert_mask(const struct atarirle_entry *input, struct atarirle_mask
|
||||
the attribute lookup table.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
void atarirle_init(int map, const struct atarirle_desc *desc)
|
||||
void atarirle_init(int map, const atarirle_desc *desc)
|
||||
{
|
||||
const UINT16 *base = (const UINT16 *)memory_region(desc->region);
|
||||
struct atarirle_data *mo = &atarirle[map];
|
||||
atarirle_data *mo = &atarirle[map];
|
||||
int i;
|
||||
|
||||
/* verify the map index */
|
||||
@ -355,6 +353,21 @@ void atarirle_init(int map, const struct atarirle_desc *desc)
|
||||
}
|
||||
|
||||
mo->partial_scanline = -1;
|
||||
|
||||
/* register for save states */
|
||||
state_save_register_item_pointer("atarirle", map, mo->spriteram[0].data, ARRAY_LENGTH(mo->spriteram[0].data) * mo->spriteramsize);
|
||||
state_save_register_item_bitmap("atarirle", map, mo->vram[0][0]);
|
||||
state_save_register_item_bitmap("atarirle", map, mo->vram[0][1]);
|
||||
if (mo->vrammask.mask != 0)
|
||||
{
|
||||
state_save_register_item_bitmap("atarirle", map, mo->vram[1][0]);
|
||||
state_save_register_item_bitmap("atarirle", map, mo->vram[1][1]);
|
||||
}
|
||||
state_save_register_item("atarirle", map, mo->partial_scanline);
|
||||
state_save_register_item("atarirle", map, mo->control_bits);
|
||||
state_save_register_item("atarirle", map, mo->command);
|
||||
state_save_register_item("atarirle", map, mo->is32bit);
|
||||
state_save_register_item_array("atarirle", map, mo->checksums);
|
||||
}
|
||||
|
||||
|
||||
@ -365,7 +378,7 @@ void atarirle_init(int map, const struct atarirle_desc *desc)
|
||||
|
||||
void atarirle_control_w(int map, UINT8 bits)
|
||||
{
|
||||
struct atarirle_data *mo = &atarirle[map];
|
||||
atarirle_data *mo = &atarirle[map];
|
||||
int scanline = video_screen_get_vpos(0);
|
||||
int oldbits = mo->control_bits;
|
||||
|
||||
@ -421,7 +434,7 @@ void atarirle_control_w(int map, UINT8 bits)
|
||||
|
||||
void atarirle_command_w(int map, UINT8 command)
|
||||
{
|
||||
struct atarirle_data *mo = &atarirle[map];
|
||||
atarirle_data *mo = &atarirle[map];
|
||||
mo->command = command;
|
||||
}
|
||||
|
||||
@ -440,7 +453,7 @@ VIDEO_EOF( atarirle )
|
||||
/* loop over all RLE handlers */
|
||||
for (i = 0; i < ATARIRLE_MAX; i++)
|
||||
{
|
||||
struct atarirle_data *mo = &atarirle[i];
|
||||
atarirle_data *mo = &atarirle[i];
|
||||
|
||||
/* if the erase flag is set, erase to the end of the screen */
|
||||
if (mo->control_bits & ATARIRLE_CONTROL_ERASE)
|
||||
@ -511,7 +524,7 @@ WRITE32_HANDLER( atarirle_0_spriteram32_w )
|
||||
|
||||
mame_bitmap *atarirle_get_vram(int map, int idx)
|
||||
{
|
||||
struct atarirle_data *mo = &atarirle[map];
|
||||
atarirle_data *mo = &atarirle[map];
|
||||
//logerror("atarirle_get_vram (frame %d)\n", (mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2);
|
||||
return mo->vram[idx][(mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
|
||||
}
|
||||
@ -605,9 +618,9 @@ int count_objects(const UINT16 *base, int length)
|
||||
width, height, and other goodies.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
static void prescan_rle(const struct atarirle_data *mo, int which)
|
||||
static void prescan_rle(const atarirle_data *mo, int which)
|
||||
{
|
||||
struct atarirle_info *rledata = &mo->info[which];
|
||||
atarirle_info *rledata = &mo->info[which];
|
||||
UINT16 *base = (UINT16 *)&mo->rombase[which * 4];
|
||||
const UINT16 *end = mo->rombase + mo->romlength / 2;
|
||||
int width = 0, height, flags, offset;
|
||||
@ -685,7 +698,7 @@ static void prescan_rle(const struct atarirle_data *mo, int which)
|
||||
compute_checksum: Compute the checksum values on the ROMs.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
static void compute_checksum(struct atarirle_data *mo)
|
||||
static void compute_checksum(atarirle_data *mo)
|
||||
{
|
||||
int reqsums = mo->spriteram[0].data[0] + 1;
|
||||
int i;
|
||||
@ -715,17 +728,17 @@ static void compute_checksum(struct atarirle_data *mo)
|
||||
sort_and_render: Render all motion objects in order.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
static void sort_and_render(struct atarirle_data *mo)
|
||||
static void sort_and_render(atarirle_data *mo)
|
||||
{
|
||||
mame_bitmap *bitmap1 = mo->vram[0][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
|
||||
mame_bitmap *bitmap2 = mo->vram[1][(~mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2];
|
||||
struct atarirle_entry *obj = mo->spriteram;
|
||||
struct mo_sort_entry sort_entry[256];
|
||||
struct mo_sort_entry *list_head[256];
|
||||
struct mo_sort_entry *current;
|
||||
atarirle_entry *obj = mo->spriteram;
|
||||
mo_sort_entry sort_entry[256];
|
||||
mo_sort_entry *list_head[256];
|
||||
mo_sort_entry *current;
|
||||
int i;
|
||||
|
||||
struct atarirle_entry *hilite = NULL;
|
||||
atarirle_entry *hilite = NULL;
|
||||
int count = 0;
|
||||
|
||||
/* sort the motion objects into their proper priorities */
|
||||
@ -799,7 +812,7 @@ if (hilite)
|
||||
int x = EXTRACT_DATA(obj, mo->xposmask);
|
||||
int y = EXTRACT_DATA(obj, mo->yposmask);
|
||||
int scaled_xoffs, scaled_yoffs;
|
||||
const struct atarirle_info *info;
|
||||
const atarirle_info *info;
|
||||
|
||||
if (x & ((mo->xposmask.mask + 1) >> 1))
|
||||
x = (INT16)(x | ~mo->xposmask.mask);
|
||||
@ -889,11 +902,11 @@ fprintf(stderr, " Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d
|
||||
object.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
void draw_rle(struct atarirle_data *mo, mame_bitmap *bitmap, int code, int color, int hflip, int vflip,
|
||||
void draw_rle(atarirle_data *mo, mame_bitmap *bitmap, int code, int color, int hflip, int vflip,
|
||||
int x, int y, int xscale, int yscale, const rectangle *clip)
|
||||
{
|
||||
UINT32 palettebase = mo->palettebase + color;
|
||||
const struct atarirle_info *info = &mo->info[code];
|
||||
const atarirle_info *info = &mo->info[code];
|
||||
int scaled_xoffs = (xscale * info->xoffs) >> 12;
|
||||
int scaled_yoffs = (yscale * info->yoffs) >> 12;
|
||||
|
||||
@ -930,7 +943,7 @@ void draw_rle(struct atarirle_data *mo, mame_bitmap *bitmap, int code, int color
|
||||
bitmap.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
void draw_rle_zoom(mame_bitmap *bitmap, const struct atarirle_info *gfx,
|
||||
void draw_rle_zoom(mame_bitmap *bitmap, const atarirle_info *gfx,
|
||||
UINT32 palette, int sx, int sy, int scalex, int scaley,
|
||||
const rectangle *clip)
|
||||
{
|
||||
@ -1120,7 +1133,7 @@ void draw_rle_zoom(mame_bitmap *bitmap, const struct atarirle_info *gfx,
|
||||
16-bit bitmap with horizontal flip.
|
||||
---------------------------------------------------------------*/
|
||||
|
||||
void draw_rle_zoom_hflip(mame_bitmap *bitmap, const struct atarirle_info *gfx,
|
||||
void draw_rle_zoom_hflip(mame_bitmap *bitmap, const atarirle_info *gfx,
|
||||
UINT32 palette, int sx, int sy, int scalex, int scaley,
|
||||
const rectangle *clip)
|
||||
{
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
|
||||
atarirle.h
|
||||
|
||||
Common RLE-based motion object management functions for early 90's
|
||||
Atari raster games.
|
||||
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __ATARIRLE__
|
||||
#define __ATARIRLE__
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
/* maximum number of motion object processors */
|
||||
#define ATARIRLE_MAX 1
|
||||
@ -32,46 +32,49 @@
|
||||
#define ATARIRLE_COMMAND_CHECKSUM 2
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
|
||||
/***************************************************************************
|
||||
TYPES & STRUCTURES
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
/* description for an eight-word mask */
|
||||
typedef struct atarirle_entry atarirle_entry;
|
||||
struct atarirle_entry
|
||||
{
|
||||
UINT16 data[8];
|
||||
};
|
||||
|
||||
/* description of the motion objects */
|
||||
typedef struct atarirle_desc atarirle_desc;
|
||||
struct atarirle_desc
|
||||
{
|
||||
UINT8 region; /* region where the GFX data lives */
|
||||
UINT16 spriteramentries; /* number of entries in sprite RAM */
|
||||
UINT16 leftclip; /* left clip coordinate */
|
||||
UINT16 rightclip; /* right clip coordinate */
|
||||
UINT8 region; /* region where the GFX data lives */
|
||||
UINT16 spriteramentries; /* number of entries in sprite RAM */
|
||||
UINT16 leftclip; /* left clip coordinate */
|
||||
UINT16 rightclip; /* right clip coordinate */
|
||||
|
||||
UINT16 palettebase; /* base palette entry */
|
||||
UINT16 maxcolors; /* maximum number of colors */
|
||||
UINT16 palettebase; /* base palette entry */
|
||||
UINT16 maxcolors; /* maximum number of colors */
|
||||
|
||||
struct atarirle_entry codemask; /* mask for the code index */
|
||||
struct atarirle_entry colormask; /* mask for the color */
|
||||
struct atarirle_entry xposmask; /* mask for the X position */
|
||||
struct atarirle_entry yposmask; /* mask for the Y position */
|
||||
struct atarirle_entry scalemask; /* mask for the scale factor */
|
||||
struct atarirle_entry hflipmask; /* mask for the horizontal flip */
|
||||
struct atarirle_entry ordermask; /* mask for the order */
|
||||
struct atarirle_entry prioritymask; /* mask for the priority */
|
||||
struct atarirle_entry vrammask; /* mask for the VRAM target */
|
||||
atarirle_entry codemask; /* mask for the code index */
|
||||
atarirle_entry colormask; /* mask for the color */
|
||||
atarirle_entry xposmask; /* mask for the X position */
|
||||
atarirle_entry yposmask; /* mask for the Y position */
|
||||
atarirle_entry scalemask; /* mask for the scale factor */
|
||||
atarirle_entry hflipmask; /* mask for the horizontal flip */
|
||||
atarirle_entry ordermask; /* mask for the order */
|
||||
atarirle_entry prioritymask; /* mask for the priority */
|
||||
atarirle_entry vrammask; /* mask for the VRAM target */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
/* setup/shutdown */
|
||||
void atarirle_init(int map, const struct atarirle_desc *desc);
|
||||
void atarirle_init(int map, const atarirle_desc *desc);
|
||||
|
||||
/* control handlers */
|
||||
void atarirle_control_w(int map, UINT8 bits);
|
||||
@ -87,9 +90,9 @@ mame_bitmap *atarirle_get_vram(int map, int idx);
|
||||
|
||||
|
||||
|
||||
/*##########################################################################
|
||||
/***************************************************************************
|
||||
GLOBAL VARIABLES
|
||||
##########################################################################*/
|
||||
***************************************************************************/
|
||||
|
||||
extern UINT16 *atarirle_0_spriteram;
|
||||
extern UINT32 *atarirle_0_spriteram32;
|
||||
|
Loading…
Reference in New Issue
Block a user