From 33ab0ceae28bcc0cad9cbe252b24af2208106bf3 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Mon, 23 Nov 2015 12:57:44 +0000 Subject: [PATCH] disallow unaligned accesses for se3208? this allows officeye and donghaer to work, but I'm not entirely convinced it's correct. --- src/devices/cpu/se3208/se3208.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp index c4678677b1f..e2823c250ad 100644 --- a/src/devices/cpu/se3208/se3208.cpp +++ b/src/devices/cpu/se3208/se3208.cpp @@ -38,6 +38,9 @@ //Precompute the instruction decoding in a big table #define INST(a) void se3208_device::a(UINT16 Opcode) +// officeye and donghaer perform unaligned DWORD accesses, allowing them to happen causes the games to malfunction. +// are such accesses simply illegal, be handled in a different way, or simply not be happening in the first place? +#define ALLOW_UNALIGNED_DWORD_ACCESS 0 const device_type SE3208 = &device_creator; @@ -58,9 +61,12 @@ UINT32 se3208_device::read_dword_unaligned(address_space &space, UINT32 address) case 1: case 2: case 3: -// printf("dword read unaligned %d\n", address & 3); + printf("%08x: dword READ unaligned %d\n", m_PC, address); +#if ALLOW_UNALIGNED_DWORD_ACCESS return space.read_byte(address) | space.read_byte(address + 1) << 8 | space.read_byte(address + 2) << 16 | space.read_byte(address + 3) << 24; - +#else + return 0; +#endif } return 0; @@ -85,11 +91,14 @@ void se3208_device::write_dword_unaligned(address_space &space, UINT32 address, case 1: case 2: case 3: +#if ALLOW_UNALIGNED_DWORD_ACCESS space.write_byte(address, data & 0xff); space.write_byte(address + 1, (data >> 8) & 0xff); space.write_byte(address + 2, (data >> 16) & 0xff); space.write_byte(address + 3, (data >> 24) & 0xff); -// printf("dword write unaligned %d\n", address & 3); +#endif + printf("%08x: dword WRITE unaligned %d\n", m_PC, address); + break; }