cpu_orig.c - restore to original - bigger codesize but faster

This commit is contained in:
twinaphex 2014-12-12 17:22:56 +01:00
parent d76dada07a
commit 24eef7a3ff
1 changed files with 89 additions and 7 deletions

View File

@ -1656,7 +1656,6 @@ void execute_arm(u32 cycles)
cpu_alert_type cpu_alert; cpu_alert_type cpu_alert;
u32 old_pc; u32 old_pc;
u32 thumb_opcode_val = 0, arm_opcode_val = 0;
if(!pc_address_block) if(!pc_address_block)
pc_address_block = load_gamepak_page(pc_region & 0x3FF); pc_address_block = load_gamepak_page(pc_region & 0x3FF);
@ -3262,9 +3261,8 @@ thumb_loop:
check_pc_region(); check_pc_region();
pc &= ~0x01; pc &= ~0x01;
opcode = address16(pc_address_block, (pc & 0x7FFF)); opcode = address16(pc_address_block, (pc & 0x7FFF));
thumb_opcode_val = (opcode >> 8) & 0xFF;
switch(thumb_opcode_val) switch((opcode >> 8) & 0xFF)
{ {
case 0x00 ... 0x07: case 0x00 ... 0x07:
/* LSL rd, rs, offset */ /* LSL rd, rs, offset */
@ -3303,78 +3301,162 @@ thumb_loop:
case 0x20: case 0x20:
/* MOV r0, imm */ /* MOV r0, imm */
thumb_logic(imm, 0, imm);
break;
case 0x21: case 0x21:
/* MOV r1, imm */ /* MOV r1, imm */
thumb_logic(imm, 1, imm);
break;
case 0x22: case 0x22:
/* MOV r2, imm */ /* MOV r2, imm */
thumb_logic(imm, 2, imm);
break;
case 0x23: case 0x23:
/* MOV r3, imm */ /* MOV r3, imm */
thumb_logic(imm, 3, imm);
break;
case 0x24: case 0x24:
/* MOV r4, imm */ /* MOV r4, imm */
thumb_logic(imm, 4, imm);
break;
case 0x25: case 0x25:
/* MOV r5, imm */ /* MOV r5, imm */
thumb_logic(imm, 5, imm);
break;
case 0x26: case 0x26:
/* MOV r6, imm */ /* MOV r6, imm */
thumb_logic(imm, 6, imm);
break;
case 0x27: case 0x27:
/* MOV r7, imm */ /* MOV r7, imm */
thumb_logic(imm, thumb_opcode_val & 0x7, imm); thumb_logic(imm, 7, imm);
break; break;
case 0x28: case 0x28:
/* CMP r0, imm */ /* CMP r0, imm */
thumb_test_sub(imm, reg[0], imm);
break;
case 0x29: case 0x29:
/* CMP r1, imm */ /* CMP r1, imm */
thumb_test_sub(imm, reg[1], imm);
break;
case 0x2A: case 0x2A:
/* CMP r2, imm */ /* CMP r2, imm */
thumb_test_sub(imm, reg[2], imm);
break;
case 0x2B: case 0x2B:
/* CMP r3, imm */ /* CMP r3, imm */
thumb_test_sub(imm, reg[3], imm);
break;
case 0x2C: case 0x2C:
/* CMP r4, imm */ /* CMP r4, imm */
thumb_test_sub(imm, reg[4], imm);
break;
case 0x2D: case 0x2D:
/* CMP r5, imm */ /* CMP r5, imm */
thumb_test_sub(imm, reg[5], imm);
break;
case 0x2E: case 0x2E:
/* CMP r6, imm */ /* CMP r6, imm */
thumb_test_sub(imm, reg[6], imm);
break;
case 0x2F: case 0x2F:
/* CMP r7, imm */ /* CMP r7, imm */
thumb_test_sub(imm, reg[thumb_opcode_val & 0x7], imm); thumb_test_sub(imm, reg[7], imm);
break; break;
case 0x30: case 0x30:
/* ADD r0, imm */ /* ADD r0, imm */
thumb_add(imm, 0, reg[0], imm);
break;
case 0x31: case 0x31:
/* ADD r1, imm */ /* ADD r1, imm */
thumb_add(imm, 1, reg[1], imm);
break;
case 0x32: case 0x32:
/* ADD r2, imm */ /* ADD r2, imm */
thumb_add(imm, 2, reg[2], imm);
break;
case 0x33: case 0x33:
/* ADD r3, imm */ /* ADD r3, imm */
thumb_add(imm, 3, reg[3], imm);
break;
case 0x34: case 0x34:
/* ADD r4, imm */ /* ADD r4, imm */
thumb_add(imm, 4, reg[4], imm);
break;
case 0x35: case 0x35:
/* ADD r5, imm */ /* ADD r5, imm */
thumb_add(imm, 5, reg[5], imm);
break;
case 0x36: case 0x36:
/* ADD r6, imm */ /* ADD r6, imm */
thumb_add(imm, 6, reg[6], imm);
break;
case 0x37: case 0x37:
/* ADD r7, imm */ /* ADD r7, imm */
thumb_add(imm, thumb_opcode_val & 0x7, reg[thumb_opcode_val & 0x7], imm); thumb_add(imm, 7, reg[7], imm);
break; break;
case 0x38: case 0x38:
/* SUB r0, imm */ /* SUB r0, imm */
thumb_sub(imm, 0, reg[0], imm);
break;
case 0x39: case 0x39:
/* SUB r1, imm */ /* SUB r1, imm */
thumb_sub(imm, 1, reg[1], imm);
break;
case 0x3A: case 0x3A:
/* SUB r2, imm */ /* SUB r2, imm */
thumb_sub(imm, 2, reg[2], imm);
break;
case 0x3B: case 0x3B:
/* SUB r3, imm */ /* SUB r3, imm */
thumb_sub(imm, 3, reg[3], imm);
break;
case 0x3C: case 0x3C:
/* SUB r4, imm */ /* SUB r4, imm */
thumb_sub(imm, 4, reg[4], imm);
break;
case 0x3D: case 0x3D:
/* SUB r5, imm */ /* SUB r5, imm */
thumb_sub(imm, 5, reg[5], imm);
break;
case 0x3E: case 0x3E:
/* SUB r6, imm */ /* SUB r6, imm */
thumb_sub(imm, 6, reg[6], imm);
break;
case 0x3F: case 0x3F:
/* SUB r7, imm */ /* SUB r7, imm */
thumb_sub(imm, thumb_opcode_val & 0x7, reg[thumb_opcode_val & 0x7], imm); thumb_sub(imm, 7, reg[7], imm);
break; break;
case 0x40: case 0x40: