diff options
Diffstat (limited to 'src/mame/drivers/nes.cpp')
-rw-r--r-- | src/mame/drivers/nes.cpp | 118 |
1 files changed, 89 insertions, 29 deletions
diff --git a/src/mame/drivers/nes.cpp b/src/mame/drivers/nes.cpp index 2e22e40df43..faa9b12732f 100644 --- a/src/mame/drivers/nes.cpp +++ b/src/mame/drivers/nes.cpp @@ -56,16 +56,16 @@ void nes_state::ppu_nmi(int *ppu_regs) static MACHINE_CONFIG_START( nes, nes_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", N2A03, NTSC_CLOCK) + MCFG_CPU_ADD("maincpu", N2A03, NTSC_APU_CLOCK) MCFG_CPU_PROGRAM_MAP(nes_map) MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60.098) + MCFG_SCREEN_REFRESH_RATE(60.0988) // This isn't used so much to calulate the vblank duration (the PPU code tracks that manually) but to determine // the number of cycles in each scanline for the PPU scanline timer. Since the PPU has 20 vblank scanlines + 2 // non-rendering scanlines, we compensate. This ends up being 2500 cycles for the non-rendering portion, 2273 // cycles for the actual vblank period. - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((113.66/(NTSC_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_NTSC-PPU_VBLANK_FIRST_SCANLINE+1+2))) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((113.66/(NTSC_APU_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_NTSC-PPU_VBLANK_FIRST_SCANLINE+1+2))) MCFG_SCREEN_SIZE(32*8, 262) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(nes_state, screen_update_nes) @@ -97,15 +97,13 @@ static MACHINE_CONFIG_START( nes, nes_state ) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( nespal, nes ) - /* basic machine hardware */ // MCFG_CPU_MODIFY("maincpu") -// MCFG_CPU_CLOCK(PAL_CLOCK) // this doesn't get inherited by the APU with DERIVED_CLOCK! +// MCFG_CPU_CLOCK(PAL_APU_CLOCK) // this doesn't get inherited by the APU with DERIVED_CLOCK! - MCFG_CPU_REPLACE("maincpu", N2A03, PAL_CLOCK) + MCFG_CPU_REPLACE("maincpu", N2A03, PAL_APU_CLOCK) MCFG_CPU_PROGRAM_MAP(nes_map) - MCFG_DEVICE_REMOVE("ppu") MCFG_PPU2C07_ADD("ppu") MCFG_PPU2C0X_CPU("maincpu") @@ -113,36 +111,44 @@ static MACHINE_CONFIG_DERIVED( nespal, nes ) /* video hardware */ MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(53.355) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2))) + MCFG_SCREEN_REFRESH_RATE(50.0070) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_APU_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2))) MCFG_SCREEN_SIZE(32*8, 312) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) +MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( famicom, nes ) + MCFG_DEVICE_REMOVE("ctrl1") + MCFG_DEVICE_REMOVE("ctrl2") + MCFG_NES_CONTROL_PORT_ADD("ctrl1", fc_control_port1_devices, "joypad") + MCFG_NES_CONTROL_PORT_ADD("ctrl2", fc_control_port2_devices, "joypad") + MCFG_FC_EXPANSION_PORT_ADD("exp", fc_expansion_devices, nullptr) + MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) + MCFG_SOFTWARE_LIST_ADD("flop_list", "famicom_flop") + MCFG_SOFTWARE_LIST_ADD("cass_list", "famicom_cass") MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( dendy, nes ) - - /* basic machine hardware */ +static MACHINE_CONFIG_DERIVED( nespalc, nespal ) // MCFG_CPU_MODIFY( "maincpu" ) -// MCFG_CPU_CLOCK( 26601712/15 ) // this doesn't get inherited by the APU with DERIVED_CLOCK! +// MCFG_CPU_CLOCK(PALC_APU_CLOCK) // this doesn't get inherited by the APU with DERIVED_CLOCK! - MCFG_CPU_REPLACE("maincpu", N2A03, 26601712/15 )/* 26.601712MHz / 15 == 1.77344746666... MHz */ + MCFG_CPU_REPLACE("maincpu", N2A03, PALC_APU_CLOCK) MCFG_CPU_PROGRAM_MAP(nes_map) + /* UMC 6538 and friends -- extends time for rendering dummy scanlines */ MCFG_DEVICE_REMOVE("ppu") - MCFG_PPU2C07_ADD("ppu") + MCFG_PPUPALC_ADD("ppu") MCFG_PPU2C0X_CPU("maincpu") MCFG_PPU2C0X_SET_NMI(nes_state, ppu_nmi) /* video hardware */ MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_REFRESH_RATE(50.00697796827) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((106.53/(PAL_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE+1+2))) - + MCFG_SCREEN_REFRESH_RATE(50.0070) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC((113.66/(PALC_APU_CLOCK/1000000)) * (PPU_VBLANK_LAST_SCANLINE_PAL-PPU_VBLANK_FIRST_SCANLINE_PALC+1+2))) MACHINE_CONFIG_END -static MACHINE_CONFIG_DERIVED( famicom, nes ) +static MACHINE_CONFIG_DERIVED( famipalc, nespalc ) MCFG_DEVICE_REMOVE("ctrl1") MCFG_DEVICE_REMOVE("ctrl2") MCFG_NES_CONTROL_PORT_ADD("ctrl1", fc_control_port1_devices, "joypad") @@ -150,10 +156,16 @@ static MACHINE_CONFIG_DERIVED( famicom, nes ) MCFG_FC_EXPANSION_PORT_ADD("exp", fc_expansion_devices, nullptr) MCFG_NESCTRL_BRIGHTPIXEL_CB(nes_state, bright_pixel) - MCFG_SOFTWARE_LIST_ADD("flop_list", "famicom_flop") MCFG_SOFTWARE_LIST_ADD("cass_list", "famicom_cass") MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( suborkbd, famipalc ) + /* TODO: emulate the parallel port bus! */ + MCFG_DEVICE_MODIFY("exp") + MCFG_SLOT_DEFAULT_OPTION("subor_keyboard") + MCFG_SLOT_FIXED(true) +MACHINE_CONFIG_END + void nes_state::setup_disk(nes_disksys_device *slot) { if (slot) @@ -285,6 +297,13 @@ ROM_START( m82 ) ROM_LOAD( "m82_v1_0.bin", 0x10000, 0x4000, CRC(7d56840a) SHA1(cbd2d14fa073273ba58367758f40d67fd8a9106d) ) ROM_END +ROM_START( m82p ) + /* same as m82 */ + ROM_REGION( 0x14000, "maincpu", 0 ) /* Main RAM + program banks */ + /* Banks to be mapped at 0xe000? More investigations needed... */ + ROM_LOAD( "m82_v1_0.bin", 0x10000, 0x4000, CRC(7d56840a) SHA1(cbd2d14fa073273ba58367758f40d67fd8a9106d) ) +ROM_END + // see http://www.disgruntleddesigner.com/chrisc/drpcjr/index.html // and http://www.disgruntleddesigner.com/chrisc/drpcjr/DrPCJrMemMap.txt ROM_START( drpcjr ) @@ -296,14 +315,30 @@ ROM_START( drpcjr ) // ROM_LOAD("drpcjr_v1_5_gg.bin", 0x10000, 0x8000, CRC(98f2033b) SHA1(93c114da787a19279d1a46667c2f69b49e25d4f1) ) ROM_END +ROM_START( iq501 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + +ROM_START( iq502 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + ROM_START( dendy ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ ROM_END +ROM_START( dendy2 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + ROM_START( gchinatv ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ ROM_END +ROM_START( sb486 ) + ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASE00 ) /* Main RAM */ +ROM_END + /*************************************************************************** Game driver(s) @@ -311,12 +346,37 @@ ROM_END ***************************************************************************/ /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1985, nes, 0, 0, nes, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System / Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1987, nespal, nes, 0, nespal, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1983, famicom, nes, 0, famicom, famicom, nes_state, famicom, "Nintendo", "Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1983, fds, nes, 0, fds, famicom, nes_state, famicom, "Nintendo", "Famicom (w/ Disk System add-on)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1986, famitwin, nes, 0, famitwin, famicom, nes_state, famicom, "Sharp", "Famicom Twin", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 198?, m82, nes, 0, nes, nes, driver_device, 0, "Nintendo", "M82 Display Unit", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) -CONS( 1996, drpcjr, nes, 0, famicom, famicom, nes_state, famicom, "Bung", "Doctor PC Jr", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 1992, dendy, nes, 0, dendy, nes, driver_device, 0, "Steepler", "Dendy Classic", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -CONS( 198?, gchinatv, nes, 0, nespal, nes, driver_device, 0, "Golden China", "Golden China TV Game", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) + +/* Nintendo Entertainment System hardware */ +CONS( 1985, nes, 0, 0, nes, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System / Famicom (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1987, nespal, nes, 0, nespal, nes, driver_device, 0, "Nintendo", "Nintendo Entertainment System (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +// M82 Display Unit +// supports up to twelve cartridge slots +CONS( 198?, m82, nes, 0, nes, nes, driver_device, 0, "Nintendo", "M82 Display Unit (NTSC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +CONS( 198?, m82p, nes, 0, nespal, nes, driver_device, 0, "Nintendo", "M82 Display Unit (PAL)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) + +/* Famicom hardware */ +CONS( 1983, famicom, 0, 0, famicom, famicom, nes_state, famicom, "Nintendo", "Famicom", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1983, fds, famicom, 0, fds, famicom, nes_state, famicom, "Nintendo", "Famicom (w/ Disk System add-on)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1986, famitwin, famicom, 0, famitwin, famicom, nes_state, famicom, "Sharp", "Famicom Twin", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) + +/* Clone hardware */ +/* Many knockoffs using derivatives of the UMC board design, later incorporated into single CMOS chips, were manufactured before and past the end of the Famicom's timeline. */ + +/* !! PAL clones documented here !! */ +// Famicom-based +CONS( 1992, iq501, 0, 0, famipalc, nes, nes_state, famicom, "Micro Genius", "IQ-501", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1992, iq502, 0, 0, famipalc, nes, nes_state, famicom, "Micro Genius", "IQ-502", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1992, dendy, iq501, 0, famipalc, nes, nes_state, famicom, "Steepler", "Dendy Classic 1", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 1992, dendy2, iq502, 0, famipalc, nes, nes_state, famicom, "Steepler", "Dendy Classic 2", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +CONS( 198?, gchinatv, 0, 0, famipalc, nes, nes_state, famicom, "Golden China", "Golden China TV Game", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) + +// Subor/Xiao Ba Wang hardware and derivatives +// These clones implement a keyboard and a parallel port for printing from a word processor. Later models have mice, PS/2 ports, serial ports and a floppy drive. +CONS( 1993, sb486, 0, 0, suborkbd, nes, nes_state, famicom, "Subor", "SB-486", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) + +/* !! NTSC clones documented here !! */ +// Famicom-based +// Bung hardware +// Mice, keyboard, etc, including a floppy drive that allows you to run games with a selection of 4 internal "mappers" available on the system. +CONS( 1996, drpcjr, 0, 0, famicom, famicom, nes_state, famicom, "Bung", "Doctor PC Jr", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) |