diff options
author | 2021-06-18 14:49:58 +0100 | |
---|---|---|
committer | 2021-06-18 09:49:58 -0400 | |
commit | c585ae63ce3d6eabb540c092af11a50a1fb71f08 (patch) | |
tree | 4ac1457d3dcccff0ba0fc107a0800f259463d6a6 | |
parent | 30d19a0fa35c0f7d5a2de3b44868b22a1db9027d (diff) |
juicebox additions [David Haywood, Sean Riddle] (#8146)
New WORKING software list entries
juicebox.xml:
Teenage Mutant Ninja Turtles Volume 1 (H2692) [Sean Riddle, David Haywood]
Teenage Mutant Ninja Turtles Episode 36 (H6260) [Sean Riddle, David Haywood]
Juicebox Music Video - Avril Lavigne, The Calling, Avril Lavigne, Clay Aiken, Ruben Studdard (H6228) [Sean Riddle, David Haywood]
Juicebox Music Video - Liz Phair, Stacie Orrico, Skye Sweetnam (H2709) [Sean Riddle, David Haywood]
Juicebox Music Video - ZOEgirl, Jump5, Jump5, Baha Men, Atomic Kitten (H6232) [Sean Riddle, David Haywood]
Juicebox Music Video - Baha Men, Jump 5, Jump 5, Beu Sisters, ZOEgirl (H6230A) [Sean Riddle, David Haywood]
Juicebox Music Video - Ashlee Simpson, The Cure, Vanessa Carlton, fan_3, Ashlee Simpson (H6226) [Sean Riddle, David Haywood]
Winx Club Volume 1 (H2686) [Sean Riddle, David Haywood]
Winx Club Episode 103 (H6258) [Sean Riddle, David Haywood]
Yu-Gi-Oh! Episode 175 (H8084) [Sean Riddle, David Haywood]
Yu-Gi-Oh! Episode 176 (H8143) [Sean Riddle, David Haywood]
Vans Pipeline Masters Volume 1 (H2690) [Sean Riddle, David Haywood]
Streetball Classics Volume 1 (H7416) [Sean Riddle, David Haywood]
Megas XLR Volume 1 (H2697) [Sean Riddle, David Haywood]
-rw-r--r-- | hash/juicebox.xml | 376 | ||||
-rw-r--r-- | src/devices/machine/smartmed.cpp | 109 |
2 files changed, 387 insertions, 98 deletions
diff --git a/hash/juicebox.xml b/hash/juicebox.xml index dac6c95c6df..7b6c75da31a 100644 --- a/hash/juicebox.xml +++ b/hash/juicebox.xml @@ -5,68 +5,352 @@ license:CC0 --> <softwarelist name="juicebox" description="Mattel Juice Box SmartMedia Flash ROM"> -<!-- known items (* = dumped) - (many still missing from this list) - - H2679 - Ed, Edd n Eddy Episode #39 - H2682 - Juiceware Animated Assortment -* H2683 - Codename: Kids Next Door vol.1 - H2684 - Ed, Edd n Eddy vol.1 -* H2685 - Yu-Gi-Oh! vol.1 - H2686 - Winx Club - H2687 - The Grim Adventures of Billy and Mandy vol.1 - H2688 - Vans Triple Crown vol.1 - H2689 - Vans Triple Crown vol.2 - H2690 - Vans Pipeline Masters - H2692 - Teenage Mutant Ninja Turtles vol.1 - H2694 - Trading Spaces vol.1 - H2697 - Megas XLR Vol. 1 - H2698 - WWE Rey Mysterio vol.1 - H2699 - Motocycle Mania 1 vol.1 - H2701 - Dexter's Laboratory vol.1 - H2702 - WWE Chris Benoit vol.1 - H2706 - MyScene Jammin in Jamaica vol.1 - H2707 - MyScene Masquerade Madness - H2708 - WWE Eugene vol.1 - H2709 - Music Video Liz Phair Skye Bnip Stacie - - H6225 - Juice Box Music Video (Ashlee Simpson, The Cure, Vanessa Carlton, Fan_3) - H6228 - Juice Box Music Video (Avril Lavine, The Calling, Clay Miken, Ruben Studdard) - H6232 - Juice Box Music Video (Zoegirl, Jumps, Baha Men, Atomic Kitten) - H6248 - Codename: Kids Next Door - Episode #19 - H6254 - Juice Box Music Video (Liz Flair, Stacie Orrico, Skye Sweetnam, Zoegirl) (full part # H6254-0971G1) - H6259 - SonicX Episode 3: Missile Wrist Rampage - H6260 - Teenage Mutant Ninja Turtles Episode 36 - - H7416 - Streetball Classics Vol.1 - - H8084 - Yu-Gi-Oh! Episode 175 - H8085 - Good Times with Carey Hart - H8143 - Yu-Gi-Oh! Episode 176 +<!-- The .smc files in this are the raw dumps dumps, but with a 0x400 byte custom header (with the first 2 bytes being the flash ident code, and rest unused) + This appears to be a custom standard, enforced by smartmed.cpp --> + +<!-- + + Known Releases + + (* = dumped and boots in MAME + B = confirmed bad dump + V = validated with 2nd cartridge) + + The flash ROMs on these cartridges look to be deteriorating, each will likely need verifying against multiple cartridges to verify the integrity of + the data. + + H2679 - Ed, Edd n Eddy Episode #39 + H2682 - Juiceware Animated Assortment +*V H2683 - Codename: Kids Next Door Volume 1 + H2684 - Ed, Edd n Eddy Volume 1 +*V H2685 - Yu-Gi-Oh! Volume 1 +* H2686 - Winx Club Volume 1 + H2687 - The Grim Adventures of Billy and Mandy Volume 1 + H2688 - Vans Triple Crown Volume 1 (BMX) + H2689 - Vans Triple Crown Volume 2 (Skateboarding) +* H2690 - Vans Pipeline Masters Volume 1 +* H2692 - Teenage Mutant Ninja Turtles Volume 1 + H2694 - Trading Spaces Volume 1 +* H2697 - Megas XLR Volume 1 + H2698 - WWE Rey Mysterio Volume 1 + H2699 - Motocycle Mania 1 Volume 1 + H2700 - Powerpuff Girls Volume 1 + H2701 - Dexter's Laboratory Volume 1 + H2702 - WWE Chris Benoit Volume 1 + H2706 - MyScene Jammin in Jamaica Volume 1 + H2707 - MyScene Masquerade Madness + H2708 - WWE Eugene Volume 1 +* H2709 - Juice Box Music Video (Liz Phair, Stacie Orrico, Skye Sweetnam) +*B H6226 - Juice Box Music Video (Ashlee Simpson, The Cure, Vanessa Carlton, fan_3, Ashlee Simpson) +* H6228 - Juice Box Music Video (Avril Lavine, The Calling, Clay Miken, Ruben Studdard) +* H6230A- Juice Box Music Video (Baha Men, Jump5, Jump5, Beu Sisters, ZOEgirl) +* H6232 - Juice Box Music Video (Zoegirl, Jump5, Jump5, Baha Men, Atomic Kitten) + H6233 - Kenny Chesney - 'Live Those Songs', 'No Shoes, No Shirt, No Problems', 'I Go Back' Sara Evans - 'Suds in the Bucket, Martina McBride - 'This One's For The Girls' + H6234 - Juice Box Music Video (Ashlee Simpson, Ashlee Simpson) (same 2 Ashlee Simpson songs as H6226, but without other tracks) + H6248 - Codename: Kids Next Door - Episode #19 + H6254 - Juice Box Music Video (Liz Flair, Stacie Orrico, Skye Sweetnam, Zoegirl) (full part # H6254-0971G1) (include 'the making of' for Skye Sweetnam Tangled Up in Me) +* H6258 - Winx Club Episode 103 + H6259 - SonicX Episode 3: Missile Wrist Rampage +* H6260 - Teenage Mutant Ninja Turtles Episode 36 + +* H7416 - Streetball Classics Volume 1 + H7417 - Streetball Classics Volume 2 + +* H8084 - Yu-Gi-Oh! Episode 175 + H8085 - Good Times with Carey Hart +* H8143 - Yu-Gi-Oh! Episode 176 + + - Johnny Bravo Vol 1 + - Brett Favre - The Field General + H269x - Courage - The Cowardly Dog Volume 1 + - Dexter's Laboratory Episode 51 + + (many still missing from this list) --> - <software name="kidsnedo"> - <description>Codename: Kids Next Door</description> + <!-- + contains: + The Shredder Strikes Part I + The Shredder Strikes Part II + --> + <!-- PVPlayer Build of Aug 07 2004 at 14:25:28 --> + <software name="tmnt1" supported="partial"> + <description>Teenage Mustant Ninja Turtles Volume 1 (H2692)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H2692" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_tmnt_vol1_h2692_matrix11247_9875.smc" size="0x2100400" crc="dccdff36" sha1="57332cd1fc90cdb6433af79f1f27863e3f68cdf2" /> + </dataarea> + </part> + </software> + + <!-- + contains: + Operation: B.E.A.C.H / Operation: U.N.D.E.R.C.O.V.E.R + Operation: F.U.T.U.R.E + --> + <!-- PVPlayer Build of Aug 11 2004 at 15:14:03 --> + <software name="knd1" supported="partial"> + <description>Codename: Kids Next Door Volume 1 (H2683)</description> <year>2004</year> <publisher>4Kids Entertainment</publisher> <info name="serial" value="H2683" /> <part name="memc" interface="sm_memc"> - <dataarea name="rom" size="34604032"> - <rom name="kidsnedo.smc" size="34604032" crc="e917e1f2" sha1="42c56a8b9a2ae076956b98e8bd71e1dfd841d002" offset="0x00000" /> + <dataarea name="rom" size="0x2100400"> + <rom name="kidsnedo.smc" size="0x2100400" crc="e917e1f2" sha1="42c56a8b9a2ae076956b98e8bd71e1dfd841d002" /> </dataarea> </part> </software> - <software name="yugioh"> - <description>Yu-Gi-Oh!</description> + <!-- + contains: + Friends Till The End - Part III + Friends Till The End - Part IV + --> + <!-- PVPlayer Build of Aug 11 2004 at 15:14:03 --> + <software name="yugiv1" supported="partial"> + <description>Yu-Gi-Oh! Volume 1 (H2685)</description> <year>2004</year> <publisher>4Kids Entertainment</publisher> <info name="serial" value="H2685" /> <part name="memc" interface="sm_memc"> - <dataarea name="rom" size="34604032"> - <rom name="yugioh.smc" size="34604032" crc="0a97c7d6" sha1="1b2375c9ef1bbd5cae0c3f0ac20511a36523e86a" offset="0x00000"/> + <dataarea name="rom" size="0x2100400"> + <rom name="yugioh.smc" size="0x2100400" crc="0a97c7d6" sha1="1b2375c9ef1bbd5cae0c3f0ac20511a36523e86a" /> + </dataarea> + </part> + </software> + + + + <!-- contains: + The Ultimate Ninja + Crash Dummies: Ruff Driving (bonus) + --> + <!-- PVPlayer Build of Aug 25 2004 at 19:30:38 --> + <software name="tmnte36" supported="partial"> + <description>Teenage Mustant Ninja Turtles Episode 36 (H6260)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H6260" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_tmnt_ep36_h6260_matrix11247_9875.smc" size="0x2100400" crc="a494fe28" sha1="5c64f229979823276ca5da95e4c4c395b85242b9" offset="0x00000"/> + </dataarea> + </part> + </software> + + <!-- + contains: + Avril Lavigne - Don't Tell Me + The Calling - Our Lives + Avril Lavigne - My Happy Ending + Clay Aiken - The Way + Ruben Studdard - Superstar + --> + <!-- PVPlayer Build of Aug 25 2004 at 19:30:38 --> + <software name="jbm_6228" supported="partial"> + <description>Juicebox Music Video - Avril Lavigne, The Calling, Avril Lavigne, Clay Aiken, Ruben Studdard (H6228)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H6228" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_musicvideo_h6228_matrix11247_9875.smc" size="0x2100400" crc="0bd04da3" sha1="8a05663e0d3c40ac963ca1b1a41339cfa5142694" /> + </dataarea> + </part> + </software> + + <!-- + contains: + Liz Phair - Extraordinary + Stacie Orrico - Stuck + Skye Sweetnam - Tangled Up In Me + --> + <!-- PVPlayer Build of Aug 25 2004 at 19:30:38 --> + <software name="jbm_2709" supported="partial"> + <description>Juicebox Music Video - Liz Phair, Stacie Orrico, Skye Sweetnam (H2709)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H2709" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_musicvideo_h2709_matrix11252_9873.smc" size="0x1080400" crc="d9ff5ee4" sha1="fdcb32a7ff8534357521f340ec16b01ec887de5c" /> + </dataarea> + </part> + </software> + + <!-- + contains: + ZOEgirl - You Get Me + Jump5 - All I Can Do + Jump5 - Spinnin' Around + Baha Men - Who Let The Dogs Out + Atomic Kitten - Eternal Flame + --> + <!-- PVPlayer Build of Sep 17 2004 at 16:30:38 --> + <software name="jbm_6232" supported="partial"> + <description>Juicebox Music Video - ZOEgirl, Jump5, Jump5, Baha Men, Atomic Kitten (H6232)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H6232" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_musicvideo_h6232_matrix11247_9875.smc" size="0x2100400" crc="27b85bb6" sha1="673937106788dd6c4a3647454f4583e97eb2d1a9" /> + </dataarea> + </part> + </software> + + <!-- PVPlayer Build of Sep 17 2004 at 16:30:38 --> + <software name="winxe103" supported="partial"> + <description>Winx Club Episode 103 (H6258)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H6258" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_winxclub_ep103_h6258_matrix11252_9873.smc" size="0x1080400" crc="d7e370ba" sha1="b24a9e1b1a7c3a830976cc6c28451cec9eefa31d" /> + </dataarea> + </part> + </software> + + <!-- + contains: + Friends 'Til The End - Part I + --> + <!-- PVPlayer Build of Sep 17 2004 at 16:30:38 --> + <software name="yugie175" supported="partial"> + <description>Yu-Gi-Oh! Episode 175 (H8084)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H8084" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_yugioh_ep175_h8084_matrix11252_9873.smc" size="0x1080400" crc="04b2c825" sha1="977e9c20384bdbc65c2b90ed32d09624e95a0e0a" /> + </dataarea> + </part> + </software> + + <!-- + contains: + Friends 'Til The End - Part II + --> + <!-- PVPlayer Build of Sep 17 2004 at 16:30:38 --> + <software name="yugie176" supported="partial"> + <description>Yu-Gi-Oh! Episode 176 (H8143)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H8143" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_yugioh_ep176_h8143_matrix11252_9873.smc" size="0x1080400" crc="f1a0edd4" sha1="553e74100f9969117f0240f98e84515823cce108" /> + </dataarea> + </part> + </software> + + <!-- PVPlayer Build of Aug 25 2004 at 19:30:38 --> + <software name="plmv1" supported="partial"> + <description>Vans Pipeline Masters Volume 1 (H2690)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H2690" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_pipelinemasters_vol1_h2690_matrix11247_9875.smc" size="0x2100400" crc="e8cca1d4" sha1="5cd2b29bc28d20d9c9b455edb750fbbb530b8e5b" /> + </dataarea> + </part> + </software> + + <software name="sbcv1" supported="partial"> + <description>Streetball Classics Volume 1 (H7416)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H7416" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_streetball-classics-vol1_h7416_matrix11247_9875.smc" size="0x2100400" crc="ada20763" sha1="b973e18d390a7d1a530e3737562722f96163d593" /> + </dataarea> + </part> + </software> + + <!-- + contains: + Test Drive + All I Wanted Was A Slushie + --> + <software name="megasv1" supported="partial"> + <description>Megas XLR Volume 1 (H2697)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H2697" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_megas-xlr_vol1_h2697_matrix11247_9875.smc" size="0x2100400" crc="385b0402" sha1="fd761af3c8eaa522db0b4c224d37440d47c26c8a" /> + </dataarea> + </part> + </software> + + <!-- + contains: + It Feels Like Magic + More Than High School + --> + <!-- PVPlayer Build of Aug 11 2004 at 15:14:03 --> + <software name="winxv1" supported="partial"> + <description>Winx Club Volume 1 (H2686)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H2686" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_winxclub_vol1_h2686_matrix11247_9875.smc" size="0x2100400" crc="0d8e6f6d" sha1="f45cd8cdbd7b0d28a2bd5a2503bae52190112db6" /> + </dataarea> + </part> + </software> + + <!-- + contains: + Baha Men - Move It Like This + Jump 5 - Do Ya + Jump 5 - Spinnin' Around + Beu Sisters - I Was Only (Seventeen) + ZOEgirl - Dismissed + --> + <!-- PVPlayer Build of Sep 17 2004 at 16:30:38 --> + <software name="jbm_6230a" supported="partial"> + <description>Juicebox Music Video - Baha Men, Jump5, Jump5, Beu Sisters, ZOEgirl (H6230A)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H6230A" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <rom name="jb_musicvideo_h6230a_matrix11247_9875.smc" size="0x2100400" crc="d8ce26c4" sha1="02b3bdec5ba1002264663e79ecbe2444a92efdfc" /> + </dataarea> + </part> + </software> + + <!-- + contains: + Ashlee Simpson - Shadow + The Cure - The End Of The World + Vanessa Carlton - White Houses + fan_3 - Geek Love + Ashlee Simpson - Pieces of Me + --> + <!-- PVPlayer Build of Sep 17 2004 at 16:30:38 --> + <software name="jbm_6226" supported="partial"> + <description>Juicebox Music Video - Ashlee Simpson, The Cure, Vanessa Carlton, fan_3, Ashlee Simpson (H6226)</description> + <year>2004</year> + <publisher>4Kids Entertainment</publisher> + <info name="serial" value="H6226" /> + <part name="memc" interface="sm_memc"> + <dataarea name="rom" size="0x2100400"> + <!-- start of The Cure song has corrupt video, so might still be bad --> + <rom name="jb_musicvideo_h6226_matrix11247_9875.smc" size="0x2100400" crc="c53ed7ac" sha1="c91eaaf3bdfba2badf4498d419dbc0bca8c89bac" status="baddump" /> </dataarea> </part> </software> + </softwarelist> diff --git a/src/devices/machine/smartmed.cpp b/src/devices/machine/smartmed.cpp index 7e4153797f6..5b2fc3bb882 100644 --- a/src/devices/machine/smartmed.cpp +++ b/src/devices/machine/smartmed.cpp @@ -124,9 +124,8 @@ void nand_device::device_start() image_init_result smartmedia_image_device::smartmedia_format_1() { SM_disk_image_header custom_header; - int bytes_read; - bytes_read = fread(&custom_header, sizeof(custom_header)); + const int bytes_read = fread(&custom_header, sizeof(custom_header)); if (bytes_read != sizeof(custom_header)) { return image_init_result::FAIL; @@ -206,6 +205,7 @@ int smartmedia_image_device::detect_geometry( uint8_t id1, uint8_t id2) { switch (id2) { + case 0x73 : m_page_data_size = 0x0200; m_num_pages = 0x08000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = true; break; case 0x75 : m_page_data_size = 0x0200; m_num_pages = 0x10000; m_page_total_size = 0x0210; m_log2_pages_per_block = 5; result = true; break; } } @@ -218,9 +218,8 @@ int smartmedia_image_device::detect_geometry( uint8_t id1, uint8_t id2) image_init_result smartmedia_image_device::smartmedia_format_2() { disk_image_format_2_header custom_header; - int bytes_read, i, j; - bytes_read = fread(&custom_header, sizeof(custom_header)); + const int bytes_read = fread(&custom_header, sizeof(custom_header)); if (bytes_read != sizeof(custom_header)) { return image_init_result::FAIL; @@ -236,7 +235,7 @@ image_init_result smartmedia_image_device::smartmedia_format_2() return image_init_result::FAIL; } - m_data_ptr = auto_alloc_array(machine(), uint8_t, m_page_total_size*m_num_pages); + m_data_ptr = auto_alloc_array(machine(), uint8_t, m_page_total_size * m_num_pages); m_data_uid_ptr = std::make_unique<uint8_t[]>(256 + 16); m_mode = SM_M_INIT; m_pointer_mode = SM_PM_A; @@ -248,20 +247,21 @@ image_init_result smartmedia_image_device::smartmedia_format_2() m_accumulated_status = 0; m_pagereg = std::make_unique<uint8_t[]>(m_page_total_size); m_id_len = 3; - memcpy( m_id, custom_header.data1, m_id_len); + memcpy(m_id, custom_header.data1, m_id_len); m_mp_opcode = 0; m_col_address_cycles = 1; m_row_address_cycles = (m_num_pages > 0x10000) ? 3 : 2; m_sequential_row_read = 1; - for (i=0;i<8;i++) + for (int i = 0; i < 8; i++) { - memcpy( m_data_uid_ptr.get() + i * 32, custom_header.data2, 16); - for (j=0;j<16;j++) m_data_uid_ptr[i*32+16+j] = custom_header.data2[j] ^ 0xFF; + memcpy(m_data_uid_ptr.get() + i * 32, custom_header.data2, 16); + for (int j = 0; j < 16; j++) + m_data_uid_ptr[i * 32 + 16 + j] = custom_header.data2[j] ^ 0xFF; } - memcpy( m_data_uid_ptr.get() + 256, custom_header.data3, 16); + memcpy(m_data_uid_ptr.get() + 256, custom_header.data3, 16); - fread(m_data_ptr, m_page_total_size*m_num_pages); + fread(m_data_ptr, m_page_total_size * m_num_pages); #ifdef SMARTMEDIA_IMAGE_SAVE m_image_format = 2; @@ -279,9 +279,9 @@ image_init_result smartmedia_image_device::call_load() result = smartmedia_format_1(); if (result != image_init_result::PASS) { - // try format 2 - fseek( position, SEEK_SET); - result = smartmedia_format_2(); + // try format 2 + fseek(position, SEEK_SET); + result = smartmedia_format_2(); } return result; } @@ -297,27 +297,26 @@ void smartmedia_image_device::call_unload() if (m_image_format == 1) { SM_disk_image_header custom_header; - int bytes_read; - fseek( 0, SEEK_SET); - bytes_read = fread( &custom_header, sizeof( custom_header)); - if (bytes_read == sizeof( custom_header)) + fseek(0, SEEK_SET); + const int bytes_read = fread(&custom_header, sizeof(custom_header)); + if (bytes_read == sizeof(custom_header)) { if (custom_header.version == 0) { - fseek( 2 + 1, SEEK_CUR); - fwrite( m_data_ptr, m_page_total_size * m_num_pages); + fseek(2 + 1, SEEK_CUR); + fwrite(m_data_ptr, m_page_total_size * m_num_pages); } else if (custom_header.version == 1) { - fseek( 3 + 1 + 256 + 16, SEEK_CUR); - fwrite( m_data_ptr, m_page_total_size * m_num_pages); + fseek(3 + 1 + 256 + 16, SEEK_CUR); + fwrite(m_data_ptr, m_page_total_size * m_num_pages); } } } else if (m_image_format == 2) { - fseek( sizeof( disk_image_format_2_header), SEEK_SET); - fwrite( m_data_ptr, m_page_total_size * m_num_pages); + fseek(sizeof(disk_image_format_2_header), SEEK_SET); + fwrite(m_data_ptr, m_page_total_size * m_num_pages); } } #endif @@ -335,7 +334,7 @@ void smartmedia_image_device::call_unload() m_status = 0xC0; m_accumulated_status = 0; m_pagereg = std::make_unique<uint8_t[]>(m_page_total_size); - memset( m_id, 0, sizeof( m_id)); + memset(m_id, 0, sizeof(m_id)); m_id_len = 0; m_mp_opcode = 0; m_mode_3065 = 0; @@ -388,8 +387,8 @@ void nand_device::command_w(uint8_t data) m_mode_3065 = 0; if (!m_write_rnb.isnull()) { - m_write_rnb( 0); - m_write_rnb( 1); + m_write_rnb(0); + m_write_rnb(1); } break; case 0x00: // Read (1st cycle) @@ -420,10 +419,10 @@ void nand_device::command_w(uint8_t data) } else { - m_mode = SM_M_READ; - m_pointer_mode = SM_PM_C; - m_page_addr = 0; - m_addr_load_ptr = 0; + m_mode = SM_M_READ; + m_pointer_mode = SM_PM_C; + m_page_addr = 0; + m_addr_load_ptr = 0; } break; case 0x80: // Page Program (1st cycle) @@ -442,11 +441,10 @@ void nand_device::command_w(uint8_t data) } else { - int i; m_status = (m_status & 0x80) | m_accumulated_status; //logerror( "smartmedia: program, page_addr %08X\n", m_page_addr); - for (i=0; i<m_page_total_size; i++) - m_data_ptr[m_page_addr*m_page_total_size + i] &= m_pagereg[i]; + for (int i = 0; i < m_page_total_size; i++) + m_data_ptr[m_page_addr * m_page_total_size + i] &= m_pagereg[i]; m_status |= 0x40; if (data == 0x15) m_accumulated_status = m_status & 0x1f; @@ -455,13 +453,13 @@ void nand_device::command_w(uint8_t data) m_mode = SM_M_INIT; if (!m_write_rnb.isnull()) { - m_write_rnb( 0); - m_write_rnb( 1); + m_write_rnb(0); + m_write_rnb(1); } } break; - /*case 0x11: - break;*/ + //case 0x11: + // break; case 0x60: // Block Erase (1st cycle) m_mode = SM_M_ERASE; m_page_addr = 0; @@ -484,22 +482,22 @@ void nand_device::command_w(uint8_t data) m_pointer_mode = SM_PM_A; if (!m_write_rnb.isnull()) { - m_write_rnb( 0); - m_write_rnb( 1); + m_write_rnb(0); + m_write_rnb(1); } } break; case 0x70: // Read Status m_mode = SM_M_READSTATUS; break; - /*case 0x71: - break;*/ + //case 0x71: + // break; case 0x90: // Read ID m_mode = SM_M_READID; m_addr_load_ptr = 0; break; - /*case 0x91: - break;*/ + //case 0x91: + // break; case 0x30: // Read (2nd cycle) if (m_col_address_cycles == 1) { @@ -521,8 +519,8 @@ void nand_device::command_w(uint8_t data) { if (!m_write_rnb.isnull()) { - m_write_rnb( 0); - m_write_rnb( 1); + m_write_rnb(0); + m_write_rnb(1); } } } @@ -620,12 +618,12 @@ void nand_device::address_w(uint8_t data) if (m_addr_load_ptr < m_col_address_cycles) { m_byte_addr &= ~(0xFF << (m_addr_load_ptr * 8)); - m_byte_addr |= (data << (m_addr_load_ptr * 8)); + m_byte_addr |= (data << (m_addr_load_ptr * 8)); } else if (m_addr_load_ptr < m_col_address_cycles + m_row_address_cycles) { m_page_addr &= ~(0xFF << ((m_addr_load_ptr - m_col_address_cycles) * 8)); - m_page_addr |= (data << ((m_addr_load_ptr - m_col_address_cycles) * 8)); + m_page_addr |= (data << ((m_addr_load_ptr - m_col_address_cycles) * 8)); } } m_addr_load_ptr++; @@ -634,7 +632,7 @@ void nand_device::address_w(uint8_t data) if (m_addr_load_ptr < m_row_address_cycles) { m_page_addr &= ~(0xFF << (m_addr_load_ptr * 8)); - m_page_addr |= (data << (m_addr_load_ptr * 8)); + m_page_addr |= (data << (m_addr_load_ptr * 8)); } m_addr_load_ptr++; break; @@ -643,7 +641,7 @@ void nand_device::address_w(uint8_t data) if (m_addr_load_ptr < m_col_address_cycles) { m_byte_addr &= ~(0xFF << (m_addr_load_ptr * 8)); - m_byte_addr |= (data << (m_addr_load_ptr * 8)); + m_byte_addr |= (data << (m_addr_load_ptr * 8)); } m_addr_load_ptr++; break; @@ -680,7 +678,10 @@ uint8_t nand_device::data_r() { if (m_byte_addr < m_page_total_size) { - reply = m_data_ptr[m_page_addr*m_page_total_size + m_byte_addr]; + if (m_page_addr < m_num_pages) + reply = m_data_ptr[m_page_addr * m_page_total_size + m_byte_addr]; + else + reply = 0xff; } else { @@ -689,7 +690,11 @@ uint8_t nand_device::data_r() } else { - reply = m_data_uid_ptr[m_page_addr*m_page_total_size + m_byte_addr]; + // FIXME: this appears to be incorrect, m_data_uid_ptr is a smaller structure of 256*16 + // this code would always result in reading past the buffer + uint32_t addr = m_page_addr * m_page_total_size + m_byte_addr; + if (addr < 256 + 16) + reply = m_data_uid_ptr[addr]; } m_byte_addr++; if ((m_byte_addr == m_page_total_size) && (m_sequential_row_read != 0)) |