Esempio n. 1
0
/*
    Open cylinder image and read RAM
*/
image_init_result apexc_cylinder_image_device::call_load()
{
	/* load RAM contents */
	m_writable = !is_readonly();

	fread( machine().root_device().memshare("maincpu")->ptr(), 0x1000);
#ifdef LSB_FIRST
	{   /* fix endianness */
		uint32_t *RAM = (uint32_t *)(machine().root_device().memshare("maincpu")->ptr());

		for (int i=0; i < 0x0400; i++)
			RAM[i] = big_endianize_int32(RAM[i]);
	}
#endif

	return image_init_result::PASS;
}
Esempio n. 2
0
/*
    Open cylinder image and read RAM
*/
bool apexc_cylinder_image_device::call_load()
{
	/* load RAM contents */
	m_writable = !is_readonly();

	fread( machine().root_device().memregion("maincpu")->base(), 0x1000);
#ifdef LSB_FIRST
	{   /* fix endianness */
		UINT32 *RAM = (UINT32 *)(machine().root_device().memregion("maincpu")->base());

		for (int i=0; i < 0x0400; i++)
			RAM[i] = big_endianize_int32(RAM[i]);
	}
#endif

	return IMAGE_INIT_PASS;
}
Esempio n. 3
0
/*
    Save RAM to cylinder image and close it
*/
void apexc_cylinder_image_device::call_unload()
{
	if (m_writable)
	{   /* save RAM contents */
		/* rewind file */
		fseek(0, SEEK_SET);
#ifdef LSB_FIRST
		{   /* fix endianness */
			uint32_t *RAM = (uint32_t *)(machine().root_device().memshare("maincpu")->ptr());

			for (int i=0; i < /*0x2000*/0x0400; i++)
				RAM[i] = big_endianize_int32(RAM[i]);
		}
#endif
		/* write */
		fwrite(machine().root_device().memshare("maincpu")->ptr(), /*0x8000*/0x1000);
	}
}