| Previous | 15994 Revisions | Next |
| r15219 Saturday 19th May, 2012 at 09:17:59 UTC by Miodrag Milanović |
|---|
| Sync with MAME r16343 (nw) |
| [src/emu] | info.c info.h ioport.c |
| [src/emu/sound] | pokey.c pokey.h |
| [src/emu/video] | psx.c |
| [src/ldplayer] | ldplayer.c ldplayer.mak |
| [src/lib/util] | chd.c |
| [src/mame] | mame.lst |
| [src/mame/audio] | bzone.c |
| [src/mame/drivers] | 8080bw.c atarigt.c atarigx2.c blitz68k.c bzone.c ccastles.c crgolf.c decocass.c dkong.c feversoc.c flyball.c galdrvr.c itech8.c ksys573.c mcr.c megatech.c missile.c namcops2.c namcos21.c xmen.c |
| [src/mame/includes] | astrocde.h |
| [src/mame/video] | astrocde.c bfm_dm01.c gsword.c |
| r15218 | r15219 | |
|---|---|---|
| 238 | 238 | checkmanj // (c) 1982 Jaleco (Zenitone/Zilec in ROM CM4, and the programmer names) |
| 239 | 239 | dingo // (c) 1983 Ashby Computers and Graphics LTD. + Jaleco license |
| 240 | 240 | dingoe // (c) 1983 Ashby Computers and Graphics LTD. + Jaleco license |
| 241 | blkhole // TDS (Tokyo Denshi Sekkei) | |
| 241 | blkhole // TDS (Tokyo Denshi Sekkei) & MINTS | |
| 242 | 242 | kingball // (c) 1980 Namco |
| 243 | 243 | kingballj // (c) 1980 Namco |
| 244 | 244 | scorpionmc // bootleg |
| r15218 | r15219 | |
| 951 | 951 | solvalou // (c) 1991 (Japan) |
| 952 | 952 | starblad // (c) 1991 |
| 953 | 953 | driveyes // (c) 1992? |
| 954 | // 1992, S | |
| 954 | // 1992, S | |
| 955 | 955 | aircomb // (c) 1992 (US) |
| 956 | 956 | aircombj // (c) 1992 (Japan) |
| 957 | 957 | cybsled // (c) 1993 |
| r15218 | r15219 | |
| 1431 | 1431 | spceking // (c) 1978 Leijac Corporation (Konami) |
| 1432 | 1432 | spcewars // (c) 1978 Sanritsu |
| 1433 | 1433 | astropal // (c) 19?? Sidam |
| 1434 | cosmo // TDS | |
| 1434 | cosmo // TDS & Mints | |
| 1435 | 1435 | darthvdr // bootleg |
| 1436 | 1436 | |
| 1437 | 1437 | 18w // 653 (c) 1979 Midway |
| r15218 | r15219 | |
| 3553 | 3553 | |
| 3554 | 3554 | // Konami System 573 |
| 3555 | 3555 | sys573 |
| 3556 | hndlchmp // 1997 - Handle Champ (GQ710 VER. JAA) | |
| 3556 | 3557 | darkhleg // 1998 - Dark Horse Legend (GX706 VER. JAA) |
| 3557 | 3558 | fbaitbc // 1998 - Fisherman's Bait - A Bass Challenge (GE765 VER. UAB) |
| 3558 | 3559 | bassangl // 1998 - Bass Angler (GE765 VER. JAA) |
| r15218 | r15219 | |
|---|---|---|
| 400 | 400 | |
| 401 | 401 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 402 | 402 | |
| 403 | MCFG_SOUND_ADD("pokey", POKEY, BZONE_MASTER_CLOCK / 8) | |
| 403 | MCFG_SOUND_ADD("pokey", POKEYN, BZONE_MASTER_CLOCK / 8) | |
| 404 | 404 | MCFG_SOUND_CONFIG(bzone_pokey_interface) |
| 405 | 405 | MCFG_SOUND_ROUTE_EX(0, "discrete", 1.0, 0) |
| 406 | 406 |
| r15218 | r15219 | |
|---|---|---|
| 42 | 42 | UINT8 m_vertical_feedback; |
| 43 | 43 | UINT8 m_horizontal_feedback; |
| 44 | 44 | emu_timer *m_scanline_timer; |
| 45 | emu_timer *m_intoff_timer; | |
| 45 | 46 | UINT8 m_colors[8]; |
| 46 | 47 | UINT8 m_colorsplit; |
| 47 | 48 | UINT8 m_bgdata; |
| r15218 | r15219 | |
|---|---|---|
| 32 | 32 | |
| 33 | 33 | static void init_savestate(running_machine &machine); |
| 34 | 34 | static TIMER_CALLBACK( scanline_callback ); |
| 35 | static TIMER_CALLBACK( interrupt_off ); | |
| 35 | 36 | static void init_sparklestar(running_machine &machine); |
| 36 | 37 | |
| 37 | 38 | |
| r15218 | r15219 | |
| 162 | 163 | VIDEO_START( astrocde ) |
| 163 | 164 | { |
| 164 | 165 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 165 | /* allocate a per-scanline timer */ | |
| 166 | ||
| 167 | /* allocate timers */ | |
| 166 | 168 | state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback)); |
| 167 | 169 | state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(1), 1); |
| 170 | state->m_intoff_timer = machine.scheduler().timer_alloc(FUNC(interrupt_off)); | |
| 168 | 171 | |
| 169 | 172 | /* register for save states */ |
| 170 | 173 | init_savestate(machine); |
| r15218 | r15219 | |
| 178 | 181 | VIDEO_START( profpac ) |
| 179 | 182 | { |
| 180 | 183 | astrocde_state *state = machine.driver_data<astrocde_state>(); |
| 181 | /* allocate a per-scanline timer */ | |
| 184 | ||
| 185 | /* allocate timers */ | |
| 182 | 186 | state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback)); |
| 183 | 187 | state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(1), 1); |
| 188 | state->m_intoff_timer = machine.scheduler().timer_alloc(FUNC(interrupt_off)); | |
| 184 | 189 | |
| 185 | 190 | /* allocate videoram */ |
| 186 | 191 | state->m_profpac_videoram = auto_alloc_array(machine, UINT16, 0x4000 * 4); |
| r15218 | r15219 | |
| 389 | 394 | if ((state->m_interrupt_enabl & 0x01) == 0) |
| 390 | 395 | { |
| 391 | 396 | cputag_set_input_line_and_vector(machine, "maincpu", 0, HOLD_LINE, state->m_interrupt_vector & 0xf0); |
| 392 | | |
| 397 | state->m_in | |
| 393 | 398 | } |
| 394 | 399 | |
| 395 | 400 | /* mode 1 means assert for 1 instruction */ |
| 396 | 401 | else |
| 397 | 402 | { |
| 398 | 403 | cputag_set_input_line_and_vector(machine, "maincpu", 0, ASSERT_LINE, state->m_interrupt_vector & 0xf0); |
| 399 | | |
| 404 | state->m_in | |
| 400 | 405 | } |
| 401 | 406 | |
| 402 | 407 | /* latch the feedback registers */ |
| r15218 | r15219 | |
|---|---|---|
| 9 | 9 | #include "includes/gsword.h" |
| 10 | 10 | |
| 11 | 11 | |
| 12 | static PALETTE_INIT( common ) | |
| 13 | { | |
| 14 | const UINT8 *color_prom = machine.root_device().memregion("proms")->base(); | |
| 15 | int i; | |
| 16 | ||
| 17 | /* characters */ | |
| 18 | for (i = 0; i < 0x100; i++) | |
| 19 | colortable_entry_set_value(machine.colortable, i, i); | |
| 20 | ||
| 21 | /* sprites */ | |
| 22 | for (i = 0x100; i < 0x200; i++) | |
| 23 | { | |
| 24 | UINT8 ctabentry = (BITSWAP8(color_prom[i - 0x100],7,6,5,4,0,1,2,3) & 0x0f) | 0x80; | |
| 25 | colortable_entry_set_value(machine.colortable, i, ctabentry); | |
| 26 | } | |
| 27 | } | |
| 28 | ||
| 29 | ||
| 30 | 12 | PALETTE_INIT( josvolly ) |
| 31 | 13 | { |
| 32 | 14 | const UINT8 *color_prom = machine.root_device().memregion("proms")->base(); |
| r15218 | r15219 | |
| 48 | 30 | /* color_prom now points to the beginning of the lookup table */ |
| 49 | 31 | color_prom += 0x300; |
| 50 | 32 | |
| 51 | PALETTE_INIT_CALL(common); | |
| 33 | /* characters */ | |
| 34 | for (i = 0; i < 0x100; i++) | |
| 35 | colortable_entry_set_value(machine.colortable, i, i); | |
| 36 | ||
| 37 | /* sprites */ | |
| 38 | for (i = 0x100; i < 0x200; i++) | |
| 39 | { | |
| 40 | UINT8 ctabentry = (BITSWAP8(color_prom[i - 0x100],7,6,5,4,0,1,2,3) & 0x0f) | 0x80; | |
| 41 | colortable_entry_set_value(machine.colortable, i, ctabentry); | |
| 42 | } | |
| 52 | 43 | } |
| 53 | 44 | |
| 54 | 45 | |
| r15218 | r15219 | |
| 90 | 81 | /* color_prom now points to the beginning of the lookup table */ |
| 91 | 82 | color_prom += 0x200; |
| 92 | 83 | |
| 93 | PALETTE_INIT_CALL(common); | |
| 84 | /* characters */ | |
| 85 | for (i = 0; i < 0x100; i++) | |
| 86 | colortable_entry_set_value(machine.colortable, i, i); | |
| 87 | ||
| 88 | /* sprites */ | |
| 89 | for (i = 0x100; i < 0x200; i++) | |
| 90 | { | |
| 91 | UINT8 ctabentry = (BITSWAP8(color_prom[i - 0x100],7,6,5,4,0,1,2,3) & 0x0f) | 0x80; | |
| 92 | colortable_entry_set_value(machine.colortable, i, ctabentry); | |
| 93 | } | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | WRITE8_MEMBER(gsword_state::gsword_videoram_w) |
| r15218 | r15219 | |
|---|---|---|
| 146 | 146 | dm01.scanline[8] &= 0x80;//filter all other bits |
| 147 | 147 | if ( (row >= 0) && (row < DM_MAXLINES) ) |
| 148 | 148 | { |
| 149 | int p,pos; | |
| 150 | pos =0; | |
| 151 | p = 0; | |
| 149 | int p = 0; | |
| 152 | 150 | |
| 153 | 151 | while ( p < (DM_BYTESPERROW) ) |
| 154 | 152 | { |
| r15218 | r15219 | |
|---|---|---|
| 333 | 333 | AM_RANGE(0x9000, 0x90ff) AM_MIRROR(0x0300) AM_READWRITE(nvram_r, nvram_w) |
| 334 | 334 | AM_RANGE(0x9400, 0x9403) AM_MIRROR(0x01fc) AM_READ(leta_r) |
| 335 | 335 | AM_RANGE(0x9600, 0x97ff) AM_READ_PORT("IN0") |
| 336 | AM_RANGE(0x9800, 0x980f) AM_MIRROR(0x01f0) AM_DEVREADWRITE_LEGACY("pokey1", pokey_r, pokey_w) | |
| 337 | AM_RANGE(0x9a00, 0x9a0f) AM_MIRROR(0x01f0) AM_DEVREADWRITE_LEGACY("pokey2", pokey_r, pokey_w) | |
| 336 | AM_RANGE(0x9800, 0x980f) AM_MIRROR(0x01f0) AM_DEVREADWRITE("pokey1", pokeyn_device, read, write) | |
| 337 | AM_RANGE(0x9a00, 0x9a0f) AM_MIRROR(0x01f0) AM_DEVREADWRITE("pokey2", pokeyn_device, read, write) | |
| 338 | 338 | AM_RANGE(0x9c00, 0x9c7f) AM_WRITE(nvram_recall_w) |
| 339 | 339 | AM_RANGE(0x9c80, 0x9cff) AM_WRITE(ccastles_hscroll_w) |
| 340 | 340 | AM_RANGE(0x9d00, 0x9d7f) AM_WRITE(ccastles_vscroll_w) |
| r15218 | r15219 | |
| 495 | 495 | /* sound hardware */ |
| 496 | 496 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 497 | 497 | |
| 498 | MCFG_SOUND_ADD("pokey1", POKEY, MASTER_CLOCK/8) | |
| 498 | MCFG_SOUND_ADD("pokey1", POKEYN, MASTER_CLOCK/8) | |
| 499 | 499 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 500 | 500 | |
| 501 | MCFG_SOUND_ADD("pokey2", POKEY, MASTER_CLOCK/8) | |
| 501 | MCFG_SOUND_ADD("pokey2", POKEYN, MASTER_CLOCK/8) | |
| 502 | 502 | MCFG_SOUND_CONFIG(pokey_config) |
| 503 | 503 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 504 | 504 | MACHINE_CONFIG_END |
| r15218 | r15219 | |
|---|---|---|
| 18 | 18 | Copyright Nicola Salmoria and the MAME Team. |
| 19 | 19 | Visit http://mamedev.org for licensing and usage restrictions. |
| 20 | 20 | |
| 21 | ||
| 22 | List of Namco System 246 games: | |
| 23 | * Battle Gear 3 (Taito, 2002) | |
| 24 | * Battle Gear 3 Tuned (Taito, 2003) | |
| 25 | * Bloody Roar 3 (Namco / 8ing / Raizing, 2000) | |
| 26 | * Capcom Fighting Jam (Capcom, 2004) | |
| 27 | * Cobra: The Arcade (Namco, 2004) | |
| 28 | * Dragon Chronicles (Namco, 2002) | |
| 29 | * Fate/Unlimited Codes (Capcom / Type-Moon / Cavia / 8ing, 2008) | |
| 30 | * Getchu Play! Tottoko Hamutaro (Banpresto, 2007) | |
| 31 | * Mobile Suit Gundam SEED: Federation Vs. Z.A.F.T. (Capcom / Banpresto, 2005) | |
| 32 | * Mobile Suit Gundam SEED Destiny: Federation Vs. Z.A.F.T. II (Banpresto, 2006) | |
| 33 | * Mobile Suit Gundam Z: AEUG Vs. Titans (Capcom / Banpresto, 2003) | |
| 34 | * Mobile Suit Gundam Z: AEUG Vs. Titans DX (Capcom / Banpresto, 2004) | |
| 35 | * Minnade Kitaeru Zennou Training (Namco, 2006) | |
| 36 | * Netchuu Pro Yakyuu 2002 (Namco, 2002) | |
| 37 | * Pride GP 2003 (Capcom, 2003) | |
| 38 | * Quiz and Variety Sukusuku Inufuku 2 (Namco / AMI / Hamster, 2007) | |
| 39 | * Quiz Mobile Suit Gundam: Tou. Senshi (Banpresto, 2006) | |
| 40 | * Raizin Ping Pong (Taito, 2001) | |
| 41 | * Ridge Racer V: Arcade Battle (Namco, 2000) | |
| 42 | * Sengoku Basara X Cross (Capcom / ARC System Works, 2008) | |
| 43 | * Smash Court Pro Tournament (Namco, 2001) | |
| 44 | * Soul Calibur II (Namco, 2002) | |
| 45 | * Soul Calibur II Ver.D (Namco, 2003) | |
| 46 | * Soul Calibur III Arcade Edition (Namco, 2006) | |
| 47 | * Taiko No Tatsujin 7 (Namco, 2005) | |
| 48 | * Taiko No Tatsujin 8 (Namco, 2006) | |
| 49 | * Technic Beat (Arika, 2002) | |
| 50 | * Tekken 4 (Namco, 2001) | |
| 51 | * Time Crisis 3 (Namco, 2002) | |
| 52 | * Vampire Night (Namco / Sega / WOW Entertainment, 2000) | |
| 53 | * Wangan Midnight (Namco, 2001) | |
| 54 | * Wangan Midnight R (Namco, 2002) | |
| 55 | * Zoids Infinity (Taito, 2004) | |
| 56 | ||
| 57 | List of Namco System 256 Games | |
| 58 | * Chou Dragon Ball Z (Banpresto, 2005) | |
| 59 | * Druaga Online - The Story of Aon (Namco, 2005) | |
| 60 | * Kinnikuman Muscle Grand Prix (Banpresto, 2006) | |
| 61 | * Kinnikuman Muscle Grand Prix 2 (Banpresto, 2007) | |
| 62 | * Kinnikuman Muscle Grand Prix 2 Tokumori (Banpresto, 2008) | |
| 63 | * Mobile Suit Gundam SEED Destiny: Federation Vs. Z.A.F.T. II (Banpresto, 2006) | |
| 64 | * Mobile Suit Gundam: Gundam Vs. Gundam (Banpresto, 2008) | |
| 65 | * Mobile Suit Gundam: Gundam Vs. Gundam Next (Banpresto, 2009) | |
| 66 | * Quiz and Variety Sukusuku Inufuku 2 (Namco / AMI / Hamster, 2007) | |
| 67 | * Sengoku Basara X Cross (Capcom / ARC System Works, 2008) | |
| 68 | * Taiko No Tatsujin 9 (Namco, 2006) | |
| 69 | * Taiko No Tatsujin 10 (Namco, 2007) | |
| 70 | * Taiko No Tatsujin 11 (Namco, 2008) | |
| 71 | * Taiko No Tatsujin 12 (Namco, 2008) | |
| 72 | * Taiko No Tatsujin 12 Don! (Namco, 2009) | |
| 73 | * Taiko No Tatsujin 13 (Namco, 2009) | |
| 74 | * Taiko No Tatsujin 14 (Namco, 2010) | |
| 75 | * Tekken 5 (Namco, 2004) | |
| 76 | * Tekken 5.1 (Namco, 2005) | |
| 77 | * Tekken 5 Dark Resurrection (Namco, 2005) | |
| 78 | * The Battle of YuYu Hakusho (Banpresto, 2006) | |
| 79 | * THE iDOLM@STER (Namco, 2005) | |
| 80 | * Zoids Infinity EX (Taito, 2005) | |
| 81 | * Zoids Infinity EX Plus (Taito, 2006) | |
| 82 | ||
| 83 | List of System Super 256 Games | |
| 84 | * Time Crisis 4 (Namco, 2006) | |
| 85 | ||
| 21 | 86 | ***************************************************************************/ |
| 22 | 87 | |
| 23 | 88 |
| r15218 | r15219 | |
|---|---|---|
| 2505 | 2505 | GAME( 1991, driveyes, 0, driveyes, winrun, driveyes, ROT0, "Namco", "Driver's Eyes (US)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) |
| 2506 | 2506 | GAME( 1991, solvalou, 0, poly_c140_typeA, s21default, solvalou, ROT0, "Namco", "Solvalou (Japan)", GAME_IMPERFECT_GRAPHICS ) |
| 2507 | 2507 | GAME( 1991, starblad, 0, poly_c140_typeA, s21default, starblad, ROT0, "Namco", "Starblade (Japan)", GAME_IMPERFECT_GRAPHICS ) |
| 2508 | /* 1992, S | |
| 2508 | /* 1992, S | |
| 2509 | 2509 | GAME( 1992, aircomb, 0, poly_c140_typeB, aircombt, aircombt, ROT0, "Namco", "Air Combat (US)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) |
| 2510 | 2510 | GAME( 1992, aircombj, aircomb, poly_c140_typeB, aircombt, aircombt, ROT0, "Namco", "Air Combat (Japan)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS ) |
| 2511 | 2511 | GAME( 1993, cybsled, 0, poly_c140_typeA, cybsled, cybsled, ROT0, "Namco", "Cyber Sled (US)", GAME_IMPERFECT_GRAPHICS ) |
| r15218 | r15219 | |
|---|---|---|
| 611 | 611 | |
| 612 | 612 | |
| 613 | 613 | /* MegaTech Games - Genesis & sms! Games with a timer */ |
| 614 | /* epr-12253b.20 is known to exist (Version 0 - Revision B) */ | |
| 614 | 615 | |
| 615 | 616 | #define MEGATECH_BIOS \ |
| 616 | 617 | ROM_REGION( 0x400000, "maincpu", ROMREGION_ERASEFF ) \ |
| 617 | 618 | ROM_REGION( 0x10000, "mtbios", 0 ) \ |
| 618 | ROM_LOAD( "epr12664.20", 0x000000, 0x8000, CRC(f71e9526) SHA1(1c7887541d02c41426992d17f8e3db9e03975953) ) \ | |
| 619 | ROM_SYSTEM_BIOS( 0, "ver1", "Ver 1" ) \ | |
| 620 | ROMX_LOAD( "epr-12664.20", 0x000000, 0x8000, CRC(f71e9526) SHA1(1c7887541d02c41426992d17f8e3db9e03975953), ROM_BIOS(1)) \ | |
| 621 | ROM_SYSTEM_BIOS( 1, "ver0", "Ver 0" ) \ | |
| 622 | ROMX_LOAD( "epr-12263a.20", 0x000000, 0x8000, CRC(07c3f423) SHA1(50c28bbc2d4349c820d988ae3f20aae3f808545f), ROM_BIOS(2)) \ | |
| 619 | 623 | |
| 620 | 624 | /* no games */ |
| 621 | 625 | ROM_START( megatech ) |
| r15218 | r15219 | |
|---|---|---|
| 6376 | 6376 | GAME( 19??, tst_galx, galaxian, galaxian, galaxian, galaxian, ROT90, "<unknown>", "Galaxian Test ROM", GAME_SUPPORTS_SAVE ) |
| 6377 | 6377 | |
| 6378 | 6378 | /* other games on basic galaxian hardware */ |
| 6379 | GAME( 1981, blkhole, 0, galaxian, blkhole, galaxian, ROT90, "TDS", "Black Hole", GAME_SUPPORTS_SAVE ) | |
| 6379 | GAME( 1981, blkhole, 0, galaxian, blkhole, galaxian, ROT90, "TDS & MINTS", "Black Hole", GAME_SUPPORTS_SAVE ) | |
| 6380 | 6380 | GAME( 1982, orbitron, 0, galaxian, orbitron, galaxian, ROT270, "Signatron USA", "Orbitron", GAME_SUPPORTS_SAVE ) |
| 6381 | 6381 | GAME( 1980, luctoday, 0, galaxian, luctoday, galaxian, ROT270, "Sigma", "Lucky Today",GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE ) |
| 6382 | 6382 | GAME( 19??, chewing, luctoday, galaxian, luctoday, galaxian, ROT90, "<unknown>", "Chewing Gum", GAME_SUPPORTS_SAVE ) |
| r15218 | r15219 | |
|---|---|---|
| 714 | 714 | WRITE8_MEMBER(missile_state::missile_w) |
| 715 | 715 | { |
| 716 | 716 | UINT8 *videoram = m_videoram; |
| 717 | ||
| 717 | 718 | /* if we're in MADSEL mode, write to video RAM */ |
| 718 | 719 | if (get_madsel(&space)) |
| 719 | 720 | { |
| r15218 | r15219 | |
| 730 | 731 | |
| 731 | 732 | /* POKEY */ |
| 732 | 733 | else if (offset < 0x4800) |
| 733 | pokey_w(machine().device("pokey"), offset & 0x0f, data); | |
| 734 | { | |
| 735 | pokeyn_device *pokey_dev = downcast<pokeyn_device *>(machine().device("pokey")); | |
| 736 | pokey_dev->write(*machine().firstcpu->space(), offset, data, 0xff); | |
| 737 | } | |
| 734 | 738 | |
| 735 | 739 | /* OUT0 */ |
| 736 | 740 | else if (offset < 0x4900) |
| r15218 | r15219 | |
| 790 | 794 | |
| 791 | 795 | /* POKEY */ |
| 792 | 796 | else if (offset < 0x4800) |
| 793 | result = pokey_r(machine().device("pokey"), offset & 0x0f); | |
| 797 | { | |
| 798 | pokeyn_device *pokey_dev = downcast<pokeyn_device *>(machine().device("pokey")); | |
| 799 | result = pokey_dev->read(*machine().firstcpu->space(), offset & 0x0f, 0xff); | |
| 800 | } | |
| 794 | 801 | |
| 795 | 802 | /* IN0 */ |
| 796 | 803 | else if (offset < 0x4900) |
| r15218 | r15219 | |
| 1046 | 1053 | /* sound hardware */ |
| 1047 | 1054 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 1048 | 1055 | |
| 1049 | MCFG_SOUND_ADD("pokey", POKEY, MASTER_CLOCK/8) | |
| 1056 | MCFG_SOUND_ADD("pokey", POKEYN, MASTER_CLOCK/8) | |
| 1050 | 1057 | MCFG_SOUND_CONFIG(pokey_config) |
| 1051 | 1058 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 1052 | 1059 | MACHINE_CONFIG_END |
| r15218 | r15219 | |
|---|---|---|
| 96 | 96 | |
| 97 | 97 | READ8_MEMBER(crgolf_state::analog_input_r) |
| 98 | 98 | { |
| 99 | return ((ioport("STICK1")->read() & 0xf0)) ^ 0x88; | |
| 99 | return ((ioport("STICK0")->read() >> 4) | (ioport("STICK1")->read() & 0xf0)) ^ 0x88; | |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 |
| r15218 | r15219 | |
|---|---|---|
| 136 | 136 | |
| 137 | 137 | READ32_MEMBER(feversoc_state::in0_r) |
| 138 | 138 | { |
| 139 | ||
| 139 | UINT32 io0 = (ioport("IN1")->read()&0xffff) << 16; | |
| 140 | UINT32 io1 = (ioport("IN0")->read()&0xffff) << 0; | |
| 140 | 141 | m_x^=0x40; //vblank? eeprom read bit? |
| 141 | return | |
| 142 | return | |
| 142 | 143 | } |
| 143 | 144 | |
| 144 | 145 | WRITE32_MEMBER(feversoc_state::output_w) |
| r15218 | r15219 | |
| 205 | 206 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) //hopper i/o |
| 206 | 207 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 207 | 208 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 208 | // PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) //vblank/eeprom read bit? | |
| 209 | // PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) | |
| 210 | // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) | |
| 209 | PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // maybe eeprom in / vblank | |
| 211 | 210 | PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) //PORT_NAME("Slottle") PORT_CODE(KEYCODE_Z) |
| 212 | 211 | PORT_DIPNAME( 0x0100, 0x0100, "DIP 1-1" ) |
| 213 | 212 | PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) |
| r15218 | r15219 | |
|---|---|---|
| 339 | 339 | if (mcr_cocktail_flip) |
| 340 | 340 | return ioport("ssio:IP0")->read() | 0x08; |
| 341 | 341 | else |
| 342 | return ((ioport("ssio:IP2")->read() & 0x01) << 4); | |
| 342 | return ((ioport("ssio:IP0")->read() & ~0x14) | 0x08) | ((ioport("ssio:IP0")->read() & 0x08) >> 1) | ((ioport("ssio:IP2")->read() & 0x01) << 4); | |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 |
| r15218 | r15219 | |
|---|---|---|
| 309 | 309 | AM_RANGE(0x1800, 0x1800) AM_DEVREAD_LEGACY("mathbox", mathbox_status_r) |
| 310 | 310 | AM_RANGE(0x1810, 0x1810) AM_DEVREAD_LEGACY("mathbox", mathbox_lo_r) |
| 311 | 311 | AM_RANGE(0x1818, 0x1818) AM_DEVREAD_LEGACY("mathbox", mathbox_hi_r) |
| 312 | AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) | |
| 312 | // AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) | |
| 313 | AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) | |
| 313 | 314 | AM_RANGE(0x1840, 0x1840) AM_DEVWRITE_LEGACY("discrete", bzone_sounds_w) |
| 314 | 315 | AM_RANGE(0x1860, 0x187f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w) |
| 315 | 316 | AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) |
| r15218 | r15219 | |
| 333 | 334 | AM_RANGE(0x1808, 0x1808) AM_DEVWRITE_LEGACY("custom", redbaron_joysound_w) /* and select joystick pot also */ |
| 334 | 335 | AM_RANGE(0x180a, 0x180a) AM_WRITENOP /* sound reset, yet todo */ |
| 335 | 336 | AM_RANGE(0x180c, 0x180c) AM_DEVWRITE("earom", atari_vg_earom_device, ctrl_w) |
| 336 | AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) | |
| 337 | //AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE_LEGACY("pokey", pokey_r, pokey_w) | |
| 338 | AM_RANGE(0x1820, 0x182f) AM_DEVREADWRITE("pokey", pokeyn_device, read, write) | |
| 337 | 339 | AM_RANGE(0x1820, 0x185f) AM_DEVREADWRITE("earom", atari_vg_earom_device, read, write) |
| 338 | 340 | AM_RANGE(0x1860, 0x187f) AM_DEVWRITE_LEGACY("mathbox", mathbox_go_w) |
| 339 | 341 | AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE_LEGACY(&avgdvg_vectorram) AM_SIZE_LEGACY(&avgdvg_vectorram_size) AM_REGION("maincpu", 0x2000) |
| r15218 | r15219 | |
| 600 | 602 | /* sound hardware */ |
| 601 | 603 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 602 | 604 | |
| 603 | MCFG_SOUND_ADD("pokey", POKEY, 1500000) | |
| 605 | MCFG_SOUND_ADD("pokey", POKEYN, 1500000) | |
| 604 | 606 | MCFG_SOUND_CONFIG(redbaron_pokey_interface) |
| 605 | 607 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 606 | 608 |
| r15218 | r15219 | |
|---|---|---|
| 732 | 732 | else |
| 733 | 733 | { |
| 734 | 734 | /* Steering Wheel inputs */ |
| 735 | return (ioport("IN4")->read() & 3); | |
| 735 | return (ioport("IN0")->read() & ~3) | (ioport("IN4")->read() & 3); | |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
| r15218 | r15219 | |
| 747 | 747 | else |
| 748 | 748 | { |
| 749 | 749 | /* Steering Wheel inputs */ |
| 750 | return (ioport("IN5")->read() & 3); | |
| 750 | return (ioport("IN1")->read() & ~3) | (ioport("IN5")->read() & 3); | |
| 751 | 751 | } |
| 752 | 752 | } |
| 753 | 753 |
| r15218 | r15219 | |
|---|---|---|
| 1104 | 1104 | { |
| 1105 | 1105 | const char *tag1 = (const char *)param; |
| 1106 | 1106 | const char *tag2 = tag1 + strlen(tag1) + 1; |
| 1107 | return ioport(tag2)->read(); | |
| 1107 | return ioport(tag1)->read() & ioport(tag2)->read(); | |
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | static INPUT_PORTS_START( gtg ) |
| r15218 | r15219 | |
|---|---|---|
| 1156 | 1156 | READ16_MEMBER(blitz68k_state::hermit_track_r) |
| 1157 | 1157 | { |
| 1158 | 1158 | #ifdef MAME_DEBUG |
| 1159 | // popmessage("track %02x %02x", ioport("TRACK_Y")->read()); | |
| 1159 | // popmessage("track %02x %02x", ioport("TRACK_X")->read(), ioport("TRACK_Y")->read()); | |
| 1160 | 1160 | #endif |
| 1161 | 1161 | |
| 1162 | 1162 | return |
| r15218 | r15219 | |
|---|---|---|
| 173 | 173 | /* two physical buttons (start game and stop runner) share the same port bit */ |
| 174 | 174 | READ8_MEMBER(flyball_state::flyball_input_r) |
| 175 | 175 | { |
| 176 | return ioport("IN1")->read(); | |
| 176 | return ioport("IN0")->read() & ioport("IN1")->read(); | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | READ8_MEMBER(flyball_state::flyball_scanline_r) |
| r15218 | r15219 | |
|---|---|---|
| 3453 | 3453 | GAME( 1979, invadpt2br,invadpt2,invadpt2, invadpt2, 0, ROT270, "Taito do Brasil", "Space Invaders Part II (Brazil)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) |
| 3454 | 3454 | GAME( 1980, invaddlx, invadpt2, invaders, invadpt2, 0, ROT270, "Taito (Midway license)", "Space Invaders Deluxe", GAME_SUPPORTS_SAVE ) |
| 3455 | 3455 | GAME( 1980, vortex, 0, vortex, vortex, vortex, ROT270, "Zilec Electronics", "Vortex", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) /* Encrypted 8080/IO */ |
| 3456 | GAME( 1979, cosmo, 0, cosmo, cosmo, 0, ROT90, "TDS & M | |
| 3456 | GAME( 1979, cosmo, 0, cosmo, cosmo, 0, ROT90, "TDS & MINTS", "Cosmo", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND ) | |
| 3457 | 3457 | GAME( 1979, schaser, 0, schaser, schaser, 0, ROT270, "Taito", "Space Chaser", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_COLORS ) |
| 3458 | 3458 | GAME( 1979, schasercv,schaser, schasercv,schasercv,0, ROT270, "Taito", "Space Chaser (CV version)", GAME_SUPPORTS_SAVE | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_COLORS ) |
| 3459 | 3459 | GAME( 1979, sflush, 0, sflush, sflush, 0, ROT270, "Taito", "Straight Flush",GAME_SUPPORTS_SAVE | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NO_COCKTAIL) |
| r15218 | r15219 | |
|---|---|---|
| 108 | 108 | N *GUITARFREAKS 11thMIX 2004.04 |
| 109 | 109 | G *Gun Mania 2000.07 G?906 JA (no CD) |
| 110 | 110 | ? *Gun Mania Zone Plus 2000.10 |
| 111 | P Handle Champ 1997.12 GQ710 JA (no CD) | |
| 111 | 112 | P Hyper Bishi Bashi Champ 1998.07 GC876 EA (no CD) |
| 112 | 113 | P Hyper Bishi Bashi Champ - 2 Player 1999.08 GC908 JA 908 A02 |
| 113 | 114 | P Jikkyou Powerful Pro Yakyuu EX 1998.04 GX802 JA 802 JA B02 |
| r15218 | r15219 | |
| 3612 | 3613 | PORT_BIT( 0x00000080, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(4) PORT_CODE(KEYCODE_I) |
| 3613 | 3614 | INPUT_PORTS_END |
| 3614 | 3615 | |
| 3616 | static INPUT_PORTS_START( hndlchmp ) | |
| 3617 | PORT_INCLUDE( konami573 ) | |
| 3618 | ||
| 3619 | PORT_START( "analog0" ) | |
| 3620 | PORT_BIT( 0xff, 0xc0, IPT_PEDAL ) PORT_MINMAX( 0xc0, 0xf0 ) PORT_SENSITIVITY( 100 ) PORT_KEYDELTA( 20 ) PORT_PLAYER( 2 ) | |
| 3621 | ||
| 3622 | PORT_START( "analog1" ) | |
| 3623 | PORT_BIT( 0xff, 0xc0, IPT_PEDAL ) PORT_MINMAX( 0xc0, 0xf0 ) PORT_SENSITIVITY( 100 ) PORT_KEYDELTA( 20 ) PORT_PLAYER( 1 ) | |
| 3624 | ||
| 3625 | PORT_START( "analog2" ) | |
| 3626 | PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX( 0x48, 0xb7 ) PORT_SENSITIVITY( 25 ) PORT_KEYDELTA( 30 ) PORT_PLAYER( 2 ) | |
| 3627 | ||
| 3628 | PORT_START( "analog3" ) | |
| 3629 | PORT_BIT( 0xff, 0x7f, IPT_PADDLE ) PORT_MINMAX( 0x48, 0xb7 ) PORT_SENSITIVITY( 25 ) PORT_KEYDELTA( 30 ) PORT_PLAYER( 1 ) | |
| 3630 | INPUT_PORTS_END | |
| 3631 | ||
| 3615 | 3632 | static INPUT_PORTS_START( hyperbbc ) |
| 3616 | 3633 | PORT_INCLUDE( konami573 ) |
| 3617 | 3634 | |
| r15218 | r15219 | |
| 3699 | 3716 | |
| 3700 | 3717 | #define SYS573_BIOS_A \ |
| 3701 | 3718 | ROM_REGION32_LE( 0x080000, "bios", 0 ) \ |
| 3702 | ROM_LOAD( "700a01.22g", 0x0000000, 0x080000, CRC(11812ef8) SHA1(e1284add4aaddd5337bd7f4e27614460d52b5b48)) | |
| 3719 | ROM_SYSTEM_BIOS( 0, "std", "Standard" ) \ | |
| 3720 | ROMX_LOAD( "700a01.22g", 0x0000000, 0x080000, CRC(11812ef8) SHA1(e1284add4aaddd5337bd7f4e27614460d52b5b48), ROM_BIOS(1) ) \ | |
| 3721 | ROM_SYSTEM_BIOS( 1, "gchgchmp", "Found on Gachagachamp" ) \ | |
| 3722 | ROMX_LOAD( "700_a01.22g", 0x000000, 0x080000, CRC(39ebb0ca) SHA1(9aab8c637dd2be84d79007e52f108abe92bf29dd), ROM_BIOS(2) ) \ | |
| 3723 | ROM_SYSTEM_BIOS( 2, "dsem2", "Found on Dancing Stage Euro Mix 2" ) \ | |
| 3724 | ROMX_LOAD( "700b01.22g", 0x0000000, 0x080000, CRC(6cf852af) NO_DUMP, ROM_BIOS(3) ) | |
| 3703 | 3725 | |
| 3704 | 3726 | #define SYS573_DIGITAL_ID \ |
| 3705 | 3727 | ROM_REGION( 0x000008, "digital_id", 0 ) /* digital board id */ \ |
| r15218 | r15219 | |
| 4817 | 4839 | DISK_IMAGE_READONLY( "918xxb02", 0, BAD_DUMP SHA1(8ced8952fff3e70ce0621a491f0973af5a6ccd82) ) |
| 4818 | 4840 | ROM_END |
| 4819 | 4841 | |
| 4842 | ROM_START( hndlchmp ) | |
| 4843 | SYS573_BIOS_A | |
| 4844 | ||
| 4845 | ROM_REGION( 0x200000, "onboard.0", 0 ) /* onboard flash */ | |
| 4846 | ROM_LOAD( "710ja.31m", 0x000000, 0x200000, CRC(f5f71b1d) SHA1(7d518e5333f44e6ec921a1e882df970953814b6e) ) | |
| 4847 | ROM_REGION( 0x200000, "onboard.1", 0 ) /* onboard flash */ | |
| 4848 | ROM_LOAD( "710ja.27m", 0x000000, 0x200000, CRC(b3d8c037) SHA1(678b88c37111d1fde8996c7d71b66ec1c4f161fe) ) | |
| 4849 | ROM_REGION( 0x200000, "onboard.2", 0 ) /* onboard flash */ | |
| 4850 | ROM_LOAD( "710ja.31l", 0x000000, 0x200000, CRC(78e8556c) SHA1(9f6bb651ddeb042ebf1ba057d4932494149f47d6) ) | |
| 4851 | ROM_REGION( 0x200000, "onboard.3", 0 ) /* onboard flash */ | |
| 4852 | ROM_LOAD( "710ja.27l", 0x000000, 0x200000, CRC(f6a87155) SHA1(269bfdf05ee4ab2e4b87b6e92045e56d0557a576) ) | |
| 4853 | ROM_REGION( 0x200000, "onboard.4", 0 ) /* onboard flash */ | |
| 4854 | ROM_LOAD( "710ja.31j", 0x000000, 0x200000, CRC(bdc05d16) SHA1(ee397950f7e7e910fdc05737f99604e43d288719) ) | |
| 4855 | ROM_REGION( 0x200000, "onboard.5", 0 ) /* onboard flash */ | |
| 4856 | ROM_LOAD( "710ja.27j", 0x000000, 0x200000, CRC(ad925ed3) SHA1(e3222308961851cccee2de9da804f74854907451) ) | |
| 4857 | ROM_REGION( 0x200000, "onboard.6", 0 ) /* onboard flash */ | |
| 4858 | ROM_LOAD( "710ja.31h", 0x000000, 0x200000, CRC(a0293108) SHA1(2e5651a4c1b8e021cc3060db138c9fe7c28caa3b) ) | |
| 4859 | ROM_REGION( 0x200000, "onboard.7", 0 ) /* onboard flash */ | |
| 4860 | ROM_LOAD( "710ja.27h", 0x000000, 0x200000, CRC(aed26efe) SHA1(20b6fccd0bc5495d8258b976f72d330d6315c6f6) ) | |
| 4861 | ||
| 4862 | ROM_REGION( 0x002000, "m48t58", 0 ) /* timekeeper */ | |
| 4863 | ROM_LOAD( "710ja.22h", 0x000000, 0x002000, CRC(b784de91) SHA1(048157e9ad6df46656dbac6349b0c821254e1c37) ) | |
| 4864 | ROM_END | |
| 4865 | ||
| 4820 | 4866 | ROM_START( gtrfrks ) |
| 4821 | 4867 | SYS573_BIOS_A |
| 4822 | 4868 | |
| r15218 | r15219 | |
| 5409 | 5455 | DISK_IMAGE_READONLY( "gca18jaa", 0, SHA1(8adcc8ef76cbfb9f47fec5702b0b200565b5c561) ) |
| 5410 | 5456 | ROM_END |
| 5411 | 5457 | |
| 5412 | // System 573 BIOS (we're missing the later version that boots up with a pseudo-GUI) | |
| 5413 | GAME( 1998, sys573, 0, konami573, konami573, konami573, ROT0, "Konami", "System 573 BIOS", GAME_IS_BIOS_ROOT ) | |
| 5458 | GAME( 1997, sys573, 0, konami573, konami573, konami573, ROT0, "Konami", "System 573 BIOS", GAME_IS_BIOS_ROOT ) | |
| 5414 | 5459 | |
| 5460 | GAME( 1997, hndlchmp, sys573, konami573, hndlchmp, konami573, ROT0, "Konami", "Handle Champ (GQ710 VER. JAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) | |
| 5415 | 5461 | GAME( 1998, darkhleg, sys573, konami573x, konami573, konami573, ROT0, "Konami", "Dark Horse Legend (GX706 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 5416 | 5462 | GAME( 1998, fbaitbc, sys573, k573baitx, fbaitbc, ge765pwbba, ROT0, "Konami", "Fisherman's Bait - A Bass Challenge (GE765 VER. UAB)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 5417 | 5463 | GAME( 1998, bassangl, fbaitbc, k573baitx, fbaitbc, ge765pwbba, ROT0, "Konami", "Bass Angler (GE765 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| r15218 | r15219 | |
|---|---|---|
| 466 | 466 | MCFG_SOUND_ROUTE(0, "lspeaker", 0.20) |
| 467 | 467 | MCFG_SOUND_ROUTE(1, "rspeaker", 0.20) |
| 468 | 468 | |
| 469 | MCFG_ | |
| 469 | MCFG_K054539_ADD("k054539", 48000, k054539_config) | |
| 470 | 470 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.00) |
| 471 | 471 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.00) |
| 472 | 472 | MACHINE_CONFIG_END |
| r15218 | r15219 | |
|---|---|---|
| 31 | 31 | |
| 32 | 32 | ------------------------------------------------------------- |
| 33 | 33 | |
| 34 | Hamburger doesn't work; no protection details were supplied. | |
| 35 | ||
| 36 | 34 | Here is the protection data for DS Telejan and Pro Golf (set 2). |
| 37 | 35 | This information maps onto the various handlers in machine/decocass.c but it's |
| 38 | 36 | not at all clear how to create a new one that fits these specs. |
| r15218 | r15219 | |
| 1069 | 1067 | ROM_LOAD( "cprogolf.cas", 0x0000, 0x8000, CRC(02123cd1) SHA1(e4c630ed293725f23d539cb43beb97953558dabd) ) |
| 1070 | 1068 | ROM_END |
| 1071 | 1069 | |
| 1072 | ROM_START( cprogolfj ) | |
| 1070 | ROM_START( cprogolfj ) // version 1-A | |
| 1073 | 1071 | DECOCASS_BIOS_A_ROMS |
| 1074 | 1072 | |
| 1075 | 1073 | ROM_REGION( 0x00020, "dongle", 0 ) /* dongle data */ |
| r15218 | r15219 | |
| 1080 | 1078 | ROM_END |
| 1081 | 1079 | |
| 1082 | 1080 | /* 14 */ |
| 1083 | ROM_START( cdsteljn ) | |
| 1081 | ROM_START( cdsteljn ) // version 4-A-3 | |
| 1084 | 1082 | DECOCASS_BIOS_A_ROMS |
| 1085 | 1083 | |
| 1086 | 1084 | ROM_REGION( 0x00020, "dongle", 0 ) /* dongle data */ |
| r15218 | r15219 | |
| 1237 | 1235 | ROM_LOAD( "cbtime.cas", 0x0000, 0x8000, CRC(56d7dc58) SHA1(34b2513c9ca7ab40f532b6d6d911aa3012113632) ) |
| 1238 | 1236 | ROM_END |
| 1239 | 1237 | |
| 1240 | ROM_START( chamburger ) | |
| 1238 | ROM_START( chamburger ) // version 0-A-0 | |
| 1241 | 1239 | DECOCASS_BIOS_A_ROMS |
| 1242 | 1240 | |
| 1243 | 1241 | ROM_REGION( 0x01000, "dongle", 0 ) /* dongle data */ |
| r15218 | r15219 | |
|---|---|---|
| 89 | 89 | switch (offset) |
| 90 | 90 | { |
| 91 | 91 | case 0: |
| 92 | return (ioport("A2D1")->read() << 8); | |
| 92 | return (ioport("A2D0")->read() << 24) | (ioport("A2D1")->read() << 8); | |
| 93 | 93 | case 1: |
| 94 | return (ioport("A2D3")->read() << 8); | |
| 94 | return (ioport("A2D2")->read() << 24) | (ioport("A2D3")->read() << 8); | |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return 0; |
| r15218 | r15219 | |
|---|---|---|
| 155 | 155 | compute_fake_pots(pots); |
| 156 | 156 | return (pots[0] << 24) | (pots[3] << 8); |
| 157 | 157 | #else |
| 158 | return (ioport("AN2")->read() << 8); | |
| 158 | return (ioport("AN1")->read() << 24) | (ioport("AN2")->read() << 8); | |
| 159 | 159 | #endif |
| 160 | 160 | } |
| 161 | 161 | |
| r15218 | r15219 | |
| 167 | 167 | compute_fake_pots(pots); |
| 168 | 168 | return (pots[2] << 24) | (pots[1] << 8); |
| 169 | 169 | #else |
| 170 | return (ioport("AN4")->read() << 8); | |
| 170 | return (ioport("AN3")->read() << 24) | (ioport("AN4")->read() << 8); | |
| 171 | 171 | #endif |
| 172 | 172 | } |
| 173 | 173 |
| r15218 | r15219 | |
|---|---|---|
| 1334 | 1334 | |
| 1335 | 1335 | for( ;; ) |
| 1336 | 1336 | { |
| 1337 | if( n_y >= 1024 ) | |
| 1338 | { | |
| 1339 | return; | |
| 1340 | } | |
| 1341 | ||
| 1337 | 1342 | if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) ) |
| 1338 | 1343 | { |
| 1339 | 1344 | while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) ) |
| r15218 | r15219 | |
| 1515 | 1520 | |
| 1516 | 1521 | for( ;; ) |
| 1517 | 1522 | { |
| 1523 | if( n_y >= 1024 ) | |
| 1524 | { | |
| 1525 | return; | |
| 1526 | } | |
| 1527 | ||
| 1518 | 1528 | if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) ) |
| 1519 | 1529 | { |
| 1520 | 1530 | while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) ) |
| r15218 | r15219 | |
| 1698 | 1708 | |
| 1699 | 1709 | for( ;; ) |
| 1700 | 1710 | { |
| 1711 | if( n_y >= 1024 ) | |
| 1712 | { | |
| 1713 | return; | |
| 1714 | } | |
| 1715 | ||
| 1701 | 1716 | if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) ) |
| 1702 | 1717 | { |
| 1703 | 1718 | while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) ) |
| r15218 | r15219 | |
| 1924 | 1939 | |
| 1925 | 1940 | for( ;; ) |
| 1926 | 1941 | { |
| 1942 | if( n_y >= 1024 ) | |
| 1943 | { | |
| 1944 | return; | |
| 1945 | } | |
| 1946 | ||
| 1927 | 1947 | if( n_y == COORD_DY( vertex[ n_leftpoint ].n_coord ) ) |
| 1928 | 1948 | { |
| 1929 | 1949 | while( n_y == COORD_DY( vertex[ p_n_leftpointlist[ n_leftpoint ] ].n_coord ) ) |
| r15218 | r15219 | |
|---|---|---|
| 1 | 1 | /***************************************************************************** |
| 2 | 2 | * |
| 3 | * POKEY chip emulator 4. | |
| 3 | * POKEY chip emulator 4.6 | |
| 4 | 4 | * Copyright Nicola Salmoria and the MAME Team |
| 5 | 5 | * |
| 6 | 6 | * Based on original info found in Ron Fries' Pokey emulator, |
| r15218 | r15219 | |
| 12 | 12 | * things means it is distributed as is, no warranties whatsoever. |
| 13 | 13 | * For more details read mame.txt that comes with MAME. |
| 14 | 14 | * |
| 15 | * 4.6: | |
| 16 | * - changed audio emulation to emulate borrow 3 clock delay and | |
| 17 | * proper channel reset. New frequency only becomes effective | |
| 18 | * after the counter hits 0. Emulation also treats counters | |
| 19 | * as 8 bit counters which are linked now instead of monolytic | |
| 20 | * 16 bit counters. | |
| 21 | * | |
| 15 | 22 | * 4.51: |
| 16 | 23 | * - changed to use the attotime datatype |
| 17 | 24 | * 4.5: |
| r15218 | r15219 | |
| 78 | 85 | */ |
| 79 | 86 | #define POKEY_DEFAULT_GAIN (32767/11/4) |
| 80 | 87 | |
| 81 | #define VERBOSE | |
| 88 | #define VERBOSE 1 | |
| 82 | 89 | #define VERBOSE_SOUND 0 |
| 83 | 90 | #define VERBOSE_TIMER 0 |
| 84 | 91 | #define VERBOSE_POLY 0 |
| 85 | #define VERBOSE_RAND | |
| 92 | #define VERBOSE_RAND 1 | |
| 86 | 93 | |
| 87 | 94 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 88 | 95 | |
| r15218 | r15219 | |
| 157 | 164 | typedef struct _pokey_state pokey_state; |
| 158 | 165 | struct _pokey_state |
| 159 | 166 | { |
| 167 | INT32 clock_cnt[3]; /* clock counters */ | |
| 168 | INT32 borrow_cnt[4]; /* borrow counters */ | |
| 169 | ||
| 160 | 170 | INT32 counter[4]; /* channel counter */ |
| 161 | 171 | INT32 divisor[4]; /* channel divisor (modulo value) */ |
| 162 | 172 | UINT32 volume[4]; /* channel volume - derived */ |
| 163 | 173 | UINT8 output[4]; /* channel output signal (1 active, 0 inactive) */ |
| 164 | UINT8 audible[4]; /* channel plays an audible tone/effect */ | |
| 165 | UINT32 samplerate_24_8; /* sample rate in 24.8 format */ | |
| 166 | UINT32 samplepos_fract; /* sample position fractional part */ | |
| 167 | UINT32 samplepos_whole; /* sample position whole part */ | |
| 168 | UINT32 polyadjust; /* polynome adjustment */ | |
| 174 | UINT8 filter_sample[4]; /* hi-pass filter sample */ | |
| 169 | 175 | UINT32 p4; /* poly4 index */ |
| 170 | 176 | UINT32 p5; /* poly5 index */ |
| 171 | 177 | UINT32 p9; /* poly9 index */ |
| r15218 | r15219 | |
| 174 | 180 | UINT32 r17; /* rand17 index */ |
| 175 | 181 | UINT32 clockmult; /* clock multiplier */ |
| 176 | 182 | device_t *device; |
| 177 | sound_stream * | |
| 183 | sound_stream * m_stream; /* streams channel */ | |
| 178 | 184 | emu_timer *timer[3]; /* timers for channel 1,2 and 4 events */ |
| 179 | 185 | attotime timer_period[3]; /* computed periods for these timers */ |
| 180 | 186 | int timer_param[3]; /* computed parameters for these timers */ |
| r15218 | r15219 | |
| 221 | 227 | static TIMER_CALLBACK( pokey_timer_expire ); |
| 222 | 228 | static TIMER_CALLBACK( pokey_pot_trigger ); |
| 223 | 229 | |
| 230 | #define CLK_1 0 | |
| 231 | #define CLK_28 1 | |
| 232 | #define CLK_114 2 | |
| 224 | 233 | |
| 225 | ||
| 234 | static const int clock_divisors[3] = {1, 28, 114}; | |
| 226 | 235 | |
| 227 | #define ADJUST_EVENT(chip) \ | |
| 228 | chip->counter[CHAN1] -= event; \ | |
| 229 | chip->counter[CHAN2] -= event; \ | |
| 230 | chip->counter[CHAN3] -= event; \ | |
| 231 | chip->counter[CHAN4] -= event; \ | |
| 232 | chip->samplepos_whole -= event; \ | |
| 233 | chip->polyadjust += event | |
| 236 | INLINE pokey_state *get_safe_token(device_t *device) | |
| 237 | { | |
| 238 | assert(device != NULL); | |
| 239 | assert(device->type() == POKEY); | |
| 240 | return (pokey_state *)downcast<legacy_device_base *>(device)->token(); | |
| 241 | } | |
| 234 | 242 | |
| 235 | #if SUPPRESS_INAUDIBLE | |
| 243 | INLINE void reset_channel(pokey_state *chip, int ch) | |
| 244 | { | |
| 245 | chip->counter[ch] = chip->AUDF[ch] ^ 0xff; | |
| 246 | } | |
| 236 | 247 | |
| 237 | #define PROCESS_CHANNEL(chip,ch) \ | |
| 238 | int toggle = 0; \ | |
| 239 | ADJUST_EVENT(chip); \ | |
| 240 | /* reset the channel counter */ \ | |
| 241 | if( chip->audible[ch] ) \ | |
| 242 | chip->counter[ch] = chip->divisor[ch]; \ | |
| 243 | else \ | |
| 244 | chip->counter[ch] = 0x7fffffff; \ | |
| 245 | chip->p4 = (chip->p4+chip->polyadjust)%0x0000f; \ | |
| 246 | chip->p5 = (chip->p5+chip->polyadjust)%0x0001f; \ | |
| 247 | chip->p9 = (chip->p9+chip->polyadjust)%0x001ff; \ | |
| 248 | chip->p17 = (chip->p17+chip->polyadjust)%0x1ffff; \ | |
| 249 | chip->polyadjust = 0; \ | |
| 250 | if( (chip->AUDC[ch] & NOTPOLY5) || P5(chip) ) \ | |
| 251 | { \ | |
| 252 | if( chip->AUDC[ch] & PURE ) \ | |
| 253 | toggle = 1; \ | |
| 254 | else \ | |
| 255 | if( chip->AUDC[ch] & POLY4 ) \ | |
| 256 | toggle = chip->output[ch] == !P4(chip); \ | |
| 257 | else \ | |
| 258 | if( chip->AUDCTL & POLY9 ) \ | |
| 259 | toggle = chip->output[ch] == !P9(chip); \ | |
| 260 | else \ | |
| 261 | toggle = chip->output[ch] == !P17(chip); \ | |
| 262 | } \ | |
| 263 | if( toggle ) \ | |
| 264 | { \ | |
| 265 | if( chip->audible[ch] ) \ | |
| 266 | { \ | |
| 267 | if( chip->output[ch] ) \ | |
| 268 | sum -= chip->volume[ch]; \ | |
| 269 | else \ | |
| 270 | sum += chip->volume[ch]; \ | |
| 271 | } \ | |
| 272 | chip->output[ch] ^= 1; \ | |
| 273 | } \ | |
| 274 | /* is this a filtering channel (3/4) and is the filter active? */ \ | |
| 275 | if( chip->AUDCTL & ((CH1_FILTER|CH2_FILTER) & (0x10 >> ch)) ) \ | |
| 276 | { \ | |
| 277 | if( ch >= 2 && chip->output[ch-2] ) \ | |
| 278 | { \ | |
| 279 | chip->output[ch-2] = 0; \ | |
| 280 | if( chip->audible[ch] ) \ | |
| 281 | sum -= chip->volume[ch-2]; \ | |
| 282 | } \ | |
| 283 | } \ | |
| 284 | 248 | |
| 285 | #else | |
| 249 | INLINE void process_channel(pokey_state *chip, int ch) | |
| 250 | { | |
| 251 | int toggle = 0; | |
| 286 | 252 | |
| 287 | #define PROCESS_CHANNEL(chip,ch) \ | |
| 288 | int toggle = 0; \ | |
| 289 | ADJUST_EVENT(chip); \ | |
| 290 | /* reset the channel counter */ \ | |
| 291 | chip->counter[ch] = p[chip].divisor[ch]; \ | |
| 292 | chip->p4 = (chip->p4+chip->polyadjust)%0x0000f; \ | |
| 293 | chip->p5 = (chip->p5+chip->polyadjust)%0x0001f; \ | |
| 294 | chip->p9 = (chip->p9+chip->polyadjust)%0x001ff; \ | |
| 295 | chip->p17 = (chip->p17+chip->polyadjust)%0x1ffff; \ | |
| 296 | chip->polyadjust = 0; \ | |
| 297 | if( (chip->AUDC[ch] & NOTPOLY5) || P5(chip) ) \ | |
| 298 | { \ | |
| 299 | if( chip->AUDC[ch] & PURE ) \ | |
| 300 | toggle = 1; \ | |
| 301 | else \ | |
| 302 | if( chip->AUDC[ch] & POLY4 ) \ | |
| 303 | toggle = chip->output[ch] == !P4(chip); \ | |
| 304 | else \ | |
| 305 | if( chip->AUDCTL & POLY9 ) \ | |
| 306 | toggle = chip->output[ch] == !P9(chip); \ | |
| 307 | else \ | |
| 308 | toggle = chip->output[ch] == !P17(chip); \ | |
| 309 | } \ | |
| 310 | if( toggle ) \ | |
| 311 | { \ | |
| 312 | if( chip->output[ch] ) \ | |
| 313 | sum -= chip->volume[ch]; \ | |
| 314 | else \ | |
| 315 | sum += chip->volume[ch]; \ | |
| 316 | chip->output[ch] ^= 1; \ | |
| 317 | } \ | |
| 318 | /* is this a filtering channel (3/4) and is the filter active? */ \ | |
| 319 | if( chip->AUDCTL & ((CH1_FILTER|CH2_FILTER) & (0x10 >> ch)) ) \ | |
| 320 | { \ | |
| 321 | if( ch >= 2 && chip->output[ch-2] ) \ | |
| 322 | { \ | |
| 323 | chip->output[ch-2] = 0; \ | |
| 324 | sum -= chip->volume[ch-2]; \ | |
| 325 | } \ | |
| 326 | } \ | |
| 253 | if( (chip->AUDC[ch] & NOTPOLY5) || P5(chip) ) | |
| 254 | { | |
| 255 | if( chip->AUDC[ch] & PURE ) | |
| 256 | toggle = 1; | |
| 257 | else | |
| 258 | if( chip->AUDC[ch] & POLY4 ) | |
| 259 | toggle = chip->output[ch] == !P4(chip); | |
| 260 | else | |
| 261 | if( chip->AUDCTL & POLY9 ) | |
| 262 | toggle = chip->output[ch] == !P9(chip); | |
| 263 | else | |
| 264 | toggle = chip->output[ch] == !P17(chip); | |
| 265 | } | |
| 266 | if( toggle ) | |
| 267 | { | |
| 268 | chip->output[ch] ^= 1; | |
| 269 | } | |
| 270 | } | |
| 327 | 271 | |
| 328 | #endif | |
| 272 | /* | |
| 273 | * http://www.atariage.com/forums/topic/3328-sio-protocol/page__st__100#entry1680190: | |
| 274 | * I noticed that the Pokey counters have clocked carry (actually, "borrow") positions that delay the | |
| 275 | * counter by 3 cycles, plus the 1 reset clock. So 16 bit mode has 6 carry delays and a reset clock. | |
| 276 | * I'm sure this was done because the propagation delays limited the number of cells the subtraction could ripple though. | |
| 277 | * | |
| 278 | */ | |
| 329 | 279 | |
| 330 | #define PROCESS_SAMPLE(chip) \ | |
| 331 | ADJUST_EVENT(chip); \ | |
| 332 | /* adjust the sample position */ \ | |
| 333 | chip->samplepos_whole++; \ | |
| 334 | /* store sum of output signals into the buffer */ \ | |
| 335 | *buffer++ = (sum > 0x7fff) ? 0x7fff : sum; \ | |
| 336 | samples-- | |
| 280 | INLINE void inc_chan(pokey_state *chip, int ch) | |
| 281 | { | |
| 282 | chip->counter[ch] = (chip->counter[ch] + 1) & 0xff; | |
| 283 | if (chip->counter[ch] == 0 && chip->borrow_cnt[ch] == 0) | |
| 284 | chip->borrow_cnt[ch] = 3; | |
| 285 | } | |
| 337 | 286 | |
| 338 | #if HEAVY_MACRO_USAGE | |
| 287 | INLINE int check_borrow(pokey_state *chip, int ch) | |
| 288 | { | |
| 289 | if (chip->borrow_cnt[ch] > 0) | |
| 290 | { | |
| 291 | chip->borrow_cnt[ch]--; | |
| 292 | return (chip->borrow_cnt[ch] == 0); | |
| 293 | } | |
| 294 | return 0; | |
| 295 | } | |
| 339 | 296 | |
| 340 | /* | |
| 341 | * This version of PROCESS_POKEY repeats the search for the minimum | |
| 342 | * event value without using an index to the channel. That way the | |
| 343 | * PROCESS_CHANNEL macros can be called with fixed values and expand | |
| 344 | * to much more efficient code | |
| 345 | */ | |
| 297 | static STREAM_UPDATE( pokey_update ) | |
| 298 | { | |
| 299 | pokey_state *chip = (pokey_state *)param; | |
| 300 | stream_sample_t *buffer = outputs[0]; | |
| 301 | int base_clock = (chip->AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28; | |
| 346 | 302 | |
| 347 | #define PROCESS_POKEY(chip) \ | |
| 348 | UINT32 sum = 0; \ | |
| 349 | if( chip->output[CHAN1] ) \ | |
| 350 | sum += chip->volume[CHAN1]; \ | |
| 351 | if( chip->output[CHAN2] ) \ | |
| 352 | sum += chip->volume[CHAN2]; \ | |
| 353 | if( chip->output[CHAN3] ) \ | |
| 354 | sum += chip->volume[CHAN3]; \ | |
| 355 | if( chip->output[CHAN4] ) \ | |
| 356 | sum += chip->volume[CHAN4]; \ | |
| 357 | while( samples > 0 ) \ | |
| 358 | { \ | |
| 359 | if( chip->counter[CHAN1] < chip->samplepos_whole ) \ | |
| 360 | { \ | |
| 361 | if( chip->counter[CHAN2] < chip->counter[CHAN1] ) \ | |
| 362 | { \ | |
| 363 | if( chip->counter[CHAN3] < chip->counter[CHAN2] ) \ | |
| 364 | { \ | |
| 365 | if( chip->counter[CHAN4] < chip->counter[CHAN3] ) \ | |
| 366 | { \ | |
| 367 | UINT32 event = chip->counter[CHAN4]; \ | |
| 368 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 369 | } \ | |
| 370 | else \ | |
| 371 | { \ | |
| 372 | UINT32 event = chip->counter[CHAN3]; \ | |
| 373 | PROCESS_CHANNEL(chip,CHAN3); \ | |
| 374 | } \ | |
| 375 | } \ | |
| 376 | else \ | |
| 377 | if( chip->counter[CHAN4] < chip->counter[CHAN2] ) \ | |
| 378 | { \ | |
| 379 | UINT32 event = chip->counter[CHAN4]; \ | |
| 380 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 381 | } \ | |
| 382 | else \ | |
| 383 | { \ | |
| 384 | UINT32 event = chip->counter[CHAN2]; \ | |
| 385 | PROCESS_CHANNEL(chip,CHAN2); \ | |
| 386 | } \ | |
| 387 | } \ | |
| 388 | else \ | |
| 389 | if( chip->counter[CHAN3] < chip->counter[CHAN1] ) \ | |
| 390 | { \ | |
| 391 | if( chip->counter[CHAN4] < chip->counter[CHAN3] ) \ | |
| 392 | { \ | |
| 393 | UINT32 event = chip->counter[CHAN4]; \ | |
| 394 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 395 | } \ | |
| 396 | else \ | |
| 397 | { \ | |
| 398 | UINT32 event = chip->counter[CHAN3]; \ | |
| 399 | PROCESS_CHANNEL(chip,CHAN3); \ | |
| 400 | } \ | |
| 401 | } \ | |
| 402 | else \ | |
| 403 | if( chip->counter[CHAN4] < chip->counter[CHAN1] ) \ | |
| 404 | { \ | |
| 405 | UINT32 event = chip->counter[CHAN4]; \ | |
| 406 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 407 | } \ | |
| 408 | else \ | |
| 409 | { \ | |
| 410 | UINT32 event = chip->counter[CHAN1]; \ | |
| 411 | PROCESS_CHANNEL(chip,CHAN1); \ | |
| 412 | } \ | |
| 413 | } \ | |
| 414 | else \ | |
| 415 | if( chip->counter[CHAN2] < chip->samplepos_whole ) \ | |
| 416 | { \ | |
| 417 | if( chip->counter[CHAN3] < chip->counter[CHAN2] ) \ | |
| 418 | { \ | |
| 419 | if( chip->counter[CHAN4] < chip->counter[CHAN3] ) \ | |
| 420 | { \ | |
| 421 | UINT32 event = chip->counter[CHAN4]; \ | |
| 422 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 423 | } \ | |
| 424 | else \ | |
| 425 | { \ | |
| 426 | UINT32 event = chip->counter[CHAN3]; \ | |
| 427 | PROCESS_CHANNEL(chip,CHAN3); \ | |
| 428 | } \ | |
| 429 | } \ | |
| 430 | else \ | |
| 431 | if( chip->counter[CHAN4] < chip->counter[CHAN2] ) \ | |
| 432 | { \ | |
| 433 | UINT32 event = chip->counter[CHAN4]; \ | |
| 434 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 435 | } \ | |
| 436 | else \ | |
| 437 | { \ | |
| 438 | UINT32 event = chip->counter[CHAN2]; \ | |
| 439 | PROCESS_CHANNEL(chip,CHAN2); \ | |
| 440 | } \ | |
| 441 | } \ | |
| 442 | else \ | |
| 443 | if( chip->counter[CHAN3] < chip->samplepos_whole ) \ | |
| 444 | { \ | |
| 445 | if( chip->counter[CHAN4] < chip->counter[CHAN3] ) \ | |
| 446 | { \ | |
| 447 | UINT32 event = chip->counter[CHAN4]; \ | |
| 448 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 449 | } \ | |
| 450 | else \ | |
| 451 | { \ | |
| 452 | UINT32 event = chip->counter[CHAN3]; \ | |
| 453 | PROCESS_CHANNEL(chip,CHAN3); \ | |
| 454 | } \ | |
| 455 | } \ | |
| 456 | else \ | |
| 457 | if( chip->counter[CHAN4] < chip->samplepos_whole ) \ | |
| 458 | { \ | |
| 459 | UINT32 event = chip->counter[CHAN4]; \ | |
| 460 | PROCESS_CHANNEL(chip,CHAN4); \ | |
| 461 | } \ | |
| 462 | else \ | |
| 463 | { \ | |
| 464 | UINT32 event = chip->samplepos_whole; \ | |
| 465 | PROCESS_SAMPLE(chip); \ | |
| 466 | } \ | |
| 467 | } \ | |
| 468 | chip->rtimer->adjust(attotime::never) | |
| 303 | while( samples > 0 ) | |
| 304 | { | |
| 305 | int ch, clk; | |
| 306 | UINT32 sum = 0; | |
| 307 | int clock_triggered[3] = {0,0,0}; | |
| 469 | 308 | |
| 470 | #else /* no HEAVY_MACRO_USAGE */ | |
| 471 | /* | |
| 472 | * And this version of PROCESS_POKEY uses event and channel variables | |
| 473 | * so that the PROCESS_CHANNEL macro needs to index memory at runtime. | |
| 474 | */ | |
| 309 | for (clk = 0; clk < 3; clk++) | |
| 310 | { | |
| 311 | chip->clock_cnt[clk]++; | |
| 312 | if (chip->clock_cnt[clk] >= clock_divisors[clk]) | |
| 313 | { | |
| 314 | chip->clock_cnt[clk] = 0; | |
| 315 | clock_triggered[clk] = 1; | |
| 316 | } | |
| 317 | } | |
| 475 | 318 | |
| 476 | #define PROCESS_POKEY(chip) \ | |
| 477 | UINT32 sum = 0; \ | |
| 478 | if( chip->output[CHAN1] ) \ | |
| 479 | sum += chip->volume[CHAN1]; \ | |
| 480 | if( chip->output[CHAN2] ) \ | |
| 481 | sum += chip->volume[CHAN2]; \ | |
| 482 | if( chip->output[CHAN3] ) \ | |
| 483 | sum += chip->volume[CHAN3]; \ | |
| 484 | if( chip->output[CHAN4] ) \ | |
| 485 | sum += chip->volume[CHAN4]; \ | |
| 486 | while( samples > 0 ) \ | |
| 487 | { \ | |
| 488 | UINT32 event = chip->samplepos_whole; \ | |
| 489 | UINT32 channel = SAMPLE; \ | |
| 490 | if( chip->counter[CHAN1] < event ) \ | |
| 491 | { \ | |
| 492 | event = chip->counter[CHAN1]; \ | |
| 493 | channel = CHAN1; \ | |
| 494 | } \ | |
| 495 | if( chip->counter[CHAN2] < event ) \ | |
| 496 | { \ | |
| 497 | event = chip->counter[CHAN2]; \ | |
| 498 | channel = CHAN2; \ | |
| 499 | } \ | |
| 500 | if( chip->counter[CHAN3] < event ) \ | |
| 501 | { \ | |
| 502 | event = chip->counter[CHAN3]; \ | |
| 503 | channel = CHAN3; \ | |
| 504 | } \ | |
| 505 | if( chip->counter[CHAN4] < event ) \ | |
| 506 | { \ | |
| 507 | event = chip->counter[CHAN4]; \ | |
| 508 | channel = CHAN4; \ | |
| 509 | } \ | |
| 510 | if( channel == SAMPLE ) \ | |
| 511 | { \ | |
| 512 | PROCESS_SAMPLE(chip); \ | |
| 513 | } \ | |
| 514 | else \ | |
| 515 | { \ | |
| 516 | PROCESS_CHANNEL(chip,channel); \ | |
| 517 | } \ | |
| 518 | } \ | |
| 519 | chip->rtimer->adjust(attotime::never) | |
| 319 | chip->p4 = (chip->p4 + 1) % 0x0000f; | |
| 320 | chip->p5 = (chip->p5 + 1) % 0x0001f; | |
| 321 | chip->p9 = (chip->p9 + 1) % 0x001ff; | |
| 322 | chip->p17 = (chip->p17 + 1 ) % 0x1ffff; | |
| 520 | 323 | |
| 521 | #endif | |
| 522 | 324 | |
| 325 | clk = (chip->AUDCTL & CH1_HICLK) ? CLK_1 : base_clock; | |
| 326 | if (clock_triggered[clk]) | |
| 327 | inc_chan(chip, CHAN1); | |
| 523 | 328 | |
| 524 | INLINE pokey_state *get_safe_token(device_t *device) | |
| 525 | { | |
| 526 | assert(device != NULL); | |
| 527 | assert(device->type() == POKEY); | |
| 528 | return (pokey_state *)downcast<legacy_device_base *>(device)->token(); | |
| 529 | } | |
| 329 | clk = (chip->AUDCTL & CH3_HICLK) ? CLK_1 : base_clock; | |
| 330 | if (clock_triggered[clk]) | |
| 331 | inc_chan(chip, CHAN3); | |
| 530 | 332 | |
| 333 | if (clock_triggered[base_clock]) | |
| 334 | { | |
| 335 | if (!(chip->AUDCTL & CH12_JOINED)) | |
| 336 | inc_chan(chip, CHAN2); | |
| 337 | if (!(chip->AUDCTL & CH34_JOINED)) | |
| 338 | inc_chan(chip, CHAN4); | |
| 339 | } | |
| 531 | 340 | |
| 532 | static STREAM_UPDATE( pokey_update ) | |
| 533 | { | |
| 534 | pokey_state *chip = (pokey_state *)param; | |
| 535 | stream_sample_t *buffer = outputs[0]; | |
| 536 | PROCESS_POKEY(chip); | |
| 341 | /* do CHAN2 before CHAN1 because CHAN1 may set borrow! */ | |
| 342 | if (check_borrow(chip, CHAN2)) | |
| 343 | { | |
| 344 | int isJoined = (chip->AUDCTL & CH12_JOINED); | |
| 345 | if (isJoined) | |
| 346 | reset_channel(chip, CHAN1); | |
| 347 | reset_channel(chip, CHAN2); | |
| 348 | process_channel(chip, CHAN2); | |
| 349 | } | |
| 350 | ||
| 351 | if (check_borrow(chip, CHAN1)) | |
| 352 | { | |
| 353 | int isJoined = (chip->AUDCTL & CH12_JOINED); | |
| 354 | if (isJoined) | |
| 355 | inc_chan(chip, CHAN2); | |
| 356 | else | |
| 357 | reset_channel(chip, CHAN1); | |
| 358 | process_channel(chip, CHAN1); | |
| 359 | } | |
| 360 | ||
| 361 | /* do CHAN4 before CHAN3 because CHAN3 may set borrow! */ | |
| 362 | if (check_borrow(chip, CHAN4)) | |
| 363 | { | |
| 364 | int isJoined = (chip->AUDCTL & CH34_JOINED); | |
| 365 | if (isJoined) | |
| 366 | reset_channel(chip, CHAN3); | |
| 367 | reset_channel(chip, CHAN4); | |
| 368 | process_channel(chip, CHAN4); | |
| 369 | /* is this a filtering channel (3/4) and is the filter active? */ | |
| 370 | if (chip->AUDCTL & CH2_FILTER) | |
| 371 | chip->filter_sample[CHAN2] = chip->output[CHAN2]; | |
| 372 | else | |
| 373 | chip->filter_sample[CHAN2] = 1; | |
| 374 | } | |
| 375 | ||
| 376 | if (check_borrow(chip, CHAN3)) | |
| 377 | { | |
| 378 | int isJoined = (chip->AUDCTL & CH34_JOINED); | |
| 379 | if (isJoined) | |
| 380 | inc_chan(chip, CHAN4); | |
| 381 | else | |
| 382 | reset_channel(chip, CHAN3); | |
| 383 | process_channel(chip, CHAN3); | |
| 384 | /* is this a filtering channel (3/4) and is the filter active? */ | |
| 385 | if (chip->AUDCTL & CH1_FILTER) | |
| 386 | chip->filter_sample[CHAN1] = chip->output[CHAN1]; | |
| 387 | else | |
| 388 | chip->filter_sample[CHAN1] = 1; | |
| 389 | } | |
| 390 | ||
| 391 | for (ch = 0; ch < 4; ch++) | |
| 392 | { | |
| 393 | sum += (((chip->output[ch] ^ chip->filter_sample[ch]) || (chip->AUDC[ch] & VOLUME_ONLY)) ? chip->volume[ch] : 0 ); | |
| 394 | } | |
| 395 | ||
| 396 | /* store sum of output signals into the buffer */ | |
| 397 | *buffer++ = (sum > 0x7fff) ? 0x7fff : sum; | |
| 398 | samples--; | |
| 399 | ||
| 400 | } | |
| 401 | chip->rtimer->adjust(attotime::never); | |
| 402 | ||
| 537 | 403 | } |
| 538 | 404 | |
| 539 | 405 | |
| r15218 | r15219 | |
| 555 | 421 | static void rand_init(UINT8 *rng, int size, int left, int right, int add) |
| 556 | 422 | { |
| 557 | 423 | int mask = (1 << size) - 1; |
| 424 | int i; | |
| 425 | UINT32 lfsr = 0; | |
| 426 | ||
| 427 | LOG_RAND(("rand %d\n", size)); | |
| 428 | ||
| 429 | if (size == 17) | |
| 430 | { | |
| 431 | for( i = 0; i < mask; i++ ) | |
| 432 | { | |
| 433 | /* calculate next bit @ 7 */ | |
| 434 | int in8 = !((lfsr >> 8) & 1) ^ ((lfsr >> 13) & 1); | |
| 435 | int in = (lfsr & 1); | |
| 436 | lfsr = lfsr >> 1; | |
| 437 | lfsr = (lfsr & 0xff7f) | (in8 << 7); | |
| 438 | lfsr = (in << 16) | lfsr; | |
| 439 | *rng = (lfsr >> 8) & 0xff; /* use bits 0..7 */ | |
| 440 | LOG_RAND(("%05x: %02x\n", lfsr, *rng)); | |
| 441 | rng++; | |
| 442 | } | |
| 443 | } | |
| 444 | else | |
| 445 | { | |
| 446 | for( i = 0; i < mask; i++ ) | |
| 447 | { | |
| 448 | /* calculate next bit */ | |
| 449 | int in = !((lfsr >> 0) & 1) ^ ((lfsr >> 5) & 1); | |
| 450 | lfsr = lfsr >> 1; | |
| 451 | lfsr = (in << 8) | lfsr; | |
| 452 | *rng = lfsr & 0xff; /* use bits 0..7 */ | |
| 453 | LOG_RAND(("%05x: %02x\n", lfsr, *rng)); | |
| 454 | rng++; | |
| 455 | } | |
| 456 | } | |
| 457 | ||
| 458 | } | |
| 459 | ||
| 460 | #if 0 | |
| 461 | static void rand_init_old(UINT8 *rng, int size, int left, int right, int add) | |
| 462 | { | |
| 463 | int mask = (1 << size) - 1; | |
| 558 | 464 | int i, x = 0; |
| 559 | 465 | |
| 560 | 466 | LOG_RAND(("rand %d\n", size)); |
| r15218 | r15219 | |
| 570 | 476 | x = ((x << left) + (x >> right) + add) & mask; |
| 571 | 477 | } |
| 572 | 478 | } |
| 479 | #endif | |
| 573 | 480 | |
| 574 | ||
| 575 | 481 | static void register_for_save(pokey_state *chip, device_t *device) |
| 576 | 482 | { |
| 577 | 483 | device->save_item(NAME(chip->counter)); |
| 578 | 484 | device->save_item(NAME(chip->divisor)); |
| 579 | 485 | device->save_item(NAME(chip->volume)); |
| 580 | 486 | device->save_item(NAME(chip->output)); |
| 581 | device->save_item(NAME(chip->audible)); | |
| 582 | device->save_item(NAME(chip->samplepos_fract)); | |
| 583 | device->save_item(NAME(chip->samplepos_whole)); | |
| 584 | device->save_item(NAME(chip->polyadjust)); | |
| 487 | device->save_item(NAME(chip->filter_sample)); | |
| 488 | device->save_item(NAME(chip->clock_cnt)); | |
| 585 | 489 | device->save_item(NAME(chip->p4)); |
| 586 | 490 | device->save_item(NAME(chip->p5)); |
| 587 | 491 | device->save_item(NAME(chip->p9)); |
| r15218 | r15219 | |
| 640 | 544 | rand_init(chip->rand9, 9, 8, 1, 0x00180); |
| 641 | 545 | rand_init(chip->rand17, 17,16, 1, 0x1c000); |
| 642 | 546 | |
| 643 | chip->samplerate_24_8 = (device->clock() << 8) / sample_rate; | |
| 644 | 547 | chip->divisor[CHAN1] = 4; |
| 645 | 548 | chip->divisor[CHAN2] = 4; |
| 646 | 549 | chip->divisor[CHAN3] = 4; |
| r15218 | r15219 | |
| 664 | 567 | chip->serout_w.resolve(chip->intf.serout_w, *device); |
| 665 | 568 | chip->interrupt_cb = chip->intf.interrupt_cb; |
| 666 | 569 | |
| 667 | chip-> | |
| 570 | chip->m_stream = device->machine().sound().stream_alloc(*device, 0, 1, sample_rate, chip, pokey_update); | |
| 668 | 571 | |
| 669 | 572 | register_for_save(chip, device); |
| 670 | 573 | } |
| r15218 | r15219 | |
| 952 | 855 | pokey_state *p = get_safe_token(device); |
| 953 | 856 | int ch_mask = 0, new_val; |
| 954 | 857 | |
| 955 | p-> | |
| 858 | p->m_stream->update(); | |
| 956 | 859 | |
| 957 | 860 | /* determine which address was changed */ |
| 958 | 861 | switch (offset & 15) |
| r15218 | r15219 | |
| 1045 | 948 | p->timer[TIMER4]->adjust(attotime::never, p->timer_param[TIMER4]); |
| 1046 | 949 | |
| 1047 | 950 | /* reset all counters to zero (side effect) */ |
| 1048 | p->polyadjust = 0; | |
| 1049 | p->counter[CHAN1] = 0; | |
| 1050 | p->counter[CHAN2] = 0; | |
| 1051 | p->counter[CHAN3] = 0; | |
| 1052 | p->counter[CHAN4] = 0; | |
| 1053 | 951 | |
| 952 | reset_channel(p, CHAN1); | |
| 953 | reset_channel(p, CHAN2); | |
| 954 | reset_channel(p, CHAN3); | |
| 955 | reset_channel(p, CHAN4); | |
| 956 | /* From the pokey documentation */ | |
| 957 | p->output[CHAN1] = 0; | |
| 958 | p->output[CHAN2] = 0; | |
| 959 | p->output[CHAN3] = 0; | |
| 960 | p->output[CHAN4] = 0; | |
| 961 | p->filter_sample[CHAN1] = 1; | |
| 962 | p->filter_sample[CHAN2] = 1; | |
| 963 | p->filter_sample[CHAN3] = 0; | |
| 964 | p->filter_sample[CHAN4] = 0; | |
| 965 | ||
| 1054 | 966 | /* joined chan#1 and chan#2 ? */ |
| 1055 | 967 | if( p->AUDCTL & CH12_JOINED ) |
| 1056 | 968 | { |
| r15218 | r15219 | |
| 1202 | 1114 | |
| 1203 | 1115 | p->volume[CHAN1] = (p->AUDC[CHAN1] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; |
| 1204 | 1116 | p->divisor[CHAN1] = new_val; |
| 1205 | if( new_val < p->counter[CHAN1] ) | |
| 1206 | p->counter[CHAN1] = new_val; | |
| 1207 | 1117 | if( p->interrupt_cb && p->timer[TIMER1] ) |
| 1208 | 1118 | p->timer[TIMER1]->adjust(p->clock_period * new_val, p->timer_param[TIMER1], p->timer_period[TIMER1]); |
| 1209 | p->audible[CHAN1] = !( | |
| 1210 | (p->AUDC[CHAN1] & VOLUME_ONLY) || | |
| 1211 | (p->AUDC[CHAN1] & VOLUME_MASK) == 0 || | |
| 1212 | ((p->AUDC[CHAN1] & PURE) && new_val < (p->samplerate_24_8 >> 8))); | |
| 1213 | if( !p->audible[CHAN1] ) | |
| 1214 | { | |
| 1215 | p->output[CHAN1] = 1; | |
| 1216 | p->counter[CHAN1] = 0x7fffffff; | |
| 1217 | /* 50% duty cycle should result in half volume */ | |
| 1218 | p->volume[CHAN1] >>= 1; | |
| 1219 | } | |
| 1220 | 1119 | } |
| 1221 | 1120 | |
| 1222 | 1121 | if( ch_mask & (1 << CHAN2) ) |
| r15218 | r15219 | |
| 1238 | 1137 | |
| 1239 | 1138 | p->volume[CHAN2] = (p->AUDC[CHAN2] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; |
| 1240 | 1139 | p->divisor[CHAN2] = new_val; |
| 1241 | if( new_val < p->counter[CHAN2] ) | |
| 1242 | p->counter[CHAN2] = new_val; | |
| 1243 | 1140 | if( p->interrupt_cb && p->timer[TIMER2] ) |
| 1244 | 1141 | p->timer[TIMER2]->adjust(p->clock_period * new_val, p->timer_param[TIMER2], p->timer_period[TIMER2]); |
| 1245 | p->audible[CHAN2] = !( | |
| 1246 | (p->AUDC[CHAN2] & VOLUME_ONLY) || | |
| 1247 | (p->AUDC[CHAN2] & VOLUME_MASK) == 0 || | |
| 1248 | ((p->AUDC[CHAN2] & PURE) && new_val < (p->samplerate_24_8 >> 8))); | |
| 1249 | if( !p->audible[CHAN2] ) | |
| 1250 | { | |
| 1251 | p->output[CHAN2] = 1; | |
| 1252 | p->counter[CHAN2] = 0x7fffffff; | |
| 1253 | /* 50% duty cycle should result in half volume */ | |
| 1254 | p->volume[CHAN2] >>= 1; | |
| 1255 | } | |
| 1256 | 1142 | } |
| 1257 | 1143 | |
| 1258 | 1144 | if( ch_mask & (1 << CHAN3) ) |
| r15218 | r15219 | |
| 1267 | 1153 | |
| 1268 | 1154 | p->volume[CHAN3] = (p->AUDC[CHAN3] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; |
| 1269 | 1155 | p->divisor[CHAN3] = new_val; |
| 1270 | if( new_val < p->counter[CHAN3] ) | |
| 1271 | p->counter[CHAN3] = new_val; | |
| 1272 | 1156 | /* channel 3 does not have a timer associated */ |
| 1273 | p->audible[CHAN3] = !( | |
| 1274 | (p->AUDC[CHAN3] & VOLUME_ONLY) || | |
| 1275 | (p->AUDC[CHAN3] & VOLUME_MASK) == 0 || | |
| 1276 | ((p->AUDC[CHAN3] & PURE) && new_val < (p->samplerate_24_8 >> 8))) || | |
| 1277 | (p->AUDCTL & CH1_FILTER); | |
| 1278 | if( !p->audible[CHAN3] ) | |
| 1279 | { | |
| 1280 | p->output[CHAN3] = 1; | |
| 1281 | p->counter[CHAN3] = 0x7fffffff; | |
| 1282 | /* 50% duty cycle should result in half volume */ | |
| 1283 | p->volume[CHAN3] >>= 1; | |
| 1284 | } | |
| 1285 | 1157 | } |
| 1286 | 1158 | |
| 1287 | 1159 | if( ch_mask & (1 << CHAN4) ) |
| r15218 | r15219 | |
| 1303 | 1175 | |
| 1304 | 1176 | p->volume[CHAN4] = (p->AUDC[CHAN4] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; |
| 1305 | 1177 | p->divisor[CHAN4] = new_val; |
| 1306 | if( new_val < p->counter[CHAN4] ) | |
| 1307 | p->counter[CHAN4] = new_val; | |
| 1308 | 1178 | if( p->interrupt_cb && p->timer[TIMER4] ) |
| 1309 | 1179 | p->timer[TIMER4]->adjust(p->clock_period * new_val, p->timer_param[TIMER4], p->timer_period[TIMER4]); |
| 1310 | p->audible[CHAN4] = !( | |
| 1311 | (p->AUDC[CHAN4] & VOLUME_ONLY) || | |
| 1312 | (p->AUDC[CHAN4] & VOLUME_MASK) == 0 || | |
| 1313 | ((p->AUDC[CHAN4] & PURE) && new_val < (p->samplerate_24_8 >> 8))) || | |
| 1314 | (p->AUDCTL & CH2_FILTER); | |
| 1315 | if( !p->audible[CHAN4] ) | |
| 1316 | { | |
| 1317 | p->output[CHAN4] = 1; | |
| 1318 | p->counter[CHAN4] = 0x7fffffff; | |
| 1319 | /* 50% duty cycle should result in half volume */ | |
| 1320 | p->volume[CHAN4] >>= 1; | |
| 1321 | } | |
| 1322 | 1180 | } |
| 1323 | 1181 | } |
| 1324 | 1182 | |
| r15218 | r15219 | |
| 1407 | 1265 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 1408 | 1266 | case DEVINFO_STR_NAME: strcpy(info->s, "POKEY"); break; |
| 1409 | 1267 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Atari custom"); break; |
| 1410 | case DEVINFO_STR_VERSION: strcpy(info->s, "4. | |
| 1268 | case DEVINFO_STR_VERSION: strcpy(info->s, "4.6 | |
| 1411 | 1269 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 1412 | 1270 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break; |
| 1413 | 1271 | } |
| r15218 | r15219 | |
| 1415 | 1273 | |
| 1416 | 1274 | |
| 1417 | 1275 | DEFINE_LEGACY_SOUND_DEVICE(POKEY, pokey); |
| 1276 | ||
| 1277 | ||
| 1278 | ||
| 1279 | ||
| 1280 | ||
| 1281 | ||
| 1282 | ||
| 1283 | ||
| 1284 | ||
| 1285 | ||
| 1286 | ||
| 1287 | ||
| 1288 | ||
| 1289 | ||
| 1290 | ||
| 1291 | ||
| 1292 | // device type definition | |
| 1293 | const device_type POKEYN = &device_creator<pokeyn_device>; | |
| 1294 | ||
| 1295 | //************************************************************************** | |
| 1296 | // LIVE DEVICE | |
| 1297 | //************************************************************************** | |
| 1298 | ||
| 1299 | //------------------------------------------------- | |
| 1300 | // okim9810_device - constructor | |
| 1301 | //------------------------------------------------- | |
| 1302 | ||
| 1303 | pokeyn_device::pokeyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) | |
| 1304 | : device_t(mconfig, POKEYN, "POKEYN", tag, owner, clock), | |
| 1305 | device_sound_interface(mconfig, *this), | |
| 1306 | m_stream(NULL) | |
| 1307 | { | |
| 1308 | } | |
| 1309 | ||
| 1310 | ||
| 1311 | //------------------------------------------------- | |
| 1312 | // device_start - device-specific startup | |
| 1313 | //------------------------------------------------- | |
| 1314 | ||
| 1315 | void pokeyn_device::device_start() | |
| 1316 | { | |
| 1317 | //int sample_rate = clock(); | |
| 1318 | int i; | |
| 1319 | ||
| 1320 | if (static_config()) | |
| 1321 | memcpy(&m_intf, static_config(), sizeof(pokey_interface)); | |
| 1322 | m_clock_period = attotime::from_hz(clock()); | |
| 1323 | ||
| 1324 | /* calculate the A/D times | |
| 1325 | * In normal, slow mode (SKCTL bit SK_PADDLE is clear) the conversion | |
| 1326 | * takes N scanlines, where N is the paddle value. A single scanline | |
| 1327 | * takes approximately 64us to finish (1.78979MHz clock). | |
| 1328 | * In quick mode (SK_PADDLE set) the conversion is done very fast | |
| 1329 | * (takes two scanlines) but the result is not as accurate. | |
| 1330 | */ | |
| 1331 | ||
| 1332 | m_ad_time_fast = (attotime::from_nsec(64000*2/228) * FREQ_17_EXACT) / clock(); | |
| 1333 | m_ad_time_slow = (attotime::from_nsec(64000 ) * FREQ_17_EXACT) / clock(); | |
| 1334 | ||
| 1335 | /* 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); | |
| 1340 | ||
| 1341 | /* initialize the random arrays */ | |
| 1342 | rand_init(m_rand9, 9, 8, 1, 0x00180); | |
| 1343 | rand_init(m_rand17, 17,16, 1, 0x1c000); | |
| 1344 | ||
| 1345 | m_divisor[CHAN1] = 4; | |
| 1346 | m_divisor[CHAN2] = 4; | |
| 1347 | m_divisor[CHAN3] = 4; | |
| 1348 | m_divisor[CHAN4] = 4; | |
| 1349 | m_clockmult = DIV_64; | |
| 1350 | m_KBCODE = 0x09; /* Atari 800 'no key' */ | |
| 1351 | m_SKCTL = SK_RESET; /* let the RNG run after reset */ | |
| 1352 | m_rtimer = timer_alloc(0); | |
| 1353 | ||
| 1354 | m_timer[0] = timer_alloc(1); | |
| 1355 | m_timer[1] = timer_alloc(1); | |
| 1356 | m_timer[2] = timer_alloc(1); | |
| 1357 | ||
| 1358 | for (i=0; i<8; i++) | |
| 1359 | { | |
| 1360 | m_ptimer[i] = timer_alloc(2); | |
| 1361 | m_pot_r[i].resolve(m_intf.pot_r[i], *this); | |
| 1362 | } | |
| 1363 | m_allpot_r.resolve(m_intf.allpot_r, *this); | |
| 1364 | m_serin_r.resolve(m_intf.serin_r, *this); | |
| 1365 | m_serout_w.resolve(m_intf.serout_w, *this); | |
| 1366 | m_interrupt_cb = m_intf.interrupt_cb; | |
| 1367 | ||
| 1368 | m_stream = stream_alloc(0, 1, clock()); | |
| 1369 | ||
| 1370 | save_item(NAME(m_counter)); | |
| 1371 | save_item(NAME(m_divisor)); | |
| 1372 | save_item(NAME(m_volume)); | |
| 1373 | save_item(NAME(m_output)); | |
| 1374 | save_item(NAME(m_filter_sample)); | |
| 1375 | save_item(NAME(m_clock_cnt)); | |
| 1376 | save_item(NAME(m_borrow_cnt)); | |
| 1377 | save_item(NAME(m_p4)); | |
| 1378 | save_item(NAME(m_p5)); | |
| 1379 | save_item(NAME(m_p9)); | |
| 1380 | save_item(NAME(m_p17)); | |
| 1381 | save_item(NAME(m_r9)); | |
| 1382 | save_item(NAME(m_r17)); | |
| 1383 | save_item(NAME(m_clockmult)); | |
| 1384 | save_item(NAME(m_timer_period[0])); | |
| 1385 | save_item(NAME(m_timer_period[1])); | |
| 1386 | save_item(NAME(m_timer_period[2])); | |
| 1387 | save_item(NAME(m_timer_param)); | |
| 1388 | save_item(NAME(m_AUDF)); | |
| 1389 | save_item(NAME(m_AUDC)); | |
| 1390 | save_item(NAME(m_POTx)); | |
| 1391 | save_item(NAME(m_AUDCTL)); | |
| 1392 | save_item(NAME(m_ALLPOT)); | |
| 1393 | save_item(NAME(m_KBCODE)); | |
| 1394 | save_item(NAME(m_RANDOM)); | |
| 1395 | save_item(NAME(m_SERIN)); | |
| 1396 | save_item(NAME(m_SEROUT)); | |
| 1397 | save_item(NAME(m_IRQST)); | |
| 1398 | save_item(NAME(m_IRQEN)); | |
| 1399 | save_item(NAME(m_SKSTAT)); | |
| 1400 | save_item(NAME(m_SKCTL));} | |
| 1401 | ||
| 1402 | ||
| 1403 | //------------------------------------------------- | |
| 1404 | // device_reset - device-specific reset | |
| 1405 | //------------------------------------------------- | |
| 1406 | ||
| 1407 | void pokeyn_device::device_reset() | |
| 1408 | { | |
| 1409 | m_stream->update(); | |
| 1410 | } | |
| 1411 | ||
| 1412 | ||
| 1413 | //------------------------------------------------- | |
| 1414 | // device_post_load - device-specific post-load | |
| 1415 | //------------------------------------------------- | |
| 1416 | ||
| 1417 | void pokeyn_device::device_post_load() | |
| 1418 | { | |
| 1419 | } | |
| 1420 | ||
| 1421 | ||
| 1422 | //------------------------------------------------- | |
| 1423 | // device_clock_changed - called if the clock | |
| 1424 | // changes | |
| 1425 | //------------------------------------------------- | |
| 1426 | ||
| 1427 | void pokeyn_device::device_clock_changed() | |
| 1428 | { | |
| 1429 | } | |
| 1430 | ||
| 1431 | //------------------------------------------------- | |
| 1432 | // stream_generate - handle update requests for | |
| 1433 | // our sound stream | |
| 1434 | //------------------------------------------------- | |
| 1435 | ||
| 1436 | void pokeyn_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) | |
| 1437 | { | |
| 1438 | if (id == 1) | |
| 1439 | { | |
| 1440 | int timers = param; | |
| 1441 | ||
| 1442 | LOG_TIMER(("POKEY #%p timer %d with IRQEN $%02x\n", this, timers, m_IRQEN)); | |
| 1443 | ||
| 1444 | /* check if some of the requested timer interrupts are enabled */ | |
| 1445 | timers &= m_IRQEN; | |
| 1446 | ||
| 1447 | if( timers ) | |
| 1448 | { | |
| 1449 | /* set the enabled timer irq status bits */ | |
| 1450 | m_IRQST |= timers; | |
| 1451 | /* call back an application supplied function to handle the interrupt */ | |
| 1452 | if( m_interrupt_cb ) | |
| 1453 | (*m_interrupt_cb)(this, timers); | |
| 1454 | } | |
| 1455 | } | |
| 1456 | else if (id == 2) | |
| 1457 | { | |
| 1458 | int pot = param; | |
| 1459 | ||
| 1460 | LOG(("POKEY #%p POT%d triggers after %dus\n", this, pot, (int)(1000000 * m_ptimer[pot]->elapsed().as_double()))); | |
| 1461 | m_ALLPOT &= ~(1 << pot); /* set the enabled timer irq status bits */ | |
| 1462 | ||
| 1463 | } | |
| 1464 | else if (id == 3) | |
| 1465 | { | |
| 1466 | /* serout_ready_cb */ | |
| 1467 | if( m_IRQEN & IRQ_SEROR ) | |
| 1468 | { | |
| 1469 | m_IRQST |= IRQ_SEROR; | |
| 1470 | if( m_interrupt_cb ) | |
| 1471 | (m_interrupt_cb)(this, IRQ_SEROR); | |
| 1472 | } | |
| 1473 | } | |
| 1474 | else if (id == 4) | |
| 1475 | { | |
| 1476 | /* serout_complete */ | |
| 1477 | if( m_IRQEN & IRQ_SEROC ) | |
| 1478 | { | |
| 1479 | m_IRQST |= IRQ_SEROC; | |
| 1480 | if( m_interrupt_cb ) | |
| 1481 | (m_interrupt_cb)(this, IRQ_SEROC); | |
| 1482 | } | |
| 1483 | } | |
| 1484 | else | |
| 1485 | assert_always(FALSE, "Unknown id in pokey_device::device_timer"); | |
| 1486 | } | |
| 1487 | ||
| 1488 | //------------------------------------------------- | |
| 1489 | // stream_generate - handle update requests for | |
| 1490 | // our sound stream | |
| 1491 | //------------------------------------------------- | |
| 1492 | ||
| 1493 | /* | |
| 1494 | * http://www.atariage.com/forums/topic/3328-sio-protocol/page__st__100#entry1680190: | |
| 1495 | * I noticed that the Pokey counters have clocked carry (actually, "borrow") positions that delay the | |
| 1496 | * counter by 3 cycles, plus the 1 reset clock. So 16 bit mode has 6 carry delays and a reset clock. | |
| 1497 | * I'm sure this was done because the propagation delays limited the number of cells the subtraction could ripple though. | |
| 1498 | * | |
| 1499 | */ | |
| 1500 | ||
| 1501 | void pokeyn_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) | |
| 1502 | { | |
| 1503 | stream_sample_t *buffer = outputs[0]; | |
| 1504 | int base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28; | |
| 1505 | ||
| 1506 | while( samples > 0 ) | |
| 1507 | { | |
| 1508 | int ch, clk; | |
| 1509 | UINT32 sum = 0; | |
| 1510 | int clock_triggered[3] = {0,0,0}; | |
| 1511 | ||
| 1512 | for (clk = 0; clk < 3; clk++) | |
| 1513 | { | |
| 1514 | m_clock_cnt[clk]++; | |
| 1515 | if (m_clock_cnt[clk] >= clock_divisors[clk]) | |
| 1516 | { | |
| 1517 | m_clock_cnt[clk] = 0; | |
| 1518 | clock_triggered[clk] = 1; | |
| 1519 | } | |
| 1520 | } | |
| 1521 | ||
| 1522 | m_p4 = (m_p4 + 1) % 0x0000f; | |
| 1523 | m_p5 = (m_p5 + 1) % 0x0001f; | |
| 1524 | m_p9 = (m_p9 + 1) % 0x001ff; | |
| 1525 | m_p17 = (m_p17 + 1 ) % 0x1ffff; | |
| 1526 | ||
| 1527 | ||
| 1528 | clk = (m_AUDCTL & CH1_HICLK) ? CLK_1 : base_clock; | |
| 1529 | if (clock_triggered[clk]) | |
| 1530 | inc_chan(CHAN1); | |
| 1531 | ||
| 1532 | clk = (m_AUDCTL & CH3_HICLK) ? CLK_1 : base_clock; | |
| 1533 | if (clock_triggered[clk]) | |
| 1534 | inc_chan(CHAN3); | |
| 1535 | ||
| 1536 | if (clock_triggered[base_clock]) | |
| 1537 | { | |
| 1538 | if (!(m_AUDCTL & CH12_JOINED)) | |
| 1539 | inc_chan(CHAN2); | |
| 1540 | if (!(m_AUDCTL & CH34_JOINED)) | |
| 1541 | inc_chan(CHAN4); | |
| 1542 | } | |
| 1543 | ||
| 1544 | /* do CHAN2 before CHAN1 because CHAN1 may set borrow! */ | |
| 1545 | if (check_borrow(CHAN2)) | |
| 1546 | { | |
| 1547 | int isJoined = (m_AUDCTL & CH12_JOINED); | |
| 1548 | if (isJoined) | |
| 1549 | reset_channel(CHAN1); | |
| 1550 | reset_channel(CHAN2); | |
| 1551 | process_channel(CHAN2); | |
| 1552 | } | |
| 1553 | ||
| 1554 | if (check_borrow(CHAN1)) | |
| 1555 | { | |
| 1556 | int isJoined = (m_AUDCTL & CH12_JOINED); | |
| 1557 | if (isJoined) | |
| 1558 | inc_chan(CHAN2); | |
| 1559 | else | |
| 1560 | reset_channel(CHAN1); | |
| 1561 | process_channel(CHAN1); | |
| 1562 | } | |
| 1563 | ||
| 1564 | /* do CHAN4 before CHAN3 because CHAN3 may set borrow! */ | |
| 1565 | if (check_borrow(CHAN4)) | |
| 1566 | { | |
| 1567 | int isJoined = (m_AUDCTL & CH34_JOINED); | |
| 1568 | if (isJoined) | |
| 1569 | reset_channel(CHAN3); | |
| 1570 | reset_channel(CHAN4); | |
| 1571 | process_channel(CHAN4); | |
| 1572 | /* is this a filtering channel (3/4) and is the filter active? */ | |
| 1573 | if (m_AUDCTL & CH2_FILTER) | |
| 1574 | m_filter_sample[CHAN2] = m_output[CHAN2]; | |
| 1575 | else | |
| 1576 | m_filter_sample[CHAN2] = 1; | |
| 1577 | } | |
| 1578 | ||
| 1579 | if (check_borrow(CHAN3)) | |
| 1580 | { | |
| 1581 | int isJoined = (m_AUDCTL & CH34_JOINED); | |
| 1582 | if (isJoined) | |
| 1583 | inc_chan(CHAN4); | |
| 1584 | else | |
| 1585 | reset_channel(CHAN3); | |
| 1586 | process_channel(CHAN3); | |
| 1587 | /* is this a filtering channel (3/4) and is the filter active? */ | |
| 1588 | if (m_AUDCTL & CH1_FILTER) | |
| 1589 | m_filter_sample[CHAN1] = m_output[CHAN1]; | |
| 1590 | else | |
| 1591 | m_filter_sample[CHAN1] = 1; | |
| 1592 | } | |
| 1593 | ||
| 1594 | for (ch = 0; ch < 4; ch++) | |
| 1595 | { | |
| 1596 | sum += (((m_output[ch] ^ m_filter_sample[ch]) || (m_AUDC[ch] & VOLUME_ONLY)) ? m_volume[ch] : 0 ); | |
| 1597 | } | |
| 1598 | ||
| 1599 | /* store sum of output signals into the buffer */ | |
| 1600 | *buffer++ = (sum > 0x7fff) ? 0x7fff : sum; | |
| 1601 | samples--; | |
| 1602 | ||
| 1603 | } | |
| 1604 | m_rtimer->adjust(attotime::never); | |
| 1605 | ||
| 1606 | } | |
| 1607 | ||
| 1608 | ||
| 1609 | ||
| 1610 | //------------------------------------------------- | |
| 1611 | // read - memory interface for reading the active status | |
| 1612 | //------------------------------------------------- | |
| 1613 | ||
| 1614 | READ8_MEMBER( pokeyn_device::read ) | |
| 1615 | { | |
| 1616 | int data = 0, pot; | |
| 1617 | UINT32 adjust = 0; | |
| 1618 | ||
| 1619 | switch (offset & 15) | |
| 1620 | { | |
| 1621 | case POT0_C: case POT1_C: case POT2_C: case POT3_C: | |
| 1622 | case POT4_C: case POT5_C: case POT6_C: case POT7_C: | |
| 1623 | pot = offset & 7; | |
| 1624 | if( !m_pot_r[pot].isnull() ) | |
| 1625 | { | |
| 1626 | /* | |
| 1627 | * If the conversion is not yet finished (ptimer running), | |
| 1628 | * get the current value by the linear interpolation of | |
| 1629 | * the final value using the elapsed time. | |
| 1630 | */ | |
| 1631 | if( m_ALLPOT & (1 << pot) ) | |
| 1632 | { | |
| 1633 | data = m_ptimer[pot]->elapsed().attoseconds / ((m_SKCTL & SK_PADDLE) ? m_ad_time_fast : m_ad_time_slow).attoseconds; | |
| 1634 | LOG(("POKEY '%s' read POT%d (interpolated) $%02x\n", tag(), pot, data)); | |
| 1635 | } | |
| 1636 | else | |
| 1637 | { | |
| 1638 | data = m_POTx[pot]; | |
| 1639 | LOG(("POKEY '%s' read POT%d (final value) $%02x\n", tag(), pot, data)); | |
| 1640 | } | |
| 1641 | } | |
| 1642 | else | |
| 1643 | logerror("%s: warning - read '%s' POT%d\n", machine().describe_context(), tag(), pot); | |
| 1644 | break; | |
| 1645 | ||
| 1646 | case ALLPOT_C: | |
| 1647 | /**************************************************************** | |
| 1648 | * If the 2 least significant bits of SKCTL are 0, the ALLPOTs | |
| 1649 | * are disabled (SKRESET). Thanks to MikeJ for pointing this out. | |
| 1650 | ****************************************************************/ | |
| 1651 | if( (m_SKCTL & SK_RESET) == 0) | |
| 1652 | { | |
| 1653 | data = 0; | |
| 1654 | LOG(("POKEY '%s' ALLPOT internal $%02x (reset)\n", tag(), data)); | |
| 1655 | } | |
| 1656 | else if( !m_allpot_r.isnull() ) | |
| 1657 | { | |
| 1658 | data = m_allpot_r(offset); | |
| 1659 | LOG(("POKEY '%s' ALLPOT callback $%02x\n", tag(), data)); | |
| 1660 | } | |
| 1661 | else | |
| 1662 | { | |
| 1663 | data = m_ALLPOT; | |
| 1664 | LOG(("POKEY '%s' ALLPOT internal $%02x\n", tag(), data)); | |
| 1665 | } | |
| 1666 | break; | |
| 1667 | ||
| 1668 | case KBCODE_C: | |
| 1669 | data = m_KBCODE; | |
| 1670 | break; | |
| 1671 | ||
| 1672 | case RANDOM_C: | |
| 1673 | /**************************************************************** | |
| 1674 | * If the 2 least significant bits of SKCTL are 0, the random | |
| 1675 | * number generator is disabled (SKRESET). Thanks to Eric Smith | |
| 1676 | * for pointing out this critical bit of info! If the random | |
| 1677 | * number generator is enabled, get a new random number. Take | |
| 1678 | * the time gone since the last read into account and read the | |
| 1679 | * new value from an appropriate offset in the rand17 table. | |
| 1680 | ****************************************************************/ | |
| 1681 | if( m_SKCTL & SK_RESET ) | |
| 1682 | { | |
| 1683 | adjust = m_rtimer->elapsed().as_double() / m_clock_period.as_double(); | |
| 1684 | m_r9 = (m_r9 + adjust) % 0x001ff; | |
| 1685 | m_r17 = (m_r17 + adjust) % 0x1ffff; | |
| 1686 | } | |
| 1687 | else | |
| 1688 | { | |
| 1689 | adjust = 1; | |
| 1690 | m_r9 = 0; | |
| 1691 | m_r17 = 0; | |
| 1692 | LOG_RAND(("POKEY '%s' rand17 frozen (SKCTL): $%02x\n", tag(), m_RANDOM)); | |
| 1693 | } | |
| 1694 | if( m_AUDCTL & POLY9 ) | |
| 1695 | { | |
| 1696 | m_RANDOM = m_rand9[m_r9]; | |
| 1697 | LOG_RAND(("POKEY '%s' adjust %u rand9[$%05x]: $%02x\n", tag(), adjust, m_r9, m_RANDOM)); | |
| 1698 | } | |
| 1699 | else | |
| 1700 | { | |
| 1701 | m_RANDOM = m_rand17[m_r17]; | |
| 1702 | LOG_RAND(("POKEY '%s' adjust %u rand17[$%05x]: $%02x\n", tag(), adjust, m_r17, m_RANDOM)); | |
| 1703 | } | |
| 1704 | if (adjust > 0) | |
| 1705 | m_rtimer->adjust(attotime::never); | |
| 1706 | data = m_RANDOM ^ 0xff; | |
| 1707 | break; | |
| 1708 | ||
| 1709 | case SERIN_C: | |
| 1710 | if( !m_serin_r.isnull() ) | |
| 1711 | m_SERIN = m_serin_r(offset); | |
| 1712 | data = m_SERIN; | |
| 1713 | LOG(("POKEY '%s' SERIN $%02x\n", tag(), data)); | |
| 1714 | break; | |
| 1715 | ||
| 1716 | case IRQST_C: | |
| 1717 | /* IRQST is an active low input port; we keep it active high */ | |
| 1718 | /* internally to ease the (un-)masking of bits */ | |
| 1719 | data = m_IRQST ^ 0xff; | |
| 1720 | LOG(("POKEY '%s' IRQST $%02x\n", tag(), data)); | |
| 1721 | break; | |
| 1722 | ||
| 1723 | case SKSTAT_C: | |
| 1724 | /* SKSTAT is also an active low input port */ | |
| 1725 | data = m_SKSTAT ^ 0xff; | |
| 1726 | LOG(("POKEY '%s' SKSTAT $%02x\n", tag(), data)); | |
| 1727 | break; | |
| 1728 | ||
| 1729 | default: | |
| 1730 | LOG(("POKEY '%s' register $%02x\n", tag(), offset)); | |
| 1731 | break; | |
| 1732 | } | |
| 1733 | return data; | |
| 1734 | ||
| 1735 | } | |
| 1736 | ||
| 1737 | ||
| 1738 | //------------------------------------------------- | |
| 1739 | // write - memory interface for write | |
| 1740 | //------------------------------------------------- | |
| 1741 | ||
| 1742 | WRITE8_MEMBER( pokeyn_device::write ) | |
| 1743 | { | |
| 1744 | write_cmd(offset, data); | |
| 1745 | } | |
| 1746 | ||
| 1747 | void pokeyn_device::write_cmd(int offset, UINT8 data) | |
| 1748 | { | |
| 1749 | int ch_mask = 0, new_val; | |
| 1750 | ||
| 1751 | m_stream->update(); | |
| 1752 | ||
| 1753 | /* determine which address was changed */ | |
| 1754 | switch (offset & 15) | |
| 1755 | { | |
| 1756 | case AUDF1_C: | |
| 1757 | if( data == m_AUDF[CHAN1] ) | |
| 1758 | return; | |
| 1759 | LOG_SOUND(("POKEY '%s' AUDF1 $%02x\n", tag(), data)); | |
| 1760 | m_AUDF[CHAN1] = data; | |
| 1761 | ch_mask = 1 << CHAN1; | |
| 1762 | if( m_AUDCTL & CH12_JOINED ) /* if ch 1&2 tied together */ | |
| 1763 | ch_mask |= 1 << CHAN2; /* then also change on ch2 */ | |
| 1764 | break; | |
| 1765 | ||
| 1766 | case AUDC1_C: | |
| 1767 | if( data == m_AUDC[CHAN1] ) | |
| 1768 | return; | |
| 1769 | LOG_SOUND(("POKEY '%s' AUDC1 $%02x (%s)\n", tag(), data, audc2str(data))); | |
| 1770 | m_AUDC[CHAN1] = data; | |
| 1771 | ch_mask = 1 << CHAN1; | |
| 1772 | break; | |
| 1773 | ||
| 1774 | case AUDF2_C: | |
| 1775 | if( data == m_AUDF[CHAN2] ) | |
| 1776 | return; | |
| 1777 | LOG_SOUND(("POKEY '%s' AUDF2 $%02x\n", tag(), data)); | |
| 1778 | m_AUDF[CHAN2] = data; | |
| 1779 | ch_mask = 1 << CHAN2; | |
| 1780 | break; | |
| 1781 | ||
| 1782 | case AUDC2_C: | |
| 1783 | if( data == m_AUDC[CHAN2] ) | |
| 1784 | return; | |
| 1785 | LOG_SOUND(("POKEY '%s' AUDC2 $%02x (%s)\n", tag(), data, audc2str(data))); | |
| 1786 | m_AUDC[CHAN2] = data; | |
| 1787 | ch_mask = 1 << CHAN2; | |
| 1788 | break; | |
| 1789 | ||
| 1790 | case AUDF3_C: | |
| 1791 | if( data == m_AUDF[CHAN3] ) | |
| 1792 | return; | |
| 1793 | LOG_SOUND(("POKEY '%s' AUDF3 $%02x\n", tag(), data)); | |
| 1794 | m_AUDF[CHAN3] = data; | |
| 1795 | ch_mask = 1 << CHAN3; | |
| 1796 | ||
| 1797 | if( m_AUDCTL & CH34_JOINED ) /* if ch 3&4 tied together */ | |
| 1798 | ch_mask |= 1 << CHAN4; /* then also change on ch4 */ | |
| 1799 | break; | |
| 1800 | ||
| 1801 | case AUDC3_C: | |
| 1802 | if( data == m_AUDC[CHAN3] ) | |
| 1803 | return; | |
| 1804 | LOG_SOUND(("POKEY '%s' AUDC3 $%02x (%s)\n", tag(), data, audc2str(data))); | |
| 1805 | m_AUDC[CHAN3] = data; | |
| 1806 | ch_mask = 1 << CHAN3; | |
| 1807 | break; | |
| 1808 | ||
| 1809 | case AUDF4_C: | |
| 1810 | if( data == m_AUDF[CHAN4] ) | |
| 1811 | return; | |
| 1812 | LOG_SOUND(("POKEY '%s' AUDF4 $%02x\n", tag(), data)); | |
| 1813 | m_AUDF[CHAN4] = data; | |
| 1814 | ch_mask = 1 << CHAN4; | |
| 1815 | break; | |
| 1816 | ||
| 1817 | case AUDC4_C: | |
| 1818 | if( data == m_AUDC[CHAN4] ) | |
| 1819 | return; | |
| 1820 | LOG_SOUND(("POKEY '%s' AUDC4 $%02x (%s)\n", tag(), data, audc2str(data))); | |
| 1821 | m_AUDC[CHAN4] = data; | |
| 1822 | ch_mask = 1 << CHAN4; | |
| 1823 | break; | |
| 1824 | ||
| 1825 | case AUDCTL_C: | |
| 1826 | if( data == m_AUDCTL ) | |
| 1827 | return; | |
| 1828 | LOG_SOUND(("POKEY '%s' AUDCTL $%02x (%s)\n", tag(), data, audctl2str(data))); | |
| 1829 | m_AUDCTL = data; | |
| 1830 | ch_mask = 15; /* all channels */ | |
| 1831 | /* determine the base multiplier for the 'div by n' calculations */ | |
| 1832 | m_clockmult = (m_AUDCTL & CLK_15KHZ) ? DIV_15 : DIV_64; | |
| 1833 | break; | |
| 1834 | ||
| 1835 | case STIMER_C: | |
| 1836 | /* first remove any existing timers */ | |
| 1837 | LOG_TIMER(("POKEY '%s' STIMER $%02x\n", tag(), data)); | |
| 1838 | ||
| 1839 | m_timer[TIMER1]->adjust(attotime::never, m_timer_param[TIMER1]); | |
| 1840 | m_timer[TIMER2]->adjust(attotime::never, m_timer_param[TIMER2]); | |
| 1841 | m_timer[TIMER4]->adjust(attotime::never, m_timer_param[TIMER4]); | |
| 1842 | ||
| 1843 | /* reset all counters to zero (side effect) */ | |
| 1844 | reset_channel(CHAN1); | |
| 1845 | reset_channel(CHAN2); | |
| 1846 | reset_channel(CHAN3); | |
| 1847 | reset_channel(CHAN4); | |
| 1848 | /* From the pokey documentation */ | |
| 1849 | m_output[CHAN1] = 0; | |
| 1850 | m_output[CHAN2] = 0; | |
| 1851 | m_output[CHAN3] = 0; | |
| 1852 | m_output[CHAN4] = 0; | |
| 1853 | m_filter_sample[CHAN1] = 1; | |
| 1854 | m_filter_sample[CHAN2] = 1; | |
| 1855 | m_filter_sample[CHAN3] = 0; | |
| 1856 | m_filter_sample[CHAN4] = 0; | |
| 1857 | /* joined chan#1 and chan#2 ? */ | |
| 1858 | if( m_AUDCTL & CH12_JOINED ) | |
| 1859 | { | |
| 1860 | if( m_divisor[CHAN2] > 4 ) | |
| 1861 | { | |
| 1862 | LOG_TIMER(("POKEY '%s' timer1+2 after %d clocks\n", tag(), m_divisor[CHAN2])); | |
| 1863 | /* set timer #1 _and_ #2 event after timer_div clocks of joined CHAN1+CHAN2 */ | |
| 1864 | m_timer_period[TIMER2] = m_clock_period * m_divisor[CHAN2]; | |
| 1865 | m_timer_param[TIMER2] = IRQ_TIMR2|IRQ_TIMR1; | |
| 1866 | m_timer[TIMER2]->adjust(m_timer_period[TIMER2], m_timer_param[TIMER2], m_timer_period[TIMER2]); | |
| 1867 | } | |
| 1868 | } | |
| 1869 | else | |
| 1870 | { | |
| 1871 | if( m_divisor[CHAN1] > 4 ) | |
| 1872 | { | |
| 1873 | LOG_TIMER(("POKEY '%s' timer1 after %d clocks\n", tag(), m_divisor[CHAN1])); | |
| 1874 | /* set timer #1 event after timer_div clocks of CHAN1 */ | |
| 1875 | m_timer_period[TIMER1] = m_clock_period * m_divisor[CHAN1]; | |
| 1876 | m_timer_param[TIMER1] = IRQ_TIMR1; | |
| 1877 | m_timer[TIMER1]->adjust(m_timer_period[TIMER1], m_timer_param[TIMER1], m_timer_period[TIMER1]); | |
| 1878 | } | |
| 1879 | ||
| 1880 | if( m_divisor[CHAN2] > 4 ) | |
| 1881 | { | |
| 1882 | LOG_TIMER(("POKEY '%s' timer2 after %d clocks\n", tag(), m_divisor[CHAN2])); | |
| 1883 | /* set timer #2 event after timer_div clocks of CHAN2 */ | |
| 1884 | m_timer_period[TIMER2] = m_clock_period * m_divisor[CHAN2]; | |
| 1885 | m_timer_param[TIMER2] = IRQ_TIMR2; | |
| 1886 | m_timer[TIMER2]->adjust(m_timer_period[TIMER2], m_timer_param[TIMER2], m_timer_period[TIMER2]); | |
| 1887 | } | |
| 1888 | } | |
| 1889 | ||
| 1890 | /* Note: p[chip] does not have a timer #3 */ | |
| 1891 | ||
| 1892 | if( m_AUDCTL & CH34_JOINED ) | |
| 1893 | { | |
| 1894 | /* not sure about this: if audc4 == 0000xxxx don't start timer 4 ? */ | |
| 1895 | if( m_AUDC[CHAN4] & 0xf0 ) | |
| 1896 | { | |
| 1897 | if( m_divisor[CHAN4] > 4 ) | |
| 1898 | { | |
| 1899 | LOG_TIMER(("POKEY '%s' timer4 after %d clocks\n", tag(), m_divisor[CHAN4])); | |
| 1900 | /* set timer #4 event after timer_div clocks of CHAN4 */ | |
| 1901 | m_timer_period[TIMER4] = m_clock_period * m_divisor[CHAN4]; | |
| 1902 | m_timer_param[TIMER4] = IRQ_TIMR4; | |
| 1903 | m_timer[TIMER4]->adjust(m_timer_period[TIMER4], m_timer_param[TIMER4], m_timer_period[TIMER4]); | |
| 1904 | } | |
| 1905 | } | |
| 1906 | } | |
| 1907 | else | |
| 1908 | { | |
| 1909 | if( m_divisor[CHAN4] > 4 ) | |
| 1910 | { | |
| 1911 | LOG_TIMER(("POKEY '%s' timer4 after %d clocks\n", tag(), m_divisor[CHAN4])); | |
| 1912 | /* set timer #4 event after timer_div clocks of CHAN4 */ | |
| 1913 | m_timer_period[TIMER4] = m_clock_period * m_divisor[CHAN4]; | |
| 1914 | m_timer_param[TIMER4] = IRQ_TIMR4; | |
| 1915 | m_timer[TIMER4]->adjust(m_timer_period[TIMER4], m_timer_param[TIMER4], m_timer_period[TIMER4]); | |
| 1916 | } | |
| 1917 | } | |
| 1918 | ||
| 1919 | m_timer[TIMER1]->enable(m_IRQEN & IRQ_TIMR1); | |
| 1920 | m_timer[TIMER2]->enable(m_IRQEN & IRQ_TIMR2); | |
| 1921 | m_timer[TIMER4]->enable(m_IRQEN & IRQ_TIMR4); | |
| 1922 | break; | |
| 1923 | ||
| 1924 | case SKREST_C: | |
| 1925 | /* reset SKSTAT */ | |
| 1926 | LOG(("POKEY '%s' SKREST $%02x\n", tag(), data)); | |
| 1927 | m_SKSTAT &= ~(SK_FRAME|SK_OVERRUN|SK_KBERR); | |
| 1928 | break; | |
| 1929 | ||
| 1930 | case POTGO_C: | |
| 1931 | LOG(("POKEY '%s' POTGO $%02x\n", tag(), data)); | |
| 1932 | pokey_potgo(); | |
| 1933 | break; | |
| 1934 | ||
| 1935 | case SEROUT_C: | |
| 1936 | LOG(("POKEY '%s' SEROUT $%02x\n", tag(), data)); | |
| 1937 | m_serout_w(offset, data); | |
| 1938 | m_SKSTAT |= SK_SEROUT; | |
| 1939 | /* | |
| 1940 | * These are arbitrary values, tested with some custom boot | |
| 1941 | * loaders from Ballblazer and Escape from Fractalus | |
| 1942 | * The real times are unknown | |
| 1943 | */ | |
| 1944 | timer_set(attotime::from_usec(200), 3); | |
| 1945 | /* 10 bits (assumption 1 start, 8 data and 1 stop bit) take how long? */ | |
| 1946 | timer_set(attotime::from_usec(2000), 4);// FUNC(pokey_serout_complete), 0, p); | |
| 1947 | break; | |
| 1948 | ||
| 1949 | case IRQEN_C: | |
| 1950 | LOG(("POKEY '%s' IRQEN $%02x\n", tag(), data)); | |
| 1951 | ||
| 1952 | /* acknowledge one or more IRQST bits ? */ | |
| 1953 | if( m_IRQST & ~data ) | |
| 1954 | { | |
| 1955 | /* reset IRQST bits that are masked now */ | |
| 1956 | m_IRQST &= data; | |
| 1957 | } | |
| 1958 | else | |
| 1959 | { | |
| 1960 | /* enable/disable timers now to avoid unneeded | |
| 1961 | breaking of the CPU cores for masked timers */ | |
| 1962 | if( m_timer[TIMER1] && ((m_IRQEN^data) & IRQ_TIMR1) ) | |
| 1963 | m_timer[TIMER1]->enable(data & IRQ_TIMR1); | |
| 1964 | if( m_timer[TIMER2] && ((m_IRQEN^data) & IRQ_TIMR2) ) | |
| 1965 | m_timer[TIMER2]->enable(data & IRQ_TIMR2); | |
| 1966 | if( m_timer[TIMER4] && ((m_IRQEN^data) & IRQ_TIMR4) ) | |
| 1967 | m_timer[TIMER4]->enable(data & IRQ_TIMR4); | |
| 1968 | } | |
| 1969 | /* store irq enable */ | |
| 1970 | m_IRQEN = data; | |
| 1971 | break; | |
| 1972 | ||
| 1973 | case SKCTL_C: | |
| 1974 | if( data == m_SKCTL ) | |
| 1975 | return; | |
| 1976 | LOG(("POKEY '%s' SKCTL $%02x\n", tag(), data)); | |
| 1977 | m_SKCTL = data; | |
| 1978 | if( !(data & SK_RESET) ) | |
| 1979 | { | |
| 1980 | write_cmd(IRQEN_C, 0); | |
| 1981 | write_cmd(SKREST_C, 0); | |
| 1982 | } | |
| 1983 | break; | |
| 1984 | } | |
| 1985 | ||
| 1986 | /************************************************************ | |
| 1987 | * As defined in the manual, the exact counter values are | |
| 1988 | * different depending on the frequency and resolution: | |
| 1989 | * 64 kHz or 15 kHz - AUDF + 1 | |
| 1990 | * 1.79 MHz, 8-bit - AUDF + 4 | |
| 1991 | * 1.79 MHz, 16-bit - AUDF[CHAN1]+256*AUDF[CHAN2] + 7 | |
| 1992 | ************************************************************/ | |
| 1993 | ||
| 1994 | /* only reset the channels that have changed */ | |
| 1995 | ||
| 1996 | if( ch_mask & (1 << CHAN1) ) | |
| 1997 | { | |
| 1998 | /* process channel 1 frequency */ | |
| 1999 | if( m_AUDCTL & CH1_HICLK ) | |
| 2000 | new_val = m_AUDF[CHAN1] + DIVADD_HICLK; | |
| 2001 | else | |
| 2002 | new_val = (m_AUDF[CHAN1] + DIVADD_LOCLK) * m_clockmult; | |
| 2003 | ||
| 2004 | LOG_SOUND(("POKEY '%s' chan1 %d\n", tag(), new_val)); | |
| 2005 | ||
| 2006 | m_volume[CHAN1] = (m_AUDC[CHAN1] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; | |
| 2007 | m_divisor[CHAN1] = new_val; | |
| 2008 | if( m_interrupt_cb && m_timer[TIMER1] ) | |
| 2009 | m_timer[TIMER1]->adjust(m_clock_period * new_val, m_timer_param[TIMER1], m_timer_period[TIMER1]); | |
| 2010 | } | |
| 2011 | ||
| 2012 | if( ch_mask & (1 << CHAN2) ) | |
| 2013 | { | |
| 2014 | /* process channel 2 frequency */ | |
| 2015 | if( m_AUDCTL & CH12_JOINED ) | |
| 2016 | { | |
| 2017 | if( m_AUDCTL & CH1_HICLK ) | |
| 2018 | new_val = m_AUDF[CHAN2] * 256 + m_AUDF[CHAN1] + DIVADD_HICLK_JOINED; | |
| 2019 | else | |
| 2020 | new_val = (m_AUDF[CHAN2] * 256 + m_AUDF[CHAN1] + DIVADD_LOCLK) * m_clockmult; | |
| 2021 | LOG_SOUND(("POKEY '%s' chan1+2 %d\n", tag(), new_val)); | |
| 2022 | } | |
| 2023 | else | |
| 2024 | { | |
| 2025 | new_val = (m_AUDF[CHAN2] + DIVADD_LOCLK) * m_clockmult; | |
| 2026 | LOG_SOUND(("POKEY '%s' chan2 %d\n", tag(), new_val)); | |
| 2027 | } | |
| 2028 | ||
| 2029 | m_volume[CHAN2] = (m_AUDC[CHAN2] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; | |
| 2030 | m_divisor[CHAN2] = new_val; | |
| 2031 | if( m_interrupt_cb && m_timer[TIMER2] ) | |
| 2032 | m_timer[TIMER2]->adjust(m_clock_period * new_val, m_timer_param[TIMER2], m_timer_period[TIMER2]); | |
| 2033 | } | |
| 2034 | ||
| 2035 | if( ch_mask & (1 << CHAN3) ) | |
| 2036 | { | |
| 2037 | /* process channel 3 frequency */ | |
| 2038 | if( m_AUDCTL & CH3_HICLK ) | |
| 2039 | new_val = m_AUDF[CHAN3] + DIVADD_HICLK; | |
| 2040 | else | |
| 2041 | new_val = (m_AUDF[CHAN3] + DIVADD_LOCLK) * m_clockmult; | |
| 2042 | ||
| 2043 | LOG_SOUND(("POKEY '%s' chan3 %d\n", tag(), new_val)); | |
| 2044 | ||
| 2045 | m_volume[CHAN3] = (m_AUDC[CHAN3] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; | |
| 2046 | m_divisor[CHAN3] = new_val; | |
| 2047 | /* channel 3 does not have a timer associated */ | |
| 2048 | } | |
| 2049 | ||
| 2050 | if( ch_mask & (1 << CHAN4) ) | |
| 2051 | { | |
| 2052 | /* process channel 4 frequency */ | |
| 2053 | if( m_AUDCTL & CH34_JOINED ) | |
| 2054 | { | |
| 2055 | if( m_AUDCTL & CH3_HICLK ) | |
| 2056 | new_val = m_AUDF[CHAN4] * 256 + m_AUDF[CHAN3] + DIVADD_HICLK_JOINED; | |
| 2057 | else | |
| 2058 | new_val = (m_AUDF[CHAN4] * 256 + m_AUDF[CHAN3] + DIVADD_LOCLK) * m_clockmult; | |
| 2059 | LOG_SOUND(("POKEY '%s' chan3+4 %d\n", tag(), new_val)); | |
| 2060 | } | |
| 2061 | else | |
| 2062 | { | |
| 2063 | new_val = (m_AUDF[CHAN4] + DIVADD_LOCLK) * m_clockmult; | |
| 2064 | LOG_SOUND(("POKEY '%s' chan4 %d\n", tag(), new_val)); | |
| 2065 | } | |
| 2066 | ||
| 2067 | m_volume[CHAN4] = (m_AUDC[CHAN4] & VOLUME_MASK) * POKEY_DEFAULT_GAIN; | |
| 2068 | m_divisor[CHAN4] = new_val; | |
| 2069 | if( m_interrupt_cb && m_timer[TIMER4] ) | |
| 2070 | m_timer[TIMER4]->adjust(m_clock_period * new_val, m_timer_param[TIMER4], m_timer_period[TIMER4]); | |
| 2071 | } | |
| 2072 | } | |
| 2073 | ||
| 2074 | ||
| 2075 | //------------------------------------------------- | |
| 2076 | // private stuff | |
| 2077 | //------------------------------------------------- | |
| 2078 | ||
| 2079 | inline void pokeyn_device::process_channel(int ch) | |
| 2080 | { | |
| 2081 | int toggle = 0; | |
| 2082 | ||
| 2083 | if( (m_AUDC[ch] & NOTPOLY5) || m_poly5[m_p5] ) | |
| 2084 | { | |
| 2085 | if( m_AUDC[ch] & PURE ) | |
| 2086 | toggle = 1; | |
| 2087 | else | |
| 2088 | if( m_AUDC[ch] & POLY4 ) | |
| 2089 | toggle = m_output[ch] == !m_poly4[m_p4]; | |
| 2090 | else | |
| 2091 | if( m_AUDCTL & POLY9 ) | |
| 2092 | toggle = m_output[ch] == !m_poly9[m_p9]; | |
| 2093 | else | |
| 2094 | toggle = m_output[ch] == !m_poly17[m_p17]; | |
| 2095 | } | |
| 2096 | if( toggle ) | |
| 2097 | { | |
| 2098 | m_output[ch] ^= 1; | |
| 2099 | } | |
| 2100 | /* is this a filtering channel (3/4) and is the filter active? */ | |
| 2101 | ||
| 2102 | if( m_AUDCTL & ((CH1_FILTER|CH2_FILTER) & (0x10 >> ch)) ) | |
| 2103 | { | |
| 2104 | if( ch >= 2) | |
| 2105 | { | |
| 2106 | m_filter_sample[ch-2] = m_output[ch-2]; | |
| 2107 | } | |
| 2108 | } | |
| 2109 | ||
| 2110 | } | |
| 2111 | ||
| 2112 | ||
| 2113 | inline void pokeyn_device::reset_channel(int ch) | |
| 2114 | { | |
| 2115 | m_counter[ch] = m_AUDF[ch] ^ 0xff; | |
| 2116 | } | |
| 2117 | ||
| 2118 | ||
| 2119 | inline void pokeyn_device::inc_chan(int ch) | |
| 2120 | { | |
| 2121 | m_counter[ch] = (m_counter[ch] + 1) & 0xff; | |
| 2122 | if (m_counter[ch] == 0 && m_borrow_cnt[ch] == 0) | |
| 2123 | m_borrow_cnt[ch] = 3; | |
| 2124 | } | |
| 2125 | ||
| 2126 | inline int pokeyn_device::check_borrow(int ch) | |
| 2127 | { | |
| 2128 | if (m_borrow_cnt[ch] > 0) | |
| 2129 | { | |
| 2130 | m_borrow_cnt[ch]--; | |
| 2131 | return (m_borrow_cnt[ch] == 0); | |
| 2132 | } | |
| 2133 | return 0; | |
| 2134 | } | |
| 2135 | ||
| 2136 | void pokeyn_device::pokey_potgo(void) | |
| 2137 | { | |
| 2138 | int pot; | |
| 2139 | ||
| 2140 | LOG(("POKEY #%p pokey_potgo\n", this)); | |
| 2141 | ||
| 2142 | m_ALLPOT = 0xff; | |
| 2143 | ||
| 2144 | for( pot = 0; pot < 8; pot++ ) | |
| 2145 | { | |
| 2146 | m_POTx[pot] = 0xff; | |
| 2147 | if( !m_pot_r[pot].isnull() ) | |
| 2148 | { | |
| 2149 | int r = m_pot_r[pot](pot); | |
| 2150 | ||
| 2151 | LOG(("POKEY %s pot_r(%d) returned $%02x\n", tag(), pot, r)); | |
| 2152 | if( r != -1 ) | |
| 2153 | { | |
| 2154 | if (r > 228) | |
| 2155 | r = 228; | |
| 2156 | ||
| 2157 | /* final value */ | |
| 2158 | m_POTx[pot] = r; | |
| 2159 | m_ptimer[pot]->adjust(((m_SKCTL & SK_PADDLE) ? m_ad_time_fast : m_ad_time_slow) * r, pot); | |
| 2160 | } | |
| 2161 | } | |
| 2162 | } | |
| 2163 | } | |
| 2164 | ||
| 2165 | ||
| 2166 | void pokeyn_device::poly_init(UINT8 *poly, int size, int left, int right, int add) | |
| 2167 | { | |
| 2168 | int mask = (1 << size) - 1; | |
| 2169 | int i, x = 0; | |
| 2170 | ||
| 2171 | LOG_POLY(("poly %d\n", size)); | |
| 2172 | for( i = 0; i < mask; i++ ) | |
| 2173 | { | |
| 2174 | *poly++ = x & 1; | |
| 2175 | LOG_POLY(("%05x: %d\n", x, x&1)); | |
| 2176 | /* calculate next bit */ | |
| 2177 | x = ((x << left) + (x >> right) + add) & mask; | |
| 2178 | } | |
| 2179 | } | |
| 2180 | ||
| 2181 | void pokeyn_device::rand_init(UINT8 *rng, int size, int left, int right, int add) | |
| 2182 | { | |
| 2183 | int mask = (1 << size) - 1; | |
| 2184 | int i, x = 0; | |
| 2185 | ||
| 2186 | LOG_RAND(("rand %d\n", size)); | |
| 2187 | for( i = 0; i < mask; i++ ) | |
| 2188 | { | |
| 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; | |
| 2197 | } | |
| 2198 | } |
| r15218 | r15219 | |
|---|---|---|
| 92 | 92 | |
| 93 | 93 | DECLARE_LEGACY_SOUND_DEVICE(POKEY, pokey); |
| 94 | 94 | |
| 95 | //************************************************************************** | |
| 96 | // TYPE DEFINITIONS | |
| 97 | //************************************************************************** | |
| 98 | ||
| 99 | ||
| 100 | // ======================> pokey_device | |
| 101 | ||
| 102 | class pokeyn_device : public device_t, | |
| 103 | public device_sound_interface | |
| 104 | { | |
| 105 | public: | |
| 106 | // construction/destruction | |
| 107 | pokeyn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); | |
| 108 | ||
| 109 | DECLARE_READ8_MEMBER( read ); | |
| 110 | DECLARE_WRITE8_MEMBER( write ); | |
| 111 | ||
| 112 | protected: | |
| 113 | // device-level overrides | |
| 114 | virtual void device_start(); | |
| 115 | virtual void device_reset(); | |
| 116 | virtual void device_post_load(); | |
| 117 | virtual void device_clock_changed(); | |
| 118 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); | |
| 119 | ||
| 120 | // device_sound_interface overrides | |
| 121 | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); | |
| 122 | ||
| 123 | // configuration state | |
| 124 | pokey_interface m_intf; | |
| 125 | ||
| 126 | private: | |
| 127 | ||
| 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); | |
| 130 | inline void process_channel(int ch); | |
| 131 | inline void reset_channel(int ch); | |
| 132 | inline void inc_chan(int ch); | |
| 133 | inline int check_borrow(int ch); | |
| 134 | void pokey_potgo(void); | |
| 135 | void write_cmd(int offset, UINT8 data); | |
| 136 | ||
| 137 | ||
| 138 | ||
| 139 | // internal state | |
| 140 | sound_stream* m_stream; | |
| 141 | ||
| 142 | INT32 m_clock_cnt[3]; /* clock counters */ | |
| 143 | INT32 m_borrow_cnt[4]; /* borrow counters */ | |
| 144 | ||
| 145 | INT32 m_counter[4]; /* channel counter */ | |
| 146 | INT32 m_divisor[4]; /* channel divisor (modulo value) */ | |
| 147 | UINT32 m_volume[4]; /* channel volume - derived */ | |
| 148 | UINT8 m_output[4]; /* channel output signal (1 active, 0 inactive) */ | |
| 149 | UINT8 m_filter_sample[4]; /* hi-pass filter sample */ | |
| 150 | UINT32 m_p4; /* poly4 index */ | |
| 151 | UINT32 m_p5; /* poly5 index */ | |
| 152 | UINT32 m_p9; /* poly9 index */ | |
| 153 | UINT32 m_p17; /* poly17 index */ | |
| 154 | UINT32 m_r9; /* rand9 index */ | |
| 155 | UINT32 m_r17; /* rand17 index */ | |
| 156 | UINT32 m_clockmult; /* clock multiplier */ | |
| 157 | emu_timer *m_timer[3]; /* timers for channel 1,2 and 4 events */ | |
| 158 | attotime m_timer_period[3]; /* computed periods for these timers */ | |
| 159 | int m_timer_param[3]; /* computed parameters for these timers */ | |
| 160 | emu_timer *m_rtimer; /* timer for calculating the random offset */ | |
| 161 | emu_timer *m_ptimer[8]; /* pot timers */ | |
| 162 | devcb_resolved_read8 m_pot_r[8]; | |
| 163 | devcb_resolved_read8 m_allpot_r; | |
| 164 | devcb_resolved_read8 m_serin_r; | |
| 165 | devcb_resolved_write8 m_serout_w; | |
| 166 | void (*m_interrupt_cb)(device_t *device, int mask); | |
| 167 | UINT8 m_AUDF[4]; /* AUDFx (D200, D202, D204, D206) */ | |
| 168 | UINT8 m_AUDC[4]; /* AUDCx (D201, D203, D205, D207) */ | |
| 169 | UINT8 m_POTx[8]; /* POTx (R/D200-D207) */ | |
| 170 | UINT8 m_AUDCTL; /* AUDCTL (W/D208) */ | |
| 171 | UINT8 m_ALLPOT; /* ALLPOT (R/D208) */ | |
| 172 | UINT8 m_KBCODE; /* KBCODE (R/D209) */ | |
| 173 | UINT8 m_RANDOM; /* RANDOM (R/D20A) */ | |
| 174 | UINT8 m_SERIN; /* SERIN (R/D20D) */ | |
| 175 | UINT8 m_SEROUT; /* SEROUT (W/D20D) */ | |
| 176 | UINT8 m_IRQST; /* IRQST (R/D20E) */ | |
| 177 | UINT8 m_IRQEN; /* IRQEN (W/D20E) */ | |
| 178 | UINT8 m_SKSTAT; /* SKSTAT (R/D20F) */ | |
| 179 | UINT8 m_SKCTL; /* SKCTL (W/D20F) */ | |
| 180 | attotime m_clock_period; | |
| 181 | attotime m_ad_time_fast; | |
| 182 | attotime m_ad_time_slow; | |
| 183 | ||
| 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 | ||
| 192 | }; | |
| 193 | ||
| 194 | ||
| 195 | // device type definition | |
| 196 | extern const device_type POKEYN; | |
| 197 | ||
| 198 | ||
| 95 | 199 | #endif /* __POKEY_H__ */ |
| r15218 | r15219 | |
|---|---|---|
| 3915 | 3915 | // allocate settings |
| 3916 | 3916 | setting_alloc(defval & mask, DEF_STR(Off)); |
| 3917 | 3917 | setting_alloc(~defval & mask, DEF_STR(On)); |
| 3918 | // clear cursettings set by setting_alloc | |
| 3919 | m_cursetting = NULL; | |
| 3918 | 3920 | } |
| 3919 | 3921 | |
| 3920 | 3922 |
| r15218 | r15219 | |
|---|---|---|
| 105 | 105 | "\t\t\t<!ATTLIST chip type (cpu|audio) #REQUIRED>\n" |
| 106 | 106 | "\t\t\t<!ATTLIST chip clock CDATA #IMPLIED>\n" |
| 107 | 107 | "\t\t<!ELEMENT display EMPTY>\n" |
| 108 | "\t\t\t<!ATTLIST display tag CDATA #IMPLIED>\n" | |
| 108 | 109 | "\t\t\t<!ATTLIST display type (raster|vector|lcd|unknown) #REQUIRED>\n" |
| 109 | 110 | "\t\t\t<!ATTLIST display rotate (0|90|180|270) #REQUIRED>\n" |
| 110 | 111 | "\t\t\t<!ATTLIST display flipx (yes|no) \"no\">\n" |
| r15218 | r15219 | |
| 318 | 319 | output_device_roms(); |
| 319 | 320 | output_sample(); |
| 320 | 321 | output_chips(m_drivlist.config().root_device(), ""); |
| 321 | output_display(m_drivlist.config().root_device()); | |
| 322 | output_display(m_drivlist.config().root_device(), ""); | |
| 322 | 323 | output_sound(m_drivlist.config().root_device()); |
| 323 | 324 | output_input(portlist); |
| 324 | 325 | output_switches(portlist, "", IPT_DIPSWITCH, "dipswitch", "dipvalue"); |
| r15218 | r15219 | |
| 372 | 373 | |
| 373 | 374 | output_rom(device); |
| 374 | 375 | output_chips(device, devtag); |
| 375 | output_display(device); | |
| 376 | output_display(device, devtag); | |
| 376 | 377 | if (has_speaker) |
| 377 | 378 | output_sound(device); |
| 378 | 379 | if (has_input) |
| r15218 | r15219 | |
| 679 | 680 | // displays |
| 680 | 681 | //------------------------------------------------- |
| 681 | 682 | |
| 682 | void info_xml_creator::output_display(device_t &device) | |
| 683 | void info_xml_creator::output_display(device_t &device, const char *root_tag) | |
| 683 | 684 | { |
| 684 | 685 | // iterate over screens |
| 685 | 686 | screen_device_iterator iter(device); |
| 686 | 687 | for (const screen_device *screendev = iter.first(); screendev != NULL; screendev = iter.next()) |
| 687 | 688 | { |
| 688 | fprintf(m_output, "\t\t<display"); | |
| 689 | ||
| 690 | switch (screendev->screen_type()) | |
| 689 | if (strcmp(screendev->tag(), device.tag())) | |
| 691 | 690 | { |
| 692 | case SCREEN_TYPE_RASTER: fprintf(m_output, " type=\"raster\""); break; | |
| 693 | case SCREEN_TYPE_VECTOR: fprintf(m_output, " type=\"vector\""); break; | |
| 694 | case SCREEN_TYPE_LCD: fprintf(m_output, " type=\"lcd\""); break; | |
| 695 | default: fprintf(m_output, " type=\"unknown\""); break; | |
| 691 | astring newtag(screendev->tag()), oldtag(":"); | |
| 692 | newtag.substr(newtag.find(oldtag.cat(root_tag)) + oldtag.len()); | |
| 693 | ||
| 694 | fprintf(m_output, "\t\t<display"); | |
| 695 | fprintf(m_output, " tag=\"%s\"", xml_normalize_string(newtag)); | |
| 696 | ||
| 697 | switch (screendev->screen_type()) | |
| 698 | { | |
| 699 | case SCREEN_TYPE_RASTER: fprintf(m_output, " type=\"raster\""); break; | |
| 700 | case SCREEN_TYPE_VECTOR: fprintf(m_output, " type=\"vector\""); break; | |
| 701 | case SCREEN_TYPE_LCD: fprintf(m_output, " type=\"lcd\""); break; | |
| 702 | default: fprintf(m_output, " type=\"unknown\""); break; | |
| 703 | } | |
| 704 | ||
| 705 | // output the orientation as a string | |
| 706 | switch (m_drivlist.driver().flags & ORIENTATION_MASK) | |
| 707 | { | |
| 708 | case ORIENTATION_FLIP_X: | |
| 709 | fprintf(m_output, " rotate=\"0\" flipx=\"yes\""); | |
| 710 | break; | |
| 711 | case ORIENTATION_FLIP_Y: | |
| 712 | fprintf(m_output, " rotate=\"180\" flipx=\"yes\""); | |
| 713 | break; | |
| 714 | case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: | |
| 715 | fprintf(m_output, " rotate=\"180\""); | |
| 716 | break; | |
| 717 | case ORIENTATION_SWAP_XY: | |
| 718 | fprintf(m_output, " rotate=\"90\" flipx=\"yes\""); | |
| 719 | break; | |
| 720 | case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: | |
| 721 | fprintf(m_output, " rotate=\"90\""); | |
| 722 | break; | |
| 723 | case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: | |
| 724 | fprintf(m_output, " rotate=\"270\""); | |
| 725 | break; | |
| 726 | case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: | |
| 727 | fprintf(m_output, " rotate=\"270\" flipx=\"yes\""); | |
| 728 | break; | |
| 729 | default: | |
| 730 | fprintf(m_output, " rotate=\"0\""); | |
| 731 | break; | |
| 732 | } | |
| 733 | ||
| 734 | // output width and height only for games that are not vector | |
| 735 | if (screendev->screen_type() != SCREEN_TYPE_VECTOR) | |
| 736 | { | |
| 737 | const rectangle &visarea = screendev->visible_area(); | |
| 738 | fprintf(m_output, " width=\"%d\"", visarea.width()); | |
| 739 | fprintf(m_output, " height=\"%d\"", visarea.height()); | |
| 740 | } | |
| 741 | ||
| 742 | // output refresh rate | |
| 743 | fprintf(m_output, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds())); | |
| 744 | ||
| 745 | // output raw video parameters only for games that are not vector | |
| 746 | // and had raw parameters specified | |
| 747 | if (screendev->screen_type() != SCREEN_TYPE_VECTOR && !screendev->oldstyle_vblank_supplied()) | |
| 748 | { | |
| 749 | int pixclock = screendev->width() * screendev->height() * ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds()); | |
| 750 | ||
| 751 | fprintf(m_output, " pixclock=\"%d\"", pixclock); | |
| 752 | fprintf(m_output, " htotal=\"%d\"", screendev->width()); | |
| 753 | fprintf(m_output, " hbend=\"%d\"", screendev->visible_area().min_x); | |
| 754 | fprintf(m_output, " hbstart=\"%d\"", screendev->visible_area().max_x+1); | |
| 755 | fprintf(m_output, " vtotal=\"%d\"", screendev->height()); | |
| 756 | fprintf(m_output, " vbend=\"%d\"", screendev->visible_area().min_y); | |
| 757 | fprintf(m_output, " vbstart=\"%d\"", screendev->visible_area().max_y+1); | |
| 758 | } | |
| 759 | fprintf(m_output, " />\n"); | |
| 696 | 760 | } |
| 697 | ||
| 698 | // output the orientation as a string | |
| 699 | switch (m_drivlist.driver().flags & ORIENTATION_MASK) | |
| 700 | { | |
| 701 | case ORIENTATION_FLIP_X: | |
| 702 | fprintf(m_output, " rotate=\"0\" flipx=\"yes\""); | |
| 703 | break; | |
| 704 | case ORIENTATION_FLIP_Y: | |
| 705 | fprintf(m_output, " rotate=\"180\" flipx=\"yes\""); | |
| 706 | break; | |
| 707 | case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: | |
| 708 | fprintf(m_output, " rotate=\"180\""); | |
| 709 | break; | |
| 710 | case ORIENTATION_SWAP_XY: | |
| 711 | fprintf(m_output, " rotate=\"90\" flipx=\"yes\""); | |
| 712 | break; | |
| 713 | case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: | |
| 714 | fprintf(m_output, " rotate=\"90\""); | |
| 715 | break; | |
| 716 | case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: | |
| 717 | fprintf(m_output, " rotate=\"270\""); | |
| 718 | break; | |
| 719 | case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: | |
| 720 | fprintf(m_output, " rotate=\"270\" flipx=\"yes\""); | |
| 721 | break; | |
| 722 | default: | |
| 723 | fprintf(m_output, " rotate=\"0\""); | |
| 724 | break; | |
| 725 | } | |
| 726 | ||
| 727 | // output width and height only for games that are not vector | |
| 728 | if (screendev->screen_type() != SCREEN_TYPE_VECTOR) | |
| 729 | { | |
| 730 | const rectangle &visarea = screendev->visible_area(); | |
| 731 | fprintf(m_output, " width=\"%d\"", visarea.width()); | |
| 732 | fprintf(m_output, " height=\"%d\"", visarea.height()); | |
| 733 | } | |
| 734 | ||
| 735 | // output refresh rate | |
| 736 | fprintf(m_output, " refresh=\"%f\"", ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds())); | |
| 737 | ||
| 738 | // output raw video parameters only for games that are not vector | |
| 739 | // and had raw parameters specified | |
| 740 | if (screendev->screen_type() != SCREEN_TYPE_VECTOR && !screendev->oldstyle_vblank_supplied()) | |
| 741 | { | |
| 742 | int pixclock = screendev->width() * screendev->height() * ATTOSECONDS_TO_HZ(screendev->refresh_attoseconds()); | |
| 743 | ||
| 744 | fprintf(m_output, " pixclock=\"%d\"", pixclock); | |
| 745 | fprintf(m_output, " htotal=\"%d\"", screendev->width()); | |
| 746 | fprintf(m_output, " hbend=\"%d\"", screendev->visible_area().min_x); | |
| 747 | fprintf(m_output, " hbstart=\"%d\"", screendev->visible_area().max_x+1); | |
| 748 | fprintf(m_output, " vtotal=\"%d\"", screendev->height()); | |
| 749 | fprintf(m_output, " vbend=\"%d\"", screendev->visible_area().min_y); | |
| 750 | fprintf(m_output, " vbstart=\"%d\"", screendev->visible_area().max_y+1); | |
| 751 | } | |
| 752 | fprintf(m_output, " />\n"); | |
| 753 | 761 | } |
| 754 | 762 | } |
| 755 | 763 |
| r15218 | r15219 | |
|---|---|---|
| 68 | 68 | void output_device_roms(); |
| 69 | 69 | void output_sample(); |
| 70 | 70 | void output_chips(device_t &device, const char *root_tag); |
| 71 | void output_display(device_t &device); | |
| 71 | void output_display(device_t &device, const char *root_tag); | |
| 72 | 72 | void output_sound(device_t &device); |
| 73 | 73 | void output_input(const ioport_list &portlist); |
| 74 | 74 | void output_switches(const ioport_list &portlist, const char *root_tag, int type, const char *outertag, const char *innertag); |
| r15218 | r15219 | |
|---|---|---|
| 1406 | 1406 | case CHDERR_NOT_SUPPORTED: return "operation not supported"; |
| 1407 | 1407 | case CHDERR_METADATA_NOT_FOUND: return "can't find metadata"; |
| 1408 | 1408 | case CHDERR_INVALID_METADATA_SIZE: return "invalid metadata size"; |
| 1409 | case CHDERR_UNSUPPORTED_VERSION: return "unsupported CHD version"; | |
| 1409 | case CHDERR_UNSUPPORTED_VERSION: return "mismatched DIFF and CHD or unsupported CHD version"; | |
| 1410 | 1410 | case CHDERR_VERIFY_INCOMPLETE: return "incomplete verify"; |
| 1411 | 1411 | case CHDERR_INVALID_METADATA: return "invalid metadata"; |
| 1412 | 1412 | case CHDERR_INVALID_STATE: return "invalid state"; |
| r15218 | r15219 | |
|---|---|---|
| 9 | 9 | # |
| 10 | 10 | ########################################################################### |
| 11 | 11 | |
| 12 | # add some additional include libraries for the mame files | |
| 13 | INCPATH += \ | |
| 14 | -I$(SRC)/mame \ | |
| 12 | 15 | |
| 13 | 16 | LDPSRC = $(SRC)/ldplayer |
| 14 | 17 | LDPOBJ = $(OBJ)/ldplayer |
| r15218 | r15219 | |
|---|---|---|
| 11 | 11 | |
| 12 | 12 | #include "emu.h" |
| 13 | 13 | #include "emuopts.h" |
| 14 | #include "chd.h" | |
| 14 | 15 | #include "cpu/mcs48/mcs48.h" |
| 15 | 16 | #include "machine/ldpr8210.h" |
| 16 | 17 | #include "machine/ldv1000.h" |
| r15218 | r15219 | |
| 19 | 20 | #include "pr8210.lh" |
| 20 | 21 | |
| 21 | 22 | |
| 23 | #define APPNAME "MAME" | |
| 24 | #define APPNAME_LOWER "mame" | |
| 25 | #define CONFIGNAME "mame" | |
| 26 | #define APPLONGNAME "M.A.M.E." | |
| 27 | #define FULLLONGNAME "Multiple Arcade Machine Emulator" | |
| 28 | #define CAPGAMENOUN "GAME" | |
| 29 | #define CAPSTARTGAMENOUN "Game" | |
| 30 | #define GAMENOUN "game" | |
| 31 | #define GAMESNOUN "games" | |
| 32 | #define COPYRIGHT "Copyright Nicola Salmoria\nand the MAME team\nhttp://mamedev.org" | |
| 33 | #define COPYRIGHT_INFO "Copyright Nicola Salmoria and the MAME team" | |
| 34 | #define DISCLAIMER "MAME is an emulator: it reproduces, more or less faithfully, the behaviour of\n" \ | |
| 35 | "several arcade machines. But hardware is useless without software, so an image\n" \ | |
| 36 | "of the ROMs which run on that hardware is required. Such ROMs, like any other\n" \ | |
| 37 | "commercial software, are copyrighted material and it is therefore illegal to\n" \ | |
| 38 | "use them if you don't own the original arcade machine. Needless to say, ROMs\n" \ | |
| 39 | "are not distributed together with MAME. Distribution of MAME together with ROM\n" \ | |
| 40 | "images is a violation of copyright law and should be promptly reported to the\n" \ | |
| 41 | "authors so that appropriate legal action can be taken.\n" | |
| 42 | #define USAGE "Usage: %s [%s] [options]" | |
| 43 | #define XML_ROOT "mame" | |
| 44 | #define XML_TOP "game" | |
| 45 | #define STATE_MAGIC_NUM "MAMESAVE" | |
| 22 | 46 | |
| 47 | const char * emulator_info::get_appname() { return APPNAME;} | |
| 48 | const char * emulator_info::get_appname_lower() { return APPNAME_LOWER;} | |
| 49 | const char * emulator_info::get_configname() { return CONFIGNAME;} | |
| 50 | const char * emulator_info::get_applongname() { return APPLONGNAME;} | |
| 51 | const char * emulator_info::get_fulllongname() { return FULLLONGNAME;} | |
| 52 | const char * emulator_info::get_capgamenoun() { return CAPGAMENOUN;} | |
| 53 | const char * emulator_info::get_capstartgamenoun() { return CAPSTARTGAMENOUN;} | |
| 54 | const char * emulator_info::get_gamenoun() { return GAMENOUN;} | |
| 55 | const char * emulator_info::get_gamesnoun() { return GAMESNOUN;} | |
| 56 | const char * emulator_info::get_copyright() { return COPYRIGHT;} | |
| 57 | const char * emulator_info::get_copyright_info() { return COPYRIGHT_INFO;} | |
| 58 | const char * emulator_info::get_disclaimer() { return DISCLAIMER;} | |
| 59 | const char * emulator_info::get_usage() { return USAGE;} | |
| 60 | const char * emulator_info::get_xml_root() { return XML_ROOT;} | |
| 61 | const char * emulator_info::get_xml_top() { return XML_TOP;} | |
| 62 | const char * emulator_info::get_state_magic_num() { return STATE_MAGIC_NUM;} | |
| 63 | void emulator_info::printf_usage(const char *par1, const char *par2) { mame_printf_info(USAGE, par1, par2); } | |
| 64 | ||
| 23 | 65 | /************************************* |
| 24 | 66 | * |
| 25 | 67 | * Constants |
| r15218 | r15219 | |
| 39 | 81 | ldplayer_state(const machine_config &mconfig, device_type type, const char *tag) |
| 40 | 82 | : driver_device(mconfig, type, tag), |
| 41 | 83 | m_last_controls(0), |
| 42 | m_playing(false), | |
| 43 | m_laserdisc(*this, "laserdisc") { } | |
| 84 | m_playing(false) { } | |
| 44 | 85 | |
| 45 | 86 | // callback hook |
| 46 | static chd_file *get_disc_static(device | |
| 87 | static chd_file *get_disc_static(laserdisc_device | |
| 47 | 88 | |
| 48 | 89 | protected: |
| 49 | 90 | // device overrides |
| r15218 | r15219 | |
| 99 | 140 | astring m_filename; |
| 100 | 141 | ioport_value m_last_controls; |
| 101 | 142 | bool m_playing; |
| 102 | required_device<laserdisc_device> m_laserdisc; | |
| 103 | 143 | }; |
| 104 | 144 | |
| 105 | 145 | |
| r15218 | r15219 | |
| 108 | 148 | public: |
| 109 | 149 | // construction/destruction |
| 110 | 150 | pr8210_state(const machine_config &mconfig, device_type type, const char *tag) |
| 111 | : ldplayer_state(machine, config), | |
| 112 | m_bit_timer(timer_alloc(TIMER_ID_BIT)), | |
| 151 | : ldplayer_state(mconfig, type, tag), | |
| 152 | m_laserdisc(*this, "laserdisc"), | |
| 113 | 153 | m_command_buffer_in(0), |
| 114 | 154 | m_command_buffer_out(0) { } |
| 115 | 155 | |
| 116 | 156 | protected: |
| 117 | 157 | // device overrides |
| 118 | 158 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 159 | virtual void machine_start(); | |
| 119 | 160 | virtual void machine_reset(); |
| 120 | 161 | |
| 121 | 162 | // command execution hook |
| r15218 | r15219 | |
| 131 | 172 | TIMER_ID_BIT_OFF |
| 132 | 173 | }; |
| 133 | 174 | |
| 175 | required_device<pioneer_pr8210_device> m_laserdisc; | |
| 176 | ||
| 134 | 177 | // internal state |
| 135 | 178 | emu_timer *m_bit_timer; |
| 136 | 179 | UINT32 m_command_buffer_in; |
| r15218 | r15219 | |
| 144 | 187 | public: |
| 145 | 188 | // construction/destruction |
| 146 | 189 | ldv1000_state(const machine_config &mconfig, device_type type, const char *tag) |
| 147 | : ldplayer_state(machine, config) { } | |
| 190 | : ldplayer_state(mconfig, type, tag), | |
| 191 | m_laserdisc(*this, "laserdisc") { } | |
| 148 | 192 | |
| 149 | 193 | protected: |
| 194 | required_device<pioneer_ldv1000_device> m_laserdisc; | |
| 195 | ||
| 150 | 196 | // command execution hook |
| 151 | 197 | virtual void execute_command(int command); |
| 152 | 198 | }; |
| r15218 | r15219 | |
| 161 | 207 | |
| 162 | 208 | chd_file *ldplayer_state::get_disc() |
| 163 | 209 | { |
| 210 | bool found = FALSE; | |
| 164 | 211 | // open a path to the ROMs and find the first CHD file |
| 165 | 212 | file_enumerator path(machine().options().media_path()); |
| 166 | 213 | |
| r15218 | r15219 | |
| 182 | 229 | file_error filerr = image_file.open(dir->name); |
| 183 | 230 | if (filerr == FILERR_NONE) |
| 184 | 231 | { |
| 185 | astring fullpath(image_file | |
| 232 | astring fullpath(image_file. | |
| 186 | 233 | image_file.close(); |
| 187 | 234 | |
| 188 | 235 | // try to open the CHD |
| r15218 | r15219 | |
| 190 | 237 | if (set_disk_handle(machine(), "laserdisc", fullpath) == CHDERR_NONE) |
| 191 | 238 | { |
| 192 | 239 | m_filename.cpy(dir->name); |
| 240 | found = TRUE; | |
| 193 | 241 | break; |
| 194 | 242 | } |
| 195 | 243 | } |
| 196 | ||
| 197 | // close the file on failure | |
| 198 | auto_free(machine(), image_file); | |
| 199 | image_file = NULL; | |
| 200 | 244 | } |
| 201 | 245 | } |
| 202 | 246 | |
| 203 | 247 | // if we failed, pop a message and exit |
| 204 | if ( | |
| 248 | if ( | |
| 205 | 249 | throw emu_fatalerror("No valid image file found!\n"); |
| 206 | 250 | |
| 207 | 251 | return get_disk_handle(machine(), "laserdisc"); |
| r15218 | r15219 | |
| 358 | 402 | // if we have bits, process |
| 359 | 403 | if (bitsleft != 0) |
| 360 | 404 | { |
| 361 | // assert the line and set a timer for deassertion | |
| 362 | laserdisc_line_w(m_laserdisc, LASERDISC_LINE_CONTROL, ASSERT_LINE); | |
| 405 | // assert the line and set a timer for deassertion | |
| 406 | m_laserdisc->control_w(ASSERT_LINE); | |
| 363 | 407 | timer_set(attotime::from_usec(250), TIMER_ID_BIT_OFF); |
| 364 | 408 | |
| 365 | 409 | // space 0 bits apart by 1msec, and 1 bits by 2msec |
| r15218 | r15219 | |
| 380 | 424 | |
| 381 | 425 | // deassert the control line |
| 382 | 426 | case TIMER_ID_BIT_OFF: |
| 383 | laserdisc | |
| 427 | m_laserdisc->control_w( | |
| 384 | 428 | break; |
| 385 | 429 | |
| 386 | 430 | // others to the parent class |
| r15218 | r15219 | |
| 390 | 434 | } |
| 391 | 435 | } |
| 392 | 436 | |
| 437 | void pr8210_state::machine_start() | |
| 438 | { | |
| 439 | ldplayer_state::machine_start(); | |
| 440 | m_bit_timer = timer_alloc(TIMER_ID_BIT); | |
| 441 | } | |
| 393 | 442 | |
| 394 | 443 | void pr8210_state::machine_reset() |
| 395 | 444 | { |
| r15218 | r15219 | |
| 520 | 569 | switch (command) |
| 521 | 570 | { |
| 522 | 571 | case CMD_SCAN_REVERSE: |
| 523 | laserdisc | |
| 572 | m_laserdisc->data_w( | |
| 524 | 573 | m_playing = true; |
| 525 | 574 | break; |
| 526 | 575 | |
| 527 | 576 | case CMD_STEP_REVERSE: |
| 528 | laserdisc | |
| 577 | m_laserdisc->data_w( | |
| 529 | 578 | m_playing = false; |
| 530 | 579 | break; |
| 531 | 580 | |
| 532 | 581 | case CMD_SCAN_FORWARD: |
| 533 | laserdisc | |
| 582 | m_laserdisc->data_w( | |
| 534 | 583 | m_playing = true; |
| 535 | 584 | break; |
| 536 | 585 | |
| 537 | 586 | case CMD_STEP_FORWARD: |
| 538 | laserdisc | |
| 587 | m_laserdisc->data_w( | |
| 539 | 588 | m_playing = false; |
| 540 | 589 | break; |
| 541 | 590 | |
| 542 | 591 | case CMD_PLAY: |
| 543 | laserdisc | |
| 592 | m_laserdisc->data_w( | |
| 544 | 593 | m_playing = true; |
| 545 | 594 | break; |
| 546 | 595 | |
| 547 | 596 | case CMD_PAUSE: |
| 548 | laserdisc | |
| 597 | m_laserdisc->data_w( | |
| 549 | 598 | m_playing = false; |
| 550 | 599 | break; |
| 551 | 600 | |
| 552 | 601 | case CMD_FRAME_TOGGLE: |
| 553 | laserdisc | |
| 602 | m_laserdisc->data_w( | |
| 554 | 603 | break; |
| 555 | 604 | |
| 556 | 605 | case CMD_0: |
| r15218 | r15219 | |
| 563 | 612 | case CMD_7: |
| 564 | 613 | case CMD_8: |
| 565 | 614 | case CMD_9: |
| 566 | laserdisc | |
| 615 | m_laserdisc->data_w( | |
| 567 | 616 | break; |
| 568 | 617 | |
| 569 | 618 | case CMD_SEARCH: |
| 570 | laserdisc | |
| 619 | m_laserdisc->data_w( | |
| 571 | 620 | m_playing = false; |
| 572 | 621 | break; |
| 573 | 622 | } |
| r15218 | r15219 | |
| 618 | 667 | *************************************/ |
| 619 | 668 | |
| 620 | 669 | static MACHINE_CONFIG_START( ldplayer_ntsc, ldplayer_state ) |
| 621 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") | |
| 622 | MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc") | |
| 623 | 670 | MACHINE_CONFIG_END |
| 624 | 671 | |
| 625 | 672 | |
| 626 | 673 | static MACHINE_CONFIG_DERIVED_CLASS( ldv1000, ldplayer_ntsc, ldv1000_state ) |
| 627 | 674 | MCFG_LASERDISC_LDV1000_ADD("laserdisc") |
| 675 | MCFG_LASERDISC_GET_DISC(laserdisc_get_disc_delegate(FUNC(ldplayer_state::get_disc_static), device)) | |
| 676 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") | |
| 628 | 677 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| 629 | 678 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 630 | MCFG_LASERDISC_ | |
| 679 | MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "l | |
| 631 | 680 | MACHINE_CONFIG_END |
| 632 | 681 | |
| 633 | 682 | |
| 634 | 683 | static MACHINE_CONFIG_DERIVED_CLASS( pr8210, ldplayer_ntsc, pr8210_state ) |
| 635 | 684 | MCFG_LASERDISC_PR8210_ADD("laserdisc") |
| 685 | MCFG_LASERDISC_GET_DISC(laserdisc_get_disc_delegate(FUNC(ldplayer_state::get_disc_static), device)) | |
| 686 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") | |
| 636 | 687 | MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) |
| 637 | 688 | MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) |
| 638 | MCFG_LASERDISC_ | |
| 689 | MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "l | |
| 639 | 690 | MACHINE_CONFIG_END |
| 640 | 691 | |
| 641 | 692 |
| Previous | 15994 Revisions | Next |