trunk/src/mame/drivers/tehkanwc.c
| r243679 | r243680 | |
| 91 | 91 | #include "emu.h" |
| 92 | 92 | #include "cpu/z80/z80.h" |
| 93 | 93 | #include "sound/ay8910.h" |
| 94 | | #include "sound/msm5205.h" |
| 95 | 94 | #include "gridiron.lh" |
| 96 | 95 | #include "includes/tehkanwc.h" |
| 97 | 96 | |
| 97 | |
| 98 | void tehkanwc_state::machine_start() |
| 99 | { |
| 100 | save_item(NAME(m_track0)); |
| 101 | save_item(NAME(m_track1)); |
| 102 | save_item(NAME(m_msm_data_offs)); |
| 103 | save_item(NAME(m_toggle)); |
| 104 | } |
| 105 | |
| 98 | 106 | WRITE8_MEMBER(tehkanwc_state::sub_cpu_halt_w) |
| 99 | 107 | { |
| 100 | 108 | if (data) |
| r243679 | r243680 | |
| 104 | 112 | } |
| 105 | 113 | |
| 106 | 114 | |
| 107 | | READ8_MEMBER(tehkanwc_state::tehkanwc_track_0_r) |
| 115 | READ8_MEMBER(tehkanwc_state::track_0_r) |
| 108 | 116 | { |
| 109 | 117 | int joy; |
| 110 | 118 | |
| r243679 | r243680 | |
| 114 | 122 | return ioport(offset ? "P1Y" : "P1X")->read() - m_track0[offset]; |
| 115 | 123 | } |
| 116 | 124 | |
| 117 | | READ8_MEMBER(tehkanwc_state::tehkanwc_track_1_r) |
| 125 | READ8_MEMBER(tehkanwc_state::track_1_r) |
| 118 | 126 | { |
| 119 | 127 | int joy; |
| 120 | 128 | |
| r243679 | r243680 | |
| 124 | 132 | return ioport(offset ? "P2Y" : "P2X")->read() - m_track1[offset]; |
| 125 | 133 | } |
| 126 | 134 | |
| 127 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_track_0_reset_w) |
| 135 | WRITE8_MEMBER(tehkanwc_state::track_0_reset_w) |
| 128 | 136 | { |
| 129 | 137 | /* reset the trackball counters */ |
| 130 | 138 | m_track0[offset] = ioport(offset ? "P1Y" : "P1X")->read() + data; |
| 131 | 139 | } |
| 132 | 140 | |
| 133 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_track_1_reset_w) |
| 141 | WRITE8_MEMBER(tehkanwc_state::track_1_reset_w) |
| 134 | 142 | { |
| 135 | 143 | /* reset the trackball counters */ |
| 136 | 144 | m_track1[offset] = ioport(offset ? "P2Y" : "P2X")->read() + data; |
| r243679 | r243680 | |
| 169 | 177 | /* Emulate MSM sound samples with counters */ |
| 170 | 178 | |
| 171 | 179 | |
| 172 | | READ8_MEMBER(tehkanwc_state::tehkanwc_portA_r) |
| 180 | READ8_MEMBER(tehkanwc_state::portA_r) |
| 173 | 181 | { |
| 174 | 182 | return m_msm_data_offs & 0xff; |
| 175 | 183 | } |
| 176 | 184 | |
| 177 | | READ8_MEMBER(tehkanwc_state::tehkanwc_portB_r) |
| 185 | READ8_MEMBER(tehkanwc_state::portB_r) |
| 178 | 186 | { |
| 179 | 187 | return (m_msm_data_offs >> 8) & 0xff; |
| 180 | 188 | } |
| 181 | 189 | |
| 182 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_portA_w) |
| 190 | WRITE8_MEMBER(tehkanwc_state::portA_w) |
| 183 | 191 | { |
| 184 | 192 | m_msm_data_offs = (m_msm_data_offs & 0xff00) | data; |
| 185 | 193 | } |
| 186 | 194 | |
| 187 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_portB_w) |
| 195 | WRITE8_MEMBER(tehkanwc_state::portB_w) |
| 188 | 196 | { |
| 189 | 197 | m_msm_data_offs = (m_msm_data_offs & 0x00ff) | (data << 8); |
| 190 | 198 | } |
| r243679 | r243680 | |
| 194 | 202 | m_msm->reset_w(data ? 0 : 1); |
| 195 | 203 | } |
| 196 | 204 | |
| 197 | | WRITE_LINE_MEMBER(tehkanwc_state::tehkanwc_adpcm_int) |
| 205 | WRITE_LINE_MEMBER(tehkanwc_state::adpcm_int) |
| 198 | 206 | { |
| 199 | 207 | UINT8 *SAMPLES = memregion("adpcm")->base(); |
| 200 | 208 | int msm_data = SAMPLES[m_msm_data_offs & 0x7fff]; |
| r243679 | r243680 | |
| 218 | 226 | AM_RANGE(0x0000, 0xbfff) AM_ROM |
| 219 | 227 | AM_RANGE(0xc000, 0xc7ff) AM_RAM |
| 220 | 228 | AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share1") |
| 221 | | AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(tehkanwc_videoram_w) AM_SHARE("videoram") |
| 222 | | AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(tehkanwc_colorram_w) AM_SHARE("colorram") |
| 229 | AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") |
| 230 | AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram") |
| 223 | 231 | AM_RANGE(0xd800, 0xddff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 224 | 232 | AM_RANGE(0xde00, 0xdfff) AM_RAM AM_SHARE("share5") /* unused part of the palette RAM, I think? Gridiron uses it */ |
| 225 | | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(tehkanwc_videoram2_w) AM_SHARE("videoram2") |
| 233 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") |
| 226 | 234 | AM_RANGE(0xe800, 0xebff) AM_RAM AM_SHARE("spriteram") /* sprites */ |
| 227 | | AM_RANGE(0xec00, 0xec01) AM_RAM_WRITE(tehkanwc_scroll_x_w) |
| 228 | | AM_RANGE(0xec02, 0xec02) AM_RAM_WRITE(tehkanwc_scroll_y_w) |
| 229 | | AM_RANGE(0xf800, 0xf801) AM_READWRITE(tehkanwc_track_0_r, tehkanwc_track_0_reset_w) /* track 0 x/y */ |
| 235 | AM_RANGE(0xec00, 0xec01) AM_RAM_WRITE(scroll_x_w) |
| 236 | AM_RANGE(0xec02, 0xec02) AM_RAM_WRITE(scroll_y_w) |
| 237 | AM_RANGE(0xf800, 0xf801) AM_READWRITE(track_0_r, track_0_reset_w) /* track 0 x/y */ |
| 230 | 238 | AM_RANGE(0xf802, 0xf802) AM_READ_PORT("SYSTEM") AM_WRITE(gridiron_led0_w) |
| 231 | 239 | AM_RANGE(0xf803, 0xf803) AM_READ_PORT("P1BUT") |
| 232 | 240 | AM_RANGE(0xf806, 0xf806) AM_READ_PORT("SYSTEM") |
| 233 | | AM_RANGE(0xf810, 0xf811) AM_READWRITE(tehkanwc_track_1_r, tehkanwc_track_1_reset_w) /* track 1 x/y */ |
| 241 | AM_RANGE(0xf810, 0xf811) AM_READWRITE(track_1_r, track_1_reset_w) /* track 1 x/y */ |
| 234 | 242 | AM_RANGE(0xf812, 0xf812) AM_WRITE(gridiron_led1_w) |
| 235 | 243 | AM_RANGE(0xf813, 0xf813) AM_READ_PORT("P2BUT") |
| 236 | 244 | AM_RANGE(0xf820, 0xf820) AM_READ(soundlatch2_byte_r) AM_WRITE(sound_command_w) /* answer from the sound CPU */ |
| 237 | 245 | AM_RANGE(0xf840, 0xf840) AM_READ_PORT("DSW1") AM_WRITE(sub_cpu_halt_w) |
| 238 | 246 | AM_RANGE(0xf850, 0xf850) AM_READ_PORT("DSW2") AM_WRITENOP /* ?? writes 0x00 or 0xff */ |
| 239 | | AM_RANGE(0xf860, 0xf860) AM_READ(watchdog_reset_r) AM_WRITE(tehkanwc_flipscreen_x_w) |
| 240 | | AM_RANGE(0xf870, 0xf870) AM_READ_PORT("DSW3") AM_WRITE(tehkanwc_flipscreen_y_w) |
| 247 | AM_RANGE(0xf860, 0xf860) AM_READ(watchdog_reset_r) AM_WRITE(flipscreen_x_w) |
| 248 | AM_RANGE(0xf870, 0xf870) AM_READ_PORT("DSW3") AM_WRITE(flipscreen_y_w) |
| 241 | 249 | ADDRESS_MAP_END |
| 242 | 250 | |
| 243 | 251 | static ADDRESS_MAP_START( sub_mem, AS_PROGRAM, 8, tehkanwc_state ) |
| 244 | 252 | AM_RANGE(0x0000, 0x7fff) AM_ROM |
| 245 | 253 | AM_RANGE(0x8000, 0xc7ff) AM_RAM |
| 246 | 254 | AM_RANGE(0xc800, 0xcfff) AM_RAM AM_SHARE("share1") |
| 247 | | AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(tehkanwc_videoram_w) AM_SHARE("videoram") |
| 248 | | AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(tehkanwc_colorram_w) AM_SHARE("colorram") |
| 255 | AM_RANGE(0xd000, 0xd3ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") |
| 256 | AM_RANGE(0xd400, 0xd7ff) AM_RAM_WRITE(colorram_w) AM_SHARE("colorram") |
| 249 | 257 | AM_RANGE(0xd800, 0xddff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") |
| 250 | 258 | AM_RANGE(0xde00, 0xdfff) AM_RAM AM_SHARE("share5") /* unused part of the palette RAM, I think? Gridiron uses it */ |
| 251 | | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(tehkanwc_videoram2_w) AM_SHARE("videoram2") |
| 259 | AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") |
| 252 | 260 | AM_RANGE(0xe800, 0xebff) AM_RAM AM_SHARE("spriteram") /* sprites */ |
| 253 | | AM_RANGE(0xec00, 0xec01) AM_RAM_WRITE(tehkanwc_scroll_x_w) |
| 254 | | AM_RANGE(0xec02, 0xec02) AM_RAM_WRITE(tehkanwc_scroll_y_w) |
| 261 | AM_RANGE(0xec00, 0xec01) AM_RAM_WRITE(scroll_x_w) |
| 262 | AM_RANGE(0xec02, 0xec02) AM_RAM_WRITE(scroll_y_w) |
| 255 | 263 | AM_RANGE(0xf860, 0xf860) AM_READ(watchdog_reset_r) |
| 256 | 264 | ADDRESS_MAP_END |
| 257 | 265 | |
| r243679 | r243680 | |
| 638 | 646 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) |
| 639 | 647 | MCFG_SCREEN_SIZE(32*8, 32*8) |
| 640 | 648 | MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) |
| 641 | | MCFG_SCREEN_UPDATE_DRIVER(tehkanwc_state, screen_update_tehkanwc) |
| 649 | MCFG_SCREEN_UPDATE_DRIVER(tehkanwc_state, screen_update) |
| 642 | 650 | MCFG_SCREEN_PALETTE("palette") |
| 643 | 651 | |
| 644 | 652 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", tehkanwc) |
| r243679 | r243680 | |
| 650 | 658 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 651 | 659 | |
| 652 | 660 | MCFG_SOUND_ADD("ay1", AY8910, 1536000) |
| 653 | | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(tehkanwc_state, tehkanwc_portA_w)) |
| 654 | | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(tehkanwc_state, tehkanwc_portB_w)) |
| 661 | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(tehkanwc_state, portA_w)) |
| 662 | MCFG_AY8910_PORT_B_WRITE_CB(WRITE8(tehkanwc_state, portB_w)) |
| 655 | 663 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 656 | 664 | |
| 657 | 665 | MCFG_SOUND_ADD("ay2", AY8910, 1536000) |
| 658 | | MCFG_AY8910_PORT_A_READ_CB(READ8(tehkanwc_state, tehkanwc_portA_r)) |
| 659 | | MCFG_AY8910_PORT_B_READ_CB(READ8(tehkanwc_state, tehkanwc_portB_r)) |
| 666 | MCFG_AY8910_PORT_A_READ_CB(READ8(tehkanwc_state, portA_r)) |
| 667 | MCFG_AY8910_PORT_B_READ_CB(READ8(tehkanwc_state, portB_r)) |
| 660 | 668 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |
| 661 | 669 | |
| 662 | 670 | MCFG_SOUND_ADD("msm", MSM5205, 384000) |
| 663 | | MCFG_MSM5205_VCLK_CB(WRITELINE(tehkanwc_state, tehkanwc_adpcm_int)) /* interrupt function */ |
| 671 | MCFG_MSM5205_VCLK_CB(WRITELINE(tehkanwc_state, adpcm_int)) /* interrupt function */ |
| 664 | 672 | MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 8KHz */ |
| 665 | 673 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.45) |
| 666 | 674 | MACHINE_CONFIG_END |
| r243679 | r243680 | |
| 882 | 890 | |
| 883 | 891 | |
| 884 | 892 | |
| 885 | | GAME( 1985, tehkanwc, 0, tehkanwc, tehkanwc, driver_device, 0, ROT0, "Tehkan", "Tehkan World Cup (set 1)", 0 ) |
| 886 | | GAME( 1985, tehkanwcb, tehkanwc, tehkanwc, tehkanwc, driver_device, 0, ROT0, "Tehkan", "Tehkan World Cup (set 2, bootleg?)", 0 ) |
| 887 | | GAME( 1985, tehkanwcc, tehkanwc, tehkanwc, tehkanwc, driver_device, 0, ROT0, "bootleg", "Tehkan World Cup (set 3, bootleg)", GAME_NOT_WORKING ) // aka 'World Cup 85', different inputs? |
| 888 | | GAMEL(1985, gridiron, 0, tehkanwc, gridiron, driver_device, 0, ROT0, "Tehkan", "Gridiron Fight", 0, layout_gridiron ) |
| 889 | | GAME( 1986, teedoff, 0, tehkanwc, teedoff, tehkanwc_state, teedoff, ROT90, "Tecmo", "Tee'd Off (Japan)", 0 ) |
| 893 | GAME( 1985, tehkanwc, 0, tehkanwc, tehkanwc, driver_device, 0, ROT0, "Tehkan", "Tehkan World Cup (set 1)", GAME_SUPPORTS_SAVE ) |
| 894 | GAME( 1985, tehkanwcb, tehkanwc, tehkanwc, tehkanwc, driver_device, 0, ROT0, "Tehkan", "Tehkan World Cup (set 2, bootleg?)", GAME_SUPPORTS_SAVE ) |
| 895 | GAME( 1985, tehkanwcc, tehkanwc, tehkanwc, tehkanwc, driver_device, 0, ROT0, "bootleg", "Tehkan World Cup (set 3, bootleg)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) // aka 'World Cup 85', different inputs? |
| 896 | GAMEL(1985, gridiron, 0, tehkanwc, gridiron, driver_device, 0, ROT0, "Tehkan", "Gridiron Fight", GAME_SUPPORTS_SAVE, layout_gridiron ) |
| 897 | GAME( 1986, teedoff, 0, tehkanwc, teedoff, tehkanwc_state, teedoff, ROT90, "Tecmo", "Tee'd Off (Japan)", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/tehkanwc.h
| r243679 | r243680 | |
| 10 | 10 | |
| 11 | 11 | tehkanwc_state(const machine_config &mconfig, device_type type, const char *tag) |
| 12 | 12 | : driver_device(mconfig, type, tag), |
| 13 | | m_videoram(*this, "videoram"), |
| 14 | | m_colorram(*this, "colorram"), |
| 15 | | m_videoram2(*this, "videoram2"), |
| 16 | | m_spriteram(*this, "spriteram"), |
| 17 | 13 | m_maincpu(*this, "maincpu"), |
| 18 | 14 | m_audiocpu(*this, "audiocpu"), |
| 19 | 15 | m_subcpu(*this, "sub"), |
| 20 | 16 | m_msm(*this, "msm"), |
| 21 | 17 | m_gfxdecode(*this, "gfxdecode"), |
| 22 | | m_palette(*this, "palette") { } |
| 18 | m_palette(*this, "palette"), |
| 19 | m_videoram(*this, "videoram"), |
| 20 | m_colorram(*this, "colorram"), |
| 21 | m_videoram2(*this, "videoram2"), |
| 22 | m_spriteram(*this, "spriteram") { } |
| 23 | 23 | |
| 24 | required_device<cpu_device> m_maincpu; |
| 25 | required_device<cpu_device> m_audiocpu; |
| 26 | required_device<cpu_device> m_subcpu; |
| 27 | required_device<msm5205_device> m_msm; |
| 28 | required_device<gfxdecode_device> m_gfxdecode; |
| 29 | required_device<palette_device> m_palette; |
| 30 | |
| 31 | required_shared_ptr<UINT8> m_videoram; |
| 32 | required_shared_ptr<UINT8> m_colorram; |
| 33 | required_shared_ptr<UINT8> m_videoram2; |
| 34 | required_shared_ptr<UINT8> m_spriteram; |
| 35 | |
| 24 | 36 | int m_track0[2]; |
| 25 | 37 | int m_track1[2]; |
| 26 | 38 | int m_msm_data_offs; |
| 27 | 39 | int m_toggle; |
| 28 | | required_shared_ptr<UINT8> m_videoram; |
| 29 | | required_shared_ptr<UINT8> m_colorram; |
| 30 | | required_shared_ptr<UINT8> m_videoram2; |
| 31 | 40 | UINT8 m_scroll_x[2]; |
| 32 | 41 | UINT8 m_led0; |
| 33 | 42 | UINT8 m_led1; |
| 34 | 43 | tilemap_t *m_bg_tilemap; |
| 35 | 44 | tilemap_t *m_fg_tilemap; |
| 36 | | required_shared_ptr<UINT8> m_spriteram; |
| 45 | |
| 37 | 46 | DECLARE_WRITE8_MEMBER(sub_cpu_halt_w); |
| 38 | | DECLARE_READ8_MEMBER(tehkanwc_track_0_r); |
| 39 | | DECLARE_READ8_MEMBER(tehkanwc_track_1_r); |
| 40 | | DECLARE_WRITE8_MEMBER(tehkanwc_track_0_reset_w); |
| 41 | | DECLARE_WRITE8_MEMBER(tehkanwc_track_1_reset_w); |
| 47 | DECLARE_READ8_MEMBER(track_0_r); |
| 48 | DECLARE_READ8_MEMBER(track_1_r); |
| 49 | DECLARE_WRITE8_MEMBER(track_0_reset_w); |
| 50 | DECLARE_WRITE8_MEMBER(track_1_reset_w); |
| 42 | 51 | DECLARE_WRITE8_MEMBER(sound_command_w); |
| 43 | 52 | DECLARE_WRITE8_MEMBER(sound_answer_w); |
| 44 | | DECLARE_WRITE8_MEMBER(tehkanwc_videoram_w); |
| 45 | | DECLARE_WRITE8_MEMBER(tehkanwc_colorram_w); |
| 46 | | DECLARE_WRITE8_MEMBER(tehkanwc_videoram2_w); |
| 47 | | DECLARE_WRITE8_MEMBER(tehkanwc_scroll_x_w); |
| 48 | | DECLARE_WRITE8_MEMBER(tehkanwc_scroll_y_w); |
| 49 | | DECLARE_WRITE8_MEMBER(tehkanwc_flipscreen_x_w); |
| 50 | | DECLARE_WRITE8_MEMBER(tehkanwc_flipscreen_y_w); |
| 53 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 54 | DECLARE_WRITE8_MEMBER(colorram_w); |
| 55 | DECLARE_WRITE8_MEMBER(videoram2_w); |
| 56 | DECLARE_WRITE8_MEMBER(scroll_x_w); |
| 57 | DECLARE_WRITE8_MEMBER(scroll_y_w); |
| 58 | DECLARE_WRITE8_MEMBER(flipscreen_x_w); |
| 59 | DECLARE_WRITE8_MEMBER(flipscreen_y_w); |
| 51 | 60 | DECLARE_WRITE8_MEMBER(gridiron_led0_w); |
| 52 | 61 | DECLARE_WRITE8_MEMBER(gridiron_led1_w); |
| 53 | | DECLARE_READ8_MEMBER(tehkanwc_portA_r); |
| 54 | | DECLARE_READ8_MEMBER(tehkanwc_portB_r); |
| 55 | | DECLARE_WRITE8_MEMBER(tehkanwc_portA_w); |
| 56 | | DECLARE_WRITE8_MEMBER(tehkanwc_portB_w); |
| 62 | DECLARE_READ8_MEMBER(portA_r); |
| 63 | DECLARE_READ8_MEMBER(portB_r); |
| 64 | DECLARE_WRITE8_MEMBER(portA_w); |
| 65 | DECLARE_WRITE8_MEMBER(portB_w); |
| 57 | 66 | DECLARE_WRITE8_MEMBER(msm_reset_w); |
| 58 | | DECLARE_DRIVER_INIT(teedoff); |
| 67 | DECLARE_WRITE_LINE_MEMBER(adpcm_int); |
| 68 | |
| 59 | 69 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 60 | 70 | TILE_GET_INFO_MEMBER(get_fg_tile_info); |
| 71 | |
| 72 | DECLARE_DRIVER_INIT(teedoff); |
| 73 | virtual void machine_start(); |
| 61 | 74 | virtual void video_start(); |
| 62 | | UINT32 screen_update_tehkanwc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 63 | | void gridiron_draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 led,int player); |
| 75 | |
| 76 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 77 | void draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 led,int player); |
| 64 | 78 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 65 | | DECLARE_WRITE_LINE_MEMBER(tehkanwc_adpcm_int); |
| 66 | | required_device<cpu_device> m_maincpu; |
| 67 | | required_device<cpu_device> m_audiocpu; |
| 68 | | required_device<cpu_device> m_subcpu; |
| 69 | | required_device<msm5205_device> m_msm; |
| 70 | | required_device<gfxdecode_device> m_gfxdecode; |
| 71 | | required_device<palette_device> m_palette; |
| 79 | |
| 72 | 80 | protected: |
| 73 | 81 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 74 | 82 | }; |
trunk/src/mame/video/tehkanwc.c
| r243679 | r243680 | |
| 15 | 15 | #include "includes/tehkanwc.h" |
| 16 | 16 | |
| 17 | 17 | |
| 18 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_videoram_w) |
| 18 | WRITE8_MEMBER(tehkanwc_state::videoram_w) |
| 19 | 19 | { |
| 20 | 20 | m_videoram[offset] = data; |
| 21 | 21 | m_fg_tilemap->mark_tile_dirty(offset); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_colorram_w) |
| 24 | WRITE8_MEMBER(tehkanwc_state::colorram_w) |
| 25 | 25 | { |
| 26 | 26 | m_colorram[offset] = data; |
| 27 | 27 | m_fg_tilemap->mark_tile_dirty(offset); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_videoram2_w) |
| 30 | WRITE8_MEMBER(tehkanwc_state::videoram2_w) |
| 31 | 31 | { |
| 32 | 32 | m_videoram2[offset] = data; |
| 33 | 33 | m_bg_tilemap->mark_tile_dirty(offset / 2); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_scroll_x_w) |
| 36 | WRITE8_MEMBER(tehkanwc_state::scroll_x_w) |
| 37 | 37 | { |
| 38 | 38 | m_scroll_x[offset] = data; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_scroll_y_w) |
| 41 | WRITE8_MEMBER(tehkanwc_state::scroll_y_w) |
| 42 | 42 | { |
| 43 | 43 | m_bg_tilemap->set_scrolly(0, data); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_flipscreen_x_w) |
| 46 | WRITE8_MEMBER(tehkanwc_state::flipscreen_x_w) |
| 47 | 47 | { |
| 48 | 48 | flip_screen_x_set(data & 0x40); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | | WRITE8_MEMBER(tehkanwc_state::tehkanwc_flipscreen_y_w) |
| 51 | WRITE8_MEMBER(tehkanwc_state::flipscreen_y_w) |
| 52 | 52 | { |
| 53 | 53 | flip_screen_y_set(data & 0x40); |
| 54 | 54 | } |
| r243679 | r243680 | |
| 94 | 94 | 8, 8, 32, 32); |
| 95 | 95 | |
| 96 | 96 | m_fg_tilemap->set_transparent_pen(0); |
| 97 | |
| 98 | save_item(NAME(m_scroll_x)); |
| 99 | save_item(NAME(m_led0)); |
| 100 | save_item(NAME(m_led1)); |
| 97 | 101 | } |
| 98 | 102 | |
| 99 | 103 | /* |
| r243679 | r243680 | |
| 113 | 117 | bit 7 = enable (0 = display off) |
| 114 | 118 | */ |
| 115 | 119 | |
| 116 | | void tehkanwc_state::gridiron_draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 led,int player) |
| 120 | void tehkanwc_state::draw_led(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 led,int player) |
| 117 | 121 | { |
| 118 | 122 | if (led&0x80) |
| 119 | 123 | output_set_digit_value(player, led&0x7f); |
| r243679 | r243680 | |
| 123 | 127 | |
| 124 | 128 | void tehkanwc_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 125 | 129 | { |
| 126 | | UINT8 *spriteram = m_spriteram; |
| 127 | | int offs; |
| 128 | | |
| 129 | | for (offs = 0;offs < m_spriteram.bytes();offs += 4) |
| 130 | for (int offs = 0;offs < m_spriteram.bytes();offs += 4) |
| 130 | 131 | { |
| 131 | | int attr = spriteram[offs + 1]; |
| 132 | | int code = spriteram[offs] + ((attr & 0x08) << 5); |
| 132 | int attr = m_spriteram[offs + 1]; |
| 133 | int code = m_spriteram[offs] + ((attr & 0x08) << 5); |
| 133 | 134 | int color = attr & 0x07; |
| 134 | 135 | int flipx = attr & 0x40; |
| 135 | 136 | int flipy = attr & 0x80; |
| 136 | | int sx = spriteram[offs + 2] + ((attr & 0x20) << 3) - 128; |
| 137 | | int sy = spriteram[offs + 3]; |
| 137 | int sx = m_spriteram[offs + 2] + ((attr & 0x20) << 3) - 128; |
| 138 | int sy = m_spriteram[offs + 3]; |
| 138 | 139 | |
| 139 | 140 | if (flip_screen_x()) |
| 140 | 141 | { |
| r243679 | r243680 | |
| 153 | 154 | } |
| 154 | 155 | } |
| 155 | 156 | |
| 156 | | UINT32 tehkanwc_state::screen_update_tehkanwc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 157 | UINT32 tehkanwc_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 157 | 158 | { |
| 158 | 159 | m_bg_tilemap->set_scrollx(0, m_scroll_x[0] + 256 * m_scroll_x[1]); |
| 159 | 160 | m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 160 | 161 | m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); |
| 161 | 162 | draw_sprites(bitmap, cliprect); |
| 162 | 163 | m_fg_tilemap->draw(screen, bitmap, cliprect, 1, 0); |
| 163 | | gridiron_draw_led(bitmap, cliprect, m_led0, 0); |
| 164 | | gridiron_draw_led(bitmap, cliprect, m_led1, 1); |
| 164 | draw_led(bitmap, cliprect, m_led0, 0); |
| 165 | draw_led(bitmap, cliprect, m_led1, 1); |
| 165 | 166 | return 0; |
| 166 | 167 | } |