trunk/src/mame/drivers/gsword.c
| r243475 | r243476 | |
| 4 | 4 | |
| 5 | 5 | TODO: |
| 6 | 6 | |
| 7 | | -joshi vollyball |
| 7 | -joshi volleyball |
| 8 | 8 | -The incomplete graphic |
| 9 | 9 | -The implementation of DAC sound ? |
| 10 | 10 | -MCU code DUMP and emulation |
| r243475 | r243476 | |
| 14 | 14 | Credits: |
| 15 | 15 | - Steve Ellenoff: Original emulation and Mame driver |
| 16 | 16 | - Jarek Parchanski: Dip Switch Fixes, Color improvements, ADPCM Interface code |
| 17 | | - Tatsuyuki Satoh: sound improvements, NEC 8741 emulation,adpcm improvements, |
| 17 | - Tatsuyuki Satoh: sound improvements, NEC 8741 emulation, adpcm improvements, |
| 18 | 18 | josvollyvall 8741 emulation |
| 19 | 19 | - Charlie Miltenberger: sprite colors improvements & precious hardware |
| 20 | 20 | information and screenshots |
| r243475 | r243476 | |
| 144 | 144 | #include "emu.h" |
| 145 | 145 | #include "cpu/z80/z80.h" |
| 146 | 146 | #include "machine/tait8741.h" |
| 147 | | #include "sound/ay8910.h" |
| 148 | 147 | #include "sound/msm5205.h" |
| 149 | 148 | #include "includes/gsword.h" |
| 150 | 149 | |
| 151 | 150 | |
| 152 | 151 | #if 0 |
| 153 | | int gsword_state::gsword_coins_in(void) |
| 152 | int gsword_state::coins_in(void) |
| 154 | 153 | { |
| 155 | 154 | /* emulate 8741 coin slot */ |
| 156 | 155 | if (ioport("IN4")->read() & 0xc0) |
| r243475 | r243476 | |
| 165 | 164 | |
| 166 | 165 | #include "cpu/z80/z80.h" |
| 167 | 166 | |
| 167 | |
| 168 | 168 | /* CPU 2 memory hack */ |
| 169 | 169 | /* (402E) timeout upcount must be under 0AH */ |
| 170 | 170 | /* (4004,4005) clear down counter , if (4004,4005)==0 then (402E)=0 */ |
| r243475 | r243476 | |
| 174 | 174 | |
| 175 | 175 | /*if(offset==1)osd_printf_debug("CNT %02X%02X\n",m_cpu2_ram[5],m_cpu2_ram[4]); */ |
| 176 | 176 | |
| 177 | | /* speedup timeout cound down */ |
| 177 | /* speedup timeout count down */ |
| 178 | 178 | if(m_protect_hack) |
| 179 | 179 | { |
| 180 | 180 | switch(offset) |
| r243475 | r243476 | |
| 219 | 219 | return 0; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | | MACHINE_RESET_MEMBER(gsword_state,gsword) |
| 222 | void gsword_state::machine_start() |
| 223 | 223 | { |
| 224 | save_item(NAME(m_fake8910_0)); |
| 225 | save_item(NAME(m_fake8910_1)); |
| 226 | save_item(NAME(m_nmi_enable)); |
| 227 | save_item(NAME(m_protect_hack)); |
| 228 | } |
| 229 | |
| 230 | void gsword_state::machine_reset() |
| 231 | { |
| 224 | 232 | m_coins = 0; |
| 225 | 233 | |
| 226 | 234 | /* snd CPU mask NMI during reset phase */ |
| r243475 | r243476 | |
| 228 | 236 | m_protect_hack = 0; |
| 229 | 237 | } |
| 230 | 238 | |
| 231 | | MACHINE_RESET_MEMBER(gsword_state,josvolly) |
| 232 | | { |
| 233 | | } |
| 234 | | |
| 235 | 239 | INTERRUPT_GEN_MEMBER(gsword_state::gsword_snd_interrupt) |
| 236 | 240 | { |
| 237 | 241 | if(m_nmi_enable) |
| 238 | 242 | device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 239 | 243 | } |
| 240 | 244 | |
| 241 | | WRITE8_MEMBER(gsword_state::gsword_nmi_set_w) |
| 245 | WRITE8_MEMBER(gsword_state::nmi_set_w) |
| 242 | 246 | { |
| 243 | 247 | /* osd_printf_debug("AY write %02X\n",data);*/ |
| 244 | 248 | |
| r243475 | r243476 | |
| 253 | 257 | switch(data) |
| 254 | 258 | { |
| 255 | 259 | case 0xff: |
| 256 | | m_nmi_enable = 0; /* NMI must be disable */ |
| 260 | m_nmi_enable = 0; /* NMI must be disabled */ |
| 257 | 261 | break; |
| 258 | 262 | case 0x02: |
| 259 | 263 | m_nmi_enable = 0; /* ANY */ |
| r243475 | r243476 | |
| 262 | 266 | m_nmi_enable = 1; |
| 263 | 267 | break; |
| 264 | 268 | case 0x0f: |
| 265 | | m_nmi_enable = 1; /* NMI must be enable */ |
| 269 | m_nmi_enable = 1; /* NMI must be enabled */ |
| 266 | 270 | break; |
| 267 | 271 | case 0xfe: |
| 268 | | m_nmi_enable = 1; /* NMI must be enable */ |
| 272 | m_nmi_enable = 1; /* NMI must be enabled */ |
| 269 | 273 | break; |
| 270 | 274 | } |
| 271 | 275 | /* bit1= nmi disable , for ram check */ |
| r243475 | r243476 | |
| 273 | 277 | #endif |
| 274 | 278 | } |
| 275 | 279 | |
| 276 | | WRITE8_MEMBER(gsword_state::gsword_AY8910_control_port_0_w) |
| 280 | WRITE8_MEMBER(gsword_state::ay8910_control_port_0_w) |
| 277 | 281 | { |
| 278 | | ay8910_device *ay8910 = machine().device<ay8910_device>("ay1"); |
| 279 | | ay8910->address_w(space,offset,data); |
| 282 | m_ay0->address_w(space,offset,data); |
| 280 | 283 | m_fake8910_0 = data; |
| 281 | 284 | } |
| 282 | | WRITE8_MEMBER(gsword_state::gsword_AY8910_control_port_1_w) |
| 285 | WRITE8_MEMBER(gsword_state::ay8910_control_port_1_w) |
| 283 | 286 | { |
| 284 | | ay8910_device *ay8910 = machine().device<ay8910_device>("ay2"); |
| 285 | | ay8910->address_w(space,offset,data); |
| 287 | m_ay1->address_w(space,offset,data); |
| 286 | 288 | m_fake8910_1 = data; |
| 287 | 289 | } |
| 288 | 290 | |
| 289 | | READ8_MEMBER(gsword_state::gsword_fake_0_r) |
| 291 | READ8_MEMBER(gsword_state::fake_0_r) |
| 290 | 292 | { |
| 291 | 293 | return m_fake8910_0+1; |
| 292 | 294 | } |
| 293 | | READ8_MEMBER(gsword_state::gsword_fake_1_r) |
| 295 | READ8_MEMBER(gsword_state::fake_1_r) |
| 294 | 296 | { |
| 295 | 297 | return m_fake8910_1+1; |
| 296 | 298 | } |
| r243475 | r243476 | |
| 308 | 310 | m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 309 | 311 | } |
| 310 | 312 | |
| 313 | |
| 311 | 314 | static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM , 8, gsword_state ) |
| 312 | 315 | AM_RANGE(0x0000, 0x8fff) AM_ROM |
| 313 | 316 | AM_RANGE(0x9000, 0x9fff) AM_RAM |
| r243475 | r243476 | |
| 315 | 318 | AM_RANGE(0xa380, 0xa3ff) AM_RAM AM_SHARE("spritetile_ram") |
| 316 | 319 | AM_RANGE(0xa400, 0xa77f) AM_RAM |
| 317 | 320 | AM_RANGE(0xa780, 0xa7ff) AM_RAM AM_SHARE("spritexy_ram") |
| 318 | | AM_RANGE(0xa980, 0xa980) AM_WRITE(gsword_charbank_w) |
| 319 | | AM_RANGE(0xaa80, 0xaa80) AM_WRITE(gsword_videoctrl_w) /* flip screen, char palette bank */ |
| 320 | | AM_RANGE(0xab00, 0xab00) AM_WRITE(gsword_scroll_w) |
| 321 | AM_RANGE(0xa980, 0xa980) AM_WRITE(charbank_w) |
| 322 | AM_RANGE(0xaa80, 0xaa80) AM_WRITE(videoctrl_w) /* flip screen, char palette bank */ |
| 323 | AM_RANGE(0xab00, 0xab00) AM_WRITE(scroll_w) |
| 321 | 324 | AM_RANGE(0xab80, 0xabff) AM_WRITEONLY AM_SHARE("spriteattram") |
| 322 | | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(gsword_videoram_w) AM_SHARE("videoram") |
| 325 | AM_RANGE(0xb000, 0xb7ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") |
| 323 | 326 | ADDRESS_MAP_END |
| 324 | 327 | |
| 325 | 328 | static ADDRESS_MAP_START( cpu1_io_map, AS_IO, 8, gsword_state ) |
| r243475 | r243476 | |
| 344 | 347 | AM_RANGE(0x00, 0x01) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_2, write_2) |
| 345 | 348 | AM_RANGE(0x20, 0x21) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_3, write_3) |
| 346 | 349 | AM_RANGE(0x40, 0x41) AM_DEVREADWRITE("taito8741", taito8741_4pack_device, read_1, write_1) |
| 347 | | AM_RANGE(0x60, 0x60) AM_READWRITE(gsword_fake_0_r, gsword_AY8910_control_port_0_w) |
| 350 | AM_RANGE(0x60, 0x60) AM_READWRITE(fake_0_r, ay8910_control_port_0_w) |
| 348 | 351 | AM_RANGE(0x61, 0x61) AM_DEVREADWRITE("ay1", ay8910_device, data_r, data_w) |
| 349 | | AM_RANGE(0x80, 0x80) AM_READWRITE(gsword_fake_1_r, gsword_AY8910_control_port_1_w) |
| 352 | AM_RANGE(0x80, 0x80) AM_READWRITE(fake_1_r, ay8910_control_port_1_w) |
| 350 | 353 | AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("ay2", ay8910_device, data_r, data_w) |
| 351 | 354 | // |
| 352 | 355 | AM_RANGE(0xe0, 0xe0) AM_READNOP /* ?? */ |
| r243475 | r243476 | |
| 378 | 381 | |
| 379 | 382 | static ADDRESS_MAP_START( josvolly_cpu2_io_map, AS_IO, 8, gsword_state ) |
| 380 | 383 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 381 | | AM_RANGE(0x00, 0x00) AM_READWRITE(gsword_fake_0_r, gsword_AY8910_control_port_0_w) |
| 384 | AM_RANGE(0x00, 0x00) AM_READWRITE(fake_0_r, ay8910_control_port_0_w) |
| 382 | 385 | AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("ay1", ay8910_device, data_r, data_w) |
| 383 | | AM_RANGE(0x40, 0x40) AM_READWRITE(gsword_fake_1_r, gsword_AY8910_control_port_1_w) |
| 386 | AM_RANGE(0x40, 0x40) AM_READWRITE(fake_1_r, ay8910_control_port_1_w) |
| 384 | 387 | AM_RANGE(0x41, 0x41) AM_DEVREADWRITE("ay2", ay8910_device, data_r, data_w) |
| 385 | 388 | |
| 386 | 389 | AM_RANGE(0x81, 0x81) AM_DEVWRITE("josvolly_8741", josvolly8741_4pack_device, nmi_enable_w) |
| r243475 | r243476 | |
| 638 | 641 | |
| 639 | 642 | MCFG_QUANTUM_TIME(attotime::from_hz(12000)) /* Allow time for 2nd cpu to interleave*/ |
| 640 | 643 | |
| 641 | | MCFG_MACHINE_RESET_OVERRIDE(gsword_state,gsword) |
| 642 | | |
| 643 | 644 | MCFG_TAITO8741_ADD("taito8741") |
| 644 | 645 | MCFG_TAITO8741_MODES(TAITO8741_MASTER,TAITO8741_SLAVE,TAITO8741_PORT,TAITO8741_PORT) |
| 645 | 646 | MCFG_TAITO8741_CONNECT(1,0,0,0) |
| r243475 | r243476 | |
| 670 | 671 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 671 | 672 | |
| 672 | 673 | MCFG_SOUND_ADD("ay2", AY8910, 1500000) |
| 673 | | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, gsword_nmi_set_w)) /* portA write */ |
| 674 | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, nmi_set_w)) /* portA write */ |
| 674 | 675 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 675 | 676 | |
| 676 | 677 | MCFG_SOUND_ADD("msm", MSM5205, XTAL_400kHz) /* verified on pcb */ |
| r243475 | r243476 | |
| 691 | 692 | MCFG_CPU_IO_MAP(josvolly_cpu2_io_map) |
| 692 | 693 | MCFG_CPU_VBLANK_INT_DRIVER("screen", gsword_state, irq0_line_hold) |
| 693 | 694 | |
| 694 | | MCFG_MACHINE_RESET_OVERRIDE(gsword_state,josvolly) |
| 695 | | |
| 696 | 695 | MCFG_JOSVOLLY8741_ADD("josvolly_8741") |
| 697 | 696 | MCFG_JOSVOLLY8741_CONNECT(1,0,0,0) |
| 698 | 697 | MCFG_JOSVOLLY8741_PORT_HANDLERS(IOPORT("DSW1"),IOPORT("DSW2"),IOPORT("DSW1"),IOPORT("DSW2")) |
| r243475 | r243476 | |
| 719 | 718 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 720 | 719 | |
| 721 | 720 | MCFG_SOUND_ADD("ay2", AY8910, 1500000) |
| 722 | | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, gsword_nmi_set_w)) /* portA write */ |
| 721 | MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(gsword_state, nmi_set_w)) /* portA write */ |
| 723 | 722 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) |
| 724 | 723 | |
| 725 | 724 | #if 0 |
| r243475 | r243476 | |
| 901 | 900 | } |
| 902 | 901 | |
| 903 | 902 | |
| 904 | | GAME( 1983, josvolly, 0, josvolly, josvolly, driver_device, 0, ROT90, "Allumer / Taito Corporation", "Joshi Volleyball", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 905 | | GAME( 1984, gsword, 0, gsword, gsword, gsword_state, gsword, ROT0, "Allumer / Taito Corporation", "Great Swordsman (World?)", 0 ) |
| 906 | | GAME( 1984, gsword2, gsword, gsword, gsword, gsword_state, gsword2, ROT0, "Allumer / Taito Corporation", "Great Swordsman (Japan?)", 0 ) |
| 903 | GAME( 1983, josvolly, 0, josvolly, josvolly, driver_device, 0, ROT90, "Allumer / Taito Corporation", "Joshi Volleyball", GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) |
| 904 | GAME( 1984, gsword, 0, gsword, gsword, gsword_state, gsword, ROT0, "Allumer / Taito Corporation", "Great Swordsman (World?)", GAME_SUPPORTS_SAVE ) |
| 905 | GAME( 1984, gsword2, gsword, gsword, gsword, gsword_state, gsword2, ROT0, "Allumer / Taito Corporation", "Great Swordsman (Japan?)", GAME_SUPPORTS_SAVE ) |
trunk/src/mame/includes/gsword.h
| r243475 | r243476 | |
| 1 | #include "sound/ay8910.h" |
| 1 | 2 | #include "sound/msm5205.h" |
| 2 | 3 | |
| 3 | 4 | class gsword_state : public driver_device |
| r243475 | r243476 | |
| 5 | 6 | public: |
| 6 | 7 | gsword_state(const machine_config &mconfig, device_type type, const char *tag) |
| 7 | 8 | : driver_device(mconfig, type, tag), |
| 8 | | m_spritetile_ram(*this, "spritetile_ram"), |
| 9 | | m_spritexy_ram(*this, "spritexy_ram"), |
| 10 | | m_spriteattrib_ram(*this, "spriteattram"), |
| 11 | | m_videoram(*this, "videoram"), |
| 12 | | m_cpu2_ram(*this, "cpu2_ram"), |
| 13 | 9 | m_maincpu(*this, "maincpu"), |
| 14 | 10 | m_audiocpu(*this, "audiocpu"), |
| 15 | 11 | m_subcpu(*this, "sub"), |
| 12 | m_ay0(*this, "ay1"), |
| 13 | m_ay1(*this, "ay2"), |
| 16 | 14 | m_msm(*this, "msm"), |
| 17 | 15 | m_gfxdecode(*this, "gfxdecode"), |
| 18 | | m_palette(*this, "palette") { } |
| 16 | m_palette(*this, "palette"), |
| 17 | m_spritetile_ram(*this, "spritetile_ram"), |
| 18 | m_spritexy_ram(*this, "spritexy_ram"), |
| 19 | m_spriteattrib_ram(*this, "spriteattram"), |
| 20 | m_videoram(*this, "videoram"), |
| 21 | m_cpu2_ram(*this, "cpu2_ram") { } |
| 19 | 22 | |
| 23 | required_device<cpu_device> m_maincpu; |
| 24 | required_device<cpu_device> m_audiocpu; |
| 25 | optional_device<cpu_device> m_subcpu; |
| 26 | required_device<ay8910_device> m_ay0; |
| 27 | required_device<ay8910_device> m_ay1; |
| 28 | optional_device<msm5205_device> m_msm; |
| 29 | required_device<gfxdecode_device> m_gfxdecode; |
| 30 | required_device<palette_device> m_palette; |
| 31 | |
| 20 | 32 | required_shared_ptr<UINT8> m_spritetile_ram; |
| 21 | 33 | required_shared_ptr<UINT8> m_spritexy_ram; |
| 22 | 34 | required_shared_ptr<UINT8> m_spriteattrib_ram; |
| 23 | 35 | required_shared_ptr<UINT8> m_videoram; |
| 24 | 36 | required_shared_ptr<UINT8> m_cpu2_ram; |
| 25 | 37 | |
| 26 | | int m_coins; |
| 38 | int m_coins; //currently initialized but not used |
| 27 | 39 | int m_fake8910_0; |
| 28 | 40 | int m_fake8910_1; |
| 29 | 41 | int m_nmi_enable; |
| r243475 | r243476 | |
| 33 | 45 | int m_flipscreen; |
| 34 | 46 | tilemap_t *m_bg_tilemap; |
| 35 | 47 | |
| 36 | | DECLARE_WRITE8_MEMBER(gsword_videoram_w); |
| 37 | | DECLARE_WRITE8_MEMBER(gsword_charbank_w); |
| 38 | | DECLARE_WRITE8_MEMBER(gsword_videoctrl_w); |
| 39 | | DECLARE_WRITE8_MEMBER(gsword_scroll_w); |
| 48 | // common |
| 49 | DECLARE_WRITE8_MEMBER(videoram_w); |
| 50 | DECLARE_WRITE8_MEMBER(charbank_w); |
| 51 | DECLARE_WRITE8_MEMBER(videoctrl_w); |
| 52 | DECLARE_WRITE8_MEMBER(scroll_w); |
| 53 | DECLARE_WRITE8_MEMBER(adpcm_soundcommand_w); |
| 54 | DECLARE_WRITE8_MEMBER(nmi_set_w); |
| 55 | DECLARE_WRITE8_MEMBER(ay8910_control_port_0_w); |
| 56 | DECLARE_WRITE8_MEMBER(ay8910_control_port_1_w); |
| 57 | DECLARE_READ8_MEMBER(fake_0_r); |
| 58 | DECLARE_READ8_MEMBER(fake_1_r); |
| 59 | |
| 60 | // gsword specific |
| 40 | 61 | DECLARE_READ8_MEMBER(gsword_hack_r); |
| 41 | | DECLARE_WRITE8_MEMBER(adpcm_soundcommand_w); |
| 42 | | DECLARE_WRITE8_MEMBER(gsword_nmi_set_w); |
| 43 | | DECLARE_WRITE8_MEMBER(gsword_AY8910_control_port_0_w); |
| 44 | | DECLARE_WRITE8_MEMBER(gsword_AY8910_control_port_1_w); |
| 45 | | DECLARE_READ8_MEMBER(gsword_fake_0_r); |
| 46 | | DECLARE_READ8_MEMBER(gsword_fake_1_r); |
| 47 | | DECLARE_READ8_MEMBER( gsword_8741_2_r ); |
| 48 | | DECLARE_READ8_MEMBER( gsword_8741_3_r ); |
| 49 | 62 | DECLARE_WRITE8_MEMBER(gsword_adpcm_data_w); |
| 63 | DECLARE_READ8_MEMBER(gsword_8741_2_r); |
| 64 | DECLARE_READ8_MEMBER(gsword_8741_3_r); |
| 65 | |
| 66 | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 67 | |
| 50 | 68 | DECLARE_DRIVER_INIT(gsword); |
| 51 | 69 | DECLARE_DRIVER_INIT(gsword2); |
| 52 | | TILE_GET_INFO_MEMBER(get_bg_tile_info); |
| 70 | virtual void machine_start(); |
| 71 | virtual void machine_reset(); |
| 53 | 72 | virtual void video_start(); |
| 54 | | DECLARE_MACHINE_RESET(gsword); |
| 55 | 73 | DECLARE_PALETTE_INIT(gsword); |
| 56 | | DECLARE_MACHINE_RESET(josvolly); |
| 57 | 74 | DECLARE_PALETTE_INIT(josvolly); |
| 75 | |
| 58 | 76 | UINT32 screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 59 | 77 | INTERRUPT_GEN_MEMBER(gsword_snd_interrupt); |
| 60 | 78 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 61 | | int gsword_coins_in(void); |
| 62 | | required_device<cpu_device> m_maincpu; |
| 63 | | required_device<cpu_device> m_audiocpu; |
| 64 | | optional_device<cpu_device> m_subcpu; |
| 65 | | optional_device<msm5205_device> m_msm; |
| 66 | | required_device<gfxdecode_device> m_gfxdecode; |
| 67 | | required_device<palette_device> m_palette; |
| 79 | int coins_in(void); //if 0'd |
| 68 | 80 | }; |