trunk/src/mame/drivers/gunpey.c
| r21485 | r21486 | |
| 5 | 5 | ASM code study: |
| 6 | 6 | 0x84718 main code |
| 7 | 7 | 0x8472c call 0x81f34 reading of dip-switches |
| 8 | 0x5e62: |
| 8 | 9 | 0x84731 call 0x81f5c move dip-switches settings to work RAM |
| 9 | 10 | 0x84736 call 0x80ae4 writes to i/os 0x7fc0-0x7fff: |
| 10 | 11 | 0x7fc0: 0x00 |
| r21485 | r21486 | |
| 96 | 97 | [+0x10] 0x00 |
| 97 | 98 | [+0x12] 0x0c |
| 98 | 99 | does the same with 0x5c89-0x5c9b |
| 99 | | 0x84745: call 0x82026 (TODO) |
| 100 | 0x84745: call 0x82026 |
| 101 | checks if 0x5e62 is 0 (bit 6 of 0x5c80, i/o 0x7f41) |
| 102 | ... |
| 103 | 0x8474a: call 0xa7f53 sound init |
| 100 | 104 | |
| 101 | | |
| 102 | 105 | ============================================================================================= |
| 103 | 106 | |
| 104 | 107 | Gunpey |
| r21485 | r21486 | |
| 186 | 189 | public: |
| 187 | 190 | gunpey_state(const machine_config &mconfig, device_type type, const char *tag) |
| 188 | 191 | : driver_device(mconfig, type, tag), |
| 189 | | m_maincpu(*this, "maincpu") |
| 192 | m_maincpu(*this, "maincpu"), |
| 193 | m_oki(*this, "oki") |
| 190 | 194 | { } |
| 191 | 195 | |
| 192 | 196 | required_device<cpu_device> m_maincpu; |
| 197 | required_device<okim6295_device> m_oki; |
| 193 | 198 | |
| 194 | 199 | UINT16 *m_blit_buffer; |
| 195 | 200 | UINT16 m_blit_ram[0x10]; |
| r21485 | r21486 | |
| 198 | 203 | DECLARE_READ8_MEMBER(gunpey_status_r); |
| 199 | 204 | DECLARE_READ8_MEMBER(gunpey_inputs_r); |
| 200 | 205 | DECLARE_WRITE8_MEMBER(gunpey_blitter_w); |
| 206 | DECLARE_WRITE8_MEMBER(gunpey_output_w); |
| 201 | 207 | DECLARE_DRIVER_INIT(gunpey); |
| 202 | 208 | virtual void video_start(); |
| 203 | 209 | virtual void palette_init(); |
| r21485 | r21486 | |
| 296 | 302 | UINT8 *blit_rom = memregion("blit_data")->base(); |
| 297 | 303 | int x,y; |
| 298 | 304 | |
| 299 | | //printf("gunpey_blitter_w offset %01x data %02x\n", offset,data); |
| 305 | //printf("gunpey_blitter_w offset %01x data %02x\n", offset,data); |
| 300 | 306 | |
| 301 | 307 | blit_ram[offset] = data; |
| 302 | 308 | |
| r21485 | r21486 | |
| 345 | 351 | |
| 346 | 352 | } |
| 347 | 353 | |
| 354 | WRITE8_MEMBER(gunpey_state::gunpey_output_w) |
| 355 | { |
| 356 | if((data & 0xf0) != 0x90) |
| 357 | printf("0x7f48 write with %02x\n",data); |
| 358 | |
| 359 | downcast<okim6295_device *>(m_oki)->set_bank_base((data & 0x0f) * 0x40000); |
| 360 | } |
| 361 | |
| 348 | 362 | /***************************************************************************************/ |
| 349 | 363 | |
| 350 | 364 | static ADDRESS_MAP_START( mem_map, AS_PROGRAM, 16, gunpey_state ) |
| r21485 | r21486 | |
| 357 | 371 | static ADDRESS_MAP_START( io_map, AS_IO, 16, gunpey_state ) |
| 358 | 372 | AM_RANGE(0x7f40, 0x7f45) AM_READ8(gunpey_inputs_r,0xffff) |
| 359 | 373 | |
| 360 | | //AM_RANGE(0x7f48, 0x7f49) AM_RAM |
| 374 | AM_RANGE(0x7f48, 0x7f49) AM_WRITE8(gunpey_output_w,0x00ff) |
| 361 | 375 | AM_RANGE(0x7f80, 0x7f81) AM_DEVREADWRITE8_LEGACY("ymz", ymz280b_r, ymz280b_w, 0xffff) |
| 362 | 376 | |
| 363 | 377 | AM_RANGE(0x7f88, 0x7f89) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0xff00) |
| r21485 | r21486 | |
| 458 | 472 | PORT_START("SYSTEM") // IN4 - 7f44 |
| 459 | 473 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 460 | 474 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 461 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 ) // TEST!! |
| 475 | PORT_SERVICE( 0x04, IP_ACTIVE_HIGH ) // TEST!! |
| 462 | 476 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 ) |
| 463 | 477 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 ) |
| 464 | 478 | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE1 ) |
| r21485 | r21486 | |
| 541 | 555 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker","rspeaker") |
| 542 | 556 | |
| 543 | 557 | MCFG_OKIM6295_ADD("oki", XTAL_16_9344MHz / 8, OKIM6295_PIN7_LOW) |
| 544 | | MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) |
| 545 | | MCFG_SOUND_ROUTE(1, "rspeaker", 0.25) |
| 558 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) |
| 559 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) |
| 546 | 560 | |
| 547 | 561 | MCFG_SOUND_ADD("ymz", YMZ280B, XTAL_16_9344MHz) |
| 548 | 562 | MCFG_SOUND_CONFIG(ymz280b_intf) |