trunk/src/mame/drivers/seta.c
| r24079 | r24080 | |
| 1366 | 1366 | #include "sound/2612intf.h" |
| 1367 | 1367 | #include "sound/3812intf.h" |
| 1368 | 1368 | #include "sound/okim6295.h" |
| 1369 | | #include "sound/x1_010.h" |
| 1370 | 1369 | #include "sound/2151intf.h" |
| 1371 | 1370 | #include "machine/nvram.h" |
| 1372 | 1371 | |
| r24079 | r24080 | |
| 1647 | 1646 | |
| 1648 | 1647 | static ADDRESS_MAP_START( downtown_map, AS_PROGRAM, 16, seta_state ) |
| 1649 | 1648 | AM_RANGE(0x000000, 0x09ffff) AM_ROM // ROM |
| 1650 | | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 1649 | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 1651 | 1650 | AM_RANGE(0x200000, 0x200001) AM_NOP // watchdog? (twineagl) |
| 1652 | 1651 | AM_RANGE(0x300000, 0x300001) AM_WRITENOP // IRQ enable/acknowledge? |
| 1653 | 1652 | AM_RANGE(0x400000, 0x400007) AM_WRITE(twineagl_tilebank_w) // special tile banking to animate water in twineagl |
| r24079 | r24080 | |
| 1816 | 1815 | static ADDRESS_MAP_START( atehate_map, AS_PROGRAM, 16, seta_state ) |
| 1817 | 1816 | AM_RANGE(0x000000, 0x0fffff) AM_ROM // ROM |
| 1818 | 1817 | AM_RANGE(0x900000, 0x9fffff) AM_RAM // RAM |
| 1819 | | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 1818 | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 1820 | 1819 | AM_RANGE(0x200000, 0x200001) AM_WRITENOP // ? watchdog ? |
| 1821 | 1820 | AM_RANGE(0x300000, 0x300001) AM_WRITENOP // ? 0 (irq ack lev 2?) |
| 1822 | 1821 | AM_RANGE(0x500000, 0x500001) AM_WRITENOP // ? (end of lev 1: bit 4 goes 1,0,1) |
| r24079 | r24080 | |
| 1859 | 1858 | AM_RANGE(0xb04000, 0xb0ffff) AM_RAM // (jjsquawk) |
| 1860 | 1859 | AM_RANGE(0xb80000, 0xb83fff) AM_RAM_WRITE(seta_vram_2_w) AM_SHARE("vram_2") // VRAM 2&3 |
| 1861 | 1860 | AM_RANGE(0xb84000, 0xb8ffff) AM_RAM // (jjsquawk) |
| 1862 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 1861 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 1863 | 1862 | AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP // ? |
| 1864 | 1863 | AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP // ? VBlank IRQ Ack |
| 1865 | 1864 | AM_RANGE(0xf00000, 0xf00001) AM_WRITENOP // ? Sound IRQ Ack |
| r24079 | r24080 | |
| 1894 | 1893 | AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16) |
| 1895 | 1894 | /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 |
| 1896 | 1895 | AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 1897 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 1896 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 1898 | 1897 | AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP // ? |
| 1899 | 1898 | AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP // ? VBlank IRQ Ack |
| 1900 | 1899 | AM_RANGE(0xf00000, 0xf00001) AM_WRITENOP // ? Sound IRQ Ack |
| r24079 | r24080 | |
| 1974 | 1973 | AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16) |
| 1975 | 1974 | /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 |
| 1976 | 1975 | AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 1977 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 1976 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 1978 | 1977 | #if __uPD71054_TIMER |
| 1979 | 1978 | AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w) // ? |
| 1980 | 1979 | #else |
| r24079 | r24080 | |
| 2050 | 2049 | AM_RANGE(0xa0a600, 0xa0a607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16) |
| 2051 | 2050 | // AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 |
| 2052 | 2051 | AM_RANGE(0xb0c000, 0xb0ffff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // RZ: Sprites Code + X + Attr |
| 2053 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2052 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2054 | 2053 | #if __uPD71054_TIMER |
| 2055 | 2054 | AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w) // ? |
| 2056 | 2055 | #else |
| r24079 | r24080 | |
| 2077 | 2076 | //AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r ) // P1 |
| 2078 | 2077 | AM_RANGE(0x8000f0, 0x8000f1) AM_RAM // NVRAM |
| 2079 | 2078 | AM_RANGE(0x800100, 0x8001ff) AM_RAM // NVRAM |
| 2080 | | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2079 | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2081 | 2080 | AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram") // Palette |
| 2082 | 2081 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2083 | 2082 | /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 |
| r24079 | r24080 | |
| 2158 | 2157 | AM_RANGE(0x800100, 0x8001ff) AM_RAM // NVRAM |
| 2159 | 2158 | AM_RANGE(0x900000, 0x900001) AM_WRITENOP // ? |
| 2160 | 2159 | AM_RANGE(0x900002, 0x900003) AM_WRITE(keroppi_prize_w) // |
| 2161 | | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2160 | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2162 | 2161 | AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram") // Palette |
| 2163 | 2162 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2164 | 2163 | /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 |
| r24079 | r24080 | |
| 2189 | 2188 | AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1") // P1 |
| 2190 | 2189 | AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2") // P2 |
| 2191 | 2190 | AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS") // Coins |
| 2192 | | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2191 | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2193 | 2192 | AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram") // Palette |
| 2194 | 2193 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2195 | 2194 | /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 |
| r24079 | r24080 | |
| 2226 | 2225 | AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 |
| 2227 | 2226 | AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2228 | 2227 | AM_RANGE(0xb04000, 0xb13fff) AM_RAM |
| 2229 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2228 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2230 | 2229 | AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP // |
| 2231 | 2230 | ADDRESS_MAP_END |
| 2232 | 2231 | |
| r24079 | r24080 | |
| 2239 | 2238 | AM_RANGE(0x000000, 0x0bffff) AM_ROM // ROM |
| 2240 | 2239 | AM_RANGE(0xf00000, 0xf0ffff) AM_RAM // RAM (qzkklogy) |
| 2241 | 2240 | AM_RANGE(0xffc000, 0xffffff) AM_RAM // RAM (drgnunit,stg) |
| 2242 | | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2241 | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2243 | 2242 | AM_RANGE(0x200000, 0x200001) AM_WRITENOP // Watchdog |
| 2244 | 2243 | AM_RANGE(0x300000, 0x300001) AM_WRITENOP // ? IRQ Ack |
| 2245 | 2244 | AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_SHARE("vregs") // Coin Lockout + Video Registers |
| r24079 | r24080 | |
| 2353 | 2352 | /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 |
| 2354 | 2353 | AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2355 | 2354 | AM_RANGE(0xb04000, 0xb13fff) AM_RAM // |
| 2356 | | AM_RANGE(0xe00000, 0xe03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2355 | AM_RANGE(0xe00000, 0xe03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2357 | 2356 | ADDRESS_MAP_END |
| 2358 | 2357 | |
| 2359 | 2358 | |
| r24079 | r24080 | |
| 2390 | 2389 | #else |
| 2391 | 2390 | AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP // ? |
| 2392 | 2391 | #endif |
| 2393 | | AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2392 | AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2394 | 2393 | ADDRESS_MAP_END |
| 2395 | 2394 | |
| 2396 | 2395 | /* almost identical to kamenrid */ |
| r24079 | r24080 | |
| 2419 | 2418 | #else |
| 2420 | 2419 | AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP // ? |
| 2421 | 2420 | #endif |
| 2422 | | AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2421 | AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2423 | 2422 | ADDRESS_MAP_END |
| 2424 | 2423 | |
| 2425 | 2424 | |
| r24079 | r24080 | |
| 2466 | 2465 | #else |
| 2467 | 2466 | AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP // ? |
| 2468 | 2467 | #endif |
| 2469 | | AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2468 | AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2470 | 2469 | ADDRESS_MAP_END |
| 2471 | 2470 | |
| 2472 | 2471 | |
| r24079 | r24080 | |
| 2511 | 2510 | AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r) // P1 |
| 2512 | 2511 | AM_RANGE(0x8000f0, 0x8000f1) AM_RAM // NVRAM |
| 2513 | 2512 | AM_RANGE(0x800100, 0x8001ff) AM_RAM // NVRAM |
| 2514 | | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2513 | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2515 | 2514 | AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram") // Palette |
| 2516 | 2515 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2517 | 2516 | /**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 |
| r24079 | r24080 | |
| 2557 | 2556 | AM_RANGE(0xa80000, 0xa83fff) AM_RAM_WRITE(seta_vram_2_w) AM_SHARE("vram_2") // VRAM 2&3 |
| 2558 | 2557 | AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_SHARE("vctrl_0") // VRAM 0&1 Ctrl |
| 2559 | 2558 | AM_RANGE(0xb80000, 0xb80005) AM_RAM AM_SHARE("vctrl_2") // VRAM 2&3 Ctrl |
| 2560 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2559 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2561 | 2560 | #if __uPD71054_TIMER |
| 2562 | 2561 | AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w) // ? |
| 2563 | 2562 | #else |
| r24079 | r24080 | |
| 2581 | 2580 | AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS") // Coins |
| 2582 | 2581 | AM_RANGE(0x400000, 0x400001) AM_WRITENOP // ? IRQ Ack |
| 2583 | 2582 | AM_RANGE(0x500000, 0x500005) AM_RAM_WRITE(seta_vregs_w) AM_SHARE("vregs") // Coin Lockout + Video Registers |
| 2584 | | AM_RANGE(0x700000, 0x703fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2583 | AM_RANGE(0x700000, 0x703fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2585 | 2584 | AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE(seta_vram_0_w) AM_SHARE("vram_0") // VRAM 0&1 |
| 2586 | 2585 | AM_RANGE(0x880000, 0x883fff) AM_RAM_WRITE(seta_vram_2_w) AM_SHARE("vram_2") // VRAM 2&3 |
| 2587 | 2586 | /**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_SHARE("vctrl_0") // VRAM 0&1 Ctrl |
| r24079 | r24080 | |
| 2672 | 2671 | /**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r16, spriteylow_w16) // Sprites Y |
| 2673 | 2672 | AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16) |
| 2674 | 2673 | AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram") // Palette |
| 2675 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2674 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2676 | 2675 | AM_RANGE(0xd00000, 0xd00009) AM_READ(kiwame_input_r) // mahjong panel |
| 2677 | 2676 | AM_RANGE(0xe00000, 0xe00003) AM_READ(seta_dsw_r) // DSW |
| 2678 | 2677 | ADDRESS_MAP_END |
| r24079 | r24080 | |
| 2697 | 2696 | static ADDRESS_MAP_START( thunderl_map, AS_PROGRAM, 16, seta_state ) |
| 2698 | 2697 | AM_RANGE(0x000000, 0x00ffff) AM_ROM // ROM |
| 2699 | 2698 | AM_RANGE(0xffc000, 0xffffff) AM_RAM // RAM |
| 2700 | | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2699 | AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2701 | 2700 | AM_RANGE(0x200000, 0x200001) AM_WRITENOP // ? |
| 2702 | 2701 | AM_RANGE(0x300000, 0x300001) AM_WRITENOP // ? |
| 2703 | 2702 | AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w) // Protection (not in wits) |
| r24079 | r24080 | |
| 2721 | 2720 | static ADDRESS_MAP_START( thunderlbl_map, AS_PROGRAM, 16, seta_state ) |
| 2722 | 2721 | AM_RANGE(0x000000, 0x00ffff) AM_ROM // ROM |
| 2723 | 2722 | AM_RANGE(0xffc000, 0xffffff) AM_RAM // RAM |
| 2724 | | // AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2723 | // AM_RANGE(0x100000, 0x103fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2725 | 2724 | AM_RANGE(0x200000, 0x200001) AM_WRITENOP // ? |
| 2726 | 2725 | AM_RANGE(0x300000, 0x300001) AM_WRITENOP // ? |
| 2727 | 2726 | // AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w) // Protection (not in wits) |
| r24079 | r24080 | |
| 2807 | 2806 | AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16) |
| 2808 | 2807 | /**/AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000 |
| 2809 | 2808 | AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2810 | | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2809 | AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2811 | 2810 | ADDRESS_MAP_END |
| 2812 | 2811 | |
| 2813 | 2812 | |
| r24079 | r24080 | |
| 2875 | 2874 | AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2") // P2 |
| 2876 | 2875 | AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS") // Coins |
| 2877 | 2876 | AM_RANGE(0x900000, 0x9001ff) AM_READWRITE(pairlove_prot_r,pairlove_prot_w) |
| 2878 | | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 2877 | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2879 | 2878 | AM_RANGE(0xb00000, 0xb00fff) AM_RAM AM_SHARE("paletteram") // Palette |
| 2880 | 2879 | AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr |
| 2881 | 2880 | AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000 |
| r24079 | r24080 | |
| 2965 | 2964 | |
| 2966 | 2965 | AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff) |
| 2967 | 2966 | |
| 2968 | | AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r, seta_sound_word_w ) // Sound |
| 2967 | AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 2969 | 2968 | |
| 2970 | 2969 | AM_RANGE(0xa00000, 0xa00005) AM_WRITEONLY AM_SHARE("vctrl_0") // VRAM 0&1 Ctrl |
| 2971 | 2970 | AM_RANGE(0xb00000, 0xb03fff) AM_RAM_WRITE(seta_vram_0_w) AM_SHARE("vram_0") // VRAM 0&1 |
| r24079 | r24080 | |
| 3027 | 3026 | |
| 3028 | 3027 | AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff) |
| 3029 | 3028 | |
| 3030 | | AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r, seta_sound_word_w) // Sound |
| 3029 | AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 3031 | 3030 | |
| 3032 | 3031 | AM_RANGE(0xa00000, 0xa00005) AM_WRITEONLY AM_SHARE("vctrl_0") // VRAM 0&1 Ctrl |
| 3033 | 3032 | AM_RANGE(0xb00000, 0xb03fff) AM_RAM_WRITE(seta_vram_0_w) AM_SHARE("vram_0") // VRAM 0&1 |
| r24079 | r24080 | |
| 3166 | 3165 | } |
| 3167 | 3166 | |
| 3168 | 3167 | static ADDRESS_MAP_START( calibr50_sub_map, AS_PROGRAM, 8, seta_state ) |
| 3169 | | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_r,seta_sound_w) // Sound |
| 3168 | AM_RANGE(0x0000, 0x1fff) AM_DEVREADWRITE("x1snd", x1_010_device, read ,write) // Sound |
| 3170 | 3169 | AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r) // From Main CPU |
| 3171 | 3170 | AM_RANGE(0x4000, 0x4000) AM_WRITE(sub_bankswitch_w) // Bankswitching |
| 3172 | 3171 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") // Banked ROM |
| r24079 | r24080 | |
| 3202 | 3201 | static ADDRESS_MAP_START( utoukond_sound_map, AS_PROGRAM, 8, seta_state ) |
| 3203 | 3202 | AM_RANGE(0x0000, 0xdfff) AM_ROM |
| 3204 | 3203 | AM_RANGE(0xe000, 0xefff) AM_RAM |
| 3205 | | AM_RANGE(0xf000, 0xffff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_r,seta_sound_w) |
| 3204 | AM_RANGE(0xf000, 0xffff) AM_DEVREADWRITE("x1snd", x1_010_device, read, write) |
| 3206 | 3205 | ADDRESS_MAP_END |
| 3207 | 3206 | |
| 3208 | 3207 | static ADDRESS_MAP_START( utoukond_sound_io_map, AS_IO, 8, seta_state ) |
trunk/src/mame/drivers/seta2.c
| r24079 | r24080 | |
| 112 | 112 | #include "machine/tmp68301.h" |
| 113 | 113 | #include "cpu/h83002/h8.h" |
| 114 | 114 | #include "sound/okim9810.h" |
| 115 | | #include "sound/x1_010.h" |
| 116 | 115 | #include "machine/eeprom.h" |
| 117 | 116 | #include "machine/nvram.h" |
| 118 | 117 | #include "machine/ticket.h" |
| r24079 | r24080 | |
| 168 | 167 | AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM") // Coins |
| 169 | 168 | AM_RANGE(0x70000c, 0x70000d) AM_READ(watchdog_reset16_r) // Watchdog |
| 170 | 169 | AM_RANGE(0x800000, 0x800001) AM_WRITE(grdians_lockout_w) |
| 171 | | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 170 | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 172 | 171 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 173 | 172 | AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 174 | 173 | AM_RANGE(0xc50000, 0xc5ffff) AM_RAM // cleared |
| r24079 | r24080 | |
| 206 | 205 | AM_RANGE(0x70000a, 0x70000b) AM_READ_PORT("IN1") // P2 |
| 207 | 206 | AM_RANGE(0x70000c, 0x70000d) AM_WRITE(watchdog_reset16_w) |
| 208 | 207 | AM_RANGE(0x800000, 0x800001) AM_WRITE(grdians_lockout_w) |
| 209 | | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 208 | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 210 | 209 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 211 | 210 | AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 212 | 211 | AM_RANGE(0xc50000, 0xc5ffff) AM_RAM // cleared |
| r24079 | r24080 | |
| 265 | 264 | AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1") // DSW 1 |
| 266 | 265 | AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2") // DSW 2 |
| 267 | 266 | AM_RANGE(0x600300, 0x60030f) AM_WRITE(seta2_sound_bank_w) // Samples Banks |
| 268 | | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 267 | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 269 | 268 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 270 | 269 | AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 271 | 270 | AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs") // Video Registers |
| r24079 | r24080 | |
| 288 | 287 | AM_RANGE(0x700300, 0x700301) AM_READ_PORT("DSW1") // DSW 1 |
| 289 | 288 | AM_RANGE(0x700302, 0x700303) AM_READ_PORT("DSW2") // DSW 2 |
| 290 | 289 | AM_RANGE(0x700310, 0x70031f) AM_WRITE(seta2_sound_bank_w) // Samples Banks |
| 291 | | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 290 | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 292 | 291 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 293 | 292 | AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 294 | 293 | AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs") // Video Registers |
| r24079 | r24080 | |
| 311 | 310 | AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1") // DSW 1 |
| 312 | 311 | AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2") // DSW 2 |
| 313 | 312 | AM_RANGE(0x600300, 0x60030f) AM_WRITE(seta2_sound_bank_w) // Samples Banks |
| 314 | | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 313 | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 315 | 314 | AM_RANGE(0xd00000, 0xd3ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 316 | 315 | AM_RANGE(0xd40000, 0xd4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 317 | 316 | AM_RANGE(0xd60000, 0xd6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs") // Video Registers |
| r24079 | r24080 | |
| 359 | 358 | AM_RANGE(0x800000, 0x83ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 360 | 359 | AM_RANGE(0x840000, 0x84ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 361 | 360 | AM_RANGE(0x860000, 0x86003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs") // Video Registers |
| 362 | | AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 361 | AM_RANGE(0x900000, 0x903fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 363 | 362 | AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w) // TMP68301 Registers |
| 364 | 363 | ADDRESS_MAP_END |
| 365 | 364 | |
| r24079 | r24080 | |
| 385 | 384 | AM_RANGE(0xb00000, 0xb3ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 386 | 385 | AM_RANGE(0xb40000, 0xb4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 387 | 386 | AM_RANGE(0xb60000, 0xb6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs") |
| 388 | | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 387 | AM_RANGE(0xa00000, 0xa03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 389 | 388 | AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w) // TMP68301 Registers |
| 390 | 389 | ADDRESS_MAP_END |
| 391 | 390 | |
| r24079 | r24080 | |
| 440 | 439 | AM_RANGE(0x400300, 0x400301) AM_READ_PORT("DSW1") // DSW 1 |
| 441 | 440 | AM_RANGE(0x400302, 0x400303) AM_READ_PORT("DSW2") // DSW 2 |
| 442 | 441 | AM_RANGE(0x400300, 0x40030f) AM_WRITE(seta2_sound_bank_w) // Samples Banks |
| 443 | | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r,seta_sound_word_w) // Sound |
| 442 | AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 444 | 443 | AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram") // Sprites |
| 445 | 444 | AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 446 | 445 | AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs") // Video Registers |
| r24079 | r24080 | |
| 502 | 501 | AM_RANGE( 0x840000, 0x84ffff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram") // Palette |
| 503 | 502 | AM_RANGE( 0x860000, 0x86003f ) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs") // Video Registers |
| 504 | 503 | |
| 505 | | AM_RANGE( 0x900000, 0x903fff ) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_word_r, seta_sound_word_w ) // Sound |
| 504 | AM_RANGE( 0x900000, 0x903fff ) AM_DEVREADWRITE("x1snd", x1_010_device, word_r, word_w) // Sound |
| 506 | 505 | |
| 507 | 506 | AM_RANGE( 0xfffd0a, 0xfffd0b ) AM_READ_PORT("DSW2") // parallel data register (DSW 2) |
| 508 | 507 | AM_RANGE( 0xfffc00, 0xffffff ) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w) // TMP68301 Registers |
trunk/src/emu/sound/x1_010.c
| r24079 | r24080 | |
| 60 | 60 | #define LOG_REGISTER_WRITE(x) do { if (VERBOSE_REGISTER_WRITE) logerror x; } while (0) |
| 61 | 61 | #define LOG_REGISTER_READ(x) do { if (VERBOSE_REGISTER_READ) logerror x; } while (0) |
| 62 | 62 | |
| 63 | | #define SETA_NUM_CHANNELS 16 |
| 64 | | |
| 65 | 63 | #define FREQ_BASE_BITS 8 // Frequency fixed decimal shift bits |
| 66 | 64 | #define ENV_BASE_BITS 16 // wave form envelope fixed decimal shift bits |
| 67 | 65 | #define VOL_BASE (2*32*256/30) // Volume base |
| r24079 | r24080 | |
| 77 | 75 | unsigned char reserve[2]; |
| 78 | 76 | }; |
| 79 | 77 | |
| 80 | | struct x1_010_state |
| 81 | | { |
| 82 | | /* Variables only used here */ |
| 83 | | int rate; // Output sampling rate (Hz) |
| 84 | | sound_stream * stream; // Stream handle |
| 85 | | int address; // address eor data |
| 86 | | const UINT8 *region; // region name |
| 87 | | int sound_enable; // sound output enable/disable |
| 88 | | UINT8 reg[0x2000]; // X1-010 Register & wave form area |
| 89 | | UINT8 HI_WORD_BUF[0x2000]; // X1-010 16bit access ram check avoidance work |
| 90 | | UINT32 smp_offset[SETA_NUM_CHANNELS]; |
| 91 | | UINT32 env_offset[SETA_NUM_CHANNELS]; |
| 92 | 78 | |
| 93 | | UINT32 base_clock; |
| 94 | | }; |
| 95 | | |
| 96 | 79 | /* mixer tables and internal buffers */ |
| 97 | 80 | //static short *mixer_buffer = NULL; |
| 98 | 81 | |
| 99 | | INLINE x1_010_state *get_safe_token(device_t *device) |
| 82 | |
| 83 | const device_type X1_010 = &device_creator<x1_010_device>; |
| 84 | |
| 85 | x1_010_device::x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 86 | : device_t(mconfig, X1_010, "X1-010", tag, owner, clock, "x1_010", __FILE__), |
| 87 | device_sound_interface(mconfig, *this), |
| 88 | m_rate(0), |
| 89 | m_stream(NULL), |
| 90 | m_region(NULL), |
| 91 | m_sound_enable(0), |
| 92 | //m_reg[0x2000], |
| 93 | //m_HI_WORD_BUF[0x2000], |
| 94 | //m_smp_offset[SETA_NUM_CHANNELS], |
| 95 | //m_env_offset[SETA_NUM_CHANNELS], |
| 96 | m_base_clock(0) |
| 100 | 97 | { |
| 101 | | assert(device != NULL); |
| 102 | | assert(device->type() == X1_010); |
| 103 | | return (x1_010_state *)downcast<x1_010_device *>(device)->token(); |
| 104 | 98 | } |
| 105 | 99 | |
| 100 | //------------------------------------------------- |
| 101 | // device_config_complete - perform any |
| 102 | // operations now that the configuration is |
| 103 | // complete |
| 104 | //------------------------------------------------- |
| 106 | 105 | |
| 107 | | /*-------------------------------------------------------------- |
| 108 | | generate sound to the mix buffer |
| 109 | | --------------------------------------------------------------*/ |
| 110 | | static STREAM_UPDATE( seta_update ) |
| 106 | void x1_010_device::device_config_complete() |
| 111 | 107 | { |
| 112 | | x1_010_state *info = (x1_010_state *)param; |
| 108 | // inherit a copy of the static data |
| 109 | const x1_010_interface *intf = reinterpret_cast<const x1_010_interface *>(static_config()); |
| 110 | if (intf != NULL) |
| 111 | *static_cast<x1_010_interface *>(this) = *intf; |
| 112 | |
| 113 | // or initialize to defaults if none provided |
| 114 | else |
| 115 | { |
| 116 | m_adr = 0; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | //------------------------------------------------- |
| 121 | // device_start - device-specific startup |
| 122 | //------------------------------------------------- |
| 123 | |
| 124 | void x1_010_device::device_start() |
| 125 | { |
| 126 | int i; |
| 127 | |
| 128 | m_region = *region(); |
| 129 | m_base_clock = clock(); |
| 130 | m_rate = clock() / 1024; |
| 131 | |
| 132 | for( i = 0; i < SETA_NUM_CHANNELS; i++ ) { |
| 133 | m_smp_offset[i] = 0; |
| 134 | m_env_offset[i] = 0; |
| 135 | } |
| 136 | /* Print some more debug info */ |
| 137 | LOG_SOUND(("masterclock = %d rate = %d\n", clock(), m_rate )); |
| 138 | |
| 139 | /* get stream channels */ |
| 140 | m_stream = machine().sound().stream_alloc(*this, 0, 2, m_rate, this); |
| 141 | |
| 142 | save_item(NAME(m_rate)); |
| 143 | save_item(NAME(m_sound_enable)); |
| 144 | save_item(NAME(m_reg)); |
| 145 | save_item(NAME(m_HI_WORD_BUF)); |
| 146 | save_item(NAME(m_smp_offset)); |
| 147 | save_item(NAME(m_env_offset)); |
| 148 | save_item(NAME(m_base_clock)); |
| 149 | } |
| 150 | |
| 151 | |
| 152 | void x1_010_device::enable_w(int data) |
| 153 | { |
| 154 | m_sound_enable = data; |
| 155 | } |
| 156 | |
| 157 | /* Use these for 8 bit CPUs */ |
| 158 | |
| 159 | |
| 160 | READ8_MEMBER( x1_010_device::read ) |
| 161 | { |
| 162 | offset ^= m_adr; |
| 163 | return m_reg[offset]; |
| 164 | } |
| 165 | |
| 166 | WRITE8_MEMBER( x1_010_device::write ) |
| 167 | { |
| 168 | int channel, reg; |
| 169 | offset ^= m_adr; |
| 170 | |
| 171 | channel = offset/sizeof(X1_010_CHANNEL); |
| 172 | reg = offset%sizeof(X1_010_CHANNEL); |
| 173 | |
| 174 | if( channel < SETA_NUM_CHANNELS && reg == 0 |
| 175 | && (m_reg[offset]&1) == 0 && (data&1) != 0 ) { |
| 176 | m_smp_offset[channel] = 0; |
| 177 | m_env_offset[channel] = 0; |
| 178 | } |
| 179 | LOG_REGISTER_WRITE(("%s: offset %6X : data %2X\n", machine().describe_context(), offset, data )); |
| 180 | m_reg[offset] = data; |
| 181 | } |
| 182 | |
| 183 | |
| 184 | /* Use these for 16 bit CPUs */ |
| 185 | |
| 186 | READ16_MEMBER( x1_010_device::word_r ) |
| 187 | { |
| 188 | UINT16 ret; |
| 189 | |
| 190 | ret = m_HI_WORD_BUF[offset]<<8; |
| 191 | ret += (read( space, offset )&0xff); |
| 192 | LOG_REGISTER_READ(( "%s: Read X1-010 Offset:%04X Data:%04X\n", machine().describe_context(), offset, ret )); |
| 193 | return ret; |
| 194 | } |
| 195 | |
| 196 | WRITE16_MEMBER( x1_010_device::word_w ) |
| 197 | { |
| 198 | m_HI_WORD_BUF[offset] = (data>>8)&0xff; |
| 199 | write( space, offset, data&0xff ); |
| 200 | LOG_REGISTER_WRITE(( "%s: Write X1-010 Offset:%04X Data:%04X\n", machine().describe_context(), offset, data )); |
| 201 | } |
| 202 | |
| 203 | |
| 204 | //------------------------------------------------- |
| 205 | // sound_stream_update - handle a stream update |
| 206 | //------------------------------------------------- |
| 207 | |
| 208 | void x1_010_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 209 | { |
| 113 | 210 | X1_010_CHANNEL *reg; |
| 114 | 211 | int ch, i, volL, volR, freq; |
| 115 | 212 | register INT8 *start, *end, data; |
| 116 | 213 | register UINT8 *env; |
| 117 | 214 | register UINT32 smp_offs, smp_step, env_offs, env_step, delta; |
| 118 | | const UINT8 *snd1 = info->region; |
| 215 | const UINT8 *snd1 = m_region; |
| 119 | 216 | |
| 120 | 217 | // mixer buffer zero clear |
| 121 | 218 | memset( outputs[0], 0, samples*sizeof(*outputs[0]) ); |
| 122 | 219 | memset( outputs[1], 0, samples*sizeof(*outputs[1]) ); |
| 123 | 220 | |
| 124 | | // if( info->sound_enable == 0 ) return; |
| 221 | // if( m_sound_enable == 0 ) return; |
| 125 | 222 | |
| 126 | 223 | for( ch = 0; ch < SETA_NUM_CHANNELS; ch++ ) { |
| 127 | | reg = (X1_010_CHANNEL *)&(info->reg[ch*sizeof(X1_010_CHANNEL)]); |
| 224 | reg = (X1_010_CHANNEL *)&(m_reg[ch*sizeof(X1_010_CHANNEL)]); |
| 128 | 225 | if( (reg->status&1) != 0 ) { // Key On |
| 129 | 226 | stream_sample_t *bufL = outputs[0]; |
| 130 | 227 | stream_sample_t *bufR = outputs[1]; |
| r24079 | r24080 | |
| 133 | 230 | end = (INT8 *)((0x100-reg->end)*0x1000+snd1); |
| 134 | 231 | volL = ((reg->volume>>4)&0xf)*VOL_BASE; |
| 135 | 232 | volR = ((reg->volume>>0)&0xf)*VOL_BASE; |
| 136 | | smp_offs = info->smp_offset[ch]; |
| 233 | smp_offs = m_smp_offset[ch]; |
| 137 | 234 | freq = reg->frequency&0x1f; |
| 138 | 235 | // Meta Fox does not write the frequency register. Ever |
| 139 | 236 | if( freq == 0 ) freq = 4; |
| 140 | | smp_step = (UINT32)((float)info->base_clock/8192.0 |
| 141 | | *freq*(1<<FREQ_BASE_BITS)/(float)info->rate); |
| 237 | smp_step = (UINT32)((float)m_base_clock/8192.0 |
| 238 | *freq*(1<<FREQ_BASE_BITS)/(float)m_rate); |
| 142 | 239 | if( smp_offs == 0 ) { |
| 143 | 240 | LOG_SOUND(( "Play sample %p - %p, channel %X volume %d:%d freq %X step %X offset %X\n", |
| 144 | 241 | start, end, ch, volL, volR, freq, smp_step, smp_offs )); |
| r24079 | r24080 | |
| 155 | 252 | *bufR++ += (data*volR/256); |
| 156 | 253 | smp_offs += smp_step; |
| 157 | 254 | } |
| 158 | | info->smp_offset[ch] = smp_offs; |
| 255 | m_smp_offset[ch] = smp_offs; |
| 159 | 256 | } else { // Wave form |
| 160 | | start = (INT8 *)&(info->reg[reg->volume*128+0x1000]); |
| 161 | | smp_offs = info->smp_offset[ch]; |
| 257 | start = (INT8 *)&(m_reg[reg->volume*128+0x1000]); |
| 258 | smp_offs = m_smp_offset[ch]; |
| 162 | 259 | freq = (reg->pitch_hi<<8)+reg->frequency; |
| 163 | | smp_step = (UINT32)((float)info->base_clock/128.0/1024.0/4.0*freq*(1<<FREQ_BASE_BITS)/(float)info->rate); |
| 260 | smp_step = (UINT32)((float)m_base_clock/128.0/1024.0/4.0*freq*(1<<FREQ_BASE_BITS)/(float)m_rate); |
| 164 | 261 | |
| 165 | | env = (UINT8 *)&(info->reg[reg->end*128]); |
| 166 | | env_offs = info->env_offset[ch]; |
| 167 | | env_step = (UINT32)((float)info->base_clock/128.0/1024.0/4.0*reg->start*(1<<ENV_BASE_BITS)/(float)info->rate); |
| 262 | env = (UINT8 *)&(m_reg[reg->end*128]); |
| 263 | env_offs = m_env_offset[ch]; |
| 264 | env_step = (UINT32)((float)m_base_clock/128.0/1024.0/4.0*reg->start*(1<<ENV_BASE_BITS)/(float)m_rate); |
| 168 | 265 | /* Print some more debug info */ |
| 169 | 266 | if( smp_offs == 0 ) { |
| 170 | 267 | LOG_SOUND(( "Play waveform %X, channel %X volume %X freq %4X step %X offset %X\n", |
| r24079 | r24080 | |
| 187 | 284 | smp_offs += smp_step; |
| 188 | 285 | env_offs += env_step; |
| 189 | 286 | } |
| 190 | | info->smp_offset[ch] = smp_offs; |
| 191 | | info->env_offset[ch] = env_offs; |
| 287 | m_smp_offset[ch] = smp_offs; |
| 288 | m_env_offset[ch] = env_offs; |
| 192 | 289 | } |
| 193 | 290 | } |
| 194 | 291 | } |
| 195 | 292 | } |
| 196 | | |
| 197 | | |
| 198 | | |
| 199 | | static DEVICE_START( x1_010 ) |
| 200 | | { |
| 201 | | int i; |
| 202 | | const x1_010_interface *intf = (const x1_010_interface *)device->static_config(); |
| 203 | | x1_010_state *info = get_safe_token(device); |
| 204 | | |
| 205 | | info->region = *device->region(); |
| 206 | | info->base_clock = device->clock(); |
| 207 | | info->rate = device->clock() / 1024; |
| 208 | | info->address = intf->adr; |
| 209 | | |
| 210 | | for( i = 0; i < SETA_NUM_CHANNELS; i++ ) { |
| 211 | | info->smp_offset[i] = 0; |
| 212 | | info->env_offset[i] = 0; |
| 213 | | } |
| 214 | | /* Print some more debug info */ |
| 215 | | LOG_SOUND(("masterclock = %d rate = %d\n", device->clock(), info->rate )); |
| 216 | | |
| 217 | | /* get stream channels */ |
| 218 | | info->stream = device->machine().sound().stream_alloc(*device,0,2,info->rate,info,seta_update); |
| 219 | | } |
| 220 | | |
| 221 | | |
| 222 | | void seta_sound_enable_w(device_t *device, int data) |
| 223 | | { |
| 224 | | x1_010_state *info = get_safe_token(device); |
| 225 | | info->sound_enable = data; |
| 226 | | } |
| 227 | | |
| 228 | | |
| 229 | | |
| 230 | | /* Use these for 8 bit CPUs */ |
| 231 | | |
| 232 | | |
| 233 | | READ8_DEVICE_HANDLER( seta_sound_r ) |
| 234 | | { |
| 235 | | x1_010_state *info = get_safe_token(device); |
| 236 | | offset ^= info->address; |
| 237 | | return info->reg[offset]; |
| 238 | | } |
| 239 | | |
| 240 | | |
| 241 | | |
| 242 | | |
| 243 | | WRITE8_DEVICE_HANDLER( seta_sound_w ) |
| 244 | | { |
| 245 | | x1_010_state *info = get_safe_token(device); |
| 246 | | int channel, reg; |
| 247 | | offset ^= info->address; |
| 248 | | |
| 249 | | channel = offset/sizeof(X1_010_CHANNEL); |
| 250 | | reg = offset%sizeof(X1_010_CHANNEL); |
| 251 | | |
| 252 | | if( channel < SETA_NUM_CHANNELS && reg == 0 |
| 253 | | && (info->reg[offset]&1) == 0 && (data&1) != 0 ) { |
| 254 | | info->smp_offset[channel] = 0; |
| 255 | | info->env_offset[channel] = 0; |
| 256 | | } |
| 257 | | LOG_REGISTER_WRITE(("%s: offset %6X : data %2X\n", device->machine().describe_context(), offset, data )); |
| 258 | | info->reg[offset] = data; |
| 259 | | } |
| 260 | | |
| 261 | | |
| 262 | | |
| 263 | | |
| 264 | | /* Use these for 16 bit CPUs */ |
| 265 | | |
| 266 | | READ16_DEVICE_HANDLER( seta_sound_word_r ) |
| 267 | | { |
| 268 | | x1_010_state *info = get_safe_token(device); |
| 269 | | UINT16 ret; |
| 270 | | |
| 271 | | ret = info->HI_WORD_BUF[offset]<<8; |
| 272 | | ret += (seta_sound_r( device, space, offset )&0xff); |
| 273 | | LOG_REGISTER_READ(( "%s: Read X1-010 Offset:%04X Data:%04X\n", device->machine().describe_context(), offset, ret )); |
| 274 | | return ret; |
| 275 | | } |
| 276 | | |
| 277 | | WRITE16_DEVICE_HANDLER( seta_sound_word_w ) |
| 278 | | { |
| 279 | | x1_010_state *info = get_safe_token(device); |
| 280 | | info->HI_WORD_BUF[offset] = (data>>8)&0xff; |
| 281 | | seta_sound_w( device, space, offset, data&0xff ); |
| 282 | | LOG_REGISTER_WRITE(( "%s: Write X1-010 Offset:%04X Data:%04X\n", device->machine().describe_context(), offset, data )); |
| 283 | | } |
| 284 | | |
| 285 | | |
| 286 | | const device_type X1_010 = &device_creator<x1_010_device>; |
| 287 | | |
| 288 | | x1_010_device::x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 289 | | : device_t(mconfig, X1_010, "X1-010", tag, owner, clock, "x1_010", __FILE__), |
| 290 | | device_sound_interface(mconfig, *this) |
| 291 | | { |
| 292 | | m_token = global_alloc_clear(x1_010_state); |
| 293 | | } |
| 294 | | |
| 295 | | //------------------------------------------------- |
| 296 | | // device_config_complete - perform any |
| 297 | | // operations now that the configuration is |
| 298 | | // complete |
| 299 | | //------------------------------------------------- |
| 300 | | |
| 301 | | void x1_010_device::device_config_complete() |
| 302 | | { |
| 303 | | } |
| 304 | | |
| 305 | | //------------------------------------------------- |
| 306 | | // device_start - device-specific startup |
| 307 | | //------------------------------------------------- |
| 308 | | |
| 309 | | void x1_010_device::device_start() |
| 310 | | { |
| 311 | | DEVICE_START_NAME( x1_010 )(this); |
| 312 | | } |
| 313 | | |
| 314 | | //------------------------------------------------- |
| 315 | | // sound_stream_update - handle a stream update |
| 316 | | //------------------------------------------------- |
| 317 | | |
| 318 | | void x1_010_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 319 | | { |
| 320 | | // should never get here |
| 321 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 322 | | } |