trunk/src/mame/drivers/tankbatt.c
| r244699 | r244700 | |
| 62 | 62 | #include "includes/tankbatt.h" |
| 63 | 63 | |
| 64 | 64 | |
| 65 | | WRITE8_MEMBER(tankbatt_state::tankbatt_led_w) |
| 65 | void tankbatt_state::machine_start() |
| 66 | 66 | { |
| 67 | save_item(NAME(m_nmi_enable)); |
| 68 | save_item(NAME(m_sound_enable)); |
| 69 | } |
| 70 | |
| 71 | WRITE8_MEMBER(tankbatt_state::led_w) |
| 72 | { |
| 67 | 73 | set_led_status(machine(), offset,data & 1); |
| 68 | 74 | } |
| 69 | 75 | |
| 70 | | READ8_MEMBER(tankbatt_state::tankbatt_in0_r) |
| 76 | READ8_MEMBER(tankbatt_state::in0_r) |
| 71 | 77 | { |
| 72 | 78 | int val; |
| 73 | 79 | |
| r244699 | r244700 | |
| 75 | 81 | return ((val << (7 - offset)) & 0x80); |
| 76 | 82 | } |
| 77 | 83 | |
| 78 | | READ8_MEMBER(tankbatt_state::tankbatt_in1_r) |
| 84 | READ8_MEMBER(tankbatt_state::in1_r) |
| 79 | 85 | { |
| 80 | 86 | int val; |
| 81 | 87 | |
| r244699 | r244700 | |
| 83 | 89 | return ((val << (7 - offset)) & 0x80); |
| 84 | 90 | } |
| 85 | 91 | |
| 86 | | READ8_MEMBER(tankbatt_state::tankbatt_dsw_r) |
| 92 | READ8_MEMBER(tankbatt_state::dsw_r) |
| 87 | 93 | { |
| 88 | 94 | int val; |
| 89 | 95 | |
| r244699 | r244700 | |
| 91 | 97 | return ((val << (7 - offset)) & 0x80); |
| 92 | 98 | } |
| 93 | 99 | |
| 94 | | WRITE8_MEMBER(tankbatt_state::tankbatt_interrupt_enable_w) |
| 100 | WRITE8_MEMBER(tankbatt_state::interrupt_enable_w) |
| 95 | 101 | { |
| 96 | 102 | m_nmi_enable = !data; |
| 97 | 103 | m_sound_enable = !data; |
| r244699 | r244700 | |
| 100 | 106 | if (data) m_samples->stop(2); |
| 101 | 107 | } |
| 102 | 108 | |
| 103 | | WRITE8_MEMBER(tankbatt_state::tankbatt_demo_interrupt_enable_w) |
| 109 | WRITE8_MEMBER(tankbatt_state::demo_interrupt_enable_w) |
| 104 | 110 | { |
| 105 | 111 | m_nmi_enable = data; |
| 106 | 112 | } |
| 107 | 113 | |
| 108 | | WRITE8_MEMBER(tankbatt_state::tankbatt_sh_expl_w) |
| 114 | WRITE8_MEMBER(tankbatt_state::sh_expl_w) |
| 109 | 115 | { |
| 110 | 116 | if (m_sound_enable) |
| 111 | 117 | { |
| r244699 | r244700 | |
| 113 | 119 | } |
| 114 | 120 | } |
| 115 | 121 | |
| 116 | | WRITE8_MEMBER(tankbatt_state::tankbatt_sh_engine_w) |
| 122 | WRITE8_MEMBER(tankbatt_state::sh_engine_w) |
| 117 | 123 | { |
| 118 | 124 | if (m_sound_enable) |
| 119 | 125 | { |
| r244699 | r244700 | |
| 125 | 131 | else m_samples->stop(2); |
| 126 | 132 | } |
| 127 | 133 | |
| 128 | | WRITE8_MEMBER(tankbatt_state::tankbatt_sh_fire_w) |
| 134 | WRITE8_MEMBER(tankbatt_state::sh_fire_w) |
| 129 | 135 | { |
| 130 | 136 | if (m_sound_enable) |
| 131 | 137 | { |
| r244699 | r244700 | |
| 133 | 139 | } |
| 134 | 140 | } |
| 135 | 141 | |
| 136 | | WRITE8_MEMBER(tankbatt_state::tankbatt_irq_ack_w) |
| 142 | WRITE8_MEMBER(tankbatt_state::irq_ack_w) |
| 137 | 143 | { |
| 138 | 144 | /* 0x6e written at the end of the irq routine, could be either irq ack or a coin sample */ |
| 139 | 145 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 140 | 146 | } |
| 141 | 147 | |
| 142 | | WRITE8_MEMBER(tankbatt_state::tankbatt_coin_counter_w) |
| 148 | WRITE8_MEMBER(tankbatt_state::coincounter_w) |
| 143 | 149 | { |
| 144 | 150 | coin_counter_w(machine(), 0,data & 1); |
| 145 | 151 | coin_counter_w(machine(), 1,data & 1); |
| 146 | 152 | } |
| 147 | 153 | |
| 148 | | WRITE8_MEMBER(tankbatt_state::tankbatt_coin_lockout_w) |
| 154 | WRITE8_MEMBER(tankbatt_state::coinlockout_w) |
| 149 | 155 | { |
| 150 | 156 | coin_lockout_w(machine(), 0,data & 1); |
| 151 | 157 | coin_lockout_w(machine(), 1,data & 1); |
| r244699 | r244700 | |
| 155 | 161 | AM_RANGE(0x0000, 0x000f) AM_RAM AM_SHARE("bulletsram") |
| 156 | 162 | AM_RANGE(0x0010, 0x01ff) AM_RAM |
| 157 | 163 | AM_RANGE(0x0200, 0x07ff) AM_RAM |
| 158 | | AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(tankbatt_videoram_w) AM_SHARE("videoram") |
| 159 | | AM_RANGE(0x0c00, 0x0c07) AM_READ(tankbatt_in0_r) |
| 160 | | AM_RANGE(0x0c00, 0x0c01) AM_WRITE(tankbatt_led_w) |
| 161 | | AM_RANGE(0x0c02, 0x0c02) AM_WRITE(tankbatt_coin_counter_w) |
| 162 | | AM_RANGE(0x0c03, 0x0c03) AM_WRITE(tankbatt_coin_lockout_w) |
| 163 | | AM_RANGE(0x0c08, 0x0c0f) AM_READ(tankbatt_in1_r) |
| 164 | AM_RANGE(0x0800, 0x0bff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") |
| 165 | AM_RANGE(0x0c00, 0x0c07) AM_READ(in0_r) |
| 166 | AM_RANGE(0x0c00, 0x0c01) AM_WRITE(led_w) |
| 167 | AM_RANGE(0x0c02, 0x0c02) AM_WRITE(coincounter_w) |
| 168 | AM_RANGE(0x0c03, 0x0c03) AM_WRITE(coinlockout_w) |
| 169 | AM_RANGE(0x0c08, 0x0c0f) AM_READ(in1_r) |
| 164 | 170 | AM_RANGE(0x0c08, 0x0c08) AM_WRITENOP //coin counter mirror? |
| 165 | | AM_RANGE(0x0c0a, 0x0c0a) AM_WRITE(tankbatt_interrupt_enable_w) |
| 166 | | AM_RANGE(0x0c0b, 0x0c0b) AM_WRITE(tankbatt_sh_engine_w) |
| 167 | | AM_RANGE(0x0c0c, 0x0c0c) AM_WRITE(tankbatt_sh_fire_w) |
| 168 | | AM_RANGE(0x0c0d, 0x0c0d) AM_WRITE(tankbatt_sh_expl_w) // bit 7 == led for the start 2 button |
| 171 | AM_RANGE(0x0c0a, 0x0c0a) AM_WRITE(interrupt_enable_w) |
| 172 | AM_RANGE(0x0c0b, 0x0c0b) AM_WRITE(sh_engine_w) |
| 173 | AM_RANGE(0x0c0c, 0x0c0c) AM_WRITE(sh_fire_w) |
| 174 | AM_RANGE(0x0c0d, 0x0c0d) AM_WRITE(sh_expl_w) // bit 7 == led for the start 2 button |
| 169 | 175 | AM_RANGE(0x0c0e, 0x0c0e) AM_WRITENOP //bit 7 == led for the start 1 button |
| 170 | | AM_RANGE(0x0c0f, 0x0c0f) AM_WRITE(tankbatt_demo_interrupt_enable_w) |
| 171 | | AM_RANGE(0x0c10, 0x0c10) AM_WRITE(tankbatt_irq_ack_w) |
| 172 | | AM_RANGE(0x0c18, 0x0c1f) AM_READ(tankbatt_dsw_r) |
| 176 | AM_RANGE(0x0c0f, 0x0c0f) AM_WRITE(demo_interrupt_enable_w) |
| 177 | AM_RANGE(0x0c10, 0x0c10) AM_WRITE(irq_ack_w) |
| 178 | AM_RANGE(0x0c18, 0x0c1f) AM_READ(dsw_r) |
| 173 | 179 | AM_RANGE(0x0c18, 0x0c18) AM_WRITENOP /* watchdog ?? */ |
| 174 | 180 | AM_RANGE(0x6000, 0x7fff) AM_ROM AM_REGION("maincpu",0) |
| 175 | 181 | AM_RANGE(0xe000, 0xffff) AM_ROM AM_REGION("maincpu",0) //mirror for the reset/irq vectors |
| 176 | 182 | AM_RANGE(0x2000, 0xffff) AM_READNOP //anything else might be left-over for a diagnostic ROM or something related to the discrete sound HW |
| 177 | 183 | ADDRESS_MAP_END |
| 178 | 184 | |
| 179 | | INTERRUPT_GEN_MEMBER(tankbatt_state::tankbatt_interrupt) |
| 185 | INTERRUPT_GEN_MEMBER(tankbatt_state::interrupt) |
| 180 | 186 | { |
| 181 | 187 | if (m_nmi_enable) device.execute().set_input_line(INPUT_LINE_NMI,PULSE_LINE); |
| 182 | 188 | } |
| r244699 | r244700 | |
| 276 | 282 | /* basic machine hardware */ |
| 277 | 283 | MCFG_CPU_ADD("maincpu", M6502, 1000000) /* 1 MHz ???? */ |
| 278 | 284 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 279 | | MCFG_CPU_VBLANK_INT_DRIVER("screen", tankbatt_state, tankbatt_interrupt) |
| 285 | MCFG_CPU_VBLANK_INT_DRIVER("screen", tankbatt_state, interrupt) |
| 280 | 286 | |
| 281 | 287 | /* video hardware */ |
| 282 | 288 | MCFG_SCREEN_ADD("screen", RASTER) |
| r244699 | r244700 | |
| 284 | 290 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 285 | 291 | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 286 | 292 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 287 | | MCFG_SCREEN_UPDATE_DRIVER(tankbatt_state, screen_update_tankbatt) |
| 293 | MCFG_SCREEN_UPDATE_DRIVER(tankbatt_state, screen_update) |
| 288 | 294 | MCFG_SCREEN_PALETTE("palette") |
| 289 | 295 | |
| 290 | 296 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", tankbatt) |
| r244699 | r244700 | |
| 337 | 343 | ROM_LOAD( "bct1-1.l3", 0x0000, 0x0100, CRC(d17518bc) SHA1(f3b0deffa586808bc59e9a24ec1699c54ebe84cc) ) // dm74s287n.3l |
| 338 | 344 | ROM_END |
| 339 | 345 | |
| 340 | | GAME( 1980, tankbatt, 0, tankbatt, tankbatt, driver_device, 0, ROT90, "Namco", "Tank Battalion", GAME_IMPERFECT_SOUND ) |
| 341 | | GAME( 1980, tankbattb, tankbatt, tankbatt, tankbatt, driver_device, 0, ROT90, "bootleg", "Tank Battalion (bootleg)", GAME_IMPERFECT_SOUND ) |
| 346 | GAME( 1980, tankbatt, 0, tankbatt, tankbatt, driver_device, 0, ROT90, "Namco", "Tank Battalion", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 347 | GAME( 1980, tankbattb, tankbatt, tankbatt, tankbatt, driver_device, 0, ROT90, "bootleg", "Tank Battalion (bootleg)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
trunk/src/mame/drivers/tankbust.c
| r244699 | r244700 | |
| 26 | 26 | { |
| 27 | 27 | membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x4000); |
| 28 | 28 | membank("bank2")->configure_entries(0, 2, memregion("maincpu")->base() + 0x18000, 0x2000); |
| 29 | |
| 30 | save_item(NAME(m_latch)); |
| 31 | save_item(NAME(m_timer1)); |
| 32 | save_item(NAME(m_e0xx_data)); |
| 33 | save_item(NAME(m_variable_data)); |
| 34 | save_item(NAME(m_irq_mask)); |
| 29 | 35 | } |
| 30 | 36 | |
| 31 | 37 | //port A of ay8910#0 |
| r244699 | r244700 | |
| 35 | 41 | m_latch = param; |
| 36 | 42 | } |
| 37 | 43 | |
| 38 | | WRITE8_MEMBER(tankbust_state::tankbust_soundlatch_w) |
| 44 | WRITE8_MEMBER(tankbust_state::soundlatch_w) |
| 39 | 45 | { |
| 40 | 46 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(tankbust_state::soundlatch_callback),this), data); |
| 41 | 47 | } |
| 42 | 48 | |
| 43 | | READ8_MEMBER(tankbust_state::tankbust_soundlatch_r) |
| 49 | READ8_MEMBER(tankbust_state::soundlatch_r) |
| 44 | 50 | { |
| 45 | 51 | return m_latch; |
| 46 | 52 | } |
| 47 | 53 | |
| 48 | 54 | //port B of ay8910#0 |
| 49 | | READ8_MEMBER(tankbust_state::tankbust_soundtimer_r) |
| 55 | READ8_MEMBER(tankbust_state::soundtimer_r) |
| 50 | 56 | { |
| 51 | 57 | int ret; |
| 52 | 58 | |
| r244699 | r244700 | |
| 65 | 71 | |
| 66 | 72 | |
| 67 | 73 | |
| 68 | | WRITE8_MEMBER(tankbust_state::tankbust_e0xx_w) |
| 74 | WRITE8_MEMBER(tankbust_state::e0xx_w) |
| 69 | 75 | { |
| 70 | 76 | m_e0xx_data[offset] = data; |
| 71 | 77 | |
| r244699 | r244700 | |
| 183 | 189 | AM_RANGE(0x0000, 0x5fff) AM_ROM |
| 184 | 190 | AM_RANGE(0x6000, 0x9fff) AM_ROMBANK("bank1") |
| 185 | 191 | AM_RANGE(0xa000, 0xbfff) AM_ROMBANK("bank2") |
| 186 | | AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(tankbust_background_videoram_r, tankbust_background_videoram_w) AM_SHARE("videoram") |
| 187 | | AM_RANGE(0xc800, 0xcfff) AM_READWRITE(tankbust_background_colorram_r, tankbust_background_colorram_w) AM_SHARE("colorram") |
| 188 | | AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tankbust_txtram_r, tankbust_txtram_w) AM_SHARE("txtram") |
| 192 | AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(background_videoram_w) AM_SHARE("videoram") |
| 193 | AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(background_colorram_w) AM_SHARE("colorram") |
| 194 | AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(txtram_w) AM_SHARE("txtram") |
| 189 | 195 | AM_RANGE(0xd800, 0xd8ff) AM_RAM AM_SHARE("spriteram") |
| 190 | | AM_RANGE(0xe000, 0xe007) AM_READWRITE(debug_output_area_r, tankbust_e0xx_w) |
| 191 | | AM_RANGE(0xe800, 0xe800) AM_READ_PORT("INPUTS") AM_WRITE(tankbust_yscroll_w) |
| 196 | AM_RANGE(0xe000, 0xe007) AM_READWRITE(debug_output_area_r, e0xx_w) |
| 197 | AM_RANGE(0xe800, 0xe800) AM_READ_PORT("INPUTS") AM_WRITE(yscroll_w) |
| 192 | 198 | AM_RANGE(0xe801, 0xe801) AM_READ_PORT("SYSTEM") |
| 193 | 199 | AM_RANGE(0xe802, 0xe802) AM_READ_PORT("DSW") |
| 194 | | AM_RANGE(0xe801, 0xe802) AM_WRITE(tankbust_xscroll_w) |
| 195 | | AM_RANGE(0xe803, 0xe803) AM_READWRITE(some_changing_input, tankbust_soundlatch_w) /*unknown. Game expects this to change so this is not player input */ |
| 200 | AM_RANGE(0xe801, 0xe802) AM_WRITE(xscroll_w) |
| 201 | AM_RANGE(0xe803, 0xe803) AM_READWRITE(some_changing_input, soundlatch_w) /*unknown. Game expects this to change so this is not player input */ |
| 196 | 202 | AM_RANGE(0xe804, 0xe804) AM_WRITENOP /* watchdog ? ; written in long-lasting loops */ |
| 197 | 203 | AM_RANGE(0xf000, 0xf7ff) AM_RAM |
| 198 | 204 | //AM_RANGE(0xf800, 0xffff) AM_READ(read_from_unmapped_memory) /* a bug in game code ? */ |
| r244699 | r244700 | |
| 341 | 347 | MCFG_SCREEN_SIZE ( 64*8, 32*8 ) |
| 342 | 348 | MCFG_SCREEN_VISIBLE_AREA ( 16*8, 56*8-1, 1*8, 31*8-1 ) |
| 343 | 349 | // MCFG_SCREEN_VISIBLE_AREA ( 0*8, 64*8-1, 1*8, 31*8-1 ) |
| 344 | | MCFG_SCREEN_UPDATE_DRIVER(tankbust_state, screen_update_tankbust) |
| 350 | MCFG_SCREEN_UPDATE_DRIVER(tankbust_state, screen_update) |
| 345 | 351 | MCFG_SCREEN_PALETTE("palette") |
| 346 | 352 | |
| 347 | 353 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", tankbust ) |
| r244699 | r244700 | |
| 353 | 359 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 354 | 360 | |
| 355 | 361 | MCFG_SOUND_ADD("ay1", AY8910, XTAL_14_31818MHz/16) /* Verified on PCB */ |
| 356 | | MCFG_AY8910_PORT_A_READ_CB(READ8(tankbust_state, tankbust_soundlatch_r)) |
| 357 | | MCFG_AY8910_PORT_B_READ_CB(READ8(tankbust_state, tankbust_soundtimer_r)) |
| 362 | MCFG_AY8910_PORT_A_READ_CB(READ8(tankbust_state, soundlatch_r)) |
| 363 | MCFG_AY8910_PORT_B_READ_CB(READ8(tankbust_state, soundtimer_r)) |
| 358 | 364 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.10) |
| 359 | 365 | |
| 360 | 366 | MCFG_SOUND_ADD("ay2", AY8910, XTAL_14_31818MHz/16) /* Verified on PCB */ |
| r244699 | r244700 | |
| 409 | 415 | ROM_END |
| 410 | 416 | |
| 411 | 417 | |
| 412 | | GAME( 1985, tankbust, 0, tankbust, tankbust, driver_device, 0, ROT90, "Valadon Automation", "Tank Busters", 0 ) |
| 418 | GAME( 1985, tankbust, 0, tankbust, tankbust, driver_device, 0, ROT90, "Valadon Automation", "Tank Busters", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/tankbatt.h
| r244699 | r244700 | |
| 4 | 4 | public: |
| 5 | 5 | tankbatt_state(const machine_config &mconfig, device_type type, const char *tag) |
| 6 | 6 | : driver_device(mconfig, type, tag), |
| 7 | | m_bulletsram(*this, "bulletsram"), |
| 8 | | m_videoram(*this, "videoram"), |
| 9 | 7 | m_maincpu(*this, "maincpu"), |
| 10 | 8 | m_samples(*this, "samples"), |
| 11 | 9 | m_gfxdecode(*this, "gfxdecode"), |
| 12 | | m_palette(*this, "palette") { } |
| 10 | m_palette(*this, "palette"), |
| 11 | m_bulletsram(*this, "bulletsram"), |
| 12 | m_videoram(*this, "videoram") { } |
| 13 | 13 | |
| 14 | required_device<cpu_device> m_maincpu; |
| 15 | required_device<samples_device> m_samples; |
| 16 | required_device<gfxdecode_device> m_gfxdecode; |
| 17 | required_device<palette_device> m_palette; |
| 18 | |
| 14 | 19 | required_shared_ptr<UINT8> m_bulletsram; |
| 15 | 20 | required_shared_ptr<UINT8> m_videoram; |
| 21 | |
| 16 | 22 | int m_nmi_enable; |
| 17 | 23 | int m_sound_enable; |
| 18 | | |
| 19 | 24 | tilemap_t *m_bg_tilemap; |
| 20 | | DECLARE_WRITE8_MEMBER(tankbatt_led_w); |
| 21 | | DECLARE_READ8_MEMBER(tankbatt_in0_r); |
| 22 | | DECLARE_READ8_MEMBER(tankbatt_in1_r); |
| 23 | | DECLARE_READ8_MEMBER(tankbatt_dsw_r); |
| 24 | | DECLARE_WRITE8_MEMBER(tankbatt_interrupt_enable_w); |
| 25 | | DECLARE_WRITE8_MEMBER(tankbatt_demo_interrupt_enable_w); |
| 26 | | DECLARE_WRITE8_MEMBER(tankbatt_sh_expl_w); |
| 27 | | DECLARE_WRITE8_MEMBER(tankbatt_sh_engine_w); |
| 28 | | DECLARE_WRITE8_MEMBER(tankbatt_sh_fire_w); |
| 29 | | DECLARE_WRITE8_MEMBER(tankbatt_irq_ack_w); |
| 30 | | DECLARE_WRITE8_MEMBER(tankbatt_coin_counter_w); |
| 31 | | DECLARE_WRITE8_MEMBER(tankbatt_coin_lockout_w); |
| 32 | | DECLARE_WRITE8_MEMBER(tankbatt_videoram_w); |
| 25 | |
| 26 | DECLARE_WRITE8_MEMBER(led_w); |
| 27 | DECLARE_READ8_MEMBER(in0_r); |
| 28 | DECLARE_READ8_MEMBER(in1_r); |
| 29 | DECLARE_READ8_MEMBER(dsw_r); |
| 30 | DECLARE_WRITE8_MEMBER(interrupt_enable_w); |
| 31 | DECLARE_WRITE8_MEMBER(demo_interrupt_enable_w); |
| 32 | DECLARE_WRITE8_MEMBER(sh_expl_w); |
| 33 | DECLARE_WRITE8_MEMBER(sh_engine_w); |
| 34 | DECLARE_WRITE8_MEMBER(sh_fire_w); |
| 35 | DECLARE_WRITE8_MEMBER(irq_ack_w); |
| 36 | DECLARE_WRITE8_MEMBER(coincounter_w); |
| 37 | DECLARE_WRITE8_MEMBER(coinlockout_w); |
| 38 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 39 | |
| 40 | |
| 41 | INTERRUPT_GEN_MEMBER(interrupt); |
| 33 | 42 | DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); |
| 43 | |
| 34 | 44 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 45 | |
| 46 | virtual void machine_start(); |
| 35 | 47 | virtual void video_start(); |
| 36 | 48 | DECLARE_PALETTE_INIT(tankbatt); |
| 37 | | UINT32 screen_update_tankbatt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 38 | | INTERRUPT_GEN_MEMBER(tankbatt_interrupt); |
| 49 | |
| 50 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 39 | 51 | void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 40 | | required_device<cpu_device> m_maincpu; |
| 41 | | required_device<samples_device> m_samples; |
| 42 | | required_device<gfxdecode_device> m_gfxdecode; |
| 43 | | required_device<palette_device> m_palette; |
| 44 | 52 | }; |
trunk/src/mame/includes/tankbust.h
| r244699 | r244700 | |
| 3 | 3 | public: |
| 4 | 4 | tankbust_state(const machine_config &mconfig, device_type type, const char *tag) |
| 5 | 5 | : driver_device(mconfig, type, tag), |
| 6 | m_maincpu(*this, "maincpu"), |
| 7 | m_subcpu(*this, "sub"), |
| 8 | m_gfxdecode(*this, "gfxdecode"), |
| 9 | m_palette(*this, "palette"), |
| 6 | 10 | m_txtram(*this, "txtram"), |
| 7 | 11 | m_videoram(*this, "videoram"), |
| 8 | 12 | m_colorram(*this, "colorram"), |
| 9 | | m_spriteram(*this, "spriteram"), |
| 10 | | m_maincpu(*this, "maincpu"), |
| 11 | | m_subcpu(*this, "sub"), |
| 12 | | m_gfxdecode(*this, "gfxdecode"), |
| 13 | | m_palette(*this, "palette") { } |
| 13 | m_spriteram(*this, "spriteram") { } |
| 14 | 14 | |
| 15 | required_device<cpu_device> m_maincpu; |
| 16 | required_device<cpu_device> m_subcpu; |
| 17 | required_device<gfxdecode_device> m_gfxdecode; |
| 18 | required_device<palette_device> m_palette; |
| 19 | |
| 20 | required_shared_ptr<UINT8> m_txtram; |
| 21 | required_shared_ptr<UINT8> m_videoram; |
| 22 | required_shared_ptr<UINT8> m_colorram; |
| 23 | required_shared_ptr<UINT8> m_spriteram; |
| 24 | |
| 15 | 25 | int m_latch; |
| 16 | 26 | UINT32 m_timer1; |
| 17 | 27 | int m_e0xx_data[8]; |
| 18 | 28 | UINT8 m_variable_data; |
| 19 | | required_shared_ptr<UINT8> m_txtram; |
| 20 | | required_shared_ptr<UINT8> m_videoram; |
| 21 | | required_shared_ptr<UINT8> m_colorram; |
| 22 | 29 | tilemap_t *m_bg_tilemap; |
| 23 | 30 | tilemap_t *m_txt_tilemap; |
| 24 | 31 | UINT8 m_xscroll[2]; |
| 25 | 32 | UINT8 m_yscroll[2]; |
| 26 | | required_shared_ptr<UINT8> m_spriteram; |
| 27 | | |
| 28 | 33 | UINT8 m_irq_mask; |
| 29 | | DECLARE_WRITE8_MEMBER(tankbust_soundlatch_w); |
| 30 | | DECLARE_WRITE8_MEMBER(tankbust_e0xx_w); |
| 34 | |
| 35 | DECLARE_WRITE8_MEMBER(soundlatch_w); |
| 36 | DECLARE_WRITE8_MEMBER(e0xx_w); |
| 31 | 37 | DECLARE_READ8_MEMBER(debug_output_area_r); |
| 32 | 38 | DECLARE_READ8_MEMBER(read_from_unmapped_memory); |
| 33 | 39 | DECLARE_READ8_MEMBER(some_changing_input); |
| 34 | | DECLARE_WRITE8_MEMBER(tankbust_background_videoram_w); |
| 35 | | DECLARE_READ8_MEMBER(tankbust_background_videoram_r); |
| 36 | | DECLARE_WRITE8_MEMBER(tankbust_background_colorram_w); |
| 37 | | DECLARE_READ8_MEMBER(tankbust_background_colorram_r); |
| 38 | | DECLARE_WRITE8_MEMBER(tankbust_txtram_w); |
| 39 | | DECLARE_READ8_MEMBER(tankbust_txtram_r); |
| 40 | | DECLARE_WRITE8_MEMBER(tankbust_xscroll_w); |
| 41 | | DECLARE_WRITE8_MEMBER(tankbust_yscroll_w); |
| 42 | | DECLARE_READ8_MEMBER(tankbust_soundlatch_r); |
| 43 | | DECLARE_READ8_MEMBER(tankbust_soundtimer_r); |
| 40 | DECLARE_WRITE8_MEMBER(background_videoram_w); |
| 41 | DECLARE_WRITE8_MEMBER(background_colorram_w); |
| 42 | DECLARE_WRITE8_MEMBER(txtram_w); |
| 43 | DECLARE_WRITE8_MEMBER(xscroll_w); |
| 44 | DECLARE_WRITE8_MEMBER(yscroll_w); |
| 45 | DECLARE_READ8_MEMBER(soundlatch_r); |
| 46 | DECLARE_READ8_MEMBER(soundtimer_r); |
| 47 | |
| 44 | 48 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 45 | 49 | TILE_GET_INFO_MEMBER(get_txt_tile_info); |
| 50 | |
| 46 | 51 | virtual void machine_start(); |
| 47 | 52 | virtual void machine_reset(); |
| 48 | 53 | virtual void video_start(); |
| 49 | 54 | DECLARE_PALETTE_INIT(tankbust); |
| 50 | | UINT32 screen_update_tankbust(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 55 | |
| 56 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 57 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 58 | |
| 51 | 59 | INTERRUPT_GEN_MEMBER(vblank_irq); |
| 52 | 60 | TIMER_CALLBACK_MEMBER(soundlatch_callback); |
| 53 | 61 | TIMER_CALLBACK_MEMBER(soundirqline_callback); |
| 54 | | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 55 | | required_device<cpu_device> m_maincpu; |
| 56 | | required_device<cpu_device> m_subcpu; |
| 57 | | required_device<gfxdecode_device> m_gfxdecode; |
| 58 | | required_device<palette_device> m_palette; |
| 59 | 62 | }; |
trunk/src/mame/video/tankbatt.c
| r244699 | r244700 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | video.c |
| 3 | tankbatt.c |
| 4 | 4 | |
| 5 | 5 | Functions to emulate the video hardware of the machine. |
| 6 | 6 | |
| r244699 | r244700 | |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | | WRITE8_MEMBER(tankbatt_state::tankbatt_videoram_w) |
| 59 | WRITE8_MEMBER(tankbatt_state::videoram_w) |
| 60 | 60 | { |
| 61 | | UINT8 *videoram = m_videoram; |
| 62 | | videoram[offset] = data; |
| 61 | m_videoram[offset] = data; |
| 63 | 62 | m_bg_tilemap->mark_tile_dirty(offset); |
| 64 | 63 | } |
| 65 | 64 | |
| 66 | 65 | TILE_GET_INFO_MEMBER(tankbatt_state::get_bg_tile_info) |
| 67 | 66 | { |
| 68 | | UINT8 *videoram = m_videoram; |
| 69 | | int code = videoram[tile_index]; |
| 70 | | int color = videoram[tile_index] | 0x01; |
| 67 | int code = m_videoram[tile_index]; |
| 68 | int color = m_videoram[tile_index] | 0x01; |
| 71 | 69 | |
| 72 | 70 | SET_TILE_INFO_MEMBER(0, code, color, 0); |
| 73 | 71 | } |
| r244699 | r244700 | |
| 79 | 77 | |
| 80 | 78 | void tankbatt_state::draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 81 | 79 | { |
| 82 | | int offs; |
| 83 | | |
| 84 | | for (offs = 0;offs < m_bulletsram.bytes();offs += 2) |
| 80 | for (int offs = 0;offs < m_bulletsram.bytes();offs += 2) |
| 85 | 81 | { |
| 86 | 82 | int color = 0xff; /* cyan, same color as the tanks */ |
| 87 | 83 | int x = m_bulletsram[offs + 1]; |
| r244699 | r244700 | |
| 95 | 91 | } |
| 96 | 92 | } |
| 97 | 93 | |
| 98 | | UINT32 tankbatt_state::screen_update_tankbatt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 94 | UINT32 tankbatt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 99 | 95 | { |
| 100 | 96 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 101 | 97 | draw_bullets(bitmap, cliprect); |
trunk/src/mame/video/tankbust.c
| r244699 | r244700 | |
| 41 | 41 | { |
| 42 | 42 | color = ((int)rand()) & 0x0f; |
| 43 | 43 | } |
| 44 | | if (attr&0x80) //al the roofs of all buildings have this bit set. What's this ??? |
| 44 | if (attr&0x80) //all the roofs of all buildings have this bit set. What's this ??? |
| 45 | 45 | { |
| 46 | 46 | color = ((int)rand()) & 0x0f; |
| 47 | 47 | } |
| r244699 | r244700 | |
| 82 | 82 | /* scrollable */ |
| 83 | 83 | m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tankbust_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); |
| 84 | 84 | |
| 85 | | |
| 86 | 85 | m_txt_tilemap->set_transparent_pen(0); |
| 86 | |
| 87 | save_item(NAME(m_xscroll)); |
| 88 | save_item(NAME(m_yscroll)); |
| 87 | 89 | } |
| 88 | 90 | |
| 89 | 91 | |
| r244699 | r244700 | |
| 93 | 95 | |
| 94 | 96 | ***************************************************************************/ |
| 95 | 97 | |
| 96 | | WRITE8_MEMBER(tankbust_state::tankbust_background_videoram_w) |
| 98 | WRITE8_MEMBER(tankbust_state::background_videoram_w) |
| 97 | 99 | { |
| 98 | 100 | m_videoram[offset] = data; |
| 99 | 101 | m_bg_tilemap->mark_tile_dirty(offset); |
| 100 | 102 | } |
| 101 | | READ8_MEMBER(tankbust_state::tankbust_background_videoram_r) |
| 102 | | { |
| 103 | | return m_videoram[offset]; |
| 104 | | } |
| 105 | 103 | |
| 106 | | WRITE8_MEMBER(tankbust_state::tankbust_background_colorram_w) |
| 104 | WRITE8_MEMBER(tankbust_state::background_colorram_w) |
| 107 | 105 | { |
| 108 | 106 | m_colorram[offset] = data; |
| 109 | 107 | m_bg_tilemap->mark_tile_dirty(offset); |
| 110 | 108 | } |
| 111 | | READ8_MEMBER(tankbust_state::tankbust_background_colorram_r) |
| 112 | | { |
| 113 | | return m_colorram[offset]; |
| 114 | | } |
| 115 | 109 | |
| 116 | | WRITE8_MEMBER(tankbust_state::tankbust_txtram_w) |
| 110 | WRITE8_MEMBER(tankbust_state::txtram_w) |
| 117 | 111 | { |
| 118 | 112 | m_txtram[offset] = data; |
| 119 | 113 | m_txt_tilemap->mark_tile_dirty(offset); |
| 120 | 114 | } |
| 121 | | READ8_MEMBER(tankbust_state::tankbust_txtram_r) |
| 122 | | { |
| 123 | | return m_txtram[offset]; |
| 124 | | } |
| 125 | 115 | |
| 126 | | |
| 127 | | |
| 128 | | WRITE8_MEMBER(tankbust_state::tankbust_xscroll_w) |
| 116 | WRITE8_MEMBER(tankbust_state::xscroll_w) |
| 129 | 117 | { |
| 130 | 118 | if( m_xscroll[offset] != data ) |
| 131 | 119 | { |
| r244699 | r244700 | |
| 141 | 129 | } |
| 142 | 130 | |
| 143 | 131 | |
| 144 | | WRITE8_MEMBER(tankbust_state::tankbust_yscroll_w) |
| 132 | WRITE8_MEMBER(tankbust_state::yscroll_w) |
| 145 | 133 | { |
| 146 | 134 | if( m_yscroll[offset] != data ) |
| 147 | 135 | { |
| r244699 | r244700 | |
| 178 | 166 | |
| 179 | 167 | void tankbust_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 180 | 168 | { |
| 181 | | UINT8 *spriteram = m_spriteram; |
| 182 | | int offs; |
| 183 | | |
| 184 | | for (offs = 0; offs < m_spriteram.bytes(); offs += 4) |
| 169 | for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) |
| 185 | 170 | { |
| 186 | 171 | int code,color,sx,sy,flipx,flipy; |
| 187 | 172 | |
| 188 | | code = spriteram[offs+0] & 0x3f; |
| 189 | | flipy = spriteram[offs+0] & 0x40; |
| 190 | | flipx = spriteram[offs+0] & 0x80; |
| 173 | code = m_spriteram[offs+0] & 0x3f; |
| 174 | flipy = m_spriteram[offs+0] & 0x40; |
| 175 | flipx = m_spriteram[offs+0] & 0x80; |
| 191 | 176 | |
| 192 | | sy = (240- spriteram[offs+1]) - 14; |
| 193 | | sx = (spriteram[offs+2] & 0x01) * 256 + spriteram[offs+3] - 7; |
| 177 | sy = (240- m_spriteram[offs+1]) - 14; |
| 178 | sx = (m_spriteram[offs+2] & 0x01) * 256 + m_spriteram[offs+3] - 7; |
| 194 | 179 | |
| 195 | 180 | color = 0; |
| 196 | 181 | |
| r244699 | r244700 | |
| 202 | 187 | //0x40 - not used |
| 203 | 188 | //0x80 - not used |
| 204 | 189 | #if 0 |
| 205 | | if ((spriteram[offs+2] & 0x02)) |
| 190 | if ((m_spriteram[offs+2] & 0x02)) |
| 206 | 191 | { |
| 207 | 192 | code = ((int)rand()) & 63; |
| 208 | 193 | } |
| 209 | 194 | #endif |
| 210 | 195 | |
| 211 | | if ((spriteram[offs+1]!=4)) //otherwise - ghost sprites |
| 196 | if ((m_spriteram[offs+1]!=4)) //otherwise - ghost sprites |
| 212 | 197 | { |
| 213 | 198 | m_gfxdecode->gfx(0)->transpen(bitmap,cliprect, |
| 214 | 199 | code, color, |
| r244699 | r244700 | |
| 219 | 204 | } |
| 220 | 205 | |
| 221 | 206 | |
| 222 | | UINT32 tankbust_state::screen_update_tankbust(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 207 | UINT32 tankbust_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 223 | 208 | { |
| 224 | 209 | #if 0 |
| 225 | | int i; |
| 226 | | |
| 227 | | for (i=0; i<0x800; i++) |
| 210 | for (int i=0; i<0x800; i++) |
| 228 | 211 | { |
| 229 | 212 | int tile_attrib = m_colorram[i]; |
| 230 | 213 | |