Пример #1
0
UINT32 memory_array::read8_from_64be(int index) { return reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)]; }
Пример #2
0
void memory_array::write8_to_64be(int index, UINT32 data) { reinterpret_cast<UINT8 *>(m_base)[BYTE8_XOR_BE(index)] = data; }
Пример #3
0
offs_t activecpu_dasm(char *buffer, offs_t pc)
{
	VERIFY_ACTIVECPU(activecpu_dasm);

	/* allow overrides */
	if (cpu_dasm_override)
	{
		offs_t result = cpu_dasm_override(activecpu, buffer, pc);
		if (result)
			return result;
	}

	/* if there's no old-style assembler, do some work to make this call work with the new one */
	if (!cpu[activecpu].intf.disassemble)
	{
		int dbwidth = activecpu_databus_width(ADDRESS_SPACE_PROGRAM);
		int maxbytes = activecpu_max_instruction_bytes();
		int endianness = activecpu_endianness();
		UINT8 opbuf[64], argbuf[64];
		int xorval = 0;
		int numbytes;

		/* determine the XOR to get the bytes in order */
		switch (dbwidth)
		{
			case 8:		xorval = 0;																break;
			case 16:	xorval = (endianness == CPU_IS_LE) ? BYTE_XOR_LE(0) : BYTE_XOR_BE(0);	break;
			case 32:	xorval = (endianness == CPU_IS_LE) ? BYTE4_XOR_LE(0) : BYTE4_XOR_BE(0);	break;
			case 64:	xorval = (endianness == CPU_IS_LE) ? BYTE8_XOR_LE(0) : BYTE8_XOR_BE(0);	break;
		}

		/* fetch the bytes up to the maximum */
		memset(opbuf, 0xff, sizeof(opbuf));
		memset(argbuf, 0xff, sizeof(argbuf));
		for (numbytes = 0; numbytes < maxbytes; numbytes++)
		{
			offs_t physpc = pc + numbytes;
			const UINT8 *ptr;

			/* translate the address, set the opcode base, and apply the byte xor */
			if (!cpu[activecpu].intf.translate || (*cpu[activecpu].intf.translate)(ADDRESS_SPACE_PROGRAM, &physpc))
			{
				memory_set_opbase(physpc);
				physpc ^= xorval;

				/* get pointer to data */
				ptr = memory_get_op_ptr(cpu_getactivecpu(), physpc, 0);
				if (ptr)
				{
					opbuf[numbytes] = *ptr;
					ptr = memory_get_op_ptr(cpu_getactivecpu(), physpc, 1);
					if (ptr)
						argbuf[numbytes] = *ptr;
					else
						argbuf[numbytes] = opbuf[numbytes];
				}
			}
		}

		return activecpu_dasm_new(buffer, pc, opbuf, argbuf, maxbytes);
	}
	return (*cpu[activecpu].intf.disassemble)(buffer, pc);
}