diff options
author | 2010-07-22 20:18:25 +0000 | |
---|---|---|
committer | 2010-07-22 20:18:25 +0000 | |
commit | 14b2eec6b7f258d606d8c00d984b8defeb3de1c7 (patch) | |
tree | 09366a7f1a2d756e02c250cfe291ed8fa3fcd827 /src/emu/cpu/arm | |
parent | 184ee16762c8c7080086cec4bf4dafbc819bd6f2 (diff) |
arm.c: Added big endian mode support to the LDRB and STRB instructions. [Wilbert Pol]
Diffstat (limited to 'src/emu/cpu/arm')
-rw-r--r-- | src/emu/cpu/arm/arm.c | 15 | ||||
-rw-r--r-- | src/emu/cpu/arm/arm.h | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c index 3ab053756d4..b197ac73f7a 100644 --- a/src/emu/cpu/arm/arm.c +++ b/src/emu/cpu/arm/arm.c @@ -236,6 +236,7 @@ typedef struct device_irq_callback irq_callback; legacy_cpu_device *device; const address_space *program; + endianness_t endian; } ARM_REGS; /* Prototypes */ @@ -497,11 +498,13 @@ static CPU_INIT( arm ) cpustate->irq_callback = irqcallback; cpustate->device = device; cpustate->program = device->space(AS_PROGRAM); + cpustate->endian = ENDIANNESS_LITTLE; state_save_register_device_item_array(device, 0, cpustate->sArmRegister); state_save_register_device_item_array(device, 0, cpustate->coproRegister); state_save_register_device_item(device, 0, cpustate->pendingIrq); state_save_register_device_item(device, 0, cpustate->pendingFiq); + state_save_register_device_item(device, 0, cpustate->endian); } /***************************************************************************/ @@ -593,7 +596,7 @@ static void HandleMemSingle( ARM_REGS* cpustate, UINT32 insn ) { if (ARM_DEBUG_CORE && rd == eR15) logerror("read byte R15 %08x\n", R15); - SetRegister(cpustate, rd,(UINT32) READ8(rnv)); + SetRegister(cpustate, rd,(UINT32) READ8( ( cpustate->endian == ENDIANNESS_LITTLE ? rnv : (rnv ^ 0x03) ) ) ); } else { @@ -629,7 +632,7 @@ static void HandleMemSingle( ARM_REGS* cpustate, UINT32 insn ) if (ARM_DEBUG_CORE && rd==eR15) logerror("Wrote R15 in byte mode\n"); - WRITE8(rnv, (UINT8) GetRegister(cpustate, rd) & 0xffu); + WRITE8( ( cpustate->endian == ENDIANNESS_LITTLE ? rnv : (rnv ^ 0x03) ), (UINT8) GetRegister(cpustate, rd) & 0xffu); } else { @@ -1375,6 +1378,14 @@ static void HandleCoPro( ARM_REGS* cpustate, UINT32 insn ) } } + +void arm_set_endianness( legacy_cpu_device *device, endianness_t endianness ) +{ + ARM_REGS *cpustate = get_safe_token(device); + + cpustate->endian = endianness; +} + /************************************************************************** * Generic set_info **************************************************************************/ diff --git a/src/emu/cpu/arm/arm.h b/src/emu/cpu/arm/arm.h index 7732e5a105d..7b9d62c1414 100644 --- a/src/emu/cpu/arm/arm.h +++ b/src/emu/cpu/arm/arm.h @@ -25,4 +25,6 @@ enum ARM32_IR13, ARM32_IR14, ARM32_SR13, ARM32_SR14 }; +void arm_set_endianness( legacy_cpu_device *device, endianness_t endianness ); + #endif /* __ARM_H__ */ |