Previous 199869 Revisions Next

r24080 Friday 5th July, 2013 at 02:53:43 UTC by Tafoid
Modernized the x1_010 device.  [Osso]
[src/emu/sound]x1_010.c x1_010.h
[src/mame/drivers]champbwl.c seta.c seta2.c
[src/mame/includes]seta.h seta2.h
[src/mame/video]seta.c

trunk/src/mame/drivers/seta.c
r24079r24080
13661366#include "sound/2612intf.h"
13671367#include "sound/3812intf.h"
13681368#include "sound/okim6295.h"
1369#include "sound/x1_010.h"
13701369#include "sound/2151intf.h"
13711370#include "machine/nvram.h"
13721371
r24079r24080
16471646
16481647static ADDRESS_MAP_START( downtown_map, AS_PROGRAM, 16, seta_state )
16491648   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
16511650   AM_RANGE(0x200000, 0x200001) AM_NOP                             // watchdog? (twineagl)
16521651   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                        // IRQ enable/acknowledge?
16531652   AM_RANGE(0x400000, 0x400007) AM_WRITE(twineagl_tilebank_w)      // special tile banking to animate water in twineagl
r24079r24080
18161815static ADDRESS_MAP_START( atehate_map, AS_PROGRAM, 16, seta_state )
18171816   AM_RANGE(0x000000, 0x0fffff) AM_ROM                             // ROM
18181817   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
18201819   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                        // ? watchdog ?
18211820   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                        // ? 0 (irq ack lev 2?)
18221821   AM_RANGE(0x500000, 0x500001) AM_WRITENOP                        // ? (end of lev 1: bit 4 goes 1,0,1)
r24079r24080
18591858   AM_RANGE(0xb04000, 0xb0ffff) AM_RAM                             // (jjsquawk)
18601859   AM_RANGE(0xb80000, 0xb83fff) AM_RAM_WRITE(seta_vram_2_w) AM_SHARE("vram_2") // VRAM 2&3
18611860   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
18631862   AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP                        // ?
18641863   AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP                        // ? VBlank IRQ Ack
18651864   AM_RANGE(0xf00000, 0xf00001) AM_WRITENOP                        // ? Sound  IRQ Ack
r24079r24080
18941893   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16)
18951894/**/AM_RANGE(0xa80000, 0xa80001) AM_RAM                             // ? 0x4000
18961895   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
18981897   AM_RANGE(0xd00000, 0xd00007) AM_WRITENOP                        // ?
18991898   AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP                        // ? VBlank IRQ Ack
19001899   AM_RANGE(0xf00000, 0xf00001) AM_WRITENOP                        // ? Sound  IRQ Ack
r24079r24080
19741973   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16)
19751974/**/AM_RANGE(0xa80000, 0xa80001) AM_RAM                             // ? 0x4000
19761975   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
19781977#if __uPD71054_TIMER
19791978   AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w)             // ?
19801979#else
r24079r24080
20502049   AM_RANGE(0xa0a600, 0xa0a607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16)
20512050// AM_RANGE(0xa80000, 0xa80001) AM_RAM                              // ? 0x4000
20522051   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
20542053#if __uPD71054_TIMER
20552054   AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w)             // ?
20562055#else
r24079r24080
20772076   //AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r     )   // P1
20782077   AM_RANGE(0x8000f0, 0x8000f1) AM_RAM                             // NVRAM
20792078   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
20812080   AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram")  // Palette
20822081   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16)     // Sprites Code + X + Attr
20832082/**/AM_RANGE(0xd00000, 0xd00001) AM_RAM                             // ? 0x4000
r24079r24080
21582157   AM_RANGE(0x800100, 0x8001ff) AM_RAM                             // NVRAM
21592158   AM_RANGE(0x900000, 0x900001) AM_WRITENOP                        // ?
21602159   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
21622161   AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram")  // Palette
21632162   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16)     // Sprites Code + X + Attr
21642163/**/AM_RANGE(0xd00000, 0xd00001) AM_RAM                             // ? 0x4000
r24079r24080
21892188   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")                 // P1
21902189   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")                 // P2
21912190   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
21932192   AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram")  // Palette
21942193   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr
21952194/**/AM_RANGE(0xd00000, 0xd00001) AM_RAM // ? 0x4000
r24079r24080
22262225   AM_RANGE(0xa80000, 0xa80001) AM_RAM // ? 0x4000
22272226   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16) // Sprites Code + X + Attr
22282227   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
22302229   AM_RANGE(0xe00000, 0xe00001) AM_WRITENOP    //
22312230ADDRESS_MAP_END
22322231
r24079r24080
22392238   AM_RANGE(0x000000, 0x0bffff) AM_ROM                             // ROM
22402239   AM_RANGE(0xf00000, 0xf0ffff) AM_RAM                             // RAM (qzkklogy)
22412240   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
22432242   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                        // Watchdog
22442243   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                        // ? IRQ Ack
22452244   AM_RANGE(0x500000, 0x500001) AM_RAM_WRITE(seta_vregs_w) AM_SHARE("vregs")   // Coin Lockout + Video Registers
r24079r24080
23532352/**/AM_RANGE(0xa80000, 0xa80001) AM_RAM                             // ? 0x4000
23542353   AM_RANGE(0xb00000, 0xb03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16)     // Sprites Code + X + Attr
23552354   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
23572356ADDRESS_MAP_END
23582357
23592358
r24079r24080
23902389#else
23912390   AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP                        // ?
23922391#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
23942393ADDRESS_MAP_END
23952394
23962395/* almost identical to kamenrid */
r24079r24080
24192418#else
24202419   AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP                        // ?
24212420#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
24232422ADDRESS_MAP_END
24242423
24252424
r24079r24080
24662465#else
24672466   AM_RANGE(0xc00000, 0xc00007) AM_WRITENOP                        // ?
24682467#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
24702469ADDRESS_MAP_END
24712470
24722471
r24079r24080
25112510   AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r)          // P1
25122511   AM_RANGE(0x8000f0, 0x8000f1) AM_RAM                             // NVRAM
25132512   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
25152514   AM_RANGE(0xb00000, 0xb003ff) AM_RAM AM_SHARE("paletteram")  // Palette
25162515   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16)     // Sprites Code + X + Attr
25172516/**/AM_RANGE(0xd00000, 0xd00001) AM_RAM                             // ? 0x4000
r24079r24080
25572556   AM_RANGE(0xa80000, 0xa83fff) AM_RAM_WRITE(seta_vram_2_w) AM_SHARE("vram_2") // VRAM 2&3
25582557   AM_RANGE(0xb00000, 0xb00005) AM_RAM AM_SHARE("vctrl_0")     // VRAM 0&1 Ctrl
25592558   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
25612560#if __uPD71054_TIMER
25622561   AM_RANGE(0xd00000, 0xd00007) AM_WRITE(timer_regs_w) // ?
25632562#else
r24079r24080
25812580   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")              // Coins
25822581   AM_RANGE(0x400000, 0x400001) AM_WRITENOP                        // ? IRQ Ack
25832582   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
25852584   AM_RANGE(0x800000, 0x803fff) AM_RAM_WRITE(seta_vram_0_w) AM_SHARE("vram_0") // VRAM 0&1
25862585   AM_RANGE(0x880000, 0x883fff) AM_RAM_WRITE(seta_vram_2_w) AM_SHARE("vram_2") // VRAM 2&3
25872586/**/AM_RANGE(0x900000, 0x900005) AM_RAM AM_SHARE("vctrl_0")     // VRAM 0&1 Ctrl
r24079r24080
26722671/**/AM_RANGE(0xa00000, 0xa005ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r16, spriteylow_w16)     // Sprites Y
26732672   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16)
26742673   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
26762675   AM_RANGE(0xd00000, 0xd00009) AM_READ(kiwame_input_r)            // mahjong panel
26772676   AM_RANGE(0xe00000, 0xe00003) AM_READ(seta_dsw_r)                // DSW
26782677ADDRESS_MAP_END
r24079r24080
26972696static ADDRESS_MAP_START( thunderl_map, AS_PROGRAM, 16, seta_state )
26982697   AM_RANGE(0x000000, 0x00ffff) AM_ROM                             // ROM
26992698   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
27012700   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                        // ?
27022701   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                        // ?
27032702   AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w)    // Protection (not in wits)
r24079r24080
27212720static ADDRESS_MAP_START( thunderlbl_map, AS_PROGRAM, 16, seta_state )
27222721   AM_RANGE(0x000000, 0x00ffff) AM_ROM                             // ROM
27232722   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
27252724   AM_RANGE(0x200000, 0x200001) AM_WRITENOP                        // ?
27262725   AM_RANGE(0x300000, 0x300001) AM_WRITENOP                        // ?
27272726//  AM_RANGE(0x400000, 0x40ffff) AM_WRITE(thunderl_protection_w)    // Protection (not in wits)
r24079r24080
28072806   AM_RANGE(0xa00600, 0xa00607) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritectrl_r16, spritectrl_w16)
28082807/**/AM_RANGE(0xa80000, 0xa80001) AM_RAM                             // ? 0x4000
28092808   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
28112810ADDRESS_MAP_END
28122811
28132812
r24079r24080
28752874   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")                 // P2
28762875   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")              // Coins
28772876   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
28792878   AM_RANGE(0xb00000, 0xb00fff) AM_RAM AM_SHARE("paletteram")  // Palette
28802879   AM_RANGE(0xc00000, 0xc03fff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecode_r16, spritecode_w16)     // Sprites Code + X + Attr
28812880   AM_RANGE(0xd00000, 0xd00001) AM_RAM                             // ? 0x4000
r24079r24080
29652964
29662965   AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
29672966
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
29692968
29702969   AM_RANGE(0xa00000, 0xa00005) AM_WRITEONLY AM_SHARE("vctrl_0")   // VRAM 0&1 Ctrl
29712970   AM_RANGE(0xb00000, 0xb03fff) AM_RAM_WRITE(seta_vram_0_w) AM_SHARE("vram_0") // VRAM 0&1
r24079r24080
30273026
30283027   AM_RANGE(0x800000, 0x80001f) AM_DEVREADWRITE8("rtc", msm6242_device, read, write, 0x00ff)
30293028
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
30313030
30323031   AM_RANGE(0xa00000, 0xa00005) AM_WRITEONLY AM_SHARE("vctrl_0")   // VRAM 0&1 Ctrl
30333032   AM_RANGE(0xb00000, 0xb03fff) AM_RAM_WRITE(seta_vram_0_w) AM_SHARE("vram_0") // VRAM 0&1
r24079r24080
31663165}
31673166
31683167static 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
31703169   AM_RANGE(0x4000, 0x4000) AM_READ(soundlatch_byte_r)             // From Main CPU
31713170   AM_RANGE(0x4000, 0x4000) AM_WRITE(sub_bankswitch_w)         // Bankswitching
31723171   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1")                        // Banked ROM
r24079r24080
32023201static ADDRESS_MAP_START( utoukond_sound_map, AS_PROGRAM, 8, seta_state )
32033202   AM_RANGE(0x0000, 0xdfff) AM_ROM
32043203   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)
32063205ADDRESS_MAP_END
32073206
32083207static ADDRESS_MAP_START( utoukond_sound_io_map, AS_IO, 8, seta_state )
trunk/src/mame/drivers/seta2.c
r24079r24080
112112#include "machine/tmp68301.h"
113113#include "cpu/h83002/h8.h"
114114#include "sound/okim9810.h"
115#include "sound/x1_010.h"
116115#include "machine/eeprom.h"
117116#include "machine/nvram.h"
118117#include "machine/ticket.h"
r24079r24080
168167   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM")             // Coins
169168   AM_RANGE(0x70000c, 0x70000d) AM_READ(watchdog_reset16_r)        // Watchdog
170169   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
172171   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram")       // Sprites
173172   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
174173   AM_RANGE(0xc50000, 0xc5ffff) AM_RAM                             // cleared
r24079r24080
206205   AM_RANGE(0x70000a, 0x70000b) AM_READ_PORT("IN1")                // P2
207206   AM_RANGE(0x70000c, 0x70000d) AM_WRITE(watchdog_reset16_w)
208207   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
210209   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram")   // Sprites
211210   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
212211   AM_RANGE(0xc50000, 0xc5ffff) AM_RAM                             // cleared
r24079r24080
265264   AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1")               // DSW 1
266265   AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2")               // DSW 2
267266   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
269268   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram")   // Sprites
270269   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
271270   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs")  // Video Registers
r24079r24080
288287   AM_RANGE(0x700300, 0x700301) AM_READ_PORT("DSW1")               // DSW 1
289288   AM_RANGE(0x700302, 0x700303) AM_READ_PORT("DSW2")               // DSW 2
290289   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
292291   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram")       // Sprites
293292   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
294293   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs")              // Video Registers
r24079r24080
311310   AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1")               // DSW 1
312311   AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2")               // DSW 2
313312   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
315314   AM_RANGE(0xd00000, 0xd3ffff) AM_RAM AM_SHARE("spriteram")       // Sprites
316315   AM_RANGE(0xd40000, 0xd4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
317316   AM_RANGE(0xd60000, 0xd6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs")          // Video Registers
r24079r24080
359358   AM_RANGE(0x800000, 0x83ffff) AM_RAM AM_SHARE("spriteram")       // Sprites
360359   AM_RANGE(0x840000, 0x84ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
361360   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
363362   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
364363ADDRESS_MAP_END
365364
r24079r24080
385384   AM_RANGE(0xb00000, 0xb3ffff) AM_RAM AM_SHARE("spriteram")       // Sprites
386385   AM_RANGE(0xb40000, 0xb4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
387386   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
389388   AM_RANGE(0xfffc00, 0xffffff) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)      // TMP68301 Registers
390389ADDRESS_MAP_END
391390
r24079r24080
440439   AM_RANGE(0x400300, 0x400301) AM_READ_PORT("DSW1")               // DSW 1
441440   AM_RANGE(0x400302, 0x400303) AM_READ_PORT("DSW2")               // DSW 2
442441   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
444443   AM_RANGE(0xc00000, 0xc3ffff) AM_RAM AM_SHARE("spriteram")       // Sprites
445444   AM_RANGE(0xc40000, 0xc4ffff) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")    // Palette
446445   AM_RANGE(0xc60000, 0xc6003f) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs")              // Video Registers
r24079r24080
502501   AM_RANGE( 0x840000, 0x84ffff ) AM_RAM_WRITE(paletteram_xRRRRRGGGGGBBBBB_word_w) AM_SHARE("paletteram")  // Palette
503502   AM_RANGE( 0x860000, 0x86003f ) AM_WRITE(seta2_vregs_w) AM_SHARE("vregs")    // Video Registers
504503
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
506505
507506   AM_RANGE( 0xfffd0a, 0xfffd0b ) AM_READ_PORT("DSW2")             // parallel data register (DSW 2)
508507   AM_RANGE( 0xfffc00, 0xffffff ) AM_READWRITE_LEGACY(tmp68301_regs_r, tmp68301_regs_w)    // TMP68301 Registers
trunk/src/mame/drivers/champbwl.c
r24079r24080
161161{
162162public:
163163   champbwl_state(const machine_config &mconfig, device_type type, const char *tag)
164      : tnzs_state(mconfig, type, tag) { }
164      : tnzs_state(mconfig, type, tag),
165      m_x1(*this, "x1snd") { }
165166
167   required_device<x1_010_device> m_x1;
166168   UINT8    m_last_trackball_val[2];
167169   DECLARE_READ8_MEMBER(trackball_r);
168170   DECLARE_WRITE8_MEMBER(champbwl_misc_w);
r24079r24080
209211   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram")
210212   AM_RANGE(0xa000, 0xafff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8)
211213   AM_RANGE(0xb000, 0xbfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodehigh_r8, spritecodehigh_w8)
212   AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_r, seta_sound_w)
214   AM_RANGE(0xc000, 0xdfff) AM_DEVREADWRITE("x1snd", x1_010_device, read, write)
213215   AM_RANGE(0xe000, 0xe2ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r8, spriteylow_w8)
214216   AM_RANGE(0xe300, 0xe303) AM_MIRROR(0xfc) AM_DEVWRITE("spritegen", seta001_device, spritectrl_w8) /* control registers (0x80 mirror used by Arkanoid 2) */
215217   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("spritegen", seta001_device, spritebgflag_w8)   /* enable / disable background transparency */
r24079r24080
248250   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_SHARE("nvram")
249251   AM_RANGE(0xa000, 0xafff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodelow_r8, spritecodelow_w8)
250252   AM_RANGE(0xb000, 0xbfff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spritecodehigh_r8, spritecodehigh_w8)
251   AM_RANGE(0xc000, 0xc07f) AM_DEVREADWRITE_LEGACY("x1snd", seta_sound_r,seta_sound_w) // Sound
253   AM_RANGE(0xc000, 0xc07f) AM_DEVREADWRITE("x1snd", x1_010_device, read, write) // Sound
252254   AM_RANGE(0xe000, 0xe2ff) AM_RAM AM_DEVREADWRITE("spritegen", seta001_device, spriteylow_r8, spriteylow_w8)
253255   AM_RANGE(0xe300, 0xe303) AM_DEVWRITE("spritegen", seta001_device, spritectrl_w8)
254256   AM_RANGE(0xe800, 0xe800) AM_DEVWRITE("spritegen", seta001_device, spritebgflag_w8)   /* enable / disable background transparency */
trunk/src/mame/includes/seta2.h
r24079r24080
11#include "sound/okim9810.h"
22#include "machine/eeprom.h"
3#include "sound/x1_010.h"
34
45class seta2_state : public driver_device
56{
r24079r24080
1213      m_vregs(*this, "vregs", 0),
1314      m_funcube_outputs(*this, "funcube_outputs"),
1415      m_funcube_leds(*this, "funcube_leds"),
16      m_x1(*this, "x1snd"),
1517      m_oki(*this, "oki"),
1618      m_eeprom(*this, "eeprom"){ }
1719
r24079r24080
2325
2426   optional_shared_ptr<UINT8> m_funcube_outputs;
2527   optional_shared_ptr<UINT8> m_funcube_leds;
28   
29   optional_device<x1_010_device> m_x1;
30   optional_device<okim9810_device> m_oki;
31   optional_device<eeprom_device> m_eeprom;
32   
2633   int m_xoffset;
2734   int m_yoffset;
2835   int m_keyboard_row;
r24079r24080
8087   TIMER_DEVICE_CALLBACK_MEMBER(funcube_interrupt);
8188   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
8289   void funcube_debug_outputs();
83   optional_device<okim9810_device> m_oki;
84   optional_device<eeprom_device> m_eeprom;
8590};
trunk/src/mame/includes/seta.h
r24079r24080
44
55***************************************************************************/
66
7#include "sound/x1_010.h"
78#include "video/seta001.h"
89
910#define __uPD71054_TIMER    1
r24079r24080
3334      m_audiocpu(*this, "audiocpu"),
3435      m_subcpu(*this,"sub"),
3536      m_seta001(*this, "spritegen"),
37      m_x1(*this, "x1snd"),
3638      m_sharedram(*this,"sharedram"),
3739      m_workram(*this,"workram"),
3840      m_vregs(*this,"vregs"),
r24079r24080
5052   optional_device<cpu_device> m_audiocpu;
5153   optional_device<cpu_device> m_subcpu;
5254   required_device<seta001_device> m_seta001;
55   optional_device<x1_010_device> m_x1;
5356
5457   optional_shared_ptr<UINT8> m_sharedram;
5558   optional_shared_ptr<UINT16> m_workram;
trunk/src/mame/video/seta.c
r24079r24080
136136***************************************************************************/
137137
138138#include "emu.h"
139#include "sound/x1_010.h"
140139#include "includes/seta.h"
141140
142141/* note that drgnunit, stg and qzkklogy run on the same board, yet they need different alignment */
r24079r24080
266265        ---- ---- ---- ---0     Coin #0 Counter     */
267266         if (ACCESSING_BITS_0_7)
268267         {
269            device_t *x1_010 = machine().device("x1snd");
270268            seta_coin_lockout_w (data & 0x0f);
271            if (x1_010 != NULL)
272               seta_sound_enable_w (x1_010, data & 0x20);
269            if (m_x1 != NULL)
270               m_x1->enable_w (data & 0x20);
273271            coin_counter_w(machine(), 0,data & 0x01);
274272            coin_counter_w(machine(), 1,data & 0x02);
275273         }
trunk/src/emu/sound/x1_010.c
r24079r24080
6060#define LOG_REGISTER_WRITE(x) do { if (VERBOSE_REGISTER_WRITE) logerror x; } while (0)
6161#define LOG_REGISTER_READ(x) do { if (VERBOSE_REGISTER_READ) logerror x; } while (0)
6262
63#define SETA_NUM_CHANNELS 16
64
6563#define FREQ_BASE_BITS        8                 // Frequency fixed decimal shift bits
6664#define ENV_BASE_BITS        16                 // wave form envelope fixed decimal shift bits
6765#define VOL_BASE    (2*32*256/30)                   // Volume base
r24079r24080
7775   unsigned char   reserve[2];
7876};
7977
80struct 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];
9278
93   UINT32 base_clock;
94};
95
9679/* mixer tables and internal buffers */
9780//static short  *mixer_buffer = NULL;
9881
99INLINE x1_010_state *get_safe_token(device_t *device)
82
83const device_type X1_010 = &device_creator<x1_010_device>;
84
85x1_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)
10097{
101   assert(device != NULL);
102   assert(device->type() == X1_010);
103   return (x1_010_state *)downcast<x1_010_device *>(device)->token();
10498}
10599
100//-------------------------------------------------
101//  device_config_complete - perform any
102//  operations now that the configuration is
103//  complete
104//-------------------------------------------------
106105
107/*--------------------------------------------------------------
108 generate sound to the mix buffer
109--------------------------------------------------------------*/
110static STREAM_UPDATE( seta_update )
106void x1_010_device::device_config_complete()
111107{
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
124void 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
152void x1_010_device::enable_w(int data)
153{
154   m_sound_enable = data;
155}
156
157/* Use these for 8 bit CPUs */
158
159
160READ8_MEMBER( x1_010_device::read )
161{
162   offset ^= m_adr;
163   return m_reg[offset];
164}
165
166WRITE8_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
186READ16_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
196WRITE16_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
208void x1_010_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
209{
113210   X1_010_CHANNEL  *reg;
114211   int     ch, i, volL, volR, freq;
115212   register INT8   *start, *end, data;
116213   register UINT8  *env;
117214   register UINT32 smp_offs, smp_step, env_offs, env_step, delta;
118   const UINT8 *snd1 = info->region;
215   const UINT8 *snd1 = m_region;
119216
120217   // mixer buffer zero clear
121218   memset( outputs[0], 0, samples*sizeof(*outputs[0]) );
122219   memset( outputs[1], 0, samples*sizeof(*outputs[1]) );
123220
124//  if( info->sound_enable == 0 ) return;
221//  if( m_sound_enable == 0 ) return;
125222
126223   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)]);
128225      if( (reg->status&1) != 0 ) {                            // Key On
129226         stream_sample_t *bufL = outputs[0];
130227         stream_sample_t *bufR = outputs[1];
r24079r24080
133230            end      = (INT8 *)((0x100-reg->end)*0x1000+snd1);
134231            volL     = ((reg->volume>>4)&0xf)*VOL_BASE;
135232            volR     = ((reg->volume>>0)&0xf)*VOL_BASE;
136            smp_offs = info->smp_offset[ch];
233            smp_offs = m_smp_offset[ch];
137234            freq     = reg->frequency&0x1f;
138235            // Meta Fox does not write the frequency register. Ever
139236            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);
142239            if( smp_offs == 0 ) {
143240               LOG_SOUND(( "Play sample %p - %p, channel %X volume %d:%d freq %X step %X offset %X\n",
144241                  start, end, ch, volL, volR, freq, smp_step, smp_offs ));
r24079r24080
155252               *bufR++ += (data*volR/256);
156253               smp_offs += smp_step;
157254            }
158            info->smp_offset[ch] = smp_offs;
255            m_smp_offset[ch] = smp_offs;
159256         } 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];
162259            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);
164261
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);
168265            /* Print some more debug info */
169266            if( smp_offs == 0 ) {
170267               LOG_SOUND(( "Play waveform %X, channel %X volume %X freq %4X step %X offset %X\n",
r24079r24080
187284               smp_offs += smp_step;
188285               env_offs += env_step;
189286            }
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;
192289         }
193290      }
194291   }
195292}
196
197
198
199static 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
222void 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
233READ8_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
243WRITE8_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
266READ16_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
277WRITE16_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
286const device_type X1_010 = &device_creator<x1_010_device>;
287
288x1_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
301void x1_010_device::device_config_complete()
302{
303}
304
305//-------------------------------------------------
306//  device_start - device-specific startup
307//-------------------------------------------------
308
309void 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
318void 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}
trunk/src/emu/sound/x1_010.h
r24079r24080
33#ifndef __X1_010_H__
44#define __X1_010_H__
55
6#include "devlegcy.h"
6#define SETA_NUM_CHANNELS 16
77
8
98struct x1_010_interface
109{
11   int adr;    /* address */
10   int m_adr;    /* address */
1211};
1312
1413
15DECLARE_READ8_DEVICE_HANDLER ( seta_sound_r );
16DECLARE_WRITE8_DEVICE_HANDLER( seta_sound_w );
17
18DECLARE_READ16_DEVICE_HANDLER ( seta_sound_word_r );
19DECLARE_WRITE16_DEVICE_HANDLER( seta_sound_word_w );
20
21void seta_sound_enable_w(device_t *device, int data);
22
2314class x1_010_device : public device_t,
24                           public device_sound_interface
15                           public device_sound_interface,
16                           public x1_010_interface
2517{
2618public:
2719   x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
28   ~x1_010_device() { global_free(m_token); }
20   ~x1_010_device() {}
2921
30   // access to legacy token
31   void *token() const { assert(m_token != NULL); return m_token; }
22   DECLARE_READ8_MEMBER ( read );
23   DECLARE_WRITE8_MEMBER( write );
24
25   DECLARE_READ16_MEMBER ( word_r );
26   DECLARE_WRITE16_MEMBER( word_w );
27
28   void enable_w(int data);
29
3230protected:
3331   // device-level overrides
3432   virtual void device_config_complete();
r24079r24080
3836   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
3937private:
4038   // internal state
41   void *m_token;
39   
40   /* Variables only used here */
41   int m_rate;                               // Output sampling rate (Hz)
42   sound_stream *  m_stream;                 // Stream handle
43   const UINT8 *m_region;                    // region name
44   int m_sound_enable;                       // sound output enable/disable
45   UINT8   m_reg[0x2000];                // X1-010 Register & wave form area
46   UINT8   m_HI_WORD_BUF[0x2000];            // X1-010 16bit access ram check avoidance work
47   UINT32  m_smp_offset[SETA_NUM_CHANNELS];
48   UINT32  m_env_offset[SETA_NUM_CHANNELS];
49
50   UINT32 m_base_clock;
4251};
4352
4453extern const device_type X1_010;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team