Previous 15994 Revisions Next

r15226 Saturday 19th May, 2012 at 17:13:35 UTC by Miodrag Milanović
Sync with MAME r16349 (no whatsnew)
[src/emu/sound]pokey.c pokey.h
[src/ldplayer]ldplayer.c
[src/mame/audio]atarijsa.c jedi.c
[src/mame/drivers]asteroid.c atarisy1.c atarisy2.c atetris.c bartop52.c bwidow.c centiped.c cloak.c cloud9.c firefox.c foodf.c gauntlet.c irobot.c liberatr.c maxaflex.c mhavoc.c quantum.c runaway.c starwars.c tempest.c tomcat.c tunhunt.c
[src/mame/machine]atari.c atarigen.c
[src/osd/windows]drawdd.c

src/mame/audio/atarijsa.c
r15225r15226
5757static const char *test_port;
5858static UINT16 test_mask;
5959
60static pokey_device *pokey;
60static pokeyn_device *pokey;
6161static ym2151_device *ym2151;
6262static device_t *tms5220;
6363static okim6295_device *oki6295;
r15225r15226
140140   /* determine which sound hardware is installed */
141141   tms5220 = machine.device("tms");
142142   ym2151 = machine.device<ym2151_device>("ymsnd");
143   pokey = machine.device<pokey_device>("pokey");
143   pokey = machine.device<pokeyn_device>("pokey");
144144   oki6295 = machine.device<okim6295_device>("adpcm");
145145   oki6295_l = machine.device<okim6295_device>("adpcml");
146146   oki6295_r = machine.device<okim6295_device>("adpcmr");
147147
148148   /* install POKEY memory handlers */
149149   if (pokey != NULL)
150      jsacpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*pokey, 0x2c00, 0x2c0f, FUNC(pokey_r), FUNC(pokey_w));
150      jsacpu->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2c00, 0x2c0f, read8_delegate(FUNC(pokeyn_device::read),pokey), write8_delegate(FUNC(pokeyn_device::write),pokey));
151151
152152   init_save_state(machine);
153153   atarijsa_reset();
r15225r15226
839839   /* basic machine hardware */
840840
841841   /* sound hardware */
842   MCFG_SOUND_ADD("pokey", POKEY, JSA_MASTER_CLOCK/2)
842   MCFG_SOUND_ADD("pokey", POKEYN, JSA_MASTER_CLOCK/2)
843843   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.40)
844844   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.40)
845845MACHINE_CONFIG_END
src/mame/audio/jedi.c
r15225r15226
170170
171171static ADDRESS_MAP_START( audio_map, AS_PROGRAM, 8, jedi_state )
172172   AM_RANGE(0x0000, 0x07ff) AM_RAM
173   AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
174   AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
175   AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey3", pokey_r, pokey_w)
176   AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE_LEGACY("pokey4", pokey_r, pokey_w)
173   AM_RANGE(0x0800, 0x080f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
174   AM_RANGE(0x0810, 0x081f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
175   AM_RANGE(0x0820, 0x082f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey3", pokeyn_device, read, write)
176   AM_RANGE(0x0830, 0x083f) AM_MIRROR(0x07c0) AM_DEVREADWRITE("pokey4", pokeyn_device, read, write)
177177   AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x00ff) AM_READNOP AM_WRITE(irq_ack_w)
178178   AM_RANGE(0x1100, 0x1100) AM_MIRROR(0x00ff) AM_READNOP AM_WRITEONLY AM_SHARE("speech_data")
179179   AM_RANGE(0x1200, 0x13ff) AM_READNOP AM_WRITE(speech_strobe_w)
r15225r15226
205205
206206   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
207207
208   MCFG_SOUND_ADD("pokey1", POKEY, JEDI_POKEY_CLOCK)
208   MCFG_SOUND_ADD("pokey1", POKEYN, JEDI_POKEY_CLOCK)
209209   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
210210   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
211211
212   MCFG_SOUND_ADD("pokey2", POKEY, JEDI_POKEY_CLOCK)
212   MCFG_SOUND_ADD("pokey2", POKEYN, JEDI_POKEY_CLOCK)
213213   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
214214   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
215215
216   MCFG_SOUND_ADD("pokey3", POKEY, JEDI_POKEY_CLOCK)
216   MCFG_SOUND_ADD("pokey3", POKEYN, JEDI_POKEY_CLOCK)
217217   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
218218
219   MCFG_SOUND_ADD("pokey4", POKEY, JEDI_POKEY_CLOCK)
219   MCFG_SOUND_ADD("pokey4", POKEYN, JEDI_POKEY_CLOCK)
220220   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
221221
222222   MCFG_SOUND_ADD("tms", TMS5220, JEDI_TMS5220_CLOCK)
src/mame/machine/atari.c
r15225r15226
159159
160160void a800_handle_keyboard(running_machine &machine)
161161{
162   device_t *pokey = machine.device("pokey");
162   pokeyn_device *pokey = machine.device<pokeyn_device>("pokey");
163163   int atari_code, count, ipt, i;
164164   static const char *const tag[] = {
165165      "keyboard_0", "keyboard_1", "keyboard_2", "keyboard_3",
r15225r15226
198198
199199            if( (atari_code & 0x3f) == AKEY_BREAK )
200200            {
201               pokey_break_w(pokey, atari_code & 0x40);
201               pokey->break_w(atari_code & 0x40);
202202               return;
203203            }
204204
205            pokey_kbcode_w(pokey, atari_code, 1);
205            pokey->kbcode_w(atari_code, 1);
206206            return;
207207         }
208208      }
209209
210210   }
211211   /* remove key pressed status bit from skstat */
212   pokey_kbcode_w(pokey, AKEY_NONE, 0);
212   pokey->kbcode_w(AKEY_NONE, 0);
213213   atari_last = AKEY_NONE;
214214}
215215
r15225r15226
244244
245245void a5200_handle_keypads(running_machine &machine)
246246{
247   device_t *pokey = machine.device("pokey");
247   pokeyn_device *pokey = downcast<pokeyn_device *>(machine.device("pokey"));
248248   int atari_code, count, ipt, i;
249249   static const char *const tag[] = { "keypad_0", "keypad_1", "keypad_2", "keypad_3" };
250250
r15225r15226
270270
271271         if( atari_code == 0 )
272272         {
273            pokey_break_w(pokey, atari_code & 0x40);
273            pokey->break_w(atari_code & 0x40);
274274            return;
275275         }
276276
277         pokey_kbcode_w(pokey, (atari_code << 1) | 0x21, 1);
277         pokey->kbcode_w((atari_code << 1) | 0x21, 1);
278278         return;
279279      }
280280
r15225r15226
285285   {
286286      if (atari_last == 0xfe)
287287         return;
288      pokey_kbcode_w(pokey, 0x61, 1);
288      pokey->kbcode_w(0x61, 1);
289289      //pokey_break_w(pokey, 0x40);
290290      atari_last = 0xfe;
291291      return;
292292   }
293293   else if (atari_last == 0xfe)
294      pokey_kbcode_w(pokey, 0x21, 1);
294      pokey->kbcode_w(0x21, 1);
295295
296296   /* remove key pressed status bit from skstat */
297   pokey_kbcode_w(pokey, 0xff, 0);
297   pokey->kbcode_w(0xff, 0);
298298   atari_last = 0xff;
299299}
300300
r15225r15226
308308
309309static void pokey_reset(running_machine &machine)
310310{
311   device_t *pokey = machine.device("pokey");
312   pokey_w(pokey,15,0);
311   pokeyn_device *pokey = downcast<pokeyn_device *>(machine.device("pokey"));
312   pokey->write(15,0);
313313   atari_last = 0xff;
314314}
315315
src/mame/machine/atarigen.c
r15225r15226
863863
864864void atarigen_set_pokey_vol(running_machine &machine, int volume)
865865{
866   atarigen_set_vol(machine, volume, POKEY);
866   atarigen_set_vol(machine, volume, POKEYN);
867867}
868868
869869void atarigen_set_tms5220_vol(running_machine &machine, int volume)
src/mame/drivers/tomcat.c
r15225r15226
332332   AM_RANGE(0x30e0, 0x30e0) AM_NOP // COINRD Inputs: D7 = Coin L, D6 = Coin R, D5 = SOUNDFLAG
333333   AM_RANGE(0x5000, 0x507f) AM_RAM   // 6532 ram
334334   AM_RANGE(0x5080, 0x509f) AM_DEVREADWRITE_LEGACY("riot", riot6532_r, riot6532_w)
335   AM_RANGE(0x6000, 0x601f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
336   AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
335   AM_RANGE(0x6000, 0x601f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
336   AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
337337   AM_RANGE(0x8000, 0xffff) AM_NOP // main sound program rom
338338ADDRESS_MAP_END
339339
r15225r15226
428428   MCFG_VIDEO_START(avg_tomcat)
429429
430430   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
431   MCFG_SOUND_ADD("pokey1", POKEY, XTAL_14_31818MHz / 8)
431   MCFG_SOUND_ADD("pokey1", POKEYN, XTAL_14_31818MHz / 8)
432432   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.20)
433433
434   MCFG_SOUND_ADD("pokey2", POKEY, XTAL_14_31818MHz / 8)
434   MCFG_SOUND_ADD("pokey2", POKEYN, XTAL_14_31818MHz / 8)
435435   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.20)
436436
437437   MCFG_SOUND_ADD("tms", TMS5220, 325000)
src/mame/drivers/maxaflex.c
r15225r15226
275275   AM_RANGE(0xc000, 0xcfff) AM_ROM /* OS */
276276   AM_RANGE(0xd000, 0xd0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
277277   AM_RANGE(0xd100, 0xd1ff) AM_NOP
278   AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
278   AM_RANGE(0xd200, 0xd2ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
279279    AM_RANGE(0xd300, 0xd3ff) AM_DEVREADWRITE("pia", pia6821_device, read_alt, write_alt)
280280   AM_RANGE(0xd400, 0xd4ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w)
281281   AM_RANGE(0xd500, 0xd7ff) AM_NOP
r15225r15226
427427   /* sound hardware */
428428   MCFG_SPEAKER_STANDARD_MONO("mono")
429429
430   MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT)
430   MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT)
431431   MCFG_SOUND_CONFIG(pokey_config)
432432   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
433433
src/mame/drivers/cloak.c
r15225r15226
167167   AM_RANGE(0x0000, 0x03ff) AM_RAM
168168   AM_RANGE(0x0400, 0x07ff) AM_RAM_WRITE(cloak_videoram_w) AM_SHARE("videoram")
169169   AM_RANGE(0x0800, 0x0fff) AM_RAM AM_SHARE("share1")
170   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)      /* DSW0 also */
171   AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)      /* DSW1 also */
170   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)      /* DSW0 also */
171   AM_RANGE(0x1800, 0x180f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)      /* DSW1 also */
172172   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("P1")
173173   AM_RANGE(0x2200, 0x2200) AM_READ_PORT("P2")
174174   AM_RANGE(0x2400, 0x2400) AM_READ_PORT("SYSTEM")
r15225r15226
359359   /* sound hardware */
360360   MCFG_SPEAKER_STANDARD_MONO("mono")
361361
362   MCFG_SOUND_ADD("pokey1", POKEY, XTAL_10MHz/8)      /* Accurate to recording */
362   MCFG_SOUND_ADD("pokey1", POKEYN, XTAL_10MHz/8)      /* Accurate to recording */
363363   MCFG_SOUND_CONFIG(pokey_interface_1)
364364   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
365365
366   MCFG_SOUND_ADD("pokey2", POKEY, XTAL_10MHz/8)      /* Accurate to recording */
366   MCFG_SOUND_ADD("pokey2", POKEYN, XTAL_10MHz/8)      /* Accurate to recording */
367367   MCFG_SOUND_CONFIG(pokey_interface_2)
368368   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
369369MACHINE_CONFIG_END
src/mame/drivers/foodf.c
r15225r15226
221221   AM_RANGE(0x950000, 0x9501ff) AM_MIRROR(0x023e00) AM_WRITE(foodf_paletteram_w) AM_SHARE("paletteram")
222222   AM_RANGE(0x954000, 0x954001) AM_MIRROR(0x023ffe) AM_WRITE(nvram_recall_w)
223223   AM_RANGE(0x958000, 0x958001) AM_MIRROR(0x023ffe) AM_READWRITE(watchdog_reset16_r, watchdog_reset16_w)
224   AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey2", pokey_r, pokey_w, 0x00ff)
225   AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey1", pokey_r, pokey_w, 0x00ff)
226   AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8_LEGACY("pokey3", pokey_r, pokey_w, 0x00ff)
224   AM_RANGE(0xa40000, 0xa4001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey2", pokeyn_device, read, write, 0x00ff)
225   AM_RANGE(0xa80000, 0xa8001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey1", pokeyn_device, read, write, 0x00ff)
226   AM_RANGE(0xac0000, 0xac001f) AM_MIRROR(0x03ffe0) AM_DEVREADWRITE8("pokey3", pokeyn_device, read, write, 0x00ff)
227227ADDRESS_MAP_END
228228
229229
r15225r15226
380380   /* sound hardware */
381381   MCFG_SPEAKER_STANDARD_MONO("mono")
382382
383   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/2/10)
383   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/2/10)
384384   MCFG_SOUND_CONFIG(pokey_config)
385385   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33)
386386
387   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/2/10)
387   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/2/10)
388388   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33)
389389
390   MCFG_SOUND_ADD("pokey3", POKEY, MASTER_CLOCK/2/10)
390   MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_CLOCK/2/10)
391391   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.33)
392392MACHINE_CONFIG_END
393393
src/mame/drivers/gauntlet.c
r15225r15226
348348   AM_RANGE(0x1010, 0x101f) AM_MIRROR(0x27c0) AM_READ_LEGACY(atarigen_6502_sound_r)
349349   AM_RANGE(0x1020, 0x102f) AM_MIRROR(0x27c0) AM_READ_PORT("COIN") AM_WRITE(mixer_w)
350350   AM_RANGE(0x1030, 0x103f) AM_MIRROR(0x27c0) AM_READWRITE(switch_6502_r, sound_ctl_w)
351   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
351   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x27c0) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
352352   AM_RANGE(0x1810, 0x1811) AM_MIRROR(0x27ce) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
353353   AM_RANGE(0x1820, 0x182f) AM_MIRROR(0x27c0) AM_DEVWRITE_LEGACY("tms", tms5220_data_w)
354354   AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x27c0) AM_READWRITE_LEGACY(atarigen_6502_irq_ack_r, atarigen_6502_irq_ack_w)
r15225r15226
545545   MCFG_SOUND_ROUTE(1, "lspeaker", 0.48)
546546   MCFG_SOUND_ROUTE(0, "rspeaker", 0.48)
547547
548   MCFG_SOUND_ADD("pokey", POKEY, ATARI_CLOCK_14MHz/8)
548   MCFG_SOUND_ADD("pokey", POKEYN, ATARI_CLOCK_14MHz/8)
549549   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.32)
550550   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.32)
551551
src/mame/drivers/liberatr.c
r15225r15226
231231   AM_RANGE(0x6c05, 0x6c06) AM_WRITE(coin_counter_w)
232232   AM_RANGE(0x6c07, 0x6c07) AM_WRITEONLY AM_SHARE("planet_select")
233233   AM_RANGE(0x6e00, 0x6e3f) AM_WRITE(earom_w)
234   AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
235   AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
234   AM_RANGE(0x7000, 0x701f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
235   AM_RANGE(0x7800, 0x781f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
236236   AM_RANGE(0x8000, 0xefff) AM_ROM
237237   AM_RANGE(0xfffa, 0xffff) AM_ROM
238238ADDRESS_MAP_END
r15225r15226
264264   AM_RANGE(0x4c05, 0x4c06) AM_WRITE(coin_counter_w)
265265   AM_RANGE(0x4c07, 0x4c07) AM_WRITEONLY AM_SHARE("planet_select")
266266   AM_RANGE(0x4e00, 0x4e3f) AM_WRITE(earom_w)
267   AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
268   AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
267   AM_RANGE(0x5000, 0x501f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
268   AM_RANGE(0x5800, 0x581f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
269269   //AM_RANGE(0x6000, 0x601f) AM_WRITE(pokey1_w) /* bug ??? */
270270   AM_RANGE(0x6000, 0xbfff) AM_ROM
271271   AM_RANGE(0xfffa, 0xffff) AM_ROM
r15225r15226
404404   /* sound hardware */
405405   MCFG_SPEAKER_STANDARD_MONO("mono")
406406
407   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */
407   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */
408408   MCFG_SOUND_CONFIG(pokey_interface_1)
409409   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
410410
411   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */
411   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/16) /* 1.25Mhz from Phi2 signal from 6502 */
412412   MCFG_SOUND_CONFIG(pokey_interface_2)
413413   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
414414MACHINE_CONFIG_END
src/mame/drivers/centiped.c
r15225r15226
692692   AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1")      /* IN1 */
693693   AM_RANGE(0x0c02, 0x0c02) AM_READ(centiped_IN2_r)   /* IN2 */
694694   AM_RANGE(0x0c03, 0x0c03) AM_READ_PORT("IN3")      /* IN3 */
695   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
695   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
696696   AM_RANGE(0x1400, 0x140f) AM_WRITE(centiped_paletteram_w) AM_SHARE("paletteram")
697697   AM_RANGE(0x1600, 0x163f) AM_DEVWRITE("earom",atari_vg_earom_device, write)
698698   AM_RANGE(0x1680, 0x1680) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w)
r15225r15226
743743static ADDRESS_MAP_START( milliped_map, AS_PROGRAM, 8, centiped_state )
744744   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
745745   AM_RANGE(0x0000, 0x03ff) AM_RAM
746   AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
747   AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
746   AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
747   AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
748748   AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_SHARE("videoram")
749749   AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_SHARE("spriteram")
750750   AM_RANGE(0x2000, 0x2000) AM_READ(centiped_IN0_r)
r15225r15226
782782   AM_RANGE(0x0801, 0x0801) AM_READ_PORT("DSW2")   /* DSW2 */
783783   AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("IN0")   /* IN0 */
784784   AM_RANGE(0x0c01, 0x0c01) AM_READ_PORT("IN1")   /* IN1 */
785   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
785   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
786786   AM_RANGE(0x1800, 0x1800) AM_WRITE(irq_ack_w)
787787   AM_RANGE(0x1c00, 0x1c02) AM_WRITE(coin_count_w)
788788   AM_RANGE(0x1c03, 0x1c06) AM_WRITE(led_w)
r15225r15226
801801static ADDRESS_MAP_START( mazeinv_map, AS_PROGRAM, 8, centiped_state )
802802   ADDRESS_MAP_GLOBAL_MASK(0x7fff)
803803   AM_RANGE(0x0000, 0x03ff) AM_RAM
804   AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
805   AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
804   AM_RANGE(0x0400, 0x040f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
805   AM_RANGE(0x0800, 0x080f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
806806   AM_RANGE(0x1000, 0x13bf) AM_RAM_WRITE(centiped_videoram_w) AM_SHARE("videoram")
807807   AM_RANGE(0x13c0, 0x13ff) AM_RAM AM_SHARE("spriteram")
808808   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("IN0")
r15225r15226
16221622   /* sound hardware */
16231623   MCFG_SPEAKER_STANDARD_MONO("mono")
16241624
1625   MCFG_SOUND_ADD("pokey", POKEY, 12096000/8)
1625   MCFG_SOUND_ADD("pokey", POKEYN, 12096000/8)
16261626   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
16271627MACHINE_CONFIG_END
16281628
r15225r15226
16771677   MCFG_SCREEN_UPDATE_STATIC(milliped)
16781678
16791679   /* sound hardware */
1680   MCFG_SOUND_REPLACE("pokey", POKEY, 12096000/8)
1680   MCFG_SOUND_REPLACE("pokey", POKEYN, 12096000/8)
16811681   MCFG_SOUND_CONFIG(milliped_pokey_interface_1)
16821682   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
16831683
1684   MCFG_SOUND_ADD("pokey2", POKEY, 12096000/8)
1684   MCFG_SOUND_ADD("pokey2", POKEYN, 12096000/8)
16851685   MCFG_SOUND_CONFIG(milliped_pokey_interface_2)
16861686   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
16871687MACHINE_CONFIG_END
r15225r15226
17031703   MCFG_SCREEN_UPDATE_STATIC(warlords)
17041704
17051705   /* sound hardware */
1706   MCFG_SOUND_REPLACE("pokey", POKEY, 12096000/8)
1706   MCFG_SOUND_REPLACE("pokey", POKEYN, 12096000/8)
17071707   MCFG_SOUND_CONFIG(warlords_pokey_interface)
17081708   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
17091709MACHINE_CONFIG_END
src/mame/drivers/atarisy2.c
r15225r15226
818818static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, atarisy2_state )
819819   AM_RANGE(0x0000, 0x0fff) AM_MIRROR(0x2000) AM_RAM
820820   AM_RANGE(0x1000, 0x17ff) AM_MIRROR(0x2000) AM_RAM AM_SHARE("eeprom")
821   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x2780) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
821   AM_RANGE(0x1800, 0x180f) AM_MIRROR(0x2780) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
822822   AM_RANGE(0x1810, 0x1813) AM_MIRROR(0x278c) AM_READ(leta_r)
823   AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x2780) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
823   AM_RANGE(0x1830, 0x183f) AM_MIRROR(0x2780) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
824824   AM_RANGE(0x1840, 0x1840) AM_MIRROR(0x278f) AM_READ(switch_6502_r)
825825   AM_RANGE(0x1850, 0x1851) AM_MIRROR(0x278e) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w)
826826   AM_RANGE(0x1860, 0x1860) AM_MIRROR(0x278f) AM_READ(sound_6502_r)
r15225r15226
12761276   MCFG_SOUND_ROUTE(0, "lspeaker", 0.60)
12771277   MCFG_SOUND_ROUTE(1, "rspeaker", 0.60)
12781278
1279   MCFG_SOUND_ADD("pokey1", POKEY, SOUND_CLOCK/8)
1279   MCFG_SOUND_ADD("pokey1", POKEYN, SOUND_CLOCK/8)
12801280   MCFG_SOUND_CONFIG(pokey_interface_1)
12811281   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.35)
12821282
1283   MCFG_SOUND_ADD("pokey2", POKEY, SOUND_CLOCK/8)
1283   MCFG_SOUND_ADD("pokey2", POKEYN, SOUND_CLOCK/8)
12841284   MCFG_SOUND_CONFIG(pokey_interface_2)
12851285   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.35)
12861286
src/mame/drivers/asteroid.c
r15225r15226
263263   AM_RANGE(0x2000, 0x2007) AM_READ(asteroid_IN0_r)   /* IN0 */
264264   AM_RANGE(0x2400, 0x2407) AM_READ(asteroid_IN1_r)   /* IN1 */
265265   AM_RANGE(0x2800, 0x2803) AM_READ(asteroid_DSW1_r)   /* DSW1 */
266   AM_RANGE(0x2c00, 0x2c0f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
266   AM_RANGE(0x2c00, 0x2c0f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
267267   AM_RANGE(0x2c40, 0x2c7f) AM_DEVREAD("earom", atari_vg_earom_device, read)
268268   AM_RANGE(0x3000, 0x3000) AM_WRITE_LEGACY(avgdvg_go_w)
269269   AM_RANGE(0x3200, 0x323f) AM_DEVWRITE("earom", atari_vg_earom_device, write)
r15225r15226
657657   MCFG_SOUND_CONFIG_DISCRETE(astdelux)
658658   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
659659
660   MCFG_SOUND_ADD("pokey", POKEY, MASTER_CLOCK/8)
660   MCFG_SOUND_ADD("pokey", POKEYN, MASTER_CLOCK/8)
661661   MCFG_SOUND_CONFIG(pokey_config)
662662   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
663663MACHINE_CONFIG_END
src/mame/drivers/firefox.c
r15225r15226
550550   AM_RANGE(0x0880, 0x089f) AM_MIRROR(0x07e0) AM_DEVREADWRITE_LEGACY("riot",riot6532_r, riot6532_w)
551551   AM_RANGE(0x1000, 0x1000) AM_READ(main_to_sound_r)
552552   AM_RANGE(0x1800, 0x1800) AM_WRITE(sound_to_main_w)
553   AM_RANGE(0x2000, 0x200f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
554   AM_RANGE(0x2800, 0x280f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
555   AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE_LEGACY("pokey3", pokey_r, pokey_w)
556   AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE_LEGACY("pokey4", pokey_r, pokey_w)
553   AM_RANGE(0x2000, 0x200f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
554   AM_RANGE(0x2800, 0x280f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
555   AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey3", pokeyn_device, read, write)
556   AM_RANGE(0x3800, 0x380f) AM_DEVREADWRITE("pokey4", pokeyn_device, read, write)
557557   AM_RANGE(0x8000, 0xffff) AM_ROM
558558ADDRESS_MAP_END
559559
r15225r15226
727727   /* sound hardware */
728728   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
729729
730   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_XTAL/8)
730   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_XTAL/8)
731731   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
732732   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
733733
734   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_XTAL/8)
734   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_XTAL/8)
735735   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
736736   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
737737
738   MCFG_SOUND_ADD("pokey3", POKEY, MASTER_XTAL/8)
738   MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_XTAL/8)
739739   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
740740   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
741741
742   MCFG_SOUND_ADD("pokey4", POKEY, MASTER_XTAL/8)
742   MCFG_SOUND_ADD("pokey4", POKEYN, MASTER_XTAL/8)
743743   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30)
744744   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30)
745745
src/mame/drivers/runaway.c
r15225r15226
9797   AM_RANGE(0x3000, 0x3007) AM_READ(runaway_input_r)
9898   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("4000")
9999   AM_RANGE(0x5000, 0x5000) AM_DEVREAD("earom", atari_vg_earom_device, read)
100   AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r,pokey_w)
101   AM_RANGE(0x7000, 0x700f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r,pokey_w)
100   AM_RANGE(0x6000, 0x600f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
101   AM_RANGE(0x7000, 0x700f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
102102   AM_RANGE(0x8000, 0xcfff) AM_ROM
103103   AM_RANGE(0xf000, 0xffff) AM_ROM   /* for the interrupt vectors */
104104ADDRESS_MAP_END
r15225r15226
373373   /* sound hardware */
374374   MCFG_SPEAKER_STANDARD_MONO("mono")
375375
376   MCFG_SOUND_ADD("pokey1", POKEY, 12096000 / 8)
376   MCFG_SOUND_ADD("pokey1", POKEYN, 12096000 / 8)
377377   MCFG_SOUND_CONFIG(pokey_interface_1)
378378   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
379379
380   MCFG_SOUND_ADD("pokey2", POKEY, 12096000 / 8)
380   MCFG_SOUND_ADD("pokey2", POKEYN, 12096000 / 8)
381381   MCFG_SOUND_CONFIG(pokey_interface_2)
382382   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
383383MACHINE_CONFIG_END
src/mame/drivers/cloud9.c
r15225r15226
280280   AM_RANGE(0x5800, 0x5800) AM_MIRROR(0x007e) AM_READ_PORT("IN0")
281281   AM_RANGE(0x5801, 0x5801) AM_MIRROR(0x007e) AM_READ_PORT("IN1")
282282   AM_RANGE(0x5900, 0x5903) AM_MIRROR(0x007c) AM_READ(leta_r)
283   AM_RANGE(0x5a00, 0x5a0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
284   AM_RANGE(0x5b00, 0x5b0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
283   AM_RANGE(0x5a00, 0x5a0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
284   AM_RANGE(0x5b00, 0x5b0f) AM_MIRROR(0x00f0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
285285   AM_RANGE(0x5c00, 0x5cff) AM_MIRROR(0x0300) AM_DEVREADWRITE("nvram", x2212_device, read, write)
286286   AM_RANGE(0x6000, 0xffff) AM_ROM
287287ADDRESS_MAP_END
r15225r15226
447447   /* sound hardware */
448448   MCFG_SPEAKER_STANDARD_MONO("mono")
449449
450   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/8)
450   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/8)
451451   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
452452
453   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/8)
453   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/8)
454454   MCFG_SOUND_CONFIG(pokey_config)
455455   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
456456MACHINE_CONFIG_END
src/mame/drivers/starwars.c
r15225r15226
193193   AM_RANGE(0x0800, 0x0fff) AM_READ(starwars_sin_r)      /* SIN Read */
194194   AM_RANGE(0x1000, 0x107f) AM_RAM                     /* 6532 ram */
195195   AM_RANGE(0x1080, 0x109f) AM_DEVREADWRITE_LEGACY("riot", riot6532_r, riot6532_w)
196   AM_RANGE(0x1800, 0x183f) AM_WRITE_LEGACY(quad_pokey_w)
196   AM_RANGE(0x1800, 0x183f) AM_WRITE_LEGACY(quad_pokeyn_w)
197197   AM_RANGE(0x2000, 0x27ff) AM_RAM                     /* program RAM */
198198   AM_RANGE(0x4000, 0x7fff) AM_ROM                     /* sound roms */
199199   AM_RANGE(0xb000, 0xffff) AM_ROM                     /* more sound roms */
r15225r15226
344344   MCFG_SOUND_START(starwars)
345345   MCFG_SPEAKER_STANDARD_MONO("mono")
346346
347   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK / 8)
347   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK / 8)
348348   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
349349
350   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK / 8)
350   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK / 8)
351351   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
352352
353   MCFG_SOUND_ADD("pokey3", POKEY, MASTER_CLOCK / 8)
353   MCFG_SOUND_ADD("pokey3", POKEYN, MASTER_CLOCK / 8)
354354   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
355355
356   MCFG_SOUND_ADD("pokey4", POKEY, MASTER_CLOCK / 8)
356   MCFG_SOUND_ADD("pokey4", POKEYN, MASTER_CLOCK / 8)
357357   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20)
358358
359359   MCFG_SOUND_ADD("tms", TMS5220, MASTER_CLOCK/2/9)
src/mame/drivers/tunhunt.c
r15225r15226
145145   AM_RANGE(0x2400, 0x2400) AM_WRITENOP   /* INT ACK */
146146   AM_RANGE(0x2800, 0x2800) AM_WRITE(tunhunt_control_w)
147147   AM_RANGE(0x2c00, 0x2fff) AM_WRITEONLY AM_SHARE("spriteram")
148   AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
149   AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
148   AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
149   AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
150150   AM_RANGE(0x5000, 0x7fff) AM_ROM
151151   AM_RANGE(0xfffa, 0xffff) AM_ROM
152152ADDRESS_MAP_END
r15225r15226
323323   /* sound hardware */
324324   MCFG_SPEAKER_STANDARD_MONO("mono")
325325
326   MCFG_SOUND_ADD("pokey1", POKEY, 1209600)
326   MCFG_SOUND_ADD("pokey1", POKEYN, 1209600)
327327   MCFG_SOUND_CONFIG(pokey_interface_1)
328328   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
329329
330   MCFG_SOUND_ADD("pokey2", POKEY, 1209600)
330   MCFG_SOUND_ADD("pokey2", POKEYN, 1209600)
331331   MCFG_SOUND_CONFIG(pokey_interface_2)
332332   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
333333MACHINE_CONFIG_END
src/mame/drivers/tempest.c
r15225r15226
413413   AM_RANGE(0x6060, 0x6060) AM_DEVREAD_LEGACY("mathbox", mathbox_lo_r)
414414   AM_RANGE(0x6070, 0x6070) AM_DEVREAD_LEGACY("mathbox", mathbox_hi_r)
415415   AM_RANGE(0x6080, 0x609f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w)
416   AM_RANGE(0x60c0, 0x60cf) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
417   AM_RANGE(0x60d0, 0x60df) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
416   AM_RANGE(0x60c0, 0x60cf) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
417   AM_RANGE(0x60d0, 0x60df) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
418418   AM_RANGE(0x60e0, 0x60e0) AM_WRITE(tempest_led_w)
419419   AM_RANGE(0x9000, 0xdfff) AM_ROM
420420   AM_RANGE(0xf000, 0xffff) AM_ROM   /* for the reset / interrupt vectors */
r15225r15226
608608   /* sound hardware */
609609   MCFG_SPEAKER_STANDARD_MONO("mono")
610610
611   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK / 8)
611   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK / 8)
612612   MCFG_SOUND_CONFIG(pokey_interface_1)
613613   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
614614
615   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK / 8)
615   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK / 8)
616616   MCFG_SOUND_CONFIG(pokey_interface_2)
617617   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
618618MACHINE_CONFIG_END
src/mame/drivers/mhavoc.c
r15225r15226
206206   int pokey_reg = (offset % 8) | control;
207207
208208   if (pokey_num == 0)
209      return pokey_r(machine().device("pokey1"), pokey_reg);
209      return machine().device<pokeyn_device>("pokey1")->read(pokey_reg);
210210   else
211      return pokey_r(machine().device("pokey2"), pokey_reg);
211      return machine().device<pokeyn_device>("pokey2")->read(pokey_reg);
212212}
213213
214214
r15225r15226
219219   int pokey_reg = (offset % 8) | control;
220220
221221   if (pokey_num == 0)
222      pokey_w(machine().device("pokey1"), pokey_reg, data);
222      machine().device<pokeyn_device>("pokey1")->write(pokey_reg, data);
223223   else
224      pokey_w(machine().device("pokey2"), pokey_reg, data);
224      machine().device<pokeyn_device>("pokey2")->write(pokey_reg, data);
225225}
226226
227227
r15225r15226
265265static ADDRESS_MAP_START( gamma_map, AS_PROGRAM, 8, mhavoc_state )
266266   AM_RANGE(0x0000, 0x07ff) AM_RAM                        /* Program RAM (2K) */
267267    AM_RANGE(0x0800, 0x0fff) AM_RAM AM_MIRROR (0x1800)
268   AM_RANGE(0x2000, 0x203f) AM_READWRITE_LEGACY(quad_pokey_r, quad_pokey_w)   /* Quad Pokey read  */
268   AM_RANGE(0x2000, 0x203f) AM_READWRITE_LEGACY(quad_pokeyn_r, quad_pokeyn_w)   /* Quad Pokey read  */
269269   AM_RANGE(0x2800, 0x2800) AM_READ_PORT("IN1")            /* Gamma Input Port */
270270   AM_RANGE(0x3000, 0x3000) AM_READ(mhavoc_alpha_r)         /* Alpha Comm. Read Port*/
271271   AM_RANGE(0x3800, 0x3803) AM_READ_PORT("DIAL")            /* Roller Controller Input*/
r15225r15226
499499   /* sound hardware */
500500   MCFG_SPEAKER_STANDARD_MONO("mono")
501501
502   MCFG_SOUND_ADD("pokey1", POKEY, MHAVOC_CLOCK_1_25M)
502   MCFG_SOUND_ADD("pokey1", POKEYN, MHAVOC_CLOCK_1_25M)
503503   MCFG_SOUND_CONFIG(pokey_config)
504504   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
505505
506   MCFG_SOUND_ADD("pokey2", POKEY, MHAVOC_CLOCK_1_25M)
506   MCFG_SOUND_ADD("pokey2", POKEYN, MHAVOC_CLOCK_1_25M)
507507   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
508508
509   MCFG_SOUND_ADD("pokey3", POKEY, MHAVOC_CLOCK_1_25M)
509   MCFG_SOUND_ADD("pokey3", POKEYN, MHAVOC_CLOCK_1_25M)
510510   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
511511
512   MCFG_SOUND_ADD("pokey4", POKEY, MHAVOC_CLOCK_1_25M)
512   MCFG_SOUND_ADD("pokey4", POKEYN, MHAVOC_CLOCK_1_25M)
513513   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
514514MACHINE_CONFIG_END
515515
r15225r15226
532532   MCFG_SCREEN_VISIBLE_AREA(0, 580, 0, 500)
533533
534534   /* sound hardware */
535   MCFG_SOUND_REPLACE("pokey1", POKEY, MHAVOC_CLOCK_1_25M)
535   MCFG_SOUND_REPLACE("pokey1", POKEYN, MHAVOC_CLOCK_1_25M)
536536   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
537537
538   MCFG_SOUND_REPLACE("pokey2", POKEY, MHAVOC_CLOCK_1_25M)
538   MCFG_SOUND_REPLACE("pokey2", POKEYN, MHAVOC_CLOCK_1_25M)
539539   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
540540
541541   MCFG_DEVICE_REMOVE("pokey3")
src/mame/drivers/bartop52.c
r15225r15226
3737   AM_RANGE(0x4000, 0xbfff) AM_ROM
3838   AM_RANGE(0xc000, 0xc0ff) AM_READWRITE_LEGACY(atari_gtia_r, atari_gtia_w)
3939   AM_RANGE(0xd400, 0xd5ff) AM_READWRITE_LEGACY(atari_antic_r, atari_antic_w)
40   AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
40   AM_RANGE(0xe800, 0xe8ff) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
4141   AM_RANGE(0xf800, 0xffff) AM_ROM
4242ADDRESS_MAP_END
4343
r15225r15226
137137
138138   /* sound hardware */
139139   MCFG_SPEAKER_STANDARD_MONO("mono")
140   MCFG_SOUND_ADD("pokey", POKEY, FREQ_17_EXACT)
140   MCFG_SOUND_ADD("pokey", POKEYN, FREQ_17_EXACT)
141141   MCFG_SOUND_CONFIG(atari_pokey_interface)
142142   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
143143
src/mame/drivers/atetris.c
r15225r15226
203203   AM_RANGE(0x1000, 0x1fff) AM_RAM_WRITE(atetris_videoram_w) AM_SHARE("videoram")
204204   AM_RANGE(0x2000, 0x20ff) AM_MIRROR(0x0300) AM_RAM_WRITE(paletteram_RRRGGGBB_byte_w) AM_SHARE("paletteram")
205205   AM_RANGE(0x2400, 0x25ff) AM_MIRROR(0x0200) AM_RAM_WRITE(nvram_w) AM_SHARE("nvram")
206   AM_RANGE(0x2800, 0x280f) AM_MIRROR(0x03e0) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
207   AM_RANGE(0x2810, 0x281f) AM_MIRROR(0x03e0) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
206   AM_RANGE(0x2800, 0x280f) AM_MIRROR(0x03e0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
207   AM_RANGE(0x2810, 0x281f) AM_MIRROR(0x03e0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
208208   AM_RANGE(0x3000, 0x3000) AM_MIRROR(0x03ff) AM_WRITE(watchdog_reset_w)
209209   AM_RANGE(0x3400, 0x3400) AM_MIRROR(0x03ff) AM_WRITE(nvram_enable_w)
210210   AM_RANGE(0x3800, 0x3800) AM_MIRROR(0x03ff) AM_WRITE(irq_ack_w)
r15225r15226
358358   /* sound hardware */
359359   MCFG_SPEAKER_STANDARD_MONO("mono")
360360
361   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/8)
361   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/8)
362362   MCFG_SOUND_CONFIG(pokey_interface_1)
363363   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
364364
365   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/8)
365   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/8)
366366   MCFG_SOUND_CONFIG(pokey_interface_2)
367367   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
368368MACHINE_CONFIG_END
src/mame/drivers/atarisy1.c
r15225r15226
504504   AM_RANGE(0x1810, 0x1810) AM_READWRITE_LEGACY(atarigen_6502_sound_r, atarigen_6502_sound_w)
505505   AM_RANGE(0x1820, 0x1820) AM_READ(switch_6502_r)
506506   AM_RANGE(0x1824, 0x1825) AM_WRITE(led_w)
507   AM_RANGE(0x1870, 0x187f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w)
507   AM_RANGE(0x1870, 0x187f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write)
508508   AM_RANGE(0x4000, 0xffff) AM_ROM
509509ADDRESS_MAP_END
510510
r15225r15226
795795   MCFG_SOUND_ROUTE(0, "lspeaker", 0.80)
796796   MCFG_SOUND_ROUTE(1, "rspeaker", 0.80)
797797
798   MCFG_SOUND_ADD("pokey", POKEY, ATARI_CLOCK_14MHz/8)
798   MCFG_SOUND_ADD("pokey", POKEYN, ATARI_CLOCK_14MHz/8)
799799   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.40)
800800   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.40)
801801
src/mame/drivers/bwidow.c
r15225r15226
369369   AM_RANGE(0x0000, 0x07ff) AM_RAM
370370   AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000)
371371   AM_RANGE(0x2800, 0x5fff) AM_ROM
372   AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
373   AM_RANGE(0x6800, 0x6fff) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
372   AM_RANGE(0x6000, 0x67ff) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
373   AM_RANGE(0x6800, 0x6fff) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
374374   AM_RANGE(0x7000, 0x7000) AM_DEVREAD("earom", atari_vg_earom_device, read)
375375   AM_RANGE(0x7800, 0x7800) AM_READ_PORT("IN0")
376376   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("IN3")
r15225r15226
399399   AM_RANGE(0x0e00, 0x0e00) AM_WRITE(irq_ack_w) /* interrupt acknowledge */
400400   AM_RANGE(0x0e80, 0x0e80) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w)
401401   AM_RANGE(0x0f00, 0x0f3f) AM_DEVWRITE("earom", atari_vg_earom_device, write)
402   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w)
403   AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w)
402   AM_RANGE(0x1000, 0x100f) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write)
403   AM_RANGE(0x1400, 0x140f) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write)
404404   AM_RANGE(0x2000, 0x27ff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000)
405405   AM_RANGE(0x2800, 0x3fff) AM_ROM
406406   AM_RANGE(0x4000, 0xffff) AM_ROM
r15225r15226
744744   /* sound hardware */
745745   MCFG_SPEAKER_STANDARD_MONO("mono")
746746
747   MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK / 8)
747   MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK / 8)
748748   MCFG_SOUND_CONFIG(pokey_interface_1)
749749   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
750750
751   MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK / 8)
751   MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK / 8)
752752   MCFG_SOUND_CONFIG(pokey_interface_2)
753753   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
754754MACHINE_CONFIG_END
src/mame/drivers/irobot.c
r15225r15226
137137    AM_RANGE(0x11c0, 0x11c0) AM_WRITE(irobot_rom_banksel_w)
138138    AM_RANGE(0x1200, 0x12ff) AM_RAM_WRITE(irobot_nvram_w) AM_SHARE("nvram")
139139    AM_RANGE(0x1300, 0x13ff) AM_READ(irobot_control_r)
140    AM_RANGE(0x1400, 0x143f) AM_READWRITE_LEGACY(quad_pokey_r, quad_pokey_w)
140    AM_RANGE(0x1400, 0x143f) AM_READWRITE_LEGACY(quad_pokeyn_r, quad_pokeyn_w)
141141    AM_RANGE(0x1800, 0x18ff) AM_WRITE(irobot_paletteram_w)
142142    AM_RANGE(0x1900, 0x19ff) AM_WRITEONLY            /* Watchdog reset */
143143    AM_RANGE(0x1a00, 0x1a00) AM_WRITE(irobot_clearfirq_w)
r15225r15226
317317   /* sound hardware */
318318   MCFG_SPEAKER_STANDARD_MONO("mono")
319319
320   MCFG_SOUND_ADD("pokey1", POKEY, MAIN_CLOCK/8)
320   MCFG_SOUND_ADD("pokey1", POKEYN, MAIN_CLOCK/8)
321321   MCFG_SOUND_CONFIG(pokey_config)
322322   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
323323
324   MCFG_SOUND_ADD("pokey2", POKEY, MAIN_CLOCK/8)
324   MCFG_SOUND_ADD("pokey2", POKEYN, MAIN_CLOCK/8)
325325   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
326326
327   MCFG_SOUND_ADD("pokey3", POKEY, MAIN_CLOCK/8)
327   MCFG_SOUND_ADD("pokey3", POKEYN, MAIN_CLOCK/8)
328328   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
329329
330   MCFG_SOUND_ADD("pokey4", POKEY, MAIN_CLOCK/8)
330   MCFG_SOUND_ADD("pokey4", POKEYN, MAIN_CLOCK/8)
331331   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
332332MACHINE_CONFIG_END
333333
src/mame/drivers/quantum.c
r15225r15226
129129   AM_RANGE(0x000000, 0x013fff) AM_ROM
130130   AM_RANGE(0x018000, 0x01cfff) AM_RAM
131131   AM_RANGE(0x800000, 0x801fff) AM_RAM AM_BASE_LEGACY((UINT16 **)&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size)
132   AM_RANGE(0x840000, 0x84001f) AM_DEVREADWRITE8_LEGACY("pokey1", pokey_r, pokey_w, 0x00ff)
133   AM_RANGE(0x840020, 0x84003f) AM_DEVREADWRITE8_LEGACY("pokey2", pokey_r, pokey_w, 0x00ff)
132   AM_RANGE(0x840000, 0x84001f) AM_DEVREADWRITE8("pokey1", pokeyn_device, read, write, 0x00ff)
133   AM_RANGE(0x840020, 0x84003f) AM_DEVREADWRITE8("pokey2", pokeyn_device, read, write, 0x00ff)
134134   AM_RANGE(0x900000, 0x9001ff) AM_RAM AM_SHARE("nvram")
135135   AM_RANGE(0x940000, 0x940001) AM_READ(trackball_r) /* trackball */
136136   AM_RANGE(0x948000, 0x948001) AM_READ_PORT("SYSTEM")
r15225r15226
259259   /* sound hardware */
260260   MCFG_SPEAKER_STANDARD_MONO("mono")
261261
262   MCFG_SOUND_ADD("pokey1", POKEY, 600000)
262   MCFG_SOUND_ADD("pokey1", POKEYN, 600000)
263263   MCFG_SOUND_CONFIG(pokey_interface_1)
264264   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
265265
266   MCFG_SOUND_ADD("pokey2", POKEY, 600000)
266   MCFG_SOUND_ADD("pokey2", POKEYN, 600000)
267267   MCFG_SOUND_CONFIG(pokey_interface_2)
268268   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
269269MACHINE_CONFIG_END
src/osd/windows/drawdd.c
r15225r15226
418418      {
419419         case 0x00ff0000:   software_renderer<UINT32, 0,0,0, 16,8,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4);   break;
420420         case 0x000000ff:   software_renderer<UINT32, 0,0,0, 0,8,16, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4);   break;
421         case 0xf800:      software_renderer<UINT32, 3,2,3, 11,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2);   break;
422         case 0x7c00:      software_renderer<UINT32, 3,3,3, 10,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2);   break;
421         case 0xf800:      software_renderer<UINT16, 3,2,3, 11,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2);   break;
422         case 0x7c00:      software_renderer<UINT16, 3,3,3, 10,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2);   break;
423423         default:
424424            mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
425425            break;
src/emu/sound/pokey.c
r15225r15226
8787
8888#define VERBOSE       1
8989#define VERBOSE_SOUND   0
90#define VERBOSE_TIMER   
90#define VERBOSE_TIMER   1
9191#define VERBOSE_POLY   0
92#define VERBOSE_RAND   1
92#define VERBOSE_RAND   
9393
9494#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
9595
r15225r15226
236236INLINE pokey_state *get_safe_token(device_t *device)
237237{
238238   assert(device != NULL);
239#ifdef OLDDEVICE_FOR_MESS
239240   assert(device->type() == POKEY);
241#endif
240242   return (pokey_state *)downcast<legacy_device_base *>(device)->token();
241243}
242244
r15225r15226
457459
458460}
459461
460#if 0
461static void rand_init_old(UINT8 *rng, int size, int left, int right, int add)
462{
463    int mask = (1 << size) - 1;
464    int i, x = 0;
465462
466   LOG_RAND(("rand %d\n", size));
467    for( i = 0; i < mask; i++ )
468   {
469      if (size == 17)
470         *rng = x >> 6;   /* use bits 6..13 */
471      else
472         *rng = x;      /* use bits 0..7 */
473        LOG_RAND(("%05x: %02x\n", x, *rng));
474        rng++;
475        /* calculate next bit */
476      x = ((x << left) + (x >> right) + add) & mask;
477   }
478}
479#endif
480
481463static void register_for_save(pokey_state *chip, device_t *device)
482464{
483465   device->save_item(NAME(chip->counter));
r15225r15226
548530   chip->divisor[CHAN2] = 4;
549531   chip->divisor[CHAN3] = 4;
550532   chip->divisor[CHAN4] = 4;
533
551534   chip->clockmult = DIV_64;
552535   chip->KBCODE = 0x09;       /* Atari 800 'no key' */
553536   chip->SKCTL = SK_RESET;    /* let the RNG run after reset */
r15225r15226
12711254   }
12721255}
12731256
1257#ifdef OLDDEVICE_FOR_MESS
12741258
12751259DEFINE_LEGACY_SOUND_DEVICE(POKEY, pokey);
12761260
1261#endif
12771262
12781263
12791264
r15225r15226
12881273
12891274
12901275
1291
12921276// device type definition
12931277const device_type POKEYN = &device_creator<pokeyn_device>;
12941278
r15225r15226
13031287pokeyn_device::pokeyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
13041288   : device_t(mconfig, POKEYN, "POKEYN", tag, owner, clock),
13051289     device_sound_interface(mconfig, *this),
1290#ifdef POKEY_EXEC_INTERFACE
1291     device_execute_interface(mconfig, *this),
1292#endif
1293     m_icount(0),
13061294     m_stream(NULL)
13071295{
13081296}
r15225r15226
13331321   m_ad_time_slow = (attotime::from_nsec(64000      ) * FREQ_17_EXACT) / clock();
13341322
13351323   /* initialize the poly counters */
1336   poly_init(m_poly4,   4, 3, 1, 0x00004);
1337   poly_init(m_poly5,   5, 3, 2, 0x00008);
1338   poly_init(m_poly9,   9, 8, 1, 0x00180);
1339   poly_init(m_poly17, 17,16, 1, 0x1c000);
1324   poly_init_4_5(m_poly4, 4, 1, 0);
1325   poly_init_4_5(m_poly5, 5, 2, 1);
1326   //poly_init(m_poly9,   9, 8, 1, 0x00180);
1327   //poly_init(m_poly17, 17,16, 1, 0x1c000);
13401328
1341   /* initialize the random arrays */
1342   rand_init(m_rand9,   9, 8, 1, 0x00180);
1343   rand_init(m_rand17, 17,16, 1, 0x1c000);
1329   /* initialize 9 / 17 arrays */
1330   poly_init_9_17(m_poly9,   9);
1331   poly_init_9_17(m_poly17, 17);
13441332
13451333   m_divisor[CHAN1] = 4;
13461334   m_divisor[CHAN2] = 4;
r15225r15226
13551343   m_timer[1] = timer_alloc(1);
13561344   m_timer[2] = timer_alloc(1);
13571345
1346   /* reset more internal state */
1347   for (i=0; i<4; i++)
1348   {
1349      m_AUDC[i] = 0;
1350      m_AUDF[i] = 0;
1351      m_volume[i] = 0;
1352      m_borrow_cnt[i] = 0;
1353      m_counter[i] = 0;
1354      if (i<3) m_clock_cnt[i] = 0;
1355      m_filter_sample[i] = 0;
1356      m_output[i] = 0;
1357   }
1358
13581359   for (i=0; i<8; i++)
13591360   {
13601361      m_ptimer[i] = timer_alloc(2);
r15225r15226
13971398   save_item(NAME(m_IRQST));
13981399   save_item(NAME(m_IRQEN));
13991400   save_item(NAME(m_SKSTAT));
1400   save_item(NAME(m_SKCTL));}
1401   save_item(NAME(m_SKCTL));
14011402
1403   // set our instruction counter
1404#ifdef POKEY_EXEC_INTERFACE
1405   m_icountptr = &m_icount;
1406#endif
14021407
1408}
1409
1410
14031411//-------------------------------------------------
14041412//  device_reset - device-specific reset
14051413//-------------------------------------------------
r15225r15226
14811489            (m_interrupt_cb)(this, IRQ_SEROC);
14821490      }
14831491   }
1492   else if (id == 5)
1493   {
1494      /* serin_ready */
1495       if( m_IRQEN & IRQ_SERIN )
1496      {
1497         /* set the enabled timer irq status bits */
1498         m_IRQST |= IRQ_SERIN;
1499         /* call back an application supplied function to handle the interrupt */
1500         if( m_interrupt_cb )
1501            (m_interrupt_cb)(this, IRQ_SERIN);
1502      }
1503   }
14841504   else
14851505      assert_always(FALSE, "Unknown id in pokey_device::device_timer");
14861506}
r15225r15226
15961616         sum += (((m_output[ch] ^ m_filter_sample[ch]) || (m_AUDC[ch] & VOLUME_ONLY)) ? m_volume[ch] : 0 );
15971617      }
15981618
1619#if 0
1620      {
1621         static int old_sum = 0;
1622         if (sum != old_sum)
1623         {
1624            old_sum = sum;
1625            printf("sum %d\n", sum);
1626         }
1627      }
1628#endif
1629
15991630          /* store sum of output signals into the buffer */
1631
16001632          *buffer++ = (sum > 0x7fff) ? 0x7fff : sum;
16011633          samples--;
16021634
r15225r15226
16131645
16141646READ8_MEMBER( pokeyn_device::read )
16151647{
1648   return read(offset);
1649}
1650
1651UINT8 pokeyn_device::read(offs_t offset)
1652{
16161653   int data = 0, pot;
16171654   UINT32 adjust = 0;
16181655
r15225r15226
16931730      }
16941731      if( m_AUDCTL & POLY9 )
16951732      {
1696         m_RANDOM = m_rand9[m_r9];
1733         m_RANDOM = m_poly9[m_r9] & 0xff;
16971734         LOG_RAND(("POKEY '%s' adjust %u rand9[$%05x]: $%02x\n", tag(), adjust, m_r9, m_RANDOM));
16981735      }
16991736      else
17001737      {
1701         m_RANDOM = m_rand17[m_r17];
1738         m_RANDOM = (m_poly17[m_r17] >> 8) & 0xff;
17021739         LOG_RAND(("POKEY '%s' adjust %u rand17[$%05x]: $%02x\n", tag(), adjust, m_r17, m_RANDOM));
17031740      }
17041741      if (adjust > 0)
r15225r15226
17411778
17421779WRITE8_MEMBER( pokeyn_device::write )
17431780{
1744   write_cmd(offset, data);
1781   write(offset, data);
17451782}
17461783
1747void pokeyn_device::write_cmd(int offset, UINT8 data)
1784void pokeyn_device::write(offs_t offset, UINT8 data)
17481785{
17491786   int ch_mask = 0, new_val;
17501787
r15225r15226
19772014      m_SKCTL = data;
19782015        if( !(data & SK_RESET) )
19792016        {
1980            write_cmd(IRQEN_C,  0);
1981            write_cmd(SKREST_C, 0);
2017            write(IRQEN_C,  0);
2018            write(SKREST_C, 0);
19822019        }
19832020        break;
19842021    }
r15225r15226
20712108    }
20722109}
20732110
2111void pokeyn_device::serin_ready(int after)
2112{
2113   timer_set(m_clock_period * after, 5, 0);
2114}
20742115
2116void pokeyn_device::break_w(int shift)
2117{
2118   if( shift )                     /* shift code ? */
2119      m_SKSTAT |= SK_SHIFT;
2120   else
2121      m_SKSTAT &= ~SK_SHIFT;
2122   /* check if the break IRQ is enabled */
2123   if( m_IRQEN & IRQ_BREAK )
2124   {
2125      /* set break IRQ status and call back the interrupt handler */
2126      m_IRQST |= IRQ_BREAK;
2127      if( m_interrupt_cb )
2128         (*m_interrupt_cb)(this, IRQ_BREAK);
2129   }
2130}
2131
2132void pokeyn_device::kbcode_w(int kbcode, int make)
2133{
2134    /* make code ? */
2135   if( make )
2136   {
2137      m_KBCODE = kbcode;
2138      m_SKSTAT |= SK_KEYBD;
2139      if( kbcode & 0x40 )       /* shift code ? */
2140         m_SKSTAT |= SK_SHIFT;
2141      else
2142         m_SKSTAT &= ~SK_SHIFT;
2143
2144      if( m_IRQEN & IRQ_KEYBD )
2145      {
2146         /* last interrupt not acknowledged ? */
2147         if( m_IRQST & IRQ_KEYBD )
2148            m_SKSTAT |= SK_KBERR;
2149         m_IRQST |= IRQ_KEYBD;
2150         if( m_interrupt_cb )
2151            (*m_interrupt_cb)(this, IRQ_KEYBD);
2152      }
2153   }
2154   else
2155   {
2156      m_KBCODE = kbcode;
2157      m_SKSTAT &= ~SK_KEYBD;
2158    }
2159}
2160
2161
2162
20752163//-------------------------------------------------
20762164//  private stuff
20772165//-------------------------------------------------
r15225r15226
20802168{
20812169   int toggle = 0;
20822170
2083   if( (m_AUDC[ch] & NOTPOLY5) || m_poly5[m_p5] )
2171   if( (m_AUDC[ch] & NOTPOLY5) || (m_poly5[m_p5] & 1) )
20842172   {
20852173      if( m_AUDC[ch] & PURE )
20862174         toggle = 1;
20872175      else
20882176      if( m_AUDC[ch] & POLY4 )
2089         toggle = m_output[ch] == !m_poly4[m_p4];
2177         toggle = m_output[ch] == !(m_poly4[m_p4] & 1);
20902178      else
20912179      if( m_AUDCTL & POLY9 )
2092         toggle = m_output[ch] == !m_poly9[m_p9];
2180         toggle = m_output[ch] == !(m_poly9[m_p9] & 1);
20932181      else
2094         toggle = m_output[ch] == !m_poly17[m_p17];
2182         toggle = m_output[ch] == !(m_poly17[m_p17] & 1);
20952183   }
20962184   if( toggle )
20972185   {
r15225r15226
21632251}
21642252
21652253
2166void pokeyn_device::poly_init(UINT8 *poly, int size, int left, int right, int add)
2254void pokeyn_device::poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert)
21672255{
21682256   int mask = (1 << size) - 1;
2169    int i, x = 0;
2257    int i;
2258    UINT32 lfsr = 0;
21702259
21712260   LOG_POLY(("poly %d\n", size));
2172   for( i = 0; i < mask; i++ )
2261    for( i = 0; i < mask; i++ )
21732262   {
2174      *poly++ = x & 1;
2175      LOG_POLY(("%05x: %d\n", x, x&1));
21762263        /* calculate next bit */
2177      x = ((x << left) + (x >> right) + add) & mask;
2264       int in = !((lfsr >> 0) & 1) ^ ((lfsr >> xorbit) & 1);
2265       lfsr = lfsr >> 1;
2266       lfsr = (in << (size-1)) | lfsr;
2267      *poly = lfsr ^ invert;
2268        LOG_POLY(("%05x: %02x\n", lfsr, *poly));
2269        poly++;
21782270   }
21792271}
21802272
2181void pokeyn_device::rand_init(UINT8 *rng, int size, int left, int right, int add)
2273void pokeyn_device::poly_init_9_17(UINT32 *poly, int size)
21822274{
21832275    int mask = (1 << size) - 1;
2184    int i, x = 0;
2276    int i;
2277    UINT32 lfsr = 0;
21852278
21862279   LOG_RAND(("rand %d\n", size));
2187    for( i = 0; i < mask; i++ )
2280
2281   if (size == 17)
21882282   {
2189      if (size == 17)
2190         *rng = x >> 6;   /* use bits 6..13 */
2191      else
2192         *rng = x;      /* use bits 0..7 */
2193        LOG_RAND(("%05x: %02x\n", x, *rng));
2194        rng++;
2195        /* calculate next bit */
2196      x = ((x << left) + (x >> right) + add) & mask;
2283       for( i = 0; i < mask; i++ )
2284      {
2285           /* calculate next bit @ 7 */
2286          int in8 = !((lfsr >> 8) & 1) ^ ((lfsr >> 13) & 1);
2287          int in = (lfsr & 1);
2288          lfsr = lfsr >> 1;
2289          lfsr = (lfsr & 0xff7f) | (in8 << 7);
2290          lfsr = (in << 16) | lfsr;
2291         *poly = lfsr;
2292           LOG_RAND(("%05x: %02x\n", lfsr, *poly));
2293           poly++;
2294      }
21972295   }
2296   else
2297   {
2298       for( i = 0; i < mask; i++ )
2299      {
2300           /* calculate next bit */
2301          int in = !((lfsr >> 0) & 1) ^ ((lfsr >> 5) & 1);
2302          lfsr = lfsr >> 1;
2303          lfsr = (in << 8) | lfsr;
2304         *poly = lfsr;
2305           LOG_RAND(("%05x: %02x\n", lfsr, *poly));
2306           poly++;
2307      }
2308   }
2309
21982310}
2311
2312//-------------------------------------------------
2313//  Quad Pokey support - should be in game drivers, really
2314//-------------------------------------------------
2315
2316
2317READ8_HANDLER( quad_pokeyn_r )
2318{
2319   static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
2320   int pokey_num = (offset >> 3) & ~0x04;
2321   int control = (offset & 0x20) >> 2;
2322   int pokey_reg = (offset % 8) | control;
2323   pokeyn_device *pokey = space->machine().device<pokeyn_device>(devname[pokey_num]);
2324
2325   return pokey->read(pokey_reg);
2326}
2327
2328WRITE8_HANDLER( quad_pokeyn_w )
2329{
2330   static const char *const devname[4] = { "pokey1", "pokey2", "pokey3", "pokey4" };
2331    int pokey_num = (offset >> 3) & ~0x04;
2332    int control = (offset & 0x20) >> 2;
2333    int pokey_reg = (offset % 8) | control;
2334   pokeyn_device *pokey = space->machine().device<pokeyn_device>(devname[pokey_num]);
2335
2336    pokey->write(pokey_reg, data);
2337}
2338
src/emu/sound/pokey.h
r15225r15226
2121
2222#include "devlegcy.h"
2323
24/* uncomment the line below for MESS to avoid breaking compile
25 * please migrate as soon as possible to new device so that we can get rid of the legacy */
26
27//#define OLDDEVICE_FOR_MESS 1
28
29//#define POKEY_EXEC_INTERFACE
30
2431/* CONSTANT DEFINITIONS */
2532
2633/* POKEY WRITE LOGICALS */
r15225r15226
7885   void (*interrupt_cb)(device_t *device, int mask);
7986};
8087
81
88#ifdef OLDDEVICE_FOR_MESS
8289READ8_DEVICE_HANDLER( pokey_r );
8390WRITE8_DEVICE_HANDLER( pokey_w );
8491
r15225r15226
9299
93100DECLARE_LEGACY_SOUND_DEVICE(POKEY, pokey);
94101
102#endif
103
95104//**************************************************************************
96105//  TYPE DEFINITIONS
97106//**************************************************************************
98107
99
100108// ======================> pokey_device
101109
102110class pokeyn_device : public device_t,
103                  public device_sound_interface
111                 public device_sound_interface
112#ifdef POKEY_EXEC_INTERFACE
113                 public ,device_execute_interface
114#endif
104115{
105116public:
106117   // construction/destruction
r15225r15226
109120   DECLARE_READ8_MEMBER( read );
110121   DECLARE_WRITE8_MEMBER( write );
111122
123   UINT8 read(offs_t offset);
124   void  write(offs_t offset, UINT8 data);
125
126   void serin_ready(int after);
127   void break_w(int shift);
128   void kbcode_w(int kbcode, int make);
129
112130protected:
113131   // device-level overrides
114132   virtual void device_start();
r15225r15226
120138   // device_sound_interface overrides
121139   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
122140
141#ifdef POKEY_EXEC_INTERFACE
142   virtual void execute_run() { m_icount = 0; } //printf("execute: %d\n", m_icount); m_icount = 0; }
143#endif
144
123145   // configuration state
124146   pokey_interface m_intf;
125147
148   // other internal states
149    int m_icount;
150
126151private:
127152
128   void poly_init(UINT8 *poly, int size, int left, int right, int add);
129   void rand_init(UINT8 *rng, int size, int left, int right, int add);
153   void poly_init_4_5(UINT32 *poly, int size, int xorbit, int invert);
154   void poly_init_9_17(UINT32 *poly, int size);
130155   inline void process_channel(int ch);
131156   inline void reset_channel(int ch);
132157   inline void inc_chan(int ch);
133158   inline int check_borrow(int ch);
134159   void pokey_potgo(void);
135   void write_cmd(int offset, UINT8 data);
136160
137
138
139161   // internal state
140162   sound_stream* m_stream;
141163
r15225r15226
181203   attotime m_ad_time_fast;
182204   attotime m_ad_time_slow;
183205
184   UINT8 m_poly4[0x0f];
185   UINT8 m_poly5[0x1f];
186   UINT8 m_poly9[0x1ff];
187   UINT8 m_poly17[0x1ffff];
188
189   UINT8 m_rand9[0x1ff];
190   UINT8 m_rand17[0x1ffff];
191
206   UINT32 m_poly4[0x0f];
207   UINT32 m_poly5[0x1f];
208   UINT32 m_poly9[0x1ff];
209   UINT32 m_poly17[0x1ffff];
192210};
193211
194212
r15225r15226
196214extern const device_type POKEYN;
197215
198216
217/* fix me: eventually this should be a single device with pokey subdevices */
218READ8_HANDLER( quad_pokeyn_r );
219WRITE8_HANDLER( quad_pokeyn_w );
220
221
199222#endif   /* __POKEY_H__ */
src/ldplayer/ldplayer.c
r15225r15226
673673static MACHINE_CONFIG_DERIVED_CLASS( ldv1000, ldplayer_ntsc, ldv1000_state )
674674   MCFG_LASERDISC_LDV1000_ADD("laserdisc")
675675   MCFG_LASERDISC_GET_DISC(laserdisc_get_disc_delegate(FUNC(ldplayer_state::get_disc_static), device))
676   MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
677
676678   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
679   MCFG_SOUND_MODIFY("laserdisc")
677680   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
678681   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
679   MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
680682MACHINE_CONFIG_END
681683
682684
683685static MACHINE_CONFIG_DERIVED_CLASS( pr8210, ldplayer_ntsc, pr8210_state )
684686   MCFG_LASERDISC_PR8210_ADD("laserdisc")
685687   MCFG_LASERDISC_GET_DISC(laserdisc_get_disc_delegate(FUNC(ldplayer_state::get_disc_static), device))
688   MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
689
686690   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
691   MCFG_SOUND_MODIFY("laserdisc")
687692   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
688693   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
689   MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
690694MACHINE_CONFIG_END
691695
692696

Previous 15994 Revisions Next


© 1998-2018 The MESS Team