diff --git a/.gitattributes b/.gitattributes index 3ad806efb7b..0f5640c4974 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2731,6 +2731,7 @@ src/mame/includes/taito_b.h svneol=native#text/plain src/mame/includes/taito_f2.h svneol=native#text/plain src/mame/includes/taito_f3.h svneol=native#text/plain src/mame/includes/taito_l.h svneol=native#text/plain +src/mame/includes/taitoair.h svneol=native#text/plain src/mame/includes/taitoipt.h svneol=native#text/plain src/mame/includes/taitosj.h svneol=native#text/plain src/mame/includes/tank8.h svneol=native#text/plain diff --git a/src/mame/drivers/taito_b.c b/src/mame/drivers/taito_b.c index 478aea4d2bd..dd575f8298d 100644 --- a/src/mame/drivers/taito_b.c +++ b/src/mame/drivers/taito_b.c @@ -188,7 +188,8 @@ static WRITE8_HANDLER( bankswitch_w ) static TIMER_CALLBACK( rsaga2_interrupt2 ) { - cputag_set_input_line(machine, "maincpu", 2, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 2, HOLD_LINE); } static INTERRUPT_GEN( rastansaga2_interrupt ) @@ -200,7 +201,8 @@ static INTERRUPT_GEN( rastansaga2_interrupt ) static TIMER_CALLBACK( crimec_interrupt3 ) { - cputag_set_input_line(machine, "maincpu", 3, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 3, HOLD_LINE); } static INTERRUPT_GEN( crimec_interrupt ) @@ -212,7 +214,8 @@ static INTERRUPT_GEN( crimec_interrupt ) static TIMER_CALLBACK( hitice_interrupt6 ) { - cputag_set_input_line(machine, "maincpu", 6, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 6, HOLD_LINE); } static INTERRUPT_GEN( hitice_interrupt ) @@ -224,7 +227,8 @@ static INTERRUPT_GEN( hitice_interrupt ) static TIMER_CALLBACK( rambo3_interrupt1 ) { - cputag_set_input_line(machine, "maincpu", 1, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 1, HOLD_LINE); } static INTERRUPT_GEN( rambo3_interrupt ) @@ -236,7 +240,8 @@ static INTERRUPT_GEN( rambo3_interrupt ) static TIMER_CALLBACK( pbobble_interrupt5 ) { - cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 5, HOLD_LINE); } static INTERRUPT_GEN( pbobble_interrupt ) @@ -247,7 +252,8 @@ static INTERRUPT_GEN( pbobble_interrupt ) static TIMER_CALLBACK( viofight_interrupt1 ) { - cputag_set_input_line(machine, "maincpu", 1, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 1, HOLD_LINE); } static INTERRUPT_GEN( viofight_interrupt ) @@ -258,7 +264,8 @@ static INTERRUPT_GEN( viofight_interrupt ) static TIMER_CALLBACK( masterw_interrupt4 ) { - cputag_set_input_line(machine, "maincpu", 4, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 4, HOLD_LINE); } static INTERRUPT_GEN( masterw_interrupt ) @@ -269,7 +276,8 @@ static INTERRUPT_GEN( masterw_interrupt ) static TIMER_CALLBACK( silentd_interrupt4 ) { - cputag_set_input_line(machine, "maincpu", 4, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 4, HOLD_LINE); } static INTERRUPT_GEN( silentd_interrupt ) @@ -280,7 +288,8 @@ static INTERRUPT_GEN( silentd_interrupt ) static TIMER_CALLBACK( selfeena_interrupt4 ) { - cputag_set_input_line(machine, "maincpu", 4, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 4, HOLD_LINE); } static INTERRUPT_GEN( selfeena_interrupt ) @@ -291,7 +300,8 @@ static INTERRUPT_GEN( selfeena_interrupt ) static TIMER_CALLBACK( sbm_interrupt5 )//4 { - cputag_set_input_line(machine, "maincpu", 5, HOLD_LINE); + taitob_state *state = (taitob_state *)machine->driver_data; + cpu_set_input_line(state->maincpu, 5, HOLD_LINE); } static INTERRUPT_GEN( sbm_interrupt )//5 @@ -306,49 +316,56 @@ static READ16_HANDLER( tracky1_hi_r ) { return input_port_read(space->machine, "TRACKX1"); } + static READ16_HANDLER( tracky1_lo_r ) { - return (input_port_read(space->machine, "TRACKX1") & 0xff) <<8; + return (input_port_read(space->machine, "TRACKX1") & 0xff) << 8; } + static READ16_HANDLER( trackx1_hi_r ) { return input_port_read(space->machine, "TRACKY1"); } + static READ16_HANDLER( trackx1_lo_r ) { - return (input_port_read(space->machine, "TRACKY1") & 0xff) <<8; + return (input_port_read(space->machine, "TRACKY1") & 0xff) << 8; } + static READ16_HANDLER( tracky2_hi_r ) { return input_port_read(space->machine, "TRACKX2"); } + static READ16_HANDLER( tracky2_lo_r ) { - return (input_port_read(space->machine, "TRACKX2") & 0xff) <<8; + return (input_port_read(space->machine, "TRACKX2") & 0xff) << 8; } + static READ16_HANDLER( trackx2_hi_r ) { return input_port_read(space->machine, "TRACKY2"); } + static READ16_HANDLER( trackx2_lo_r ) { - return (input_port_read(space->machine, "TRACKY2") & 0xff) <<8; + return (input_port_read(space->machine, "TRACKY2") & 0xff) << 8; } static WRITE16_HANDLER( gain_control_w ) { - const device_config *mb87078 = devtag_get_device(space->machine, "mb87078"); + taitob_state *state = (taitob_state *)space->machine->driver_data; if (ACCESSING_BITS_8_15) { if (offset == 0) { - mb87078_data_w(mb87078, data >> 8, 0); + mb87078_data_w(state->mb87078, data >> 8, 0); //logerror("MB87078 dsel=0 data=%4x\n", data); } else { - mb87078_data_w(mb87078, data >> 8, 1); + mb87078_data_w(state->mb87078, data >> 8, 1); //logerror("MB87078 dsel=1 data=%4x\n", data); } } @@ -371,16 +388,17 @@ static const eeprom_interface taitob_eeprom_intf = "0100110000" /* unlock command*/ }; -static UINT16 eep_latch = 0; - static READ16_HANDLER( eep_latch_r ) { - return eep_latch; + taitob_state *state = (taitob_state *)space->machine->driver_data; + return state->eep_latch; } static WRITE16_HANDLER( eeprom_w ) { - COMBINE_DATA(&eep_latch); + taitob_state *state = (taitob_state *)space->machine->driver_data; + + COMBINE_DATA(&state->eep_latch); if (ACCESSING_BITS_8_15) { @@ -410,53 +428,55 @@ static WRITE16_HANDLER( eeprom_w ) *************************************************************************/ -static UINT16 coin_word=0; static READ16_HANDLER( player_34_coin_ctrl_r ) { - return coin_word; + taitob_state *state = (taitob_state *)space->machine->driver_data; + return state->coin_word; } static WRITE16_HANDLER( player_34_coin_ctrl_w ) { - COMBINE_DATA(&coin_word); + taitob_state *state = (taitob_state *)space->machine->driver_data; + + COMBINE_DATA(&state->coin_word); /* coin counters and lockout */ - coin_lockout_w(space->machine, 2,~data & 0x0100); - coin_lockout_w(space->machine, 3,~data & 0x0200); - coin_counter_w(space->machine, 2, data & 0x0400); - coin_counter_w(space->machine, 3, data & 0x0800); + coin_lockout_w(space->machine, 2, ~data & 0x0100); + coin_lockout_w(space->machine, 3, ~data & 0x0200); + coin_counter_w(space->machine, 2, data & 0x0400); + coin_counter_w(space->machine, 3, data & 0x0800); } static READ16_HANDLER( pbobble_input_bypass_r ) { - const device_config *tc0640fio = devtag_get_device(space->machine, "tc0640fio"); + taitob_state *state = (taitob_state *)space->machine->driver_data; switch (offset) { case 0x01: return input_port_read(space->machine, "COIN") << 8; default: - return tc0640fio_r(tc0640fio, offset) << 8; + return tc0640fio_r(state->tc0640fio, offset) << 8; } } static WRITE16_HANDLER( spacedxo_tc0220ioc_w ) { - const device_config *tc0220ioc = devtag_get_device(space->machine, "tc0220ioc"); + taitob_state *state = (taitob_state *)space->machine->driver_data; if (ACCESSING_BITS_0_7) - tc0220ioc_w(tc0220ioc, offset, data & 0xff); + tc0220ioc_w(state->tc0220ioc, offset, data & 0xff); else { /* spacedxo also writes here - bug? */ - tc0220ioc_w(tc0220ioc, offset, (data >> 8) & 0xff); + tc0220ioc_w(state->tc0220ioc, offset, (data >> 8) & 0xff); } } #define TC0180VCU_MEMRW( ADDR ) \ AM_RANGE(ADDR+0x00000, ADDR+0x0ffff) AM_DEVREADWRITE("tc0180vcu", tc0180vcu_word_r, tc0180vcu_word_w) \ - AM_RANGE(ADDR+0x10000, ADDR+0x1197f) AM_RAM AM_BASE(&taitob_spriteram) \ + AM_RANGE(ADDR+0x10000, ADDR+0x1197f) AM_RAM AM_BASE_MEMBER(taitob_state, spriteram) \ AM_RANGE(ADDR+0x11980, ADDR+0x137ff) AM_RAM \ AM_RANGE(ADDR+0x13800, ADDR+0x13fff) AM_DEVREADWRITE("tc0180vcu", tc0180vcu_scroll_r, tc0180vcu_scroll_w) \ AM_RANGE(ADDR+0x18000, ADDR+0x1801f) AM_DEVREADWRITE("tc0180vcu", tc0180vcu_ctrl_r, tc0180vcu_ctrl_w) \ @@ -516,7 +536,7 @@ static ADDRESS_MAP_START( hitice_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x700002, 0x700003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_comm_r, tc0140syt_comm_w, 0xff00) AM_RANGE(0x800000, 0x803fff) AM_RAM /* Main RAM */ AM_RANGE(0xa00000, 0xa01fff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBxxxx_word_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xb00000, 0xb7ffff) AM_RAM_WRITE(hitice_pixelram_w) AM_BASE(&taitob_pixelram) + AM_RANGE(0xb00000, 0xb7ffff) AM_RAM_WRITE(hitice_pixelram_w) AM_BASE_MEMBER(taitob_state, pixelram) // { 0xbffff0, 0xbffff1, ??? AM_RANGE(0xbffff2, 0xbffff5) AM_WRITE(hitice_pixel_scroll_w) // { 0xbffffa, 0xbffffb, ??? @@ -2069,9 +2089,10 @@ GFXDECODE_END /* handler called by the YM2610 emulator when the internal timers cause an IRQ */ -static void irqhandler(const device_config *device, int irq) +static void irqhandler( const device_config *device, int irq ) { - cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); + taitob_state *state = (taitob_state *)device->machine->driver_data; + cpu_set_input_line(state->audiocpu, 0, irq ? ASSERT_LINE : CLEAR_LINE); } static const ym2610_interface ym2610_config = @@ -2105,12 +2126,13 @@ static const ym2203_interface ym2203_config = */ static void mb87078_gain_changed( running_machine *machine, int channel, int percent ) { + taitob_state *state = (taitob_state *)machine->driver_data; + if (channel == 1) { - const device_config *ym = devtag_get_device(machine, "ymsnd"); - sound_set_output_gain(ym, 0, percent / 100.0); - sound_set_output_gain(ym, 1, percent / 100.0); - sound_set_output_gain(ym, 2, percent / 100.0); + sound_set_output_gain(state->ym, 0, percent / 100.0); + sound_set_output_gain(state->ym, 1, percent / 100.0); + sound_set_output_gain(state->ym, 2, percent / 100.0); //popmessage("MB87078 gain ch#%i percent=%i", channel, percent); } } @@ -2168,8 +2190,35 @@ static const tc0140syt_interface taitob_tc0140syt_intf = "maincpu", "audiocpu" }; +static MACHINE_START( taitob ) +{ + taitob_state *state = (taitob_state *)machine->driver_data; + + state->maincpu = devtag_get_device(machine, "maincpu"); + state->audiocpu = devtag_get_device(machine, "audiocpu"); + state->mb87078 = devtag_get_device(machine, "mb87078"); + state->ym = devtag_get_device(machine, "ymsnd"); + state->tc0180vcu = devtag_get_device(machine, "tc0180vcu"); + state->tc0640fio = devtag_get_device(machine, "tc0640fio"); + state->tc0220ioc = devtag_get_device(machine, "tc0220ioc"); + + state_save_register_global(machine, state->eep_latch); + state_save_register_global(machine, state->coin_word); +} + +static MACHINE_RESET( taitob ) +{ + taitob_state *state = (taitob_state *)machine->driver_data; + + state->eep_latch = 0; + state->coin_word = 0; +} + static MACHINE_DRIVER_START( rastsag2 ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(rastsag2_map) @@ -2180,6 +2229,9 @@ static MACHINE_DRIVER_START( rastsag2 ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2214,6 +2266,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( ashura ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(rastsag2_map) @@ -2224,6 +2279,9 @@ static MACHINE_DRIVER_START( ashura ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2258,6 +2316,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( crimec ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(crimec_map) @@ -2268,6 +2329,9 @@ static MACHINE_DRIVER_START( crimec ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2302,6 +2366,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( tetrist ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz ???*/ MDRV_CPU_PROGRAM_MAP(tetrist_map) @@ -2312,6 +2379,9 @@ static MACHINE_DRIVER_START( tetrist ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2345,6 +2415,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( tetrista ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(tetrista_map) @@ -2355,6 +2428,9 @@ static MACHINE_DRIVER_START( tetrista ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2389,6 +2465,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( hitice ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(hitice_map) @@ -2399,6 +2478,9 @@ static MACHINE_DRIVER_START( hitice ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2439,6 +2521,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( rambo3 ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, XTAL_24MHz/2) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(rambo3_map) @@ -2449,6 +2534,9 @@ static MACHINE_DRIVER_START( rambo3 ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2483,6 +2571,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( rambo3a ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, XTAL_24MHz/2) /* verified on pcb */ MDRV_CPU_PROGRAM_MAP(rambo3_map) @@ -2493,6 +2584,9 @@ static MACHINE_DRIVER_START( rambo3a ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2526,6 +2620,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( pbobble ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(pbobble_map) @@ -2534,6 +2631,9 @@ static MACHINE_DRIVER_START( pbobble ) MDRV_CPU_ADD("audiocpu", Z80, 4000000) /* 4 MHz */ MDRV_CPU_PROGRAM_MAP(sound_map) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_QUANTUM_TIME(HZ(600)) MDRV_EEPROM_ADD("eeprom", taitob_eeprom_intf) @@ -2574,6 +2674,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( spacedx ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(spacedx_map) @@ -2584,6 +2687,9 @@ static MACHINE_DRIVER_START( spacedx ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_EEPROM_ADD("eeprom", taitob_eeprom_intf) MDRV_TC0640FIO_ADD("tc0640fio", pbobble_io_intf) @@ -2622,6 +2728,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( spacedxo ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(spacedxo_map) @@ -2632,6 +2741,9 @@ static MACHINE_DRIVER_START( spacedxo ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2666,6 +2778,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( qzshowby ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 16000000) /* 16 MHz according to the readme*/ MDRV_CPU_PROGRAM_MAP(qzshowby_map) @@ -2676,6 +2791,9 @@ static MACHINE_DRIVER_START( qzshowby ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_EEPROM_ADD("eeprom", taitob_eeprom_intf) MDRV_TC0640FIO_ADD("tc0640fio", pbobble_io_intf) @@ -2714,6 +2832,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( viofight ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(viofight_map) @@ -2724,6 +2845,9 @@ static MACHINE_DRIVER_START( viofight ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2762,6 +2886,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( masterw ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(masterw_map) @@ -2772,6 +2899,9 @@ static MACHINE_DRIVER_START( masterw ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2807,6 +2937,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( silentd ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 16000000) /* 16 MHz ??? */ MDRV_CPU_PROGRAM_MAP(silentd_map) @@ -2817,6 +2950,9 @@ static MACHINE_DRIVER_START( silentd ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2851,6 +2987,9 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( selfeena ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(selfeena_map) @@ -2861,6 +3000,9 @@ static MACHINE_DRIVER_START( selfeena ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2904,6 +3046,9 @@ static void ryujin_patch(void) static MACHINE_DRIVER_START( ryujin ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(selfeena_map) @@ -2914,6 +3059,9 @@ static MACHINE_DRIVER_START( ryujin ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0220IOC_ADD("tc0220ioc", taitob_io_intf) /* video hardware */ @@ -2955,6 +3103,9 @@ static void sbm_patch(void) static MACHINE_DRIVER_START( sbm ) + /* driver data */ + MDRV_DRIVER_DATA(taitob_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000, 12000000) /* 12 MHz */ MDRV_CPU_PROGRAM_MAP(sbm_map) @@ -2965,6 +3116,9 @@ static MACHINE_DRIVER_START( sbm ) MDRV_QUANTUM_TIME(HZ(600)) + MDRV_MACHINE_START(taitob) + MDRV_MACHINE_RESET(taitob) + MDRV_TC0510NIO_ADD("tc0510nio", sbm_io_intf) /* video hardware */ diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c index ec68fc4e55f..f701fea67f0 100644 --- a/src/mame/drivers/taitoair.c +++ b/src/mame/drivers/taitoair.c @@ -219,84 +219,85 @@ cpu #2 (PC=0000060E): unmapped memory word read from 0000683A & FFFF #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "includes/taitoipt.h" +#include "includes/taitoair.h" #include "audio/taitosnd.h" #include "video/taitoic.h" #include "machine/taitoio.h" #include "cpu/tms32025/tms32025.h" #include "sound/2610intf.h" -static int dsp_HOLD_signal; - -static UINT16 *taitoh_68000_mainram; -UINT16 *taitoair_line_ram; -static UINT16 *dsp_ram; /* Shared 68000/TMS32025 RAM */ - -VIDEO_UPDATE( taitoair ); - - - /*********************************************************** MEMORY handlers ***********************************************************/ static WRITE16_HANDLER( system_control_w ) { + taitoair_state *state = (taitoair_state *)space->machine->driver_data; + if ((ACCESSING_BITS_0_7 == 0) && ACCESSING_BITS_8_15) - { data >>= 8; - } - dsp_HOLD_signal = (data & 4) ? CLEAR_LINE : ASSERT_LINE; + state->dsp_hold_signal = (data & 4) ? CLEAR_LINE : ASSERT_LINE; - cputag_set_input_line(space->machine, "dsp", INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE); + cpu_set_input_line(state->dsp, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE); logerror("68K:%06x writing %04x to TMS32025. %s HOLD , %s RESET\n", cpu_get_previouspc(space->cpu), data, ((data & 4) ? "Clear" : "Assert"), ((data & 1) ? "Clear" : "Assert")); } static READ16_HANDLER( lineram_r ) { - return taitoair_line_ram[offset]; + taitoair_state *state = (taitoair_state *)space->machine->driver_data; + return state->line_ram[offset]; } static WRITE16_HANDLER( lineram_w ) { + taitoair_state *state = (taitoair_state *)space->machine->driver_data; + if (ACCESSING_BITS_8_15 && ACCESSING_BITS_0_7) - taitoair_line_ram[offset] = data; + state->line_ram[offset] = data; } static READ16_HANDLER( dspram_r ) { - return dsp_ram[offset]; + taitoair_state *state = (taitoair_state *)space->machine->driver_data; + return state->dsp_ram[offset]; } static WRITE16_HANDLER( dspram_w ) { + taitoair_state *state = (taitoair_state *)space->machine->driver_data; + if (ACCESSING_BITS_8_15 && ACCESSING_BITS_0_7) - dsp_ram[offset] = data; + state->dsp_ram[offset] = data; } static READ16_HANDLER( dsp_HOLD_signal_r ) { - /* HOLD signal is active low */ - // logerror("TMS32025:%04x Reading %01x level from HOLD signal\n",cpu_get_previouspc(space->cpu),dsp_HOLD_signal); + taitoair_state *state = (taitoair_state *)space->machine->driver_data; - return dsp_HOLD_signal; + /* HOLD signal is active low */ + // logerror("TMS32025:%04x Reading %01x level from HOLD signal\n", cpu_get_previouspc(space->cpu), state->dsp_hold_signal); + + return state->dsp_hold_signal; } static WRITE16_HANDLER( dsp_HOLDA_signal_w ) { if (offset) - logerror("TMS32025:%04x Writing %01x level to HOLD-Acknowledge signal\n",cpu_get_previouspc(space->cpu),data); + logerror("TMS32025:%04x Writing %01x level to HOLD-Acknowledge signal\n", cpu_get_previouspc(space->cpu), data); } static WRITE16_HANDLER( airsys_paletteram16_w ) /* xxBBBBxRRRRxGGGG */ { + taitoair_state *state = (taitoair_state *)space->machine->driver_data; int a; - COMBINE_DATA(&space->machine->generic.paletteram.u16[offset]); - a = space->machine->generic.paletteram.u16[offset]; - palette_set_color_rgb(space->machine,offset,pal4bit(a >> 0),pal4bit(a >> 5),pal4bit(a >> 10)); + COMBINE_DATA(&state->paletteram[offset]); + + a = state->paletteram[offset]; + palette_set_color_rgb(space->machine, offset, pal4bit(a >> 0), pal4bit(a >> 5), pal4bit(a >> 10)); } @@ -343,33 +344,21 @@ static READ16_HANDLER( stick2_input_r ) } -static INT32 banknum; -static void reset_sound_region(running_machine *machine) +static void reset_sound_region( running_machine *machine ) { - memory_set_bankptr(machine, "bank1", memory_region(machine, "audiocpu") + (banknum * 0x4000) + 0x10000); + taitoair_state *state = (taitoair_state *)machine->driver_data; + memory_set_bank(machine, "bank1", state->banknum); } static WRITE8_HANDLER( sound_bankswitch_w ) { - banknum = (data - 1) & 3; + taitoair_state *state = (taitoair_state *)space->machine->driver_data; + + state->banknum = (data - 1) & 3; reset_sound_region(space->machine); } -static STATE_POSTLOAD( taitoair_postload ) -{ - reset_sound_region(machine); -} - -static MACHINE_START( taitoair ) -{ - dsp_HOLD_signal = ASSERT_LINE; - banknum = -1; - - state_save_register_global(machine, banknum); - state_save_register_postload(machine, taitoair_postload, NULL); -} - /*********************************************************** MEMORY STRUCTURES @@ -377,14 +366,14 @@ static MACHINE_START( taitoair ) static ADDRESS_MAP_START( airsys_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0x000000, 0x0bffff) AM_ROM - AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_BASE(&taitoh_68000_mainram) + AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_BASE_MEMBER(taitoair_state, m68000_mainram) AM_RANGE(0x140000, 0x140001) AM_WRITE(system_control_w) /* Pause the TMS32025 */ AM_RANGE(0x180000, 0x183fff) AM_RAM /* "gradiation ram (0)" */ AM_RANGE(0x184000, 0x187fff) AM_RAM /* "gradiation ram (1)" */ - AM_RANGE(0x188000, 0x18bfff) AM_RAM_WRITE(airsys_paletteram16_w) AM_BASE_GENERIC(paletteram) + AM_RANGE(0x188000, 0x18bfff) AM_RAM_WRITE(airsys_paletteram16_w) AM_BASE_MEMBER(taitoair_state, paletteram) AM_RANGE(0x800000, 0x820fff) AM_DEVREADWRITE("tc0080vco", tc0080vco_word_r, tc0080vco_word_w) /* tilemaps, sprites */ - AM_RANGE(0x908000, 0x90ffff) AM_RAM AM_BASE(&taitoair_line_ram) /* "line ram" */ - AM_RANGE(0x910000, 0x91ffff) AM_RAM AM_BASE(&dsp_ram) /* "dsp common ram" (TMS320C25) */ + AM_RANGE(0x908000, 0x90ffff) AM_RAM AM_BASE_MEMBER(taitoair_state, line_ram) /* "line ram" */ + AM_RANGE(0x910000, 0x91ffff) AM_RAM AM_BASE_MEMBER(taitoair_state, dsp_ram) /* "dsp common ram" (TMS320C25) */ AM_RANGE(0xa00000, 0xa00007) AM_READ(stick_input_r) AM_RANGE(0xa00100, 0xa00107) AM_READ(stick2_input_r) AM_RANGE(0xa00200, 0xa0020f) AM_DEVREADWRITE8("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff) /* other I/O */ @@ -580,9 +569,10 @@ GFXDECODE_END ************************************************************/ /* Handler called by the YM2610 emulator when the internal timers cause an IRQ */ -static void irqhandler(const device_config *device, int irq) +static void irqhandler( const device_config *device, int irq ) { - cputag_set_input_line(device->machine, "audiocpu", 0, irq ? ASSERT_LINE : CLEAR_LINE); + taitoair_state *state = (taitoair_state *)device->machine->driver_data; + cpu_set_input_line(state->audiocpu, 0, irq ? ASSERT_LINE : CLEAR_LINE); } static const ym2610_interface airsys_ym2610_interface = @@ -613,8 +603,64 @@ static const tc0140syt_interface airsys_tc0140syt_intf = "maincpu", "audiocpu" }; +static STATE_POSTLOAD( taitoair_postload ) +{ + reset_sound_region(machine); +} + +static MACHINE_START( taitoair ) +{ + taitoair_state *state = (taitoair_state *)machine->driver_data; + UINT8 *ROM = memory_region(machine, "audiocpu"); + int i; + + memory_configure_bank(machine, "bank1", 0, 3, &ROM[0x10000], 0x4000); + + state->audiocpu = devtag_get_device(machine, "audiocpu"); + state->dsp = devtag_get_device(machine, "dsp"); + state->tc0080vco = devtag_get_device(machine, "tc0080vco"); + + state_save_register_global(machine, state->banknum); + state_save_register_global(machine, state->view.x1); + state_save_register_global(machine, state->view.y1); + state_save_register_global(machine, state->view.x2); + state_save_register_global(machine, state->view.y2); + state_save_register_global(machine, state->q.col); + state_save_register_global(machine, state->q.pcount); + + for (i = 0; i < TAITOAIR_POLY_MAX_PT; i++) + { + state_save_register_item(machine, "globals", NULL, i, state->q.p[i].x); + state_save_register_item(machine, "globals", NULL, i, state->q.p[i].y); + } + + state_save_register_postload(machine, taitoair_postload, NULL); +} + +static MACHINE_RESET( taitoair ) +{ + taitoair_state *state = (taitoair_state *)machine->driver_data; + int i; + + state->dsp_hold_signal = ASSERT_LINE; + state->banknum = -1; + state->view.x1 = 0; + state->view.y1 = 0; + state->view.x2 = 0; + state->view.y2 = 0; + + for (i = 0; i < TAITOAIR_POLY_MAX_PT; i++) + { + state->q.p[i].x = 0; + state->q.p[i].y = 0; + } +} + static MACHINE_DRIVER_START( airsys ) + /* driver data */ + MDRV_DRIVER_DATA(taitoair_state) + /* basic machine hardware */ MDRV_CPU_ADD("maincpu", M68000,24000000 / 2) /* 12 MHz ??? */ MDRV_CPU_PROGRAM_MAP(airsys_map) @@ -631,6 +677,7 @@ static MACHINE_DRIVER_START( airsys ) MDRV_QUANTUM_TIME(HZ(600)) MDRV_MACHINE_START(taitoair) + MDRV_MACHINE_RESET(taitoair) MDRV_TC0220IOC_ADD("tc0220ioc", airsys_io_intf) diff --git a/src/mame/includes/taito_b.h b/src/mame/includes/taito_b.h index d5faddbbbad..29107d849ba 100644 --- a/src/mame/includes/taito_b.h +++ b/src/mame/includes/taito_b.h @@ -1,20 +1,51 @@ + +typedef struct _taitob_state taitob_state; +struct _taitob_state +{ + /* memory pointers */ + UINT16 * spriteram; + UINT16 * pixelram; +// UINT16 * paletteram; // this currently uses generic palette handlers + + /* video-related */ + /* framebuffer is a raw bitmap, remapped as a last step */ + bitmap_t *framebuffer[2], *pixel_bitmap; + + UINT16 pixel_scroll[2]; + + int b_fg_color_base; + int b_sp_color_base; + + /* misc */ + UINT16 eep_latch; + UINT16 coin_word; + + /* devices */ + const device_config *maincpu; + const device_config *audiocpu; + const device_config *mb87078; + const device_config *ym; + const device_config *tc0180vcu; + const device_config *tc0640fio; + const device_config *tc0220ioc; +}; + + /*----------- defined in video/taito_b.c -----------*/ -extern UINT16 *taitob_spriteram; -extern UINT16 *taitob_pixelram; - -VIDEO_START( taitob_color_order0 ); -VIDEO_START( taitob_color_order1 ); -VIDEO_START( taitob_color_order2 ); -VIDEO_START( hitice ); -VIDEO_EOF( taitob ); - -VIDEO_RESET( hitice ); - -VIDEO_UPDATE( taitob ); - READ16_HANDLER( tc0180vcu_framebuffer_word_r ); WRITE16_HANDLER( tc0180vcu_framebuffer_word_w ); WRITE16_HANDLER( hitice_pixelram_w ); WRITE16_HANDLER( hitice_pixel_scroll_w ); + +VIDEO_START( taitob_color_order0 ); +VIDEO_START( taitob_color_order1 ); +VIDEO_START( taitob_color_order2 ); +VIDEO_START( hitice ); + +VIDEO_RESET( hitice ); + +VIDEO_UPDATE( taitob ); + +VIDEO_EOF( taitob ); diff --git a/src/mame/includes/taitoair.h b/src/mame/includes/taitoair.h new file mode 100644 index 00000000000..6e96a62c853 --- /dev/null +++ b/src/mame/includes/taitoair.h @@ -0,0 +1,49 @@ +/************************************************************************* + + Taito Air System + +*************************************************************************/ + +enum { TAITOAIR_FRAC_SHIFT = 16, TAITOAIR_POLY_MAX_PT = 16 }; + +struct taitoair_spoint { + INT32 x, y; +}; + +struct taitoair_poly { + struct taitoair_spoint p[TAITOAIR_POLY_MAX_PT]; + int pcount; + int col; +}; + + +typedef struct _taitoair_state taitoair_state; +struct _taitoair_state +{ + /* memory pointers */ + UINT16 * m68000_mainram; + UINT16 * line_ram; + UINT16 * dsp_ram; /* Shared 68000/TMS32025 RAM */ + UINT16 * paletteram; + + /* video-related */ + struct { + int x1, y1, x2, y2; + } view; + + taitoair_poly q; + + /* misc */ + int dsp_hold_signal; + INT32 banknum; + + /* devices */ + const device_config *audiocpu; + const device_config *dsp; + const device_config *tc0080vco; +}; + + +/*----------- defined in video/taitoair.c -----------*/ + +VIDEO_UPDATE( taitoair ); diff --git a/src/mame/video/taito_b.c b/src/mame/video/taito_b.c index 5e1adec2adf..83f077ecc8b 100644 --- a/src/mame/video/taito_b.c +++ b/src/mame/video/taito_b.c @@ -3,35 +3,26 @@ #include "video/taitoic.h" #include "includes/taito_b.h" -UINT16 *taitob_spriteram; -UINT16 *taitob_pixelram; - -/* framebuffer is a raw bitmap, remapped as a last step */ -static bitmap_t *framebuffer[2],*pixel_bitmap; - -static UINT16 pixel_scroll[2]; - -static int b_fg_color_base = 0; -static int b_sp_color_base = 0; - WRITE16_HANDLER( hitice_pixelram_w ) { + taitob_state *state = (taitob_state *)space->machine->driver_data; int sy = offset >> 9; int sx = offset & 0x1ff; - COMBINE_DATA(&taitob_pixelram[offset]); + COMBINE_DATA(&state->pixelram[offset]); if (ACCESSING_BITS_0_7) { /* bit 15 of pixel_scroll[0] is probably flip screen */ - *BITMAP_ADDR16(pixel_bitmap, sy, 2 * sx + 0) = b_fg_color_base * 16 + (data & 0xff); - *BITMAP_ADDR16(pixel_bitmap, sy, 2 * sx + 1) = b_fg_color_base * 16 + (data & 0xff); + *BITMAP_ADDR16(state->pixel_bitmap, sy, 2 * sx + 0) = state->b_fg_color_base * 16 + (data & 0xff); + *BITMAP_ADDR16(state->pixel_bitmap, sy, 2 * sx + 1) = state->b_fg_color_base * 16 + (data & 0xff); } } WRITE16_HANDLER( hitice_pixel_scroll_w ) { - COMBINE_DATA(&pixel_scroll[offset]); + taitob_state *state = (taitob_state *)space->machine->driver_data; + COMBINE_DATA(&state->pixel_scroll[offset]); } static void hitice_clear_pixel_bitmap( running_machine *machine ) @@ -46,14 +37,16 @@ static void hitice_clear_pixel_bitmap( running_machine *machine ) static VIDEO_START( taitob_core ) { - framebuffer[0] = auto_bitmap_alloc(machine, 512, 256, video_screen_get_format(machine->primary_screen)); - framebuffer[1] = auto_bitmap_alloc(machine, 512, 256, video_screen_get_format(machine->primary_screen)); - pixel_bitmap = NULL; /* only hitice needs this */ + taitob_state *state = (taitob_state *)machine->driver_data; - state_save_register_global_array(machine, pixel_scroll); + state->framebuffer[0] = auto_bitmap_alloc(machine, 512, 256, video_screen_get_format(machine->primary_screen)); + state->framebuffer[1] = auto_bitmap_alloc(machine, 512, 256, video_screen_get_format(machine->primary_screen)); + state->pixel_bitmap = NULL; /* only hitice needs this */ - state_save_register_global_bitmap(machine, framebuffer[0]); - state_save_register_global_bitmap(machine, framebuffer[1]); + state_save_register_global_array(machine, state->pixel_scroll); + + state_save_register_global_bitmap(machine, state->framebuffer[0]); + state_save_register_global_bitmap(machine, state->framebuffer[1]); } VIDEO_START( taitob_color_order0 ) @@ -61,11 +54,10 @@ VIDEO_START( taitob_color_order0 ) /*graphics are shared, only that they use different palette*/ /*this is the basic layout used in: Nastar, Ashura Blaster, Hit the Ice, Rambo3, Tetris*/ - /*Note that in both this and color order 1 - * pixel_color_base/color_granularity is equal to sprites color base. - * Pure coincidence ?*/ + /*Note that in both this and color order 1 pixel_color_base/color_granularity is equal to sprites color base. Pure coincidence? */ - b_sp_color_base = 0x40 * 16; /*sprites */ + taitob_state *state = (taitob_state *)machine->driver_data; + state->b_sp_color_base = 0x40 * 16; /*sprites */ /* bg, fg, tx color_base are set in the tc0180vcu interface */ @@ -75,7 +67,8 @@ VIDEO_START( taitob_color_order0 ) VIDEO_START( taitob_color_order1 ) { /* this is the reversed layout used in: Crime City, Puzzle Bobble */ - b_sp_color_base = 0x80 * 16; + taitob_state *state = (taitob_state *)machine->driver_data; + state->b_sp_color_base = 0x80 * 16; VIDEO_START_CALL(taitob_core); } @@ -83,7 +76,8 @@ VIDEO_START( taitob_color_order1 ) VIDEO_START( taitob_color_order2 ) { /*this is used in: rambo3a, masterw, silentd, selfeena, ryujin */ - b_sp_color_base = 0x10 * 16; + taitob_state *state = (taitob_state *)machine->driver_data; + state->b_sp_color_base = 0x10 * 16; VIDEO_START_CALL(taitob_core); } @@ -91,13 +85,15 @@ VIDEO_START( taitob_color_order2 ) VIDEO_START( hitice ) { + taitob_state *state = (taitob_state *)machine->driver_data; + VIDEO_START_CALL(taitob_color_order0); - b_fg_color_base = 0x80; /* hitice also uses this for the pixel_bitmap */ + state->b_fg_color_base = 0x80; /* hitice also uses this for the pixel_bitmap */ - pixel_bitmap = auto_bitmap_alloc(machine, 1024, 512, video_screen_get_format(machine->primary_screen)); + state->pixel_bitmap = auto_bitmap_alloc(machine, 1024, 512, video_screen_get_format(machine->primary_screen)); - state_save_register_global_bitmap(machine, pixel_bitmap); + state_save_register_global_bitmap(machine, state->pixel_bitmap); } VIDEO_RESET( hitice ) @@ -109,21 +105,23 @@ VIDEO_RESET( hitice ) READ16_HANDLER( tc0180vcu_framebuffer_word_r ) { + taitob_state *state = (taitob_state *)space->machine->driver_data; int sy = offset >> 8; - int sx = 2*(offset & 0xff); + int sx = 2 * (offset & 0xff); - return (*BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 0) << 8) | *BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 1); + return (*BITMAP_ADDR16(state->framebuffer[sy >> 8], sy & 0xff, sx + 0) << 8) | *BITMAP_ADDR16(state->framebuffer[sy >> 8], sy & 0xff, sx + 1); } WRITE16_HANDLER( tc0180vcu_framebuffer_word_w ) { + taitob_state *state = (taitob_state *)space->machine->driver_data; int sy = offset >> 8; - int sx = 2*(offset & 0xff); + int sx = 2 * (offset & 0xff); if (ACCESSING_BITS_8_15) - *BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 0) = data >> 8; + *BITMAP_ADDR16(state->framebuffer[sy >> 8], sy & 0xff, sx + 0) = data >> 8; if (ACCESSING_BITS_0_7) - *BITMAP_ADDR16(framebuffer[sy >> 8], sy & 0xff, sx + 1) = data & 0xff; + *BITMAP_ADDR16(state->framebuffer[sy >> 8], sy & 0xff, sx + 1) = data & 0xff; } @@ -158,53 +156,54 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect 000c - 000f: unused */ + taitob_state *state = (taitob_state *)machine->driver_data; int x, y, xlatch = 0, ylatch = 0, x_no = 0, y_no = 0, x_num = 0, y_num = 0, big_sprite = 0; int offs, code, color, flipx, flipy; UINT32 data, zoomx, zoomy, zx, zy, zoomxlatch = 0, zoomylatch = 0; - for (offs = (0x1980-16)/2; offs >=0; offs -= 8) + for (offs = (0x1980 - 16) / 2; offs >=0; offs -= 8) { - code = taitob_spriteram[offs]; + code = state->spriteram[offs]; - color = taitob_spriteram[offs + 1]; + color = state->spriteram[offs + 1]; flipx = color & 0x4000; flipy = color & 0x8000; #if 0 /*check the unknown bits*/ if (color & 0x3fc0) { - logerror("sprite color (taitob)=%4x ofs=%4x\n",color,offs); - color = rand()&0x3f; + logerror("sprite color (taitob)=%4x ofs=%4x\n", color, offs); + color = rand() & 0x3f; } #endif color = (color & 0x3f) * 16; - x = taitob_spriteram[offs + 2] & 0x3ff; - y = taitob_spriteram[offs + 3] & 0x3ff; + x = state->spriteram[offs + 2] & 0x3ff; + y = state->spriteram[offs + 3] & 0x3ff; if (x >= 0x200) x -= 0x400; if (y >= 0x200) y -= 0x400; - data = taitob_spriteram[offs + 5]; + data = state->spriteram[offs + 5]; if (data) { if (!big_sprite) { x_num = (data >> 8) & 0xff; - y_num = (data) & 0xff; + y_num = (data >> 0) & 0xff; x_no = 0; y_no = 0; xlatch = x; ylatch = y; - data = taitob_spriteram[offs + 4]; + data = state->spriteram[offs + 4]; zoomxlatch = (data >> 8) & 0xff; - zoomylatch = (data) & 0xff; + zoomylatch = (data >> 0) & 0xff; big_sprite = 1; } } - data = taitob_spriteram[offs+4]; + data = state->spriteram[offs + 4]; zoomx = (data >> 8) & 0xff; - zoomy = (data) & 0xff; + zoomy = (data >> 0) & 0xff; zx = (0x100 - zoomx) / 16; zy = (0x100 - zoomy) / 16; @@ -215,8 +214,8 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect x = xlatch + x_no * (0x100 - zoomx) / 16; y = ylatch + y_no * (0x100 - zoomy) / 16; - zx = xlatch + (x_no+1) * (0x100 - zoomx) / 16 - x; - zy = ylatch + (y_no+1) * (0x100 - zoomy) / 16 - y; + zx = xlatch + (x_no + 1) * (0x100 - zoomx) / 16 - x; + zy = ylatch + (y_no + 1) * (0x100 - zoomy) / 16 - y; y_no++; if (y_no > y_num) @@ -253,11 +252,11 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect static void draw_framebuffer( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority ) { - const device_config *tc0180vcu = devtag_get_device(machine, "tc0180vcu"); + taitob_state *state = (taitob_state *)machine->driver_data; rectangle myclip = *cliprect; int x, y; - UINT8 video_control = tc0180vcu_get_videoctrl(tc0180vcu, 0); - UINT8 framebuffer_page = tc0180vcu_get_fb_page(tc0180vcu, 0); + UINT8 video_control = tc0180vcu_get_videoctrl(state->tc0180vcu, 0); + UINT8 framebuffer_page = tc0180vcu_get_fb_page(state->tc0180vcu, 0); profiler_mark_start(PROFILER_USER1); @@ -276,7 +275,7 @@ profiler_mark_start(PROFILER_USER1); /*popmessage("1. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ for (y = myclip.min_y; y <= myclip.max_y; y++) { - UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); + UINT16 *src = BITMAP_ADDR16(state->framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *dst; dst = BITMAP_ADDR16(bitmap, bitmap->height-1-y, myclip.max_x); @@ -286,7 +285,7 @@ profiler_mark_start(PROFILER_USER1); UINT16 c = *src++; if (c != 0) - *dst = b_sp_color_base + c; + *dst = state->b_sp_color_base + c; dst--; } @@ -296,7 +295,7 @@ profiler_mark_start(PROFILER_USER1); { for (y = myclip.min_y; y <= myclip.max_y; y++) { - UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); + UINT16 *src = BITMAP_ADDR16(state->framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *dst = BITMAP_ADDR16(bitmap, y, myclip.min_x); for (x = myclip.min_x; x <= myclip.max_x; x++) @@ -304,7 +303,7 @@ profiler_mark_start(PROFILER_USER1); UINT16 c = *src++; if (c != 0) - *dst = b_sp_color_base + c; + *dst = state->b_sp_color_base + c; dst++; } @@ -318,7 +317,7 @@ profiler_mark_start(PROFILER_USER1); /*popmessage("3. X[%3i;%3i] Y[%3i;%3i]", myclip.min_x, myclip.max_x, myclip.min_y, myclip.max_y);*/ for (y = myclip.min_y ;y <= myclip.max_y; y++) { - UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); + UINT16 *src = BITMAP_ADDR16(state->framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *dst; dst = BITMAP_ADDR16(bitmap, bitmap->height-1-y, myclip.max_x); @@ -328,7 +327,7 @@ profiler_mark_start(PROFILER_USER1); UINT16 c = *src++; if (c != 0 && (c & 0x10) == priority) - *dst = b_sp_color_base + c; + *dst = state->b_sp_color_base + c; dst--; } @@ -338,7 +337,7 @@ profiler_mark_start(PROFILER_USER1); { for (y = myclip.min_y; y <= myclip.max_y; y++) { - UINT16 *src = BITMAP_ADDR16(framebuffer[framebuffer_page], y, myclip.min_x); + UINT16 *src = BITMAP_ADDR16(state->framebuffer[framebuffer_page], y, myclip.min_x); UINT16 *dst = BITMAP_ADDR16(bitmap, y, myclip.min_x); for (x = myclip.min_x; x <= myclip.max_x; x++) @@ -346,7 +345,7 @@ profiler_mark_start(PROFILER_USER1); UINT16 c = *src++; if (c != 0 && (c & 0x10) == priority) - *dst = b_sp_color_base + c; + *dst = state->b_sp_color_base + c; dst++; } @@ -358,8 +357,8 @@ profiler_mark_end(); VIDEO_UPDATE( taitob ) { - const device_config *tc0180vcu = devtag_get_device(screen->machine, "tc0180vcu"); - UINT8 video_control = tc0180vcu_get_videoctrl(tc0180vcu, 0); + taitob_state *state = (taitob_state *)screen->machine->driver_data; + UINT8 video_control = tc0180vcu_get_videoctrl(state->tc0180vcu, 0); if ((video_control & 0x20) == 0) { @@ -368,24 +367,24 @@ VIDEO_UPDATE( taitob ) } /* Draw playfields */ - tc0180vcu_tilemap_draw(tc0180vcu, bitmap, cliprect, 0, 1); + tc0180vcu_tilemap_draw(state->tc0180vcu, bitmap, cliprect, 0, 1); draw_framebuffer(screen->machine, bitmap, cliprect, 1); - tc0180vcu_tilemap_draw(tc0180vcu, bitmap, cliprect, 1, 0); + tc0180vcu_tilemap_draw(state->tc0180vcu, bitmap, cliprect, 1, 0); - if (pixel_bitmap) /* hitice only */ + if (state->pixel_bitmap) /* hitice only */ { - int scrollx = -2 * pixel_scroll[0]; //+320; - int scrolly = - pixel_scroll[1]; //+240; + int scrollx = -2 * state->pixel_scroll[0]; //+320; + int scrolly = - state->pixel_scroll[1]; //+240; /* bit 15 of pixel_scroll[0] is probably flip screen */ - copyscrollbitmap_trans(bitmap, pixel_bitmap, 1, &scrollx, 1, &scrolly, cliprect, b_fg_color_base * 16); + copyscrollbitmap_trans(bitmap, state->pixel_bitmap, 1, &scrollx, 1, &scrolly, cliprect, state->b_fg_color_base * 16); } draw_framebuffer(screen->machine, bitmap, cliprect, 0); - tc0180vcu_tilemap_draw(tc0180vcu, bitmap, cliprect, 2, 0); + tc0180vcu_tilemap_draw(state->tc0180vcu, bitmap, cliprect, 2, 0); return 0; } @@ -394,18 +393,18 @@ VIDEO_UPDATE( taitob ) VIDEO_EOF( taitob ) { - const device_config *tc0180vcu = devtag_get_device(machine, "tc0180vcu"); - UINT8 video_control = tc0180vcu_get_videoctrl(tc0180vcu, 0); - UINT8 framebuffer_page = tc0180vcu_get_fb_page(tc0180vcu, 0); + taitob_state *state = (taitob_state *)machine->driver_data; + UINT8 video_control = tc0180vcu_get_videoctrl(state->tc0180vcu, 0); + UINT8 framebuffer_page = tc0180vcu_get_fb_page(state->tc0180vcu, 0); if (~video_control & 0x01) - bitmap_fill(framebuffer[framebuffer_page], video_screen_get_visible_area(machine->primary_screen), 0); + bitmap_fill(state->framebuffer[framebuffer_page], video_screen_get_visible_area(machine->primary_screen), 0); if (~video_control & 0x80) { framebuffer_page ^= 1; - tc0180vcu_set_fb_page(tc0180vcu, 0, framebuffer_page); + tc0180vcu_set_fb_page(state->tc0180vcu, 0, framebuffer_page); } - draw_sprites(machine, framebuffer[framebuffer_page], video_screen_get_visible_area(machine->primary_screen)); + draw_sprites(machine, state->framebuffer[framebuffer_page], video_screen_get_visible_area(machine->primary_screen)); } diff --git a/src/mame/video/taitoair.c b/src/mame/video/taitoair.c index 0ad16362b84..b8b815835ac 100644 --- a/src/mame/video/taitoair.c +++ b/src/mame/video/taitoair.c @@ -46,7 +46,8 @@ sprite RAM ***************************************************************************/ #include "driver.h" -#include "taitoic.h" +#include "video/taitoic.h" +#include "includes/taitoair.h" /* These are hand-tuned values */ @@ -68,12 +69,12 @@ static const int zoomy_conv_table[] = Screen refresh ***************************************************************************/ -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) +static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority ) { - const device_config *tc0080vco = devtag_get_device(machine, "tc0080vco"); /* Y chain size is 16/32?/64/64? pixels. X chain size is always 64 pixels. */ + taitoair_state *state = (taitoair_state *)machine->driver_data; static const int size[] = { 1, 2, 4, 4 }; int x0, y0, x, y, dx, dy, ex, ey, zx, zy; int ysize; @@ -87,12 +88,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta if (offs < 0x01b0 && priority == 0) continue; if (offs >= 0x01b0 && priority == 1) continue; - x0 = tc0080vco_sprram_r(tc0080vco, offs + 1, 0xffff) & 0x3ff; - y0 = tc0080vco_sprram_r(tc0080vco, offs + 0, 0xffff) & 0x3ff; - zoomx = (tc0080vco_sprram_r(tc0080vco, offs + 2, 0xffff) & 0x7f00) >> 8; - zoomy = (tc0080vco_sprram_r(tc0080vco, offs + 2, 0xffff) & 0x007f); - tile_offs = (tc0080vco_sprram_r(tc0080vco, offs + 3, 0xffff) & 0x1fff) << 2; - ysize = size[(tc0080vco_sprram_r(tc0080vco, offs, 0xffff) & 0x0c00) >> 10]; + x0 = tc0080vco_sprram_r(state->tc0080vco, offs + 1, 0xffff) & 0x3ff; + y0 = tc0080vco_sprram_r(state->tc0080vco, offs + 0, 0xffff) & 0x3ff; + zoomx = (tc0080vco_sprram_r(state->tc0080vco, offs + 2, 0xffff) & 0x7f00) >> 8; + zoomy = (tc0080vco_sprram_r(state->tc0080vco, offs + 2, 0xffff) & 0x007f); + tile_offs = (tc0080vco_sprram_r(state->tc0080vco, offs + 3, 0xffff) & 0x1fff) << 2; + ysize = size[(tc0080vco_sprram_r(state->tc0080vco, offs, 0xffff) & 0x0c00) >> 10]; if (tile_offs) { @@ -128,7 +129,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta if (x0 >= 0x200) x0 -= 0x400; if (y0 >= 0x200) y0 -= 0x400; - if (tc0080vco_flipscreen_r(tc0080vco)) + if (tc0080vco_flipscreen_r(state->tc0080vco)) { x0 = 497 - x0; y0 = 498 - y0; @@ -151,12 +152,12 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta { int tile, color, flipx, flipy; - tile = tc0080vco_cram_0_r(tc0080vco, tile_offs, 0xffff) & 0x7fff; - color = tc0080vco_cram_1_r(tc0080vco, tile_offs, 0xffff) & 0x001f; - flipx = tc0080vco_cram_1_r(tc0080vco, tile_offs, 0xffff) & 0x0040; - flipy = tc0080vco_cram_1_r(tc0080vco, tile_offs, 0xffff) & 0x0080; + tile = tc0080vco_cram_0_r(state->tc0080vco, tile_offs, 0xffff) & 0x7fff; + color = tc0080vco_cram_1_r(state->tc0080vco, tile_offs, 0xffff) & 0x001f; + flipx = tc0080vco_cram_1_r(state->tc0080vco, tile_offs, 0xffff) & 0x0040; + flipy = tc0080vco_cram_1_r(state->tc0080vco, tile_offs, 0xffff) & 0x0080; - if (tc0080vco_flipscreen_r(tc0080vco)) + if (tc0080vco_flipscreen_r(state->tc0080vco)) { flipx ^= 0x0040; flipy ^= 0x0080; @@ -180,50 +181,37 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta } } -extern UINT16 *taitoair_line_ram; - -enum { FRAC_SHIFT = 16, POLY_MAX_PT = 16 }; - -static struct { - int x1, y1, x2, y2; -} view; - -struct spoint { - INT32 x, y; -}; - -struct poly { - struct spoint p[POLY_MAX_PT]; - int pcount; - int col; -}; - -static void fill_slope(bitmap_t *bitmap, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2) +static void fill_slope( running_machine *machine, bitmap_t *bitmap, int color, INT32 x1, INT32 x2, INT32 sl1, INT32 sl2, INT32 y1, INT32 y2, INT32 *nx1, INT32 *nx2 ) { - if(y1 > view.y2) + taitoair_state *state = (taitoair_state *)machine->driver_data; + + if (y1 > state->view.y2) return; - if(y2 <= view.y1) { - int delta = y2-y1; - *nx1 = x1+delta*sl1; - *nx2 = x2+delta*sl2; + if (y2 <= state->view.y1) + { + int delta = y2 - y1; + *nx1 = x1 + delta * sl1; + *nx2 = x2 + delta * sl2; return; } - if(y1 < -1000000 || y1 > 1000000) + if (y1 < -1000000 || y1 > 1000000) return; - if(y2 > view.y2) - y2 = view.y2+1; + if (y2 > state->view.y2) + y2 = state->view.y2 + 1; - if(y1 < view.y1) { - int delta = view.y1 - y1; - x1 += delta*sl1; - x2 += delta*sl2; - y1 = view.y1; + if (y1 < state->view.y1) + { + int delta = state->view.y1 - y1; + x1 += delta * sl1; + x2 += delta * sl2; + y1 = state->view.y1; } - if(x1 > x2 || (x1==x2 && sl1 > sl2)) { + if (x1 > x2 || (x1==x2 && sl1 > sl2)) + { INT32 t, *tp; t = x1; x1 = x2; @@ -236,22 +224,26 @@ static void fill_slope(bitmap_t *bitmap, int color, INT32 x1, INT32 x2, INT32 sl nx2 = tp; } - while(y1 < y2) { - if(y1 >= view.y1) { - int xx1 = x1>>FRAC_SHIFT; - int xx2 = x2>>FRAC_SHIFT; - if(xx1 <= view.x2 || xx2 >= view.x1) { - if(xx1 < view.x1) - xx1 = view.x1; - if(xx2 > view.x2) - xx2 = view.x2; + while (y1 < y2) + { + if (y1 >= state->view.y1) + { + int xx1 = x1 >> TAITOAIR_FRAC_SHIFT; + int xx2 = x2 >> TAITOAIR_FRAC_SHIFT; + if (xx1 <= state->view.x2 || xx2 >= state->view.x1) + { + if (xx1 < state->view.x1) + xx1 = state->view.x1; + if (xx2 > state->view.x2) + xx2 = state->view.x2; - while(xx1 <= xx2) { - *BITMAP_ADDR16(bitmap, y1, xx1) = color; - xx1++; + while (xx1 <= xx2) + { + *BITMAP_ADDR16(bitmap, y1, xx1) = color; + xx1++; + } } } - } x1 += sl1; x2 += sl2; @@ -261,144 +253,153 @@ static void fill_slope(bitmap_t *bitmap, int color, INT32 x1, INT32 x2, INT32 sl *nx2 = x2; } -static void fill_poly(bitmap_t *bitmap, const struct poly *q) +static void fill_poly( running_machine *machine, bitmap_t *bitmap, const struct taitoair_poly *q ) { + taitoair_state *state = (taitoair_state *)machine->driver_data; INT32 sl1, sl2, cury, limy, x1, x2; int pmin, pmax, i, ps1, ps2; - struct spoint p[POLY_MAX_PT*2]; + struct taitoair_spoint p[TAITOAIR_POLY_MAX_PT * 2]; int color = q->col; int pcount = q->pcount; - for(i=0; ip[i].x << FRAC_SHIFT; - p[i].y = p[i+pcount].y = q->p[i].y; + for (i = 0; i < pcount; i++) + { + p[i].x = p[i + pcount].x = q->p[i].x << TAITOAIR_FRAC_SHIFT; + p[i].y = p[i + pcount].y = q->p[i].y; } pmin = pmax = 0; - for(i=1; i p[pmax].y) + if (p[i].y > p[pmax].y) pmax = i; } cury = p[pmin].y; limy = p[pmax].y; - if(cury == limy) + if (cury == limy) return; - if(cury > view.y2) + if (cury > state->view.y2) return; - if(limy <= view.y1) + if (limy <= state->view.y1) return; - if(limy > view.y2) - limy = view.y2; + if (limy > state->view.y2) + limy = state->view.y2; - ps1 = pmin+pcount; + ps1 = pmin + pcount; ps2 = pmin; goto startup; - for(;;) { - if(p[ps1-1].y == p[ps2+1].y) { - fill_slope(bitmap, color, x1, x2, sl1, sl2, cury, p[ps1-1].y, &x1, &x2); - cury = p[ps1-1].y; - if(cury >= limy) + for (;;) + { + if (p[ps1 - 1].y == p[ps2 + 1].y) + { + fill_slope(machine, bitmap, color, x1, x2, sl1, sl2, cury, p[ps1 - 1].y, &x1, &x2); + cury = p[ps1 - 1].y; + if (cury >= limy) break; ps1--; ps2++; startup: - while(p[ps1-1].y == cury) + while (p[ps1 - 1].y == cury) ps1--; - while(p[ps2+1].y == cury) + while (p[ps2 + 1].y == cury) ps2++; x1 = p[ps1].x; x2 = p[ps2].x; - sl1 = (x1-p[ps1-1].x)/(cury-p[ps1-1].y); - sl2 = (x2-p[ps2+1].x)/(cury-p[ps2+1].y); - } else if(p[ps1-1].y < p[ps2+1].y) { - fill_slope(bitmap, color, x1, x2, sl1, sl2, cury, p[ps1-1].y, &x1, &x2); - cury = p[ps1-1].y; - if(cury >= limy) + sl1 = (x1 - p[ps1 - 1].x) / (cury - p[ps1 - 1].y); + sl2 = (x2 - p[ps2 + 1].x) / (cury - p[ps2 + 1].y); + } + else if (p[ps1 - 1].y < p[ps2 + 1].y) + { + fill_slope(machine, bitmap, color, x1, x2, sl1, sl2, cury, p[ps1 - 1].y, &x1, &x2); + cury = p[ps1 - 1].y; + if (cury >= limy) break; ps1--; - while(p[ps1-1].y == cury) + while (p[ps1 - 1].y == cury) ps1--; x1 = p[ps1].x; - sl1 = (x1-p[ps1-1].x)/(cury-p[ps1-1].y); - } else { - fill_slope(bitmap, color, x1, x2, sl1, sl2, cury, p[ps2+1].y, &x1, &x2); - cury = p[ps2+1].y; - if(cury >= limy) + sl1 = (x1 - p[ps1 - 1].x) / (cury - p[ps1 - 1].y); + } + else + { + fill_slope(machine, bitmap, color, x1, x2, sl1, sl2, cury, p[ps2 + 1].y, &x1, &x2); + cury = p[ps2 + 1].y; + if (cury >= limy) break; ps2++; - while(p[ps2+1].y == cury) + while (p[ps2 + 1].y == cury) ps2++; x2 = p[ps2].x; - sl2 = (x2-p[ps2+1].x)/(cury-p[ps2+1].y); + sl2 = (x2 - p[ps2 + 1].x) / (cury - p[ps2 + 1].y); } } } VIDEO_UPDATE( taitoair ) { - const device_config *tc0080vco = devtag_get_device(screen->machine, "tc0080vco"); + taitoair_state *state = (taitoair_state *)screen->machine->driver_data; - tc0080vco_tilemap_update(tc0080vco); + tc0080vco_tilemap_update(state->tc0080vco); bitmap_fill(bitmap, cliprect, 0x41); #ifdef MAME_DEBUG - if ( !input_code_pressed(screen->machine, KEYCODE_A) ) - tc0080vco_tilemap_draw(tc0080vco, bitmap, cliprect, 0, 0, 0); - if ( !input_code_pressed(screen->machine, KEYCODE_S) ) + if (!input_code_pressed(screen->machine, KEYCODE_A)) + tc0080vco_tilemap_draw(state->tc0080vco, bitmap, cliprect, 0, 0, 0); + if (!input_code_pressed(screen->machine, KEYCODE_S)) draw_sprites(screen->machine, bitmap, cliprect, 0); - if ( !input_code_pressed(screen->machine, KEYCODE_D) ) - tc0080vco_tilemap_draw(tc0080vco, bitmap, cliprect, 1, 0, 0); - if ( !input_code_pressed(screen->machine, KEYCODE_F) ) + if (!input_code_pressed(screen->machine, KEYCODE_D)) + tc0080vco_tilemap_draw(state->tc0080vco, bitmap, cliprect, 1, 0, 0); + if (!input_code_pressed(screen->machine, KEYCODE_F)) draw_sprites(screen->machine, bitmap, cliprect, 1); #else - tc0080vco_tilemap_draw(tc0080vco, bitmap, cliprect, 0, 0, 0); + tc0080vco_tilemap_draw(state->tc0080vco, bitmap, cliprect, 0, 0, 0); draw_sprites(screen->machine, bitmap, cliprect, 0); - tc0080vco_tilemap_draw(tc0080vco, bitmap, cliprect, 1, 0, 0); + tc0080vco_tilemap_draw(state->tc0080vco, bitmap, cliprect, 1, 0, 0); draw_sprites(screen->machine, bitmap, cliprect, 1); #endif - tc0080vco_tilemap_draw(tc0080vco, bitmap, cliprect, 2, 0, 0); + tc0080vco_tilemap_draw(state->tc0080vco, bitmap, cliprect, 2, 0, 0); - if (taitoair_line_ram[0x3fff]) + if (state->line_ram[0x3fff]) { int adr = 0x3fff; - struct poly q; - view.x1 = cliprect->min_x; - view.y1 = cliprect->min_y; - view.x2 = cliprect->max_x; - view.y2 = cliprect->max_y; +// struct taitoair_poly q; + state->view.x1 = cliprect->min_x; + state->view.y1 = cliprect->min_y; + state->view.x2 = cliprect->max_x; + state->view.y2 = cliprect->max_y; - while(adr>=0 && taitoair_line_ram[adr] && taitoair_line_ram[adr] != 0x4000) + while (adr >= 0 && state->line_ram[adr] && state->line_ram[adr] != 0x4000) { int pcount; - if(!(taitoair_line_ram[adr] & 0x8000) || adr < 10) + if (!(state->line_ram[adr] & 0x8000) || adr < 10) { - logerror("quad: unknown value %04x at %04x\n", taitoair_line_ram[adr], adr); + logerror("quad: unknown value %04x at %04x\n", state->line_ram[adr], adr); break; } - q.col = (taitoair_line_ram[adr] & 0x7fff) + 0x300; + state->q.col = (state->line_ram[adr] & 0x7fff) + 0x300; adr--; pcount = 0; - while(pcount < POLY_MAX_PT && adr>=1 && !(taitoair_line_ram[adr] & 0xc000)) + while (pcount < TAITOAIR_POLY_MAX_PT && adr >= 1 && !(state->line_ram[adr] & 0xc000)) { - q.p[pcount].y = taitoair_line_ram[adr]+3*16; - q.p[pcount].x = taitoair_line_ram[adr-1]; + state->q.p[pcount].y = state->line_ram[adr] + 3 * 16; + state->q.p[pcount].x = state->line_ram[adr - 1]; pcount++; adr -= 2; } adr--; - q.pcount = pcount; - fill_poly(bitmap, &q); + state->q.pcount = pcount; + fill_poly(screen->machine, bitmap, &state->q); } } return 0;