trunk/src/mame/drivers/gauntlet.c
| r18579 | r18580 | |
| 300 | 300 | |
| 301 | 301 | /* MBUS */ |
| 302 | 302 | AM_RANGE(0x800000, 0x801fff) AM_MIRROR(0x2fc000) AM_RAM |
| 303 | | AM_RANGE(0x802000, 0x802fff) AM_MIRROR(0x2fc000) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom") |
| 303 | AM_RANGE(0x802000, 0x802fff) AM_MIRROR(0x2fc000) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom") |
| 304 | 304 | AM_RANGE(0x803000, 0x803001) AM_MIRROR(0x2fcef0) AM_READ_PORT("803000") |
| 305 | 305 | AM_RANGE(0x803002, 0x803003) AM_MIRROR(0x2fcef0) AM_READ_PORT("803002") |
| 306 | 306 | AM_RANGE(0x803004, 0x803005) AM_MIRROR(0x2fcef0) AM_READ_PORT("803004") |
| r18579 | r18580 | |
| 309 | 309 | AM_RANGE(0x80300e, 0x80300f) AM_MIRROR(0x2fcef0) AM_READ8(sound_r, 0x00ff) |
| 310 | 310 | AM_RANGE(0x803100, 0x803101) AM_MIRROR(0x2fce8e) AM_WRITE(watchdog_reset16_w) |
| 311 | 311 | AM_RANGE(0x803120, 0x803121) AM_MIRROR(0x2fce8e) AM_WRITE(sound_reset_w) |
| 312 | | AM_RANGE(0x803140, 0x803141) AM_MIRROR(0x2fce8e) AM_WRITE_LEGACY(atarigen_video_int_ack_w) |
| 313 | | AM_RANGE(0x803150, 0x803151) AM_MIRROR(0x2fce8e) AM_WRITE_LEGACY(atarigen_eeprom_enable_w) |
| 312 | AM_RANGE(0x803140, 0x803141) AM_MIRROR(0x2fce8e) AM_WRITE(video_int_ack_w) |
| 313 | AM_RANGE(0x803150, 0x803151) AM_MIRROR(0x2fce8e) AM_WRITE(eeprom_enable_w) |
| 314 | 314 | AM_RANGE(0x803170, 0x803171) AM_MIRROR(0x2fce8e) AM_WRITE8(sound_w, 0x00ff) |
| 315 | 315 | |
| 316 | 316 | /* VBUS */ |
| 317 | | AM_RANGE(0x900000, 0x901fff) AM_MIRROR(0x2c8000) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield") |
| 317 | AM_RANGE(0x900000, 0x901fff) AM_MIRROR(0x2c8000) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield") |
| 318 | 318 | AM_RANGE(0x902000, 0x903fff) AM_MIRROR(0x2c8000) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w) |
| 319 | 319 | AM_RANGE(0x904000, 0x904fff) AM_MIRROR(0x2c8000) AM_RAM |
| 320 | 320 | AM_RANGE(0x905f6e, 0x905f6f) AM_MIRROR(0x2c8000) AM_RAM_WRITE_LEGACY(gauntlet_yscroll_w) AM_SHARE("yscroll") |
| 321 | | AM_RANGE(0x905000, 0x905f7f) AM_MIRROR(0x2c8000) AM_RAM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha") |
| 321 | AM_RANGE(0x905000, 0x905f7f) AM_MIRROR(0x2c8000) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha") |
| 322 | 322 | AM_RANGE(0x905f80, 0x905fff) AM_MIRROR(0x2c8000) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w) |
| 323 | 323 | AM_RANGE(0x910000, 0x9107ff) AM_MIRROR(0x2cf800) AM_RAM_WRITE(paletteram_IIIIRRRRGGGGBBBB_word_w) AM_SHARE("paletteram") |
| 324 | 324 | AM_RANGE(0x930000, 0x930001) AM_MIRROR(0x2cfffe) AM_WRITE_LEGACY(gauntlet_xscroll_w) AM_SHARE("xscroll") |
| r18579 | r18580 | |
| 508 | 508 | /* basic machine hardware */ |
| 509 | 509 | MCFG_CPU_ADD("maincpu", M68010, ATARI_CLOCK_14MHz/2) |
| 510 | 510 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 511 | | MCFG_CPU_VBLANK_INT("screen", atarigen_video_int_gen) |
| 511 | MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) |
| 512 | 512 | |
| 513 | 513 | MCFG_CPU_ADD("audiocpu", M6502, ATARI_CLOCK_14MHz/8) |
| 514 | 514 | MCFG_CPU_PROGRAM_MAP(sound_map) |
| r18579 | r18580 | |
| 1610 | 1610 | * |
| 1611 | 1611 | *************************************/ |
| 1612 | 1612 | |
| 1613 | | static void gauntlet_common_init(running_machine &machine, int slapstic, int vindctr2) |
| 1613 | //------------------------------------------------- |
| 1614 | // swap_memory: Inverts the bits in a region. |
| 1615 | //------------------------------------------------- |
| 1616 | |
| 1617 | void gauntlet_state::swap_memory(void *ptr1, void *ptr2, int bytes) |
| 1614 | 1618 | { |
| 1615 | | gauntlet_state *state = machine.driver_data<gauntlet_state>(); |
| 1616 | | UINT8 *rom = state->memregion("maincpu")->base(); |
| 1617 | | state->m_eeprom_default = NULL; |
| 1618 | | state->slapstic_configure(*machine.device<cpu_device>("maincpu"), 0x038000, 0, slapstic); |
| 1619 | UINT8 *p1 = (UINT8 *)ptr1; |
| 1620 | UINT8 *p2 = (UINT8 *)ptr2; |
| 1621 | while (bytes--) |
| 1622 | { |
| 1623 | int temp = *p1; |
| 1624 | *p1++ = *p2; |
| 1625 | *p2++ = temp; |
| 1626 | } |
| 1627 | } |
| 1619 | 1628 | |
| 1629 | void gauntlet_state::common_init(int slapstic, int vindctr2) |
| 1630 | { |
| 1631 | UINT8 *rom = memregion("maincpu")->base(); |
| 1632 | m_eeprom_default = NULL; |
| 1633 | slapstic_configure(*subdevice<cpu_device>("maincpu"), 0x038000, 0, slapstic); |
| 1634 | |
| 1620 | 1635 | /* swap the top and bottom halves of the main CPU ROM images */ |
| 1621 | | atarigen_swap_mem(rom + 0x000000, rom + 0x008000, 0x8000); |
| 1622 | | atarigen_swap_mem(rom + 0x040000, rom + 0x048000, 0x8000); |
| 1623 | | atarigen_swap_mem(rom + 0x050000, rom + 0x058000, 0x8000); |
| 1624 | | atarigen_swap_mem(rom + 0x060000, rom + 0x068000, 0x8000); |
| 1625 | | atarigen_swap_mem(rom + 0x070000, rom + 0x078000, 0x8000); |
| 1636 | swap_memory(rom + 0x000000, rom + 0x008000, 0x8000); |
| 1637 | swap_memory(rom + 0x040000, rom + 0x048000, 0x8000); |
| 1638 | swap_memory(rom + 0x050000, rom + 0x058000, 0x8000); |
| 1639 | swap_memory(rom + 0x060000, rom + 0x068000, 0x8000); |
| 1640 | swap_memory(rom + 0x070000, rom + 0x078000, 0x8000); |
| 1626 | 1641 | |
| 1627 | 1642 | /* indicate whether or not we are vindicators 2 */ |
| 1628 | | state->m_vindctr2_screen_refresh = vindctr2; |
| 1643 | m_vindctr2_screen_refresh = vindctr2; |
| 1629 | 1644 | } |
| 1630 | 1645 | |
| 1631 | 1646 | |
| 1632 | 1647 | DRIVER_INIT_MEMBER(gauntlet_state,gauntlet) |
| 1633 | 1648 | { |
| 1634 | | gauntlet_common_init(machine(), 104, 0); |
| 1649 | common_init(104, 0); |
| 1635 | 1650 | } |
| 1636 | 1651 | |
| 1637 | 1652 | |
| 1638 | 1653 | DRIVER_INIT_MEMBER(gauntlet_state,gaunt2p) |
| 1639 | 1654 | { |
| 1640 | | gauntlet_common_init(machine(), 107, 0); |
| 1655 | common_init(107, 0); |
| 1641 | 1656 | } |
| 1642 | 1657 | |
| 1643 | 1658 | |
| 1644 | 1659 | DRIVER_INIT_MEMBER(gauntlet_state,gauntlet2) |
| 1645 | 1660 | { |
| 1646 | | gauntlet_common_init(machine(), 106, 0); |
| 1661 | common_init(106, 0); |
| 1647 | 1662 | } |
| 1648 | 1663 | |
| 1649 | 1664 | |
| r18579 | r18580 | |
| 1653 | 1668 | UINT8 *data = auto_alloc_array(machine(), UINT8, 0x8000); |
| 1654 | 1669 | int i; |
| 1655 | 1670 | |
| 1656 | | gauntlet_common_init(machine(), 118, 1); |
| 1671 | common_init(118, 1); |
| 1657 | 1672 | |
| 1658 | 1673 | /* highly strange -- the address bits on the chip at 2J (and only that |
| 1659 | 1674 | chip) are scrambled -- this is verified on the schematics! */ |
trunk/src/mame/drivers/eprom.c
| r18579 | r18580 | |
| 146 | 146 | |
| 147 | 147 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, eprom_state ) |
| 148 | 148 | AM_RANGE(0x000000, 0x09ffff) AM_ROM |
| 149 | | AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom") |
| 149 | AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom") |
| 150 | 150 | AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("sync_data") |
| 151 | 151 | AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1") |
| 152 | | AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w) |
| 152 | AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE(eeprom_enable_w) |
| 153 | 153 | AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000") |
| 154 | 154 | AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r) |
| 155 | 155 | AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r) |
| 156 | 156 | AM_RANGE(0x260030, 0x260031) AM_READ8(sound_r, 0x00ff) |
| 157 | 157 | AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w) |
| 158 | | AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w) |
| 158 | AM_RANGE(0x360000, 0x360001) AM_WRITE(video_int_ack_w) |
| 159 | 159 | AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w) |
| 160 | 160 | AM_RANGE(0x360020, 0x360021) AM_WRITE(sound_reset_w) |
| 161 | 161 | AM_RANGE(0x360030, 0x360031) AM_WRITE8(sound_w, 0x00ff) |
| 162 | 162 | AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram") |
| 163 | | AM_RANGE(0x3f0000, 0x3f1fff) AM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield") |
| 163 | AM_RANGE(0x3f0000, 0x3f1fff) AM_WRITE(playfield_w) AM_SHARE("playfield") |
| 164 | 164 | AM_RANGE(0x3f2000, 0x3f3fff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w) |
| 165 | | AM_RANGE(0x3f4000, 0x3f4f7f) AM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha") |
| 165 | AM_RANGE(0x3f4000, 0x3f4f7f) AM_WRITE(alpha_w) AM_SHARE("alpha") |
| 166 | 166 | AM_RANGE(0x3f4f80, 0x3f4fff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w) |
| 167 | | AM_RANGE(0x3f8000, 0x3f9fff) AM_WRITE_LEGACY(atarigen_playfield_upper_w) AM_SHARE("playfield_up") |
| 167 | AM_RANGE(0x3f8000, 0x3f9fff) AM_WRITE(playfield_upper_w) AM_SHARE("playfield_up") |
| 168 | 168 | AM_RANGE(0x3f0000, 0x3f9fff) AM_RAM |
| 169 | 169 | ADDRESS_MAP_END |
| 170 | 170 | |
| 171 | 171 | |
| 172 | 172 | static ADDRESS_MAP_START( guts_map, AS_PROGRAM, 16, eprom_state ) |
| 173 | 173 | AM_RANGE(0x000000, 0x09ffff) AM_ROM |
| 174 | | AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom") |
| 174 | AM_RANGE(0x0e0000, 0x0e0fff) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom") |
| 175 | 175 | AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("sync_data") |
| 176 | 176 | AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1") |
| 177 | | AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w) |
| 177 | AM_RANGE(0x1f0000, 0x1fffff) AM_WRITE(eeprom_enable_w) |
| 178 | 178 | AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000") |
| 179 | 179 | AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r) |
| 180 | 180 | AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r) |
| 181 | 181 | AM_RANGE(0x260030, 0x260031) AM_READ8(sound_r, 0x00ff) |
| 182 | 182 | AM_RANGE(0x2e0000, 0x2e0001) AM_WRITE(watchdog_reset16_w) |
| 183 | | AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w) |
| 183 | AM_RANGE(0x360000, 0x360001) AM_WRITE(video_int_ack_w) |
| 184 | 184 | // AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w) |
| 185 | 185 | AM_RANGE(0x360020, 0x360021) AM_WRITE(sound_reset_w) |
| 186 | 186 | AM_RANGE(0x360030, 0x360031) AM_WRITE8(sound_w, 0x00ff) |
| 187 | 187 | AM_RANGE(0x3e0000, 0x3e0fff) AM_RAM AM_SHARE("paletteram") |
| 188 | | AM_RANGE(0xff0000, 0xff1fff) AM_WRITE_LEGACY(atarigen_playfield_upper_w) AM_SHARE("playfield_up") |
| 189 | | AM_RANGE(0xff8000, 0xff9fff) AM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield") |
| 188 | AM_RANGE(0xff0000, 0xff1fff) AM_WRITE(playfield_upper_w) AM_SHARE("playfield_up") |
| 189 | AM_RANGE(0xff8000, 0xff9fff) AM_WRITE(playfield_w) AM_SHARE("playfield") |
| 190 | 190 | AM_RANGE(0xffa000, 0xffbfff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w) |
| 191 | | AM_RANGE(0xffc000, 0xffcf7f) AM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha") |
| 191 | AM_RANGE(0xffc000, 0xffcf7f) AM_WRITE(alpha_w) AM_SHARE("alpha") |
| 192 | 192 | AM_RANGE(0xffcf80, 0xffcfff) AM_READWRITE_LEGACY(atarimo_0_slipram_r, atarimo_0_slipram_w) |
| 193 | 193 | AM_RANGE(0xff0000, 0xff1fff) AM_RAM |
| 194 | 194 | AM_RANGE(0xff8000, 0xffffff) AM_RAM |
| r18579 | r18580 | |
| 210 | 210 | AM_RANGE(0x260010, 0x26001f) AM_READ(special_port1_r) |
| 211 | 211 | AM_RANGE(0x260020, 0x26002f) AM_READ(adc_r) |
| 212 | 212 | AM_RANGE(0x260030, 0x260031) AM_READ8(sound_r, 0x00ff) |
| 213 | | AM_RANGE(0x360000, 0x360001) AM_WRITE_LEGACY(atarigen_video_int_ack_w) |
| 213 | AM_RANGE(0x360000, 0x360001) AM_WRITE(video_int_ack_w) |
| 214 | 214 | AM_RANGE(0x360010, 0x360011) AM_WRITE(eprom_latch_w) |
| 215 | 215 | AM_RANGE(0x360020, 0x360021) AM_WRITE(sound_reset_w) |
| 216 | 216 | AM_RANGE(0x360030, 0x360031) AM_WRITE8(sound_w, 0x00ff) |
| r18579 | r18580 | |
| 396 | 396 | /* basic machine hardware */ |
| 397 | 397 | MCFG_CPU_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2) |
| 398 | 398 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 399 | | MCFG_CPU_VBLANK_INT("screen", atarigen_video_int_gen) |
| 399 | MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) |
| 400 | 400 | |
| 401 | 401 | MCFG_CPU_ADD("extra", M68000, ATARI_CLOCK_14MHz/2) |
| 402 | 402 | MCFG_CPU_PROGRAM_MAP(extra_map) |
| r18579 | r18580 | |
| 429 | 429 | /* basic machine hardware */ |
| 430 | 430 | MCFG_CPU_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2) |
| 431 | 431 | MCFG_CPU_PROGRAM_MAP(main_map) |
| 432 | | MCFG_CPU_VBLANK_INT("screen", atarigen_video_int_gen) |
| 432 | MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) |
| 433 | 433 | |
| 434 | 434 | MCFG_QUANTUM_TIME(attotime::from_hz(600)) |
| 435 | 435 | |
| r18579 | r18580 | |
| 459 | 459 | /* basic machine hardware */ |
| 460 | 460 | MCFG_CPU_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2) |
| 461 | 461 | MCFG_CPU_PROGRAM_MAP(guts_map) |
| 462 | | MCFG_CPU_VBLANK_INT("screen", atarigen_video_int_gen) |
| 462 | MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) |
| 463 | 463 | |
| 464 | 464 | MCFG_QUANTUM_TIME(attotime::from_hz(600)) |
| 465 | 465 | |
trunk/src/mame/drivers/cyberbal.c
| r18579 | r18580 | |
| 137 | 137 | |
| 138 | 138 | static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, cyberbal_state ) |
| 139 | 139 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 140 | | AM_RANGE(0xfc0000, 0xfc0fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom") |
| 140 | AM_RANGE(0xfc0000, 0xfc0fff) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom") |
| 141 | 141 | AM_RANGE(0xfc8000, 0xfcffff) AM_READ8(sound_r, 0xff00) |
| 142 | | AM_RANGE(0xfd0000, 0xfd1fff) AM_WRITE_LEGACY(atarigen_eeprom_enable_w) |
| 142 | AM_RANGE(0xfd0000, 0xfd1fff) AM_WRITE(eeprom_enable_w) |
| 143 | 143 | AM_RANGE(0xfd2000, 0xfd3fff) AM_WRITE(sound_reset_w) |
| 144 | 144 | AM_RANGE(0xfd4000, 0xfd5fff) AM_WRITE(watchdog_reset16_w) |
| 145 | 145 | AM_RANGE(0xfd6000, 0xfd7fff) AM_WRITE(p2_reset_w) |
| r18579 | r18580 | |
| 148 | 148 | AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1") |
| 149 | 149 | AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("paletteram_1") |
| 150 | 150 | AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("paletteram_0") |
| 151 | | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE_LEGACY(atarigen_playfield2_w) AM_SHARE("playfield2") |
| 152 | | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE_LEGACY(atarigen_alpha2_w) AM_SHARE("alpha2") |
| 151 | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2") |
| 152 | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2") |
| 153 | 153 | AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w) |
| 154 | 154 | AM_RANGE(0xff3800, 0xff3fff) AM_RAM AM_SHARE("share6") |
| 155 | | AM_RANGE(0xff4000, 0xff5fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield") |
| 156 | | AM_RANGE(0xff6000, 0xff6fff) AM_RAM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha") |
| 155 | AM_RANGE(0xff4000, 0xff5fff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield") |
| 156 | AM_RANGE(0xff6000, 0xff6fff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha") |
| 157 | 157 | AM_RANGE(0xff7000, 0xff77ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w) |
| 158 | 158 | AM_RANGE(0xff7800, 0xff9fff) AM_RAM AM_SHARE("share10") |
| 159 | 159 | AM_RANGE(0xffa000, 0xffbfff) AM_READONLY AM_WRITENOP AM_SHARE("share11") |
| r18579 | r18580 | |
| 170 | 170 | |
| 171 | 171 | static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16, cyberbal_state ) |
| 172 | 172 | AM_RANGE(0x000000, 0x03ffff) AM_ROM |
| 173 | | AM_RANGE(0xfc0000, 0xfdffff) AM_WRITE_LEGACY(atarigen_video_int_ack_w) |
| 173 | AM_RANGE(0xfc0000, 0xfdffff) AM_WRITE(video_int_ack_w) |
| 174 | 174 | AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r) |
| 175 | 175 | AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1") |
| 176 | 176 | AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("paletteram_1") |
| 177 | 177 | AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("paletteram_0") |
| 178 | | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE_LEGACY(atarigen_playfield2_w) AM_SHARE("playfield2") |
| 179 | | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE_LEGACY(atarigen_alpha2_w) AM_SHARE("alpha2") |
| 178 | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2") |
| 179 | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2") |
| 180 | 180 | AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w) |
| 181 | 181 | AM_RANGE(0xff3800, 0xff3fff) AM_RAM AM_SHARE("share6") |
| 182 | | AM_RANGE(0xff4000, 0xff5fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield") |
| 183 | | AM_RANGE(0xff6000, 0xff6fff) AM_RAM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha") |
| 182 | AM_RANGE(0xff4000, 0xff5fff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield") |
| 183 | AM_RANGE(0xff6000, 0xff6fff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha") |
| 184 | 184 | AM_RANGE(0xff7000, 0xff77ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w) |
| 185 | 185 | AM_RANGE(0xff7800, 0xff9fff) AM_RAM AM_SHARE("share10") |
| 186 | 186 | AM_RANGE(0xffa000, 0xffbfff) AM_RAM AM_SHARE("share11") |
| r18579 | r18580 | |
| 241 | 241 | AM_RANGE(0xfc2000, 0xfc2003) AM_READ_PORT("IN1") |
| 242 | 242 | AM_RANGE(0xfc4000, 0xfc4003) AM_READ(special_port2_r) |
| 243 | 243 | AM_RANGE(0xfc6000, 0xfc6003) AM_READ8(sound_r, 0xff00) |
| 244 | | AM_RANGE(0xfc8000, 0xfc8fff) AM_READWRITE_LEGACY(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom") |
| 245 | | AM_RANGE(0xfca000, 0xfcafff) AM_RAM_WRITE_LEGACY(atarigen_666_paletteram_w) AM_SHARE("paletteram") |
| 246 | | AM_RANGE(0xfd0000, 0xfd0003) AM_WRITE_LEGACY(atarigen_eeprom_enable_w) |
| 244 | AM_RANGE(0xfc8000, 0xfc8fff) AM_READWRITE(eeprom_r, eeprom_w) AM_SHARE("eeprom") |
| 245 | AM_RANGE(0xfca000, 0xfcafff) AM_RAM_WRITE(paletteram_666_w) AM_SHARE("paletteram") |
| 246 | AM_RANGE(0xfd0000, 0xfd0003) AM_WRITE(eeprom_enable_w) |
| 247 | 247 | AM_RANGE(0xfd2000, 0xfd2003) AM_WRITE(sound_reset_w) |
| 248 | 248 | AM_RANGE(0xfd4000, 0xfd4003) AM_WRITE(watchdog_reset16_w) |
| 249 | | AM_RANGE(0xfd6000, 0xfd6003) AM_WRITE_LEGACY(atarigen_video_int_ack_w) |
| 249 | AM_RANGE(0xfd6000, 0xfd6003) AM_WRITE(video_int_ack_w) |
| 250 | 250 | AM_RANGE(0xfd8000, 0xfd8003) AM_WRITE8(sound_w, 0xff00) |
| 251 | 251 | AM_RANGE(0xfe0000, 0xfe0003) AM_READ(sound_state_r) |
| 252 | | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE_LEGACY(atarigen_playfield_w) AM_SHARE("playfield") |
| 253 | | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE_LEGACY(atarigen_alpha_w) AM_SHARE("alpha") |
| 252 | AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield_w) AM_SHARE("playfield") |
| 253 | AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha_w) AM_SHARE("alpha") |
| 254 | 254 | AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_0_spriteram_r, atarimo_0_spriteram_w) |
| 255 | 255 | AM_RANGE(0xff3800, 0xffffff) AM_RAM |
| 256 | 256 | ADDRESS_MAP_END |
| r18579 | r18580 | |
| 416 | 416 | |
| 417 | 417 | MCFG_CPU_ADD("extra", M68000, ATARI_CLOCK_14MHz/2) |
| 418 | 418 | MCFG_CPU_PROGRAM_MAP(extra_map) |
| 419 | | MCFG_CPU_VBLANK_INT("lscreen", atarigen_video_int_gen) /* or is it "right?" */ |
| 419 | MCFG_DEVICE_VBLANK_INT_DRIVER("lscreen", atarigen_state, video_int_gen) /* or is it "right?" */ |
| 420 | 420 | |
| 421 | 421 | MCFG_CPU_ADD("dac", M68000, ATARI_CLOCK_14MHz/2) |
| 422 | 422 | MCFG_CPU_PROGRAM_MAP(sound_68k_map) |
| r18579 | r18580 | |
| 468 | 468 | /* basic machine hardware */ |
| 469 | 469 | MCFG_CPU_ADD("maincpu", M68000, ATARI_CLOCK_14MHz/2) |
| 470 | 470 | MCFG_CPU_PROGRAM_MAP(cyberbal2p_map) |
| 471 | | MCFG_CPU_VBLANK_INT("screen", atarigen_video_int_gen) |
| 471 | MCFG_DEVICE_VBLANK_INT_DRIVER("screen", atarigen_state, video_int_gen) |
| 472 | 472 | |
| 473 | 473 | MCFG_MACHINE_START_OVERRIDE(cyberbal_state,cyberbal) |
| 474 | 474 | MCFG_MACHINE_RESET_OVERRIDE(cyberbal_state,cyberbal2p) |
trunk/src/mame/machine/atarigen.c
| r18579 | r18580 | |
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | //------------------------------------------------- |
| 326 | | // atarigen_sound_int_gen: Standard interrupt routine which |
| 326 | // sound_int_gen: Standard interrupt routine which |
| 327 | 327 | // sets the sound interrupt state. |
| 328 | 328 | //------------------------------------------------- |
| 329 | 329 | |
| 330 | | INTERRUPT_GEN( atarigen_sound_int_gen ) |
| 330 | INTERRUPT_GEN_MEMBER(atarigen_state::sound_int_gen) |
| 331 | 331 | { |
| 332 | | atarigen_state *state = device->machine().driver_data<atarigen_state>(); |
| 333 | | state->m_sound_int_state = 1; |
| 334 | | state->update_interrupts(); |
| 332 | m_sound_int_state = 1; |
| 333 | update_interrupts(); |
| 335 | 334 | } |
| 336 | 335 | |
| 337 | 336 | |
| 338 | 337 | //------------------------------------------------- |
| 339 | | // atarigen_sound_int_ack_w: Resets the state of the sound |
| 338 | // sound_int_ack_w: Resets the state of the sound |
| 340 | 339 | // interrupt. |
| 341 | 340 | //------------------------------------------------- |
| 342 | 341 | |
| 343 | | WRITE16_HANDLER( atarigen_sound_int_ack_w ) |
| 342 | WRITE16_MEMBER(atarigen_state::sound_int_ack_w) |
| 344 | 343 | { |
| 345 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 346 | | state->m_sound_int_state = 0; |
| 347 | | state->update_interrupts(); |
| 344 | m_sound_int_state = 0; |
| 345 | update_interrupts(); |
| 348 | 346 | } |
| 349 | 347 | |
| 350 | | WRITE32_HANDLER( atarigen_sound_int_ack32_w ) |
| 351 | | { |
| 352 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 353 | | state->m_sound_int_state = 0; |
| 354 | | state->update_interrupts(); |
| 355 | | } |
| 356 | 348 | |
| 357 | | |
| 358 | 349 | //------------------------------------------------- |
| 359 | | // atarigen_video_int_gen: Standard interrupt routine which |
| 350 | // video_int_gen: Standard interrupt routine which |
| 360 | 351 | // sets the video interrupt state. |
| 361 | 352 | //------------------------------------------------- |
| 362 | 353 | |
| 363 | | INTERRUPT_GEN( atarigen_video_int_gen ) |
| 354 | INTERRUPT_GEN_MEMBER(atarigen_state::video_int_gen) |
| 364 | 355 | { |
| 365 | | atarigen_state *state = device->machine().driver_data<atarigen_state>(); |
| 366 | | state->m_video_int_state = 1; |
| 367 | | state->update_interrupts(); |
| 356 | m_video_int_state = 1; |
| 357 | update_interrupts(); |
| 368 | 358 | } |
| 369 | 359 | |
| 370 | 360 | |
| 371 | 361 | //------------------------------------------------- |
| 372 | | // atarigen_video_int_ack_w: Resets the state of the video |
| 362 | // video_int_ack_w: Resets the state of the video |
| 373 | 363 | // interrupt. |
| 374 | 364 | //------------------------------------------------- |
| 375 | 365 | |
| 376 | | WRITE16_HANDLER( atarigen_video_int_ack_w ) |
| 366 | WRITE16_MEMBER(atarigen_state::video_int_ack_w) |
| 377 | 367 | { |
| 378 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 379 | | state->m_video_int_state = 0; |
| 380 | | state->update_interrupts(); |
| 368 | m_video_int_state = 0; |
| 369 | update_interrupts(); |
| 381 | 370 | } |
| 382 | 371 | |
| 383 | | WRITE32_HANDLER( atarigen_video_int_ack32_w ) |
| 384 | | { |
| 385 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 386 | | state->m_video_int_state = 0; |
| 387 | | state->update_interrupts(); |
| 388 | | } |
| 389 | 372 | |
| 390 | 373 | |
| 391 | | |
| 392 | 374 | /*************************************************************************** |
| 393 | 375 | EEPROM HANDLING |
| 394 | 376 | ***************************************************************************/ |
| 395 | 377 | |
| 396 | 378 | //------------------------------------------------- |
| 397 | | // atarigen_eeprom_enable_w: Any write to this handler will |
| 379 | // eeprom_enable_w: Any write to this handler will |
| 398 | 380 | // allow one byte to be written to the EEPROM data area the |
| 399 | 381 | // next time. |
| 400 | 382 | //------------------------------------------------- |
| 401 | 383 | |
| 402 | | WRITE16_HANDLER( atarigen_eeprom_enable_w ) |
| 384 | WRITE16_MEMBER(atarigen_state::eeprom_enable_w) |
| 403 | 385 | { |
| 404 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 405 | | state->m_eeprom_unlocked = true; |
| 386 | m_eeprom_unlocked = true; |
| 406 | 387 | } |
| 407 | 388 | |
| 408 | | WRITE32_HANDLER( atarigen_eeprom_enable32_w ) |
| 409 | | { |
| 410 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 411 | | state->m_eeprom_unlocked = true; |
| 412 | | } |
| 413 | 389 | |
| 414 | | |
| 415 | 390 | //------------------------------------------------- |
| 416 | | // atarigen_eeprom_w: Writes a "word" to the EEPROM, which is |
| 391 | // eeprom_w: Writes a "word" to the EEPROM, which is |
| 417 | 392 | // almost always accessed via the low byte of the word only. |
| 418 | 393 | // If the EEPROM hasn't been unlocked, the write attempt is |
| 419 | 394 | // ignored. |
| 420 | 395 | //------------------------------------------------- |
| 421 | 396 | |
| 422 | | WRITE16_HANDLER( atarigen_eeprom_w ) |
| 397 | WRITE16_MEMBER(atarigen_state::eeprom_w) |
| 423 | 398 | { |
| 424 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 425 | | |
| 426 | | if (!state->m_eeprom_unlocked) |
| 399 | if (!m_eeprom_unlocked) |
| 427 | 400 | return; |
| 428 | 401 | |
| 429 | | COMBINE_DATA(&state->m_eeprom[offset]); |
| 430 | | state->m_eeprom_unlocked = false; |
| 402 | COMBINE_DATA(&m_eeprom[offset]); |
| 403 | m_eeprom_unlocked = false; |
| 431 | 404 | } |
| 432 | 405 | |
| 433 | | WRITE32_HANDLER( atarigen_eeprom32_w ) |
| 406 | WRITE32_MEMBER(atarigen_state::eeprom32_w) |
| 434 | 407 | { |
| 435 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 436 | | |
| 437 | | if (!state->m_eeprom_unlocked) |
| 408 | if (!m_eeprom_unlocked) |
| 438 | 409 | return; |
| 439 | 410 | |
| 440 | | COMBINE_DATA(&state->m_eeprom[offset * 2 + 1]); |
| 411 | COMBINE_DATA(&m_eeprom[offset * 2 + 1]); |
| 441 | 412 | data >>= 16; |
| 442 | 413 | mem_mask >>= 16; |
| 443 | | COMBINE_DATA(&state->m_eeprom[offset * 2]); |
| 444 | | state->m_eeprom_unlocked = false; |
| 414 | COMBINE_DATA(&m_eeprom[offset * 2]); |
| 415 | m_eeprom_unlocked = false; |
| 445 | 416 | } |
| 446 | 417 | |
| 447 | 418 | |
| 448 | 419 | //------------------------------------------------- |
| 449 | | // atarigen_eeprom_r: Reads a "word" from the EEPROM, which is |
| 420 | // eeprom_r: Reads a "word" from the EEPROM, which is |
| 450 | 421 | // almost always accessed via the low byte of the word only. |
| 451 | 422 | //------------------------------------------------- |
| 452 | 423 | |
| 453 | | READ16_HANDLER( atarigen_eeprom_r ) |
| 424 | READ16_MEMBER(atarigen_state::eeprom_r) |
| 454 | 425 | { |
| 455 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 456 | | return state->m_eeprom[offset] | 0xff00; |
| 426 | return m_eeprom[offset] | 0xff00; |
| 457 | 427 | } |
| 458 | 428 | |
| 459 | | READ16_HANDLER( atarigen_eeprom_upper_r ) |
| 429 | READ32_MEMBER(atarigen_state::eeprom_upper32_r) |
| 460 | 430 | { |
| 461 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 462 | | return state->m_eeprom[offset] | 0x00ff; |
| 431 | return (m_eeprom[offset * 2] << 16) | m_eeprom[offset * 2 + 1] | 0x00ff00ff; |
| 463 | 432 | } |
| 464 | 433 | |
| 465 | | READ32_HANDLER( atarigen_eeprom_upper32_r ) |
| 466 | | { |
| 467 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 468 | | return (state->m_eeprom[offset * 2] << 16) | state->m_eeprom[offset * 2 + 1] | 0x00ff00ff; |
| 469 | | } |
| 470 | 434 | |
| 471 | 435 | |
| 472 | | |
| 473 | 436 | /*************************************************************************** |
| 474 | 437 | SLAPSTIC HANDLING |
| 475 | 438 | ***************************************************************************/ |
| r18579 | r18580 | |
| 691 | 654 | READ8_MEMBER(atarigen_state::sound_r) |
| 692 | 655 | { |
| 693 | 656 | m_sound_to_cpu_ready = 0; |
| 694 | | atarigen_sound_int_ack_w(space, 0, 0, 0xffff); |
| 657 | sound_int_ack_w(space, 0, 0); |
| 695 | 658 | return m_sound_to_cpu; |
| 696 | 659 | } |
| 697 | 660 | |
| r18579 | r18580 | |
| 753 | 716 | |
| 754 | 717 | // reset the sound write state |
| 755 | 718 | m_sound_to_cpu_ready = 0; |
| 756 | | atarigen_sound_int_ack_w(m_sound_cpu->space(AS_PROGRAM), 0, 0, 0xffff); |
| 719 | sound_int_ack_w(m_sound_cpu->space(AS_PROGRAM), 0, 0); |
| 757 | 720 | |
| 758 | 721 | // allocate a high frequency timer until a response is generated |
| 759 | 722 | // the main CPU is *very* sensistive to the timing of the response |
| r18579 | r18580 | |
| 797 | 760 | // set up the states and signal the sound interrupt to the main CPU |
| 798 | 761 | m_sound_to_cpu = data; |
| 799 | 762 | m_sound_to_cpu_ready = 1; |
| 800 | | atarigen_sound_int_gen(machine().device("maincpu")); |
| 763 | sound_int_gen(*machine().device("maincpu")); |
| 801 | 764 | } |
| 802 | 765 | |
| 803 | 766 | |
| r18579 | r18580 | |
| 943 | 906 | // atarivc_reset: Initializes the video controller. |
| 944 | 907 | //------------------------------------------------- |
| 945 | 908 | |
| 946 | | void atarivc_reset(screen_device &screen, UINT16 *eof_data, int playfields) |
| 909 | void atarigen_state::atarivc_reset(screen_device &screen, UINT16 *eof_data, int playfields) |
| 947 | 910 | { |
| 948 | | atarigen_state *state = screen.machine().driver_data<atarigen_state>(); |
| 949 | | |
| 950 | 911 | // this allows us to manually reset eof_data to NULL if it's not used |
| 951 | | state->m_atarivc_eof_data.set_target(eof_data, 0x100); |
| 952 | | state->m_atarivc_playfields = playfields; |
| 912 | m_atarivc_eof_data.set_target(eof_data, 0x100); |
| 913 | m_atarivc_playfields = playfields; |
| 953 | 914 | |
| 954 | 915 | // clear the RAM we use |
| 955 | | memset(state->m_atarivc_data, 0, 0x40); |
| 956 | | memset(&state->m_atarivc_state, 0, sizeof(state->m_atarivc_state)); |
| 916 | memset(m_atarivc_data, 0, 0x40); |
| 917 | memset(&m_atarivc_state, 0, sizeof(m_atarivc_state)); |
| 957 | 918 | |
| 958 | 919 | // reset the latches |
| 959 | | state->m_atarivc_state.latch1 = state->m_atarivc_state.latch2 = -1; |
| 960 | | state->m_actual_vc_latch0 = state->m_actual_vc_latch1 = -1; |
| 920 | m_atarivc_state.latch1 = m_atarivc_state.latch2 = -1; |
| 921 | m_actual_vc_latch0 = m_actual_vc_latch1 = -1; |
| 961 | 922 | |
| 962 | 923 | // start a timer to go off a little before scanline 0 |
| 963 | | if (state->m_atarivc_eof_data) |
| 924 | if (m_atarivc_eof_data != NULL) |
| 964 | 925 | get_screen_timer(screen)->atarivc_eof_update_timer->adjust(screen.time_until_pos(0)); |
| 965 | 926 | } |
| 966 | 927 | |
| r18579 | r18580 | |
| 969 | 930 | // atarivc_w: Handles an I/O write to the video controller. |
| 970 | 931 | //------------------------------------------------- |
| 971 | 932 | |
| 972 | | void atarivc_w(screen_device &screen, offs_t offset, UINT16 data, UINT16 mem_mask) |
| 933 | void atarigen_state::atarivc_w(screen_device &screen, offs_t offset, UINT16 data, UINT16 mem_mask) |
| 973 | 934 | { |
| 974 | | atarigen_state *state = screen.machine().driver_data<atarigen_state>(); |
| 975 | | int oldword = state->m_atarivc_data[offset]; |
| 935 | int oldword = m_atarivc_data[offset]; |
| 976 | 936 | int newword = oldword; |
| 977 | 937 | |
| 978 | 938 | COMBINE_DATA(&newword); |
| r18579 | r18580 | |
| 986 | 946 | // write. |
| 987 | 947 | //------------------------------------------------- |
| 988 | 948 | |
| 989 | | static void atarivc_common_w(screen_device &screen, offs_t offset, UINT16 newword) |
| 949 | void atarigen_state::atarivc_common_w(screen_device &screen, offs_t offset, UINT16 newword) |
| 990 | 950 | { |
| 991 | | atarigen_state *state = screen.machine().driver_data<atarigen_state>(); |
| 992 | | int oldword = state->m_atarivc_data[offset]; |
| 993 | | state->m_atarivc_data[offset] = newword; |
| 951 | int oldword = m_atarivc_data[offset]; |
| 952 | m_atarivc_data[offset] = newword; |
| 994 | 953 | |
| 995 | 954 | // switch off the offset |
| 996 | 955 | switch (offset) |
| r18579 | r18580 | |
| 1005 | 964 | // set the scanline interrupt here |
| 1006 | 965 | case 0x03: |
| 1007 | 966 | if (oldword != newword) |
| 1008 | | state->scanline_int_set(screen, newword & 0x1ff); |
| 967 | scanline_int_set(screen, newword & 0x1ff); |
| 1009 | 968 | break; |
| 1010 | 969 | |
| 1011 | 970 | // latch enable |
| 1012 | 971 | case 0x0a: |
| 1013 | 972 | |
| 1014 | 973 | // reset the latches when disabled |
| 1015 | | atarigen_set_playfield_latch(state, (newword & 0x0080) ? state->m_actual_vc_latch0 : -1); |
| 1016 | | atarigen_set_playfield2_latch(state, (newword & 0x0080) ? state->m_actual_vc_latch1 : -1); |
| 974 | set_playfield_latch((newword & 0x0080) ? m_actual_vc_latch0 : -1); |
| 975 | set_playfield2_latch((newword & 0x0080) ? m_actual_vc_latch1 : -1); |
| 1017 | 976 | |
| 1018 | 977 | // check for rowscroll enable |
| 1019 | | state->m_atarivc_state.rowscroll_enable = (newword & 0x2000) >> 13; |
| 978 | m_atarivc_state.rowscroll_enable = (newword & 0x2000) >> 13; |
| 1020 | 979 | |
| 1021 | 980 | // check for palette banking |
| 1022 | | if (state->m_atarivc_state.palette_bank != (((newword & 0x0400) >> 10) ^ 1)) |
| 981 | if (m_atarivc_state.palette_bank != (((newword & 0x0400) >> 10) ^ 1)) |
| 1023 | 982 | { |
| 1024 | 983 | screen.update_partial(screen.vpos()); |
| 1025 | | state->m_atarivc_state.palette_bank = ((newword & 0x0400) >> 10) ^ 1; |
| 984 | m_atarivc_state.palette_bank = ((newword & 0x0400) >> 10) ^ 1; |
| 1026 | 985 | } |
| 1027 | 986 | break; |
| 1028 | 987 | |
| r18579 | r18580 | |
| 1033 | 992 | switch (newword & 15) |
| 1034 | 993 | { |
| 1035 | 994 | case 9: |
| 1036 | | state->m_atarivc_state.mo_xscroll = (newword >> 7) & 0x1ff; |
| 995 | m_atarivc_state.mo_xscroll = (newword >> 7) & 0x1ff; |
| 1037 | 996 | break; |
| 1038 | 997 | |
| 1039 | 998 | case 10: |
| 1040 | | state->m_atarivc_state.pf1_xscroll_raw = (newword >> 7) & 0x1ff; |
| 1041 | | atarivc_update_pf_xscrolls(state); |
| 999 | m_atarivc_state.pf1_xscroll_raw = (newword >> 7) & 0x1ff; |
| 1000 | atarivc_update_pf_xscrolls(); |
| 1042 | 1001 | break; |
| 1043 | 1002 | |
| 1044 | 1003 | case 11: |
| 1045 | | state->m_atarivc_state.pf0_xscroll_raw = (newword >> 7) & 0x1ff; |
| 1046 | | atarivc_update_pf_xscrolls(state); |
| 1004 | m_atarivc_state.pf0_xscroll_raw = (newword >> 7) & 0x1ff; |
| 1005 | atarivc_update_pf_xscrolls(); |
| 1047 | 1006 | break; |
| 1048 | 1007 | |
| 1049 | 1008 | case 13: |
| 1050 | | state->m_atarivc_state.mo_yscroll = (newword >> 7) & 0x1ff; |
| 1009 | m_atarivc_state.mo_yscroll = (newword >> 7) & 0x1ff; |
| 1051 | 1010 | break; |
| 1052 | 1011 | |
| 1053 | 1012 | case 14: |
| 1054 | | state->m_atarivc_state.pf1_yscroll = (newword >> 7) & 0x1ff; |
| 1013 | m_atarivc_state.pf1_yscroll = (newword >> 7) & 0x1ff; |
| 1055 | 1014 | break; |
| 1056 | 1015 | |
| 1057 | 1016 | case 15: |
| 1058 | | state->m_atarivc_state.pf0_yscroll = (newword >> 7) & 0x1ff; |
| 1017 | m_atarivc_state.pf0_yscroll = (newword >> 7) & 0x1ff; |
| 1059 | 1018 | break; |
| 1060 | 1019 | } |
| 1061 | 1020 | break; |
| 1062 | 1021 | |
| 1063 | 1022 | // latch 1 value |
| 1064 | 1023 | case 0x1c: |
| 1065 | | state->m_actual_vc_latch0 = -1; |
| 1066 | | state->m_actual_vc_latch1 = newword; |
| 1067 | | atarigen_set_playfield_latch(state, (state->m_atarivc_data[0x0a] & 0x80) ? state->m_actual_vc_latch0 : -1); |
| 1068 | | atarigen_set_playfield2_latch(state, (state->m_atarivc_data[0x0a] & 0x80) ? state->m_actual_vc_latch1 : -1); |
| 1024 | m_actual_vc_latch0 = -1; |
| 1025 | m_actual_vc_latch1 = newword; |
| 1026 | set_playfield_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch0 : -1); |
| 1027 | set_playfield2_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch1 : -1); |
| 1069 | 1028 | break; |
| 1070 | 1029 | |
| 1071 | 1030 | // latch 2 value |
| 1072 | 1031 | case 0x1d: |
| 1073 | | state->m_actual_vc_latch0 = newword; |
| 1074 | | state->m_actual_vc_latch1 = -1; |
| 1075 | | atarigen_set_playfield_latch(state, (state->m_atarivc_data[0x0a] & 0x80) ? state->m_actual_vc_latch0 : -1); |
| 1076 | | atarigen_set_playfield2_latch(state, (state->m_atarivc_data[0x0a] & 0x80) ? state->m_actual_vc_latch1 : -1); |
| 1032 | m_actual_vc_latch0 = newword; |
| 1033 | m_actual_vc_latch1 = -1; |
| 1034 | set_playfield_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch0 : -1); |
| 1035 | set_playfield2_latch((m_atarivc_data[0x0a] & 0x80) ? m_actual_vc_latch1 : -1); |
| 1077 | 1036 | break; |
| 1078 | 1037 | |
| 1079 | 1038 | // scanline IRQ ack here |
| 1080 | 1039 | case 0x1e: |
| 1081 | 1040 | // hack: this should be a device |
| 1082 | | state->scanline_int_ack_w(screen.machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0, 0xffff); |
| 1041 | scanline_int_ack_w(screen.machine().device("maincpu")->memory().space(AS_PROGRAM), 0, 0, 0xffff); |
| 1083 | 1042 | break; |
| 1084 | 1043 | |
| 1085 | 1044 | // log anything else |
| r18579 | r18580 | |
| 1096 | 1055 | // atarivc_r: Handles an I/O read from the video controller. |
| 1097 | 1056 | //------------------------------------------------- |
| 1098 | 1057 | |
| 1099 | | UINT16 atarivc_r(screen_device &screen, offs_t offset) |
| 1058 | UINT16 atarigen_state::atarivc_r(screen_device &screen, offs_t offset) |
| 1100 | 1059 | { |
| 1101 | | atarigen_state *state = screen.machine().driver_data<atarigen_state>(); |
| 1102 | | |
| 1103 | 1060 | logerror("vc_r(%02X)\n", offset); |
| 1104 | 1061 | |
| 1105 | 1062 | // a read from offset 0 returns the current scanline |
| r18579 | r18580 | |
| 1116 | 1073 | return result; |
| 1117 | 1074 | } |
| 1118 | 1075 | else |
| 1119 | | return state->m_atarivc_data[offset]; |
| 1076 | return m_atarivc_data[offset]; |
| 1120 | 1077 | } |
| 1121 | 1078 | |
| 1122 | 1079 | |
| r18579 | r18580 | |
| 1126 | 1083 | ***************************************************************************/ |
| 1127 | 1084 | |
| 1128 | 1085 | //------------------------------------------------- |
| 1129 | | // atarigen_alpha_w: Generic write handler for alpha RAM. |
| 1086 | // alpha_w: Generic write handler for alpha RAM. |
| 1130 | 1087 | //------------------------------------------------- |
| 1131 | 1088 | |
| 1132 | | WRITE16_HANDLER( atarigen_alpha_w ) |
| 1089 | WRITE16_MEMBER(atarigen_state::alpha_w) |
| 1133 | 1090 | { |
| 1134 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1135 | | COMBINE_DATA(&state->m_alpha[offset]); |
| 1136 | | state->m_alpha_tilemap->mark_tile_dirty(offset); |
| 1091 | COMBINE_DATA(&m_alpha[offset]); |
| 1092 | m_alpha_tilemap->mark_tile_dirty(offset); |
| 1137 | 1093 | } |
| 1138 | 1094 | |
| 1139 | | WRITE32_HANDLER( atarigen_alpha32_w ) |
| 1095 | WRITE32_MEMBER(atarigen_state::alpha32_w) |
| 1140 | 1096 | { |
| 1141 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1142 | | COMBINE_DATA(&state->m_alpha32[offset]); |
| 1097 | COMBINE_DATA(&m_alpha32[offset]); |
| 1143 | 1098 | if (ACCESSING_BITS_16_31) |
| 1144 | | state->m_alpha_tilemap->mark_tile_dirty(offset * 2); |
| 1099 | m_alpha_tilemap->mark_tile_dirty(offset * 2); |
| 1145 | 1100 | if (ACCESSING_BITS_0_15) |
| 1146 | | state->m_alpha_tilemap->mark_tile_dirty(offset * 2 + 1); |
| 1101 | m_alpha_tilemap->mark_tile_dirty(offset * 2 + 1); |
| 1147 | 1102 | } |
| 1148 | 1103 | |
| 1149 | | WRITE16_HANDLER( atarigen_alpha2_w ) |
| 1104 | WRITE16_MEMBER(atarigen_state::alpha2_w) |
| 1150 | 1105 | { |
| 1151 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1152 | | COMBINE_DATA(&state->m_alpha2[offset]); |
| 1153 | | state->m_alpha2_tilemap->mark_tile_dirty(offset); |
| 1106 | COMBINE_DATA(&m_alpha2[offset]); |
| 1107 | m_alpha2_tilemap->mark_tile_dirty(offset); |
| 1154 | 1108 | } |
| 1155 | 1109 | |
| 1156 | 1110 | |
| 1157 | 1111 | |
| 1158 | 1112 | //------------------------------------------------- |
| 1159 | | // atarigen_set_playfield_latch: Sets the latch for the latched |
| 1113 | // set_playfield_latch: Sets the latch for the latched |
| 1160 | 1114 | // playfield handlers below. |
| 1161 | 1115 | //------------------------------------------------- |
| 1162 | 1116 | |
| 1163 | | void atarigen_set_playfield_latch(atarigen_state *state, int data) |
| 1117 | void atarigen_state::set_playfield_latch(int data) |
| 1164 | 1118 | { |
| 1165 | | state->m_playfield_latch = data; |
| 1119 | m_playfield_latch = data; |
| 1166 | 1120 | } |
| 1167 | 1121 | |
| 1168 | | void atarigen_set_playfield2_latch(atarigen_state *state, int data) |
| 1122 | void atarigen_state::set_playfield2_latch(int data) |
| 1169 | 1123 | { |
| 1170 | | state->m_playfield2_latch = data; |
| 1124 | m_playfield2_latch = data; |
| 1171 | 1125 | } |
| 1172 | 1126 | |
| 1173 | 1127 | |
| 1174 | 1128 | |
| 1175 | 1129 | //------------------------------------------------- |
| 1176 | | // atarigen_playfield_w: Generic write handler for PF RAM. |
| 1130 | // playfield_w: Generic write handler for PF RAM. |
| 1177 | 1131 | //------------------------------------------------- |
| 1178 | 1132 | |
| 1179 | | WRITE16_HANDLER( atarigen_playfield_w ) |
| 1133 | WRITE16_MEMBER(atarigen_state::playfield_w) |
| 1180 | 1134 | { |
| 1181 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1182 | | COMBINE_DATA(&state->m_playfield[offset]); |
| 1183 | | state->m_playfield_tilemap->mark_tile_dirty(offset); |
| 1135 | COMBINE_DATA(&m_playfield[offset]); |
| 1136 | m_playfield_tilemap->mark_tile_dirty(offset); |
| 1184 | 1137 | } |
| 1185 | 1138 | |
| 1186 | | WRITE32_HANDLER( atarigen_playfield32_w ) |
| 1139 | WRITE32_MEMBER(atarigen_state::playfield32_w) |
| 1187 | 1140 | { |
| 1188 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1189 | | COMBINE_DATA(&state->m_playfield32[offset]); |
| 1141 | COMBINE_DATA(&m_playfield32[offset]); |
| 1190 | 1142 | if (ACCESSING_BITS_16_31) |
| 1191 | | state->m_playfield_tilemap->mark_tile_dirty(offset * 2); |
| 1143 | m_playfield_tilemap->mark_tile_dirty(offset * 2); |
| 1192 | 1144 | if (ACCESSING_BITS_0_15) |
| 1193 | | state->m_playfield_tilemap->mark_tile_dirty(offset * 2 + 1); |
| 1145 | m_playfield_tilemap->mark_tile_dirty(offset * 2 + 1); |
| 1194 | 1146 | } |
| 1195 | 1147 | |
| 1196 | | WRITE16_HANDLER( atarigen_playfield2_w ) |
| 1148 | WRITE16_MEMBER(atarigen_state::playfield2_w) |
| 1197 | 1149 | { |
| 1198 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1199 | | COMBINE_DATA(&state->m_playfield2[offset]); |
| 1200 | | state->m_playfield2_tilemap->mark_tile_dirty(offset); |
| 1150 | COMBINE_DATA(&m_playfield2[offset]); |
| 1151 | m_playfield2_tilemap->mark_tile_dirty(offset); |
| 1201 | 1152 | } |
| 1202 | 1153 | |
| 1203 | 1154 | |
| 1204 | 1155 | |
| 1205 | 1156 | //------------------------------------------------- |
| 1206 | | // atarigen_playfield_large_w: Generic write handler for |
| 1157 | // playfield_large_w: Generic write handler for |
| 1207 | 1158 | // large (2-word) playfield RAM. |
| 1208 | 1159 | //------------------------------------------------- |
| 1209 | 1160 | |
| 1210 | | WRITE16_HANDLER( atarigen_playfield_large_w ) |
| 1161 | WRITE16_MEMBER(atarigen_state::playfield_large_w) |
| 1211 | 1162 | { |
| 1212 | 1163 | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1213 | 1164 | COMBINE_DATA(&state->m_playfield[offset]); |
| r18579 | r18580 | |
| 1217 | 1168 | |
| 1218 | 1169 | |
| 1219 | 1170 | //------------------------------------------------- |
| 1220 | | // atarigen_playfield_upper_w: Generic write handler for |
| 1171 | // playfield_upper_w: Generic write handler for |
| 1221 | 1172 | // upper word of split playfield RAM. |
| 1222 | 1173 | //------------------------------------------------- |
| 1223 | 1174 | |
| 1224 | | WRITE16_HANDLER( atarigen_playfield_upper_w ) |
| 1175 | WRITE16_MEMBER(atarigen_state::playfield_upper_w) |
| 1225 | 1176 | { |
| 1226 | 1177 | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1227 | 1178 | COMBINE_DATA(&state->m_playfield_upper[offset]); |
| r18579 | r18580 | |
| 1231 | 1182 | |
| 1232 | 1183 | |
| 1233 | 1184 | //------------------------------------------------- |
| 1234 | | // atarigen_playfield_dual_upper_w: Generic write handler for |
| 1185 | // playfield_dual_upper_w: Generic write handler for |
| 1235 | 1186 | // upper word of split dual playfield RAM. |
| 1236 | 1187 | //------------------------------------------------- |
| 1237 | 1188 | |
| 1238 | | WRITE16_HANDLER( atarigen_playfield_dual_upper_w ) |
| 1189 | WRITE16_MEMBER(atarigen_state::playfield_dual_upper_w) |
| 1239 | 1190 | { |
| 1240 | 1191 | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1241 | 1192 | COMBINE_DATA(&state->m_playfield_upper[offset]); |
| r18579 | r18580 | |
| 1246 | 1197 | |
| 1247 | 1198 | |
| 1248 | 1199 | //------------------------------------------------- |
| 1249 | | // atarigen_playfield_latched_lsb_w: Generic write handler for |
| 1200 | // playfield_latched_lsb_w: Generic write handler for |
| 1250 | 1201 | // lower word of playfield RAM with a latch in the LSB of the |
| 1251 | 1202 | // upper word. |
| 1252 | 1203 | //------------------------------------------------- |
| 1253 | 1204 | |
| 1254 | | WRITE16_HANDLER( atarigen_playfield_latched_lsb_w ) |
| 1205 | WRITE16_MEMBER(atarigen_state::playfield_latched_lsb_w) |
| 1255 | 1206 | { |
| 1256 | 1207 | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1257 | 1208 | |
| r18579 | r18580 | |
| 1265 | 1216 | |
| 1266 | 1217 | |
| 1267 | 1218 | //------------------------------------------------- |
| 1268 | | // atarigen_playfield_latched_lsb_w: Generic write handler for |
| 1219 | // playfield_latched_msb_w: Generic write handler for |
| 1269 | 1220 | // lower word of playfield RAM with a latch in the MSB of the |
| 1270 | 1221 | // upper word. |
| 1271 | 1222 | //------------------------------------------------- |
| 1272 | 1223 | |
| 1273 | | WRITE16_HANDLER( atarigen_playfield_latched_msb_w ) |
| 1224 | WRITE16_MEMBER(atarigen_state::playfield_latched_msb_w) |
| 1274 | 1225 | { |
| 1275 | 1226 | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1276 | 1227 | |
| r18579 | r18580 | |
| 1284 | 1235 | |
| 1285 | 1236 | |
| 1286 | 1237 | //------------------------------------------------- |
| 1287 | | // atarigen_playfield_latched_lsb_w: Generic write handler for |
| 1238 | // playfield2_latched_msb_w: Generic write handler for |
| 1288 | 1239 | // lower word of second playfield RAM with a latch in the MSB |
| 1289 | 1240 | // of the upper word. |
| 1290 | 1241 | //------------------------------------------------- |
| 1291 | 1242 | |
| 1292 | | WRITE16_HANDLER( atarigen_playfield2_latched_msb_w ) |
| 1243 | WRITE16_MEMBER(atarigen_state::playfield2_latched_msb_w) |
| 1293 | 1244 | { |
| 1294 | 1245 | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1295 | 1246 | |
| r18579 | r18580 | |
| 1308 | 1259 | ***************************************************************************/ |
| 1309 | 1260 | |
| 1310 | 1261 | //------------------------------------------------- |
| 1311 | | // atarigen_get_hblank: Returns a guesstimate about the current |
| 1312 | | // HBLANK state, based on the assumption that HBLANK represents |
| 1313 | | // 10% of the scanline period. |
| 1314 | | //------------------------------------------------- |
| 1315 | | |
| 1316 | | int atarigen_get_hblank(screen_device &screen) |
| 1317 | | { |
| 1318 | | return (screen.hpos() > (screen.width() * 9 / 10)); |
| 1319 | | } |
| 1320 | | |
| 1321 | | |
| 1322 | | //------------------------------------------------- |
| 1323 | 1262 | // halt_until_hblank_0: Halts CPU 0 until the |
| 1324 | 1263 | // next HBLANK. |
| 1325 | 1264 | //------------------------------------------------- |
| r18579 | r18580 | |
| 1342 | 1281 | |
| 1343 | 1282 | |
| 1344 | 1283 | //------------------------------------------------- |
| 1345 | | // atarigen_666_paletteram_w: 6-6-6 RGB palette RAM handler. |
| 1284 | // paletteram_666_w: 6-6-6 RGB palette RAM handler. |
| 1346 | 1285 | //------------------------------------------------- |
| 1347 | 1286 | |
| 1348 | | WRITE16_HANDLER( atarigen_666_paletteram_w ) |
| 1287 | WRITE16_MEMBER(atarigen_state::paletteram_666_w) |
| 1349 | 1288 | { |
| 1350 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1351 | 1289 | int newword, r, g, b; |
| 1352 | 1290 | |
| 1353 | | COMBINE_DATA(&state->m_generic_paletteram_16[offset]); |
| 1354 | | newword = state->m_generic_paletteram_16[offset]; |
| 1291 | COMBINE_DATA(&m_generic_paletteram_16[offset]); |
| 1292 | newword = m_generic_paletteram_16[offset]; |
| 1355 | 1293 | |
| 1356 | 1294 | r = ((newword >> 9) & 0x3e) | ((newword >> 15) & 1); |
| 1357 | 1295 | g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 1); |
| r18579 | r18580 | |
| 1362 | 1300 | |
| 1363 | 1301 | |
| 1364 | 1302 | //------------------------------------------------- |
| 1365 | | // atarigen_expanded_666_paletteram_w: 6-6-6 RGB expanded |
| 1303 | // expanded_paletteram_666_w: 6-6-6 RGB expanded |
| 1366 | 1304 | // palette RAM handler. |
| 1367 | 1305 | //------------------------------------------------- |
| 1368 | 1306 | |
| 1369 | | WRITE16_HANDLER( atarigen_expanded_666_paletteram_w ) |
| 1307 | WRITE16_MEMBER(atarigen_state::expanded_paletteram_666_w) |
| 1370 | 1308 | { |
| 1371 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1372 | | COMBINE_DATA(&state->m_generic_paletteram_16[offset]); |
| 1309 | COMBINE_DATA(&m_generic_paletteram_16[offset]); |
| 1373 | 1310 | |
| 1374 | 1311 | if (ACCESSING_BITS_8_15) |
| 1375 | 1312 | { |
| 1376 | 1313 | int palentry = offset / 2; |
| 1377 | | int newword = (state->m_generic_paletteram_16[palentry * 2] & 0xff00) | (state->m_generic_paletteram_16[palentry * 2 + 1] >> 8); |
| 1314 | int newword = (m_generic_paletteram_16[palentry * 2] & 0xff00) | (m_generic_paletteram_16[palentry * 2 + 1] >> 8); |
| 1378 | 1315 | |
| 1379 | 1316 | int r, g, b; |
| 1380 | 1317 | |
| r18579 | r18580 | |
| 1388 | 1325 | |
| 1389 | 1326 | |
| 1390 | 1327 | //------------------------------------------------- |
| 1391 | | // atarigen_666_paletteram32_w: 6-6-6 RGB palette RAM handler. |
| 1328 | // paletteram32_666_w: 6-6-6 RGB palette RAM handler. |
| 1392 | 1329 | //------------------------------------------------- |
| 1393 | 1330 | |
| 1394 | | WRITE32_HANDLER( atarigen_666_paletteram32_w ) |
| 1331 | WRITE32_MEMBER(atarigen_state::paletteram32_666_w ) |
| 1395 | 1332 | { |
| 1396 | | atarigen_state *state = space.machine().driver_data<atarigen_state>(); |
| 1397 | 1333 | int newword, r, g, b; |
| 1398 | 1334 | |
| 1399 | | COMBINE_DATA(&state->m_generic_paletteram_32[offset]); |
| 1335 | COMBINE_DATA(&m_generic_paletteram_32[offset]); |
| 1400 | 1336 | |
| 1401 | 1337 | if (ACCESSING_BITS_16_31) |
| 1402 | 1338 | { |
| 1403 | | newword = state->m_generic_paletteram_32[offset] >> 16; |
| 1339 | newword = m_generic_paletteram_32[offset] >> 16; |
| 1404 | 1340 | |
| 1405 | 1341 | r = ((newword >> 9) & 0x3e) | ((newword >> 15) & 1); |
| 1406 | 1342 | g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 1); |
| r18579 | r18580 | |
| 1411 | 1347 | |
| 1412 | 1348 | if (ACCESSING_BITS_0_15) |
| 1413 | 1349 | { |
| 1414 | | newword = state->m_generic_paletteram_32[offset] & 0xffff; |
| 1350 | newword = m_generic_paletteram_32[offset] & 0xffff; |
| 1415 | 1351 | |
| 1416 | 1352 | r = ((newword >> 9) & 0x3e) | ((newword >> 15) & 1); |
| 1417 | 1353 | g = ((newword >> 4) & 0x3e) | ((newword >> 15) & 1); |
| r18579 | r18580 | |
| 1428 | 1364 | ***************************************************************************/ |
| 1429 | 1365 | |
| 1430 | 1366 | //------------------------------------------------- |
| 1431 | | // atarigen_swap_mem: Inverts the bits in a region. |
| 1432 | | //------------------------------------------------- |
| 1433 | | |
| 1434 | | void atarigen_swap_mem(void *ptr1, void *ptr2, int bytes) |
| 1435 | | { |
| 1436 | | UINT8 *p1 = (UINT8 *)ptr1; |
| 1437 | | UINT8 *p2 = (UINT8 *)ptr2; |
| 1438 | | while (bytes--) |
| 1439 | | { |
| 1440 | | int temp = *p1; |
| 1441 | | *p1++ = *p2; |
| 1442 | | *p2++ = temp; |
| 1443 | | } |
| 1444 | | } |
| 1445 | | |
| 1446 | | |
| 1447 | | //------------------------------------------------- |
| 1448 | | // atarigen_blend_gfx: Takes two GFXElements and blends their |
| 1367 | // blend_gfx: Takes two GFXElements and blends their |
| 1449 | 1368 | // data together to form one. Then frees the second. |
| 1450 | 1369 | //------------------------------------------------- |
| 1451 | 1370 | |
| 1452 | | void atarigen_blend_gfx(running_machine &machine, int gfx0, int gfx1, int mask0, int mask1) |
| 1371 | void atarigen_state::blend_gfx(int gfx0, int gfx1, int mask0, int mask1) |
| 1453 | 1372 | { |
| 1454 | | gfx_element *gx0 = machine.gfx[gfx0]; |
| 1455 | | gfx_element *gx1 = machine.gfx[gfx1]; |
| 1373 | gfx_element *gx0 = machine().gfx[gfx0]; |
| 1374 | gfx_element *gx1 = machine().gfx[gfx1]; |
| 1456 | 1375 | UINT8 *srcdata, *dest; |
| 1457 | 1376 | int c, x, y; |
| 1458 | 1377 | |
| 1459 | 1378 | // allocate memory for the assembled data |
| 1460 | | srcdata = auto_alloc_array(machine, UINT8, gx0->elements() * gx0->width() * gx0->height()); |
| 1379 | srcdata = auto_alloc_array(machine(), UINT8, gx0->elements() * gx0->width() * gx0->height()); |
| 1461 | 1380 | |
| 1462 | 1381 | // loop over elements |
| 1463 | 1382 | dest = srcdata; |
| r18579 | r18580 | |
| 1485 | 1404 | gx0->set_granularity(granularity); |
| 1486 | 1405 | |
| 1487 | 1406 | // free the second graphics element |
| 1488 | | machine.gfx[gfx1] = NULL; |
| 1489 | | auto_free(machine, gx1); |
| 1407 | machine().gfx[gfx1] = NULL; |
| 1408 | auto_free(machine(), gx1); |
| 1490 | 1409 | } |
| 1491 | 1410 | |
| 1492 | 1411 | |
trunk/src/mame/machine/atarigen.h
| r18579 | r18580 | |
| 106 | 106 | void scanline_int_set(screen_device &screen, int scanline); |
| 107 | 107 | INTERRUPT_GEN_MEMBER(scanline_int_gen); |
| 108 | 108 | DECLARE_WRITE16_MEMBER(scanline_int_ack_w); |
| 109 | INTERRUPT_GEN_MEMBER(sound_int_gen); |
| 110 | DECLARE_WRITE16_MEMBER(sound_int_ack_w); |
| 111 | INTERRUPT_GEN_MEMBER(video_int_gen); |
| 112 | DECLARE_WRITE16_MEMBER(video_int_ack_w); |
| 113 | |
| 114 | // EEPROM helpers |
| 115 | WRITE16_MEMBER(eeprom_enable_w); |
| 116 | WRITE16_MEMBER(eeprom_w); |
| 117 | WRITE32_MEMBER(eeprom32_w); |
| 118 | READ16_MEMBER(eeprom_r); |
| 119 | READ32_MEMBER(eeprom_upper32_r); |
| 109 | 120 | |
| 110 | 121 | // slapstic helpers |
| 111 | 122 | void slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, int chipnum); |
| r18579 | r18580 | |
| 145 | 156 | |
| 146 | 157 | // video controller |
| 147 | 158 | void atarivc_eof_update(emu_timer &timer, screen_device &screen); |
| 159 | void atarivc_reset(screen_device &screen, UINT16 *eof_data, int playfields); |
| 160 | void atarivc_w(screen_device &screen, offs_t offset, UINT16 data, UINT16 mem_mask); |
| 161 | UINT16 atarivc_r(screen_device &screen, offs_t offset); |
| 162 | inline void atarivc_update_pf_xscrolls() |
| 163 | { |
| 164 | m_atarivc_state.pf0_xscroll = m_atarivc_state.pf0_xscroll_raw + ((m_atarivc_state.pf1_xscroll_raw) & 7); |
| 165 | m_atarivc_state.pf1_xscroll = m_atarivc_state.pf1_xscroll_raw + 4; |
| 166 | } |
| 167 | void atarivc_common_w(screen_device &screen, offs_t offset, UINT16 newword); |
| 148 | 168 | |
| 169 | // playfield/alpha tilemap helpers |
| 170 | DECLARE_WRITE16_MEMBER( alpha_w ); |
| 171 | DECLARE_WRITE32_MEMBER( alpha32_w ); |
| 172 | DECLARE_WRITE16_MEMBER( alpha2_w ); |
| 173 | void set_playfield_latch(int data); |
| 174 | void set_playfield2_latch(int data); |
| 175 | DECLARE_WRITE16_MEMBER( playfield_w ); |
| 176 | DECLARE_WRITE32_MEMBER( playfield32_w ); |
| 177 | DECLARE_WRITE16_MEMBER( playfield_large_w ); |
| 178 | DECLARE_WRITE16_MEMBER( playfield_upper_w ); |
| 179 | DECLARE_WRITE16_MEMBER( playfield_dual_upper_w ); |
| 180 | DECLARE_WRITE16_MEMBER( playfield_latched_lsb_w ); |
| 181 | DECLARE_WRITE16_MEMBER( playfield_latched_msb_w ); |
| 182 | DECLARE_WRITE16_MEMBER( playfield2_w ); |
| 183 | DECLARE_WRITE16_MEMBER( playfield2_latched_msb_w ); |
| 184 | |
| 149 | 185 | // video helpers |
| 186 | int get_hblank(screen_device &screen) const { return (screen.hpos() > (screen.width() * 9 / 10)); } |
| 150 | 187 | void halt_until_hblank_0(device_t &device, screen_device &screen); |
| 188 | DECLARE_WRITE16_HANDLER( paletteram_666_w ); |
| 189 | DECLARE_WRITE16_HANDLER( expanded_paletteram_666_w ); |
| 190 | DECLARE_WRITE32_HANDLER( paletteram32_666_w ); |
| 151 | 191 | |
| 192 | // misc helpers |
| 193 | void blend_gfx(int gfx0, int gfx1, int mask0, int mask1); |
| 194 | |
| 152 | 195 | // vector and early raster EAROM interface |
| 153 | 196 | DECLARE_READ8_MEMBER( earom_r ); |
| 154 | 197 | DECLARE_WRITE8_MEMBER( earom_w ); |
| r18579 | r18580 | |
| 236 | 279 | |
| 237 | 280 | |
| 238 | 281 | /*************************************************************************** |
| 239 | | FUNCTION PROTOTYPES |
| 240 | | ***************************************************************************/ |
| 241 | | |
| 242 | | /*--------------------------------------------------------------- |
| 243 | | INTERRUPT HANDLING |
| 244 | | ---------------------------------------------------------------*/ |
| 245 | | |
| 246 | | INTERRUPT_GEN( atarigen_sound_int_gen ); |
| 247 | | DECLARE_WRITE16_HANDLER( atarigen_sound_int_ack_w ); |
| 248 | | DECLARE_WRITE32_HANDLER( atarigen_sound_int_ack32_w ); |
| 249 | | |
| 250 | | INTERRUPT_GEN( atarigen_video_int_gen ); |
| 251 | | DECLARE_WRITE16_HANDLER( atarigen_video_int_ack_w ); |
| 252 | | DECLARE_WRITE32_HANDLER( atarigen_video_int_ack32_w ); |
| 253 | | |
| 254 | | |
| 255 | | /*--------------------------------------------------------------- |
| 256 | | EEPROM HANDLING |
| 257 | | ---------------------------------------------------------------*/ |
| 258 | | |
| 259 | | DECLARE_WRITE16_HANDLER( atarigen_eeprom_enable_w ); |
| 260 | | DECLARE_WRITE16_HANDLER( atarigen_eeprom_w ); |
| 261 | | DECLARE_READ16_HANDLER( atarigen_eeprom_r ); |
| 262 | | DECLARE_READ16_HANDLER( atarigen_eeprom_upper_r ); |
| 263 | | |
| 264 | | DECLARE_WRITE32_HANDLER( atarigen_eeprom_enable32_w ); |
| 265 | | DECLARE_WRITE32_HANDLER( atarigen_eeprom32_w ); |
| 266 | | DECLARE_READ32_HANDLER( atarigen_eeprom_upper32_r ); |
| 267 | | |
| 268 | | |
| 269 | | /*--------------------------------------------------------------- |
| 270 | | VIDEO CONTROLLER |
| 271 | | ---------------------------------------------------------------*/ |
| 272 | | |
| 273 | | void atarivc_reset(screen_device &screen, UINT16 *eof_data, int playfields); |
| 274 | | |
| 275 | | void atarivc_w(screen_device &screen, offs_t offset, UINT16 data, UINT16 mem_mask); |
| 276 | | UINT16 atarivc_r(screen_device &screen, offs_t offset); |
| 277 | | |
| 278 | | INLINE void atarivc_update_pf_xscrolls(atarigen_state *state) |
| 279 | | { |
| 280 | | state->m_atarivc_state.pf0_xscroll = state->m_atarivc_state.pf0_xscroll_raw + ((state->m_atarivc_state.pf1_xscroll_raw) & 7); |
| 281 | | state->m_atarivc_state.pf1_xscroll = state->m_atarivc_state.pf1_xscroll_raw + 4; |
| 282 | | } |
| 283 | | |
| 284 | | |
| 285 | | /*--------------------------------------------------------------- |
| 286 | | PLAYFIELD/ALPHA MAP HELPERS |
| 287 | | ---------------------------------------------------------------*/ |
| 288 | | |
| 289 | | DECLARE_WRITE16_HANDLER( atarigen_alpha_w ); |
| 290 | | DECLARE_WRITE32_HANDLER( atarigen_alpha32_w ); |
| 291 | | DECLARE_WRITE16_HANDLER( atarigen_alpha2_w ); |
| 292 | | void atarigen_set_playfield_latch(atarigen_state *state, int data); |
| 293 | | void atarigen_set_playfield2_latch(atarigen_state *state, int data); |
| 294 | | DECLARE_WRITE16_HANDLER( atarigen_playfield_w ); |
| 295 | | DECLARE_WRITE32_HANDLER( atarigen_playfield32_w ); |
| 296 | | DECLARE_WRITE16_HANDLER( atarigen_playfield_large_w ); |
| 297 | | DECLARE_WRITE16_HANDLER( atarigen_playfield_upper_w ); |
| 298 | | DECLARE_WRITE16_HANDLER( atarigen_playfield_dual_upper_w ); |
| 299 | | DECLARE_WRITE16_HANDLER( atarigen_playfield_latched_lsb_w ); |
| 300 | | DECLARE_WRITE16_HANDLER( atarigen_playfield_latched_msb_w ); |
| 301 | | DECLARE_WRITE16_HANDLER( atarigen_playfield2_w ); |
| 302 | | DECLARE_WRITE16_HANDLER( atarigen_playfield2_latched_msb_w ); |
| 303 | | |
| 304 | | |
| 305 | | /*--------------------------------------------------------------- |
| 306 | | VIDEO HELPERS |
| 307 | | ---------------------------------------------------------------*/ |
| 308 | | |
| 309 | | int atarigen_get_hblank(screen_device &screen); |
| 310 | | DECLARE_WRITE16_HANDLER( atarigen_666_paletteram_w ); |
| 311 | | DECLARE_WRITE16_HANDLER( atarigen_expanded_666_paletteram_w ); |
| 312 | | DECLARE_WRITE32_HANDLER( atarigen_666_paletteram32_w ); |
| 313 | | |
| 314 | | |
| 315 | | /*--------------------------------------------------------------- |
| 316 | | MISC HELPERS |
| 317 | | ---------------------------------------------------------------*/ |
| 318 | | |
| 319 | | void atarigen_swap_mem(void *ptr1, void *ptr2, int bytes); |
| 320 | | void atarigen_blend_gfx(running_machine &machine, int gfx0, int gfx1, int mask0, int mask1); |
| 321 | | |
| 322 | | |
| 323 | | |
| 324 | | /*************************************************************************** |
| 325 | 282 | GENERAL ATARI NOTES |
| 326 | 283 | **************************************************************************## |
| 327 | 284 | |