Viewing Issue Advanced Details Jump to Notes ] nes.cpp
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
05508 Crash/Freeze Critical (emulator) Always Apr 10, 2014, 22:13 May 14, 2014, 18:28
Tester Firewave View Status Public Platform MESS (Self-compiled)
Assigned To etabeta Resolution Fixed OS Linux
Status [?] Resolved   Driver nes.cpp
Version 0.153 Fixed in Version 0.154 Build Debug
Summary MESS-specific 05508: dendy: [debug] Assertion with -cart genchohi
mess64d: src/lib/util/coretmpl.h:83: _ElementType &dynamic_array<unsigned char>::operator[](int) [_ElementType = unsigned char]: Assertion `index < m_count' failed.

The other sets in nes.c are fine.
Steps To Reproduce
Additional Information
Flags Debug build specific
Regression Version
Affected Sets / Systems dendy
Attached Files

-  Notes
User avatar
(Senior Tester)
May 13, 2014, 10:28
>	vmess64d.exe!_NMSG_WRITE(int rterrnum) Line 226	C
 	vmess64d.exe!abort() Line 72	C
 	vmess64d.exe!_wassert(const wchar_t * expr, const wchar_t * filename, unsigned int lineno) Line 155	C
 	vmess64d.exe!dynamic_array<unsigned char>::operator[](int index) Line 83	C++
 	vmess64d.exe!nes_exrom_device::base_chr_r(int bank, unsigned int offset) Line 394	C++
 	vmess64d.exe!nes_exrom_device::chr_r(address_space & space, unsigned int offset, unsigned char mem_mask) Line 425	C++
 	vmess64d.exe!delegate_mfp::method_stub<device_nes_cart_interface,unsigned char,address_space & __ptr64,unsigned int,unsigned char>(delegate_generic_class * object, address_space & p1, unsigned int p2, unsigned char p3) Line 373	C++
 	vmess64d.exe!delegate_base<unsigned char,address_space & __ptr64,unsigned int,unsigned char,_noparam,_noparam,_noparam,_noparam,_noparam,_noparam,_noparam,_noparam,_noparam>::operator()(address_space & p1, unsigned int p2, unsigned char p3) Line 652	C++
 	vmess64d.exe!handler_entry_read::read8(address_space & space, unsigned int offset, unsigned char mask) Line 358	C++
 	vmess64d.exe!address_space_specific<unsigned char,0,0>::read_native(unsigned int offset) Line 1099	C++
 	vmess64d.exe!address_space_specific<unsigned char,0,0>::read_byte(unsigned int address) Line 1417	C++
 	vmess64d.exe!ppu2c0x_device::readbyte(unsigned int address) Line 273	C++
 	vmess64d.exe!ppu2c0x_device::draw_sprites(unsigned char * line_priority) Line 774	C++
 	vmess64d.exe!ppu2c0x_device::render_scanline() Line 928	C++
 	vmess64d.exe!ppu2c0x_device::update_scanline() Line 949	C++
 	vmess64d.exe!ppu2c0x_device::device_timer(emu_timer & timer, unsigned int id, int param, void * ptr) Line 498	C++
 	vmess64d.exe!device_t::timer_expired(emu_timer & timer, unsigned int id, int param, void * ptr) Line 189	C++
 	vmess64d.exe!device_scheduler::execute_timers() Line 900	C++
 	vmess64d.exe!device_scheduler::timeslice() Line 517	C++
 	vmess64d.exe!running_machine::run(bool firstrun) Line 382	C++
 	vmess64d.exe!mame_execute(emu_options & options, osd_interface & osd) Line 177	C++
 	vmess64d.exe!cli_frontend::execute(int argc, char * * argv) Line 240	C++
 	vmess64d.exe!utf8_main(int argc, char * * argv) Line 437	C++
 	vmess64d.exe!wmain(int argc, wchar_t * * argv) Line 49	C++
 	vmess64d.exe!__tmainCRTStartup() Line 241	C
 	vmess64d.exe!wmainCRTStartup() Line 164	C

This is where the assert occurs:

return m_vrom[helper];

And here's the bogus valu coming form. The issue is, that m_vrom_bank is not fully initialized

helper = (m_vrom_bank[bank] * 0x400) + (offset & 0x3ff);

The initialization is all wrong:

memset(m_vrom_bank, 0x3ff, ARRAY_LENGTH(m_vrom_bank));

 It needs to be sizeof(m_vrom_bank) and the value is cut off at 0xff since the maximum value allowed is unsigned char even if it takes a char. I assume this should actually be a loop.
User avatar
(Senior Tester)
May 14, 2014, 18:28
Fixed in r30435