remove textrels with -fPIC/-fPIE (for android/ios)
authorkub <derkub@gmail.com>
Tue, 3 Dec 2019 22:52:13 +0000 (23:52 +0100)
committerkub <derkub@gmail.com>
Tue, 3 Dec 2019 22:52:13 +0000 (23:52 +0100)
cpu/DrZ80/drz80.S [moved from cpu/DrZ80/drz80.s with 90% similarity]
cpu/drc/emit_arm64.c
cpu/drc/emit_mips.c
pico/32x/draw_arm.S
pico/arm_features.h
pico/cd/memory_arm.S
pico/memory_arm.S
pico/sound/ym2612_arm.S [moved from pico/sound/ym2612_arm.s with 95% similarity]
platform/common/common.mak
platform/common/dismips.c

similarity index 90%
rename from cpu/DrZ80/drz80.s
rename to cpu/DrZ80/drz80.S
index c2a64df..4d592b1 100644 (file)
@@ -5,6 +5,8 @@
 \r
 ;@ For commercial use, separate licencing terms must be obtained.\r
 \r
+#include "../../pico/arm_features.h"\r
+\r
       .data\r
       .align 4\r
 \r
@@ -102,6 +104,7 @@ DrZ80Ver: .long 0x0001
 ;@---------------------------------------\r
 \r
 .text\r
+    PIC_LDR_INIT()\r
 \r
 .if DRZ80_XMAP\r
 \r
@@ -1370,7 +1373,7 @@ DrZ80Run:
        blne DoInterrupt\r
 .endif\r
 \r
-       ldr opcodes,MAIN_opcodes_POINTER2\r
+       PIC_LDR(opcodes, r0, MAIN_opcodes)\r
 \r
        cmp z80_icount,#0     ;@ irq might have used all cycles\r
        ldrplb r0,[z80pc],#1\r
@@ -1382,11 +1385,7 @@ z80_execute_end:
        stmia cpucontext,{z80pc-z80sp}                  ;@ save Z80 registers\r
        mov r0,z80_icount\r
        ldmia sp!,{r4-r12,pc}                                   ;@ restore registers from stack and return to C code\r
-\r
-MAIN_opcodes_POINTER2: .word MAIN_opcodes\r
-.if INTERRUPT_MODE\r
-Interrupt_local: .word Interrupt\r
-.endif\r
+.pool\r
 \r
 DoInterrupt:\r
 .if INTERRUPT_MODE\r
@@ -1395,8 +1394,9 @@ DoInterrupt:
        ;@ save everything back into DrZ80 context\r
        stmia cpucontext,{z80pc-z80sp}                  ;@ save Z80 registers\r
        stmfd sp!,{r3,r4,r5,lr}                                 ;@ save rest of regs on stack\r
+       PIC_LDR(r2, r3, Interrupt)\r
        mov lr,pc\r
-       ldr pc,Interrupt_local\r
+       bx r2\r
        ldmfd sp!,{r3,r4,r5,lr}                                 ;@ load regs from stack\r
        ;@ reload regs from DrZ80 context\r
        ldmia cpucontext,{z80pc-z80sp}                  ;@ load Z80 registers\r
@@ -4469,7 +4469,6 @@ opcode_2_6:
        and z80hl,z80hl,#0xFF<<16\r
        orr z80hl,z80hl,r1, lsl #24\r
        fetch 7\r
-DAATABLE_LOCAL: .word DAATable\r
 ;@DAA\r
 opcode_2_7:\r
        mov r1,z80a, lsr #24\r
@@ -4479,13 +4478,14 @@ opcode_2_7:
        orrne r1,r1,#512\r
        tst z80f,#1<<NFlag\r
        orrne r1,r1,#1024\r
-       ldr r2,DAATABLE_LOCAL\r
+       PIC_LDR(r2, r0, DAATable)\r
        add r2,r2,r1, lsl #1\r
        ldrh r1,[r2]\r
        and z80f,r1,#0xFF\r
        and r2,r1,#0xFF<<8\r
        mov z80a,r2, lsl #16\r
        fetch 4\r
+.pool\r
 ;@JR Z,$+2\r
 opcode_2_8:\r
        tst z80f,#1<<ZFlag\r
@@ -5230,40 +5230,40 @@ opcode_C_A:
 ;@the CB sub for the intruction and then branches to that location\r
 opcode_C_B:\r
        ldrb r0,[z80pc],#1\r
-       ldr pc,[pc,r0, lsl #2]\r
+       PIC_XB(,r0, lsl #2)\r
 opcodes_CB:    .word 0x00000000\r
-                       .word opcode_CB_00,opcode_CB_01,opcode_CB_02,opcode_CB_03,opcode_CB_04,opcode_CB_05,opcode_CB_06,opcode_CB_07\r
-                       .word opcode_CB_08,opcode_CB_09,opcode_CB_0A,opcode_CB_0B,opcode_CB_0C,opcode_CB_0D,opcode_CB_0E,opcode_CB_0F\r
-                       .word opcode_CB_10,opcode_CB_11,opcode_CB_12,opcode_CB_13,opcode_CB_14,opcode_CB_15,opcode_CB_16,opcode_CB_17\r
-                       .word opcode_CB_18,opcode_CB_19,opcode_CB_1A,opcode_CB_1B,opcode_CB_1C,opcode_CB_1D,opcode_CB_1E,opcode_CB_1F\r
-                       .word opcode_CB_20,opcode_CB_21,opcode_CB_22,opcode_CB_23,opcode_CB_24,opcode_CB_25,opcode_CB_26,opcode_CB_27\r
-                       .word opcode_CB_28,opcode_CB_29,opcode_CB_2A,opcode_CB_2B,opcode_CB_2C,opcode_CB_2D,opcode_CB_2E,opcode_CB_2F\r
-                       .word opcode_CB_30,opcode_CB_31,opcode_CB_32,opcode_CB_33,opcode_CB_34,opcode_CB_35,opcode_CB_36,opcode_CB_37\r
-                       .word opcode_CB_38,opcode_CB_39,opcode_CB_3A,opcode_CB_3B,opcode_CB_3C,opcode_CB_3D,opcode_CB_3E,opcode_CB_3F\r
-                       .word opcode_CB_40,opcode_CB_41,opcode_CB_42,opcode_CB_43,opcode_CB_44,opcode_CB_45,opcode_CB_46,opcode_CB_47\r
-                       .word opcode_CB_48,opcode_CB_49,opcode_CB_4A,opcode_CB_4B,opcode_CB_4C,opcode_CB_4D,opcode_CB_4E,opcode_CB_4F\r
-                       .word opcode_CB_50,opcode_CB_51,opcode_CB_52,opcode_CB_53,opcode_CB_54,opcode_CB_55,opcode_CB_56,opcode_CB_57\r
-                       .word opcode_CB_58,opcode_CB_59,opcode_CB_5A,opcode_CB_5B,opcode_CB_5C,opcode_CB_5D,opcode_CB_5E,opcode_CB_5F\r
-                       .word opcode_CB_60,opcode_CB_61,opcode_CB_62,opcode_CB_63,opcode_CB_64,opcode_CB_65,opcode_CB_66,opcode_CB_67\r
-                       .word opcode_CB_68,opcode_CB_69,opcode_CB_6A,opcode_CB_6B,opcode_CB_6C,opcode_CB_6D,opcode_CB_6E,opcode_CB_6F\r
-                       .word opcode_CB_70,opcode_CB_71,opcode_CB_72,opcode_CB_73,opcode_CB_74,opcode_CB_75,opcode_CB_76,opcode_CB_77\r
-                       .word opcode_CB_78,opcode_CB_79,opcode_CB_7A,opcode_CB_7B,opcode_CB_7C,opcode_CB_7D,opcode_CB_7E,opcode_CB_7F\r
-                       .word opcode_CB_80,opcode_CB_81,opcode_CB_82,opcode_CB_83,opcode_CB_84,opcode_CB_85,opcode_CB_86,opcode_CB_87\r
-                       .word opcode_CB_88,opcode_CB_89,opcode_CB_8A,opcode_CB_8B,opcode_CB_8C,opcode_CB_8D,opcode_CB_8E,opcode_CB_8F\r
-                       .word opcode_CB_90,opcode_CB_91,opcode_CB_92,opcode_CB_93,opcode_CB_94,opcode_CB_95,opcode_CB_96,opcode_CB_97\r
-                       .word opcode_CB_98,opcode_CB_99,opcode_CB_9A,opcode_CB_9B,opcode_CB_9C,opcode_CB_9D,opcode_CB_9E,opcode_CB_9F\r
-                       .word opcode_CB_A0,opcode_CB_A1,opcode_CB_A2,opcode_CB_A3,opcode_CB_A4,opcode_CB_A5,opcode_CB_A6,opcode_CB_A7\r
-                       .word opcode_CB_A8,opcode_CB_A9,opcode_CB_AA,opcode_CB_AB,opcode_CB_AC,opcode_CB_AD,opcode_CB_AE,opcode_CB_AF\r
-                       .word opcode_CB_B0,opcode_CB_B1,opcode_CB_B2,opcode_CB_B3,opcode_CB_B4,opcode_CB_B5,opcode_CB_B6,opcode_CB_B7\r
-                       .word opcode_CB_B8,opcode_CB_B9,opcode_CB_BA,opcode_CB_BB,opcode_CB_BC,opcode_CB_BD,opcode_CB_BE,opcode_CB_BF\r
-                       .word opcode_CB_C0,opcode_CB_C1,opcode_CB_C2,opcode_CB_C3,opcode_CB_C4,opcode_CB_C5,opcode_CB_C6,opcode_CB_C7\r
-                       .word opcode_CB_C8,opcode_CB_C9,opcode_CB_CA,opcode_CB_CB,opcode_CB_CC,opcode_CB_CD,opcode_CB_CE,opcode_CB_CF\r
-                       .word opcode_CB_D0,opcode_CB_D1,opcode_CB_D2,opcode_CB_D3,opcode_CB_D4,opcode_CB_D5,opcode_CB_D6,opcode_CB_D7\r
-                       .word opcode_CB_D8,opcode_CB_D9,opcode_CB_DA,opcode_CB_DB,opcode_CB_DC,opcode_CB_DD,opcode_CB_DE,opcode_CB_DF\r
-                       .word opcode_CB_E0,opcode_CB_E1,opcode_CB_E2,opcode_CB_E3,opcode_CB_E4,opcode_CB_E5,opcode_CB_E6,opcode_CB_E7\r
-                       .word opcode_CB_E8,opcode_CB_E9,opcode_CB_EA,opcode_CB_EB,opcode_CB_EC,opcode_CB_ED,opcode_CB_EE,opcode_CB_EF\r
-                       .word opcode_CB_F0,opcode_CB_F1,opcode_CB_F2,opcode_CB_F3,opcode_CB_F4,opcode_CB_F5,opcode_CB_F6,opcode_CB_F7\r
-                       .word opcode_CB_F8,opcode_CB_F9,opcode_CB_FA,opcode_CB_FB,opcode_CB_FC,opcode_CB_FD,opcode_CB_FE,opcode_CB_FF\r
+               PIC_BT(opcode_CB_00);PIC_BT(opcode_CB_01);PIC_BT(opcode_CB_02);PIC_BT(opcode_CB_03);PIC_BT(opcode_CB_04);PIC_BT(opcode_CB_05);PIC_BT(opcode_CB_06);PIC_BT(opcode_CB_07)\r
+               PIC_BT(opcode_CB_08);PIC_BT(opcode_CB_09);PIC_BT(opcode_CB_0A);PIC_BT(opcode_CB_0B);PIC_BT(opcode_CB_0C);PIC_BT(opcode_CB_0D);PIC_BT(opcode_CB_0E);PIC_BT(opcode_CB_0F)\r
+               PIC_BT(opcode_CB_10);PIC_BT(opcode_CB_11);PIC_BT(opcode_CB_12);PIC_BT(opcode_CB_13);PIC_BT(opcode_CB_14);PIC_BT(opcode_CB_15);PIC_BT(opcode_CB_16);PIC_BT(opcode_CB_17)\r
+               PIC_BT(opcode_CB_18);PIC_BT(opcode_CB_19);PIC_BT(opcode_CB_1A);PIC_BT(opcode_CB_1B);PIC_BT(opcode_CB_1C);PIC_BT(opcode_CB_1D);PIC_BT(opcode_CB_1E);PIC_BT(opcode_CB_1F)\r
+               PIC_BT(opcode_CB_20);PIC_BT(opcode_CB_21);PIC_BT(opcode_CB_22);PIC_BT(opcode_CB_23);PIC_BT(opcode_CB_24);PIC_BT(opcode_CB_25);PIC_BT(opcode_CB_26);PIC_BT(opcode_CB_27)\r
+               PIC_BT(opcode_CB_28);PIC_BT(opcode_CB_29);PIC_BT(opcode_CB_2A);PIC_BT(opcode_CB_2B);PIC_BT(opcode_CB_2C);PIC_BT(opcode_CB_2D);PIC_BT(opcode_CB_2E);PIC_BT(opcode_CB_2F)\r
+               PIC_BT(opcode_CB_30);PIC_BT(opcode_CB_31);PIC_BT(opcode_CB_32);PIC_BT(opcode_CB_33);PIC_BT(opcode_CB_34);PIC_BT(opcode_CB_35);PIC_BT(opcode_CB_36);PIC_BT(opcode_CB_37)\r
+               PIC_BT(opcode_CB_38);PIC_BT(opcode_CB_39);PIC_BT(opcode_CB_3A);PIC_BT(opcode_CB_3B);PIC_BT(opcode_CB_3C);PIC_BT(opcode_CB_3D);PIC_BT(opcode_CB_3E);PIC_BT(opcode_CB_3F)\r
+               PIC_BT(opcode_CB_40);PIC_BT(opcode_CB_41);PIC_BT(opcode_CB_42);PIC_BT(opcode_CB_43);PIC_BT(opcode_CB_44);PIC_BT(opcode_CB_45);PIC_BT(opcode_CB_46);PIC_BT(opcode_CB_47)\r
+               PIC_BT(opcode_CB_48);PIC_BT(opcode_CB_49);PIC_BT(opcode_CB_4A);PIC_BT(opcode_CB_4B);PIC_BT(opcode_CB_4C);PIC_BT(opcode_CB_4D);PIC_BT(opcode_CB_4E);PIC_BT(opcode_CB_4F)\r
+               PIC_BT(opcode_CB_50);PIC_BT(opcode_CB_51);PIC_BT(opcode_CB_52);PIC_BT(opcode_CB_53);PIC_BT(opcode_CB_54);PIC_BT(opcode_CB_55);PIC_BT(opcode_CB_56);PIC_BT(opcode_CB_57)\r
+               PIC_BT(opcode_CB_58);PIC_BT(opcode_CB_59);PIC_BT(opcode_CB_5A);PIC_BT(opcode_CB_5B);PIC_BT(opcode_CB_5C);PIC_BT(opcode_CB_5D);PIC_BT(opcode_CB_5E);PIC_BT(opcode_CB_5F)\r
+               PIC_BT(opcode_CB_60);PIC_BT(opcode_CB_61);PIC_BT(opcode_CB_62);PIC_BT(opcode_CB_63);PIC_BT(opcode_CB_64);PIC_BT(opcode_CB_65);PIC_BT(opcode_CB_66);PIC_BT(opcode_CB_67)\r
+               PIC_BT(opcode_CB_68);PIC_BT(opcode_CB_69);PIC_BT(opcode_CB_6A);PIC_BT(opcode_CB_6B);PIC_BT(opcode_CB_6C);PIC_BT(opcode_CB_6D);PIC_BT(opcode_CB_6E);PIC_BT(opcode_CB_6F)\r
+               PIC_BT(opcode_CB_70);PIC_BT(opcode_CB_71);PIC_BT(opcode_CB_72);PIC_BT(opcode_CB_73);PIC_BT(opcode_CB_74);PIC_BT(opcode_CB_75);PIC_BT(opcode_CB_76);PIC_BT(opcode_CB_77)\r
+               PIC_BT(opcode_CB_78);PIC_BT(opcode_CB_79);PIC_BT(opcode_CB_7A);PIC_BT(opcode_CB_7B);PIC_BT(opcode_CB_7C);PIC_BT(opcode_CB_7D);PIC_BT(opcode_CB_7E);PIC_BT(opcode_CB_7F)\r
+               PIC_BT(opcode_CB_80);PIC_BT(opcode_CB_81);PIC_BT(opcode_CB_82);PIC_BT(opcode_CB_83);PIC_BT(opcode_CB_84);PIC_BT(opcode_CB_85);PIC_BT(opcode_CB_86);PIC_BT(opcode_CB_87)\r
+               PIC_BT(opcode_CB_88);PIC_BT(opcode_CB_89);PIC_BT(opcode_CB_8A);PIC_BT(opcode_CB_8B);PIC_BT(opcode_CB_8C);PIC_BT(opcode_CB_8D);PIC_BT(opcode_CB_8E);PIC_BT(opcode_CB_8F)\r
+               PIC_BT(opcode_CB_90);PIC_BT(opcode_CB_91);PIC_BT(opcode_CB_92);PIC_BT(opcode_CB_93);PIC_BT(opcode_CB_94);PIC_BT(opcode_CB_95);PIC_BT(opcode_CB_96);PIC_BT(opcode_CB_97)\r
+               PIC_BT(opcode_CB_98);PIC_BT(opcode_CB_99);PIC_BT(opcode_CB_9A);PIC_BT(opcode_CB_9B);PIC_BT(opcode_CB_9C);PIC_BT(opcode_CB_9D);PIC_BT(opcode_CB_9E);PIC_BT(opcode_CB_9F)\r
+               PIC_BT(opcode_CB_A0);PIC_BT(opcode_CB_A1);PIC_BT(opcode_CB_A2);PIC_BT(opcode_CB_A3);PIC_BT(opcode_CB_A4);PIC_BT(opcode_CB_A5);PIC_BT(opcode_CB_A6);PIC_BT(opcode_CB_A7)\r
+               PIC_BT(opcode_CB_A8);PIC_BT(opcode_CB_A9);PIC_BT(opcode_CB_AA);PIC_BT(opcode_CB_AB);PIC_BT(opcode_CB_AC);PIC_BT(opcode_CB_AD);PIC_BT(opcode_CB_AE);PIC_BT(opcode_CB_AF)\r
+               PIC_BT(opcode_CB_B0);PIC_BT(opcode_CB_B1);PIC_BT(opcode_CB_B2);PIC_BT(opcode_CB_B3);PIC_BT(opcode_CB_B4);PIC_BT(opcode_CB_B5);PIC_BT(opcode_CB_B6);PIC_BT(opcode_CB_B7)\r
+               PIC_BT(opcode_CB_B8);PIC_BT(opcode_CB_B9);PIC_BT(opcode_CB_BA);PIC_BT(opcode_CB_BB);PIC_BT(opcode_CB_BC);PIC_BT(opcode_CB_BD);PIC_BT(opcode_CB_BE);PIC_BT(opcode_CB_BF)\r
+               PIC_BT(opcode_CB_C0);PIC_BT(opcode_CB_C1);PIC_BT(opcode_CB_C2);PIC_BT(opcode_CB_C3);PIC_BT(opcode_CB_C4);PIC_BT(opcode_CB_C5);PIC_BT(opcode_CB_C6);PIC_BT(opcode_CB_C7)\r
+               PIC_BT(opcode_CB_C8);PIC_BT(opcode_CB_C9);PIC_BT(opcode_CB_CA);PIC_BT(opcode_CB_CB);PIC_BT(opcode_CB_CC);PIC_BT(opcode_CB_CD);PIC_BT(opcode_CB_CE);PIC_BT(opcode_CB_CF)\r
+               PIC_BT(opcode_CB_D0);PIC_BT(opcode_CB_D1);PIC_BT(opcode_CB_D2);PIC_BT(opcode_CB_D3);PIC_BT(opcode_CB_D4);PIC_BT(opcode_CB_D5);PIC_BT(opcode_CB_D6);PIC_BT(opcode_CB_D7)\r
+               PIC_BT(opcode_CB_D8);PIC_BT(opcode_CB_D9);PIC_BT(opcode_CB_DA);PIC_BT(opcode_CB_DB);PIC_BT(opcode_CB_DC);PIC_BT(opcode_CB_DD);PIC_BT(opcode_CB_DE);PIC_BT(opcode_CB_DF)\r
+               PIC_BT(opcode_CB_E0);PIC_BT(opcode_CB_E1);PIC_BT(opcode_CB_E2);PIC_BT(opcode_CB_E3);PIC_BT(opcode_CB_E4);PIC_BT(opcode_CB_E5);PIC_BT(opcode_CB_E6);PIC_BT(opcode_CB_E7)\r
+               PIC_BT(opcode_CB_E8);PIC_BT(opcode_CB_E9);PIC_BT(opcode_CB_EA);PIC_BT(opcode_CB_EB);PIC_BT(opcode_CB_EC);PIC_BT(opcode_CB_ED);PIC_BT(opcode_CB_EE);PIC_BT(opcode_CB_EF)\r
+               PIC_BT(opcode_CB_F0);PIC_BT(opcode_CB_F1);PIC_BT(opcode_CB_F2);PIC_BT(opcode_CB_F3);PIC_BT(opcode_CB_F4);PIC_BT(opcode_CB_F5);PIC_BT(opcode_CB_F6);PIC_BT(opcode_CB_F7)\r
+               PIC_BT(opcode_CB_F8);PIC_BT(opcode_CB_F9);PIC_BT(opcode_CB_FA);PIC_BT(opcode_CB_FB);PIC_BT(opcode_CB_FC);PIC_BT(opcode_CB_FD);PIC_BT(opcode_CB_FE);PIC_BT(opcode_CB_FF)\r
 \r
 ;@CALL Z,NN\r
 opcode_C_C:\r
@@ -5378,40 +5378,40 @@ opcode_F_D:
        add z80xx,cpucontext,#z80iy\r
 opcode_D_D_F_D:\r
        ldrb r0,[z80pc],#1\r
-       ldr pc,[pc,r0, lsl #2]\r
+       PIC_XB(,r0, lsl #2)\r
 opcodes_DD:    .word 0x00000000\r
-                       .word opcode_0_0,  opcode_0_1,  opcode_0_2,  opcode_0_3,  opcode_0_4,  opcode_0_5,  opcode_0_6,  opcode_0_7\r
-                       .word opcode_0_8,  opcode_DD_09,opcode_0_A,  opcode_0_B,  opcode_0_C,  opcode_0_D,  opcode_0_E,  opcode_0_F\r
-                       .word opcode_1_0,  opcode_1_1,  opcode_1_2,  opcode_1_3,  opcode_1_4,  opcode_1_5,  opcode_1_6,  opcode_1_7\r
-                       .word opcode_1_8,  opcode_DD_19,opcode_1_A,  opcode_1_B,  opcode_1_C,  opcode_1_D,  opcode_1_E,  opcode_1_F\r
-                       .word opcode_2_0,  opcode_DD_21,opcode_DD_22,opcode_DD_23,opcode_DD_24,opcode_DD_25,opcode_DD_26,opcode_2_7\r
-                       .word opcode_2_8,  opcode_DD_29,opcode_DD_2A,opcode_DD_2B,opcode_DD_2C,opcode_DD_2D,opcode_DD_2E,opcode_2_F\r
-                       .word opcode_3_0,  opcode_3_1,  opcode_3_2,  opcode_3_3,  opcode_DD_34,opcode_DD_35,opcode_DD_36,opcode_3_7\r
-                       .word opcode_3_8,  opcode_DD_39,opcode_3_A,  opcode_3_B,  opcode_3_C,  opcode_3_D,  opcode_3_E,  opcode_3_F\r
-                       .word opcode_4_0,  opcode_4_1,  opcode_4_2,  opcode_4_3,  opcode_DD_44,opcode_DD_45,opcode_DD_46,opcode_4_7\r
-                       .word opcode_4_8,  opcode_4_9,  opcode_4_A,  opcode_4_B,  opcode_DD_4C,opcode_DD_4D,opcode_DD_4E,opcode_4_F\r
-                       .word opcode_5_0,  opcode_5_1,  opcode_5_2,  opcode_5_3,  opcode_DD_54,opcode_DD_55,opcode_DD_56,opcode_5_7\r
-                       .word opcode_5_8,  opcode_5_9,  opcode_5_A,  opcode_5_B,  opcode_DD_5C,opcode_DD_5D,opcode_DD_5E,opcode_5_F\r
-                       .word opcode_DD_60,opcode_DD_61,opcode_DD_62,opcode_DD_63,opcode_DD_64,opcode_DD_65,opcode_DD_66,opcode_DD_67\r
-                       .word opcode_DD_68,opcode_DD_69,opcode_DD_6A,opcode_DD_6B,opcode_DD_6C,opcode_DD_6D,opcode_DD_6E,opcode_DD_6F\r
-                       .word opcode_DD_70,opcode_DD_71,opcode_DD_72,opcode_DD_73,opcode_DD_74,opcode_DD_75,opcode_7_6,  opcode_DD_77\r
-                       .word opcode_7_8,  opcode_7_9,  opcode_7_A,  opcode_7_B,  opcode_DD_7C,opcode_DD_7D,opcode_DD_7E,opcode_7_F\r
-                       .word opcode_8_0,  opcode_8_1,  opcode_8_2,  opcode_8_3,  opcode_DD_84,opcode_DD_85,opcode_DD_86,opcode_8_7\r
-                       .word opcode_8_8,  opcode_8_9,  opcode_8_A,  opcode_8_B,  opcode_DD_8C,opcode_DD_8D,opcode_DD_8E,opcode_8_F\r
-                       .word opcode_9_0,  opcode_9_1,  opcode_9_2,  opcode_9_3,  opcode_DD_94,opcode_DD_95,opcode_DD_96,opcode_9_7\r
-                       .word opcode_9_8,  opcode_9_9,  opcode_9_A,  opcode_9_B,  opcode_DD_9C,opcode_DD_9D,opcode_DD_9E,opcode_9_F\r
-                       .word opcode_A_0,  opcode_A_1,  opcode_A_2,  opcode_A_3,  opcode_DD_A4,opcode_DD_A5,opcode_DD_A6,opcode_A_7\r
-                       .word opcode_A_8,  opcode_A_9,  opcode_A_A,  opcode_A_B,  opcode_DD_AC,opcode_DD_AD,opcode_DD_AE,opcode_A_F\r
-                       .word opcode_B_0,  opcode_B_1,  opcode_B_2,  opcode_B_3,  opcode_DD_B4,opcode_DD_B5,opcode_DD_B6,opcode_B_7\r
-                       .word opcode_B_8,  opcode_B_9,  opcode_B_A,  opcode_B_B,  opcode_DD_BC,opcode_DD_BD,opcode_DD_BE,opcode_B_F\r
-                       .word opcode_C_0,  opcode_C_1,  opcode_C_2,  opcode_C_3,  opcode_C_4,  opcode_C_5,  opcode_C_6,  opcode_C_7\r
-                       .word opcode_C_8,  opcode_C_9,  opcode_C_A,  opcode_DD_CB,opcode_C_C,  opcode_C_D,  opcode_C_E,  opcode_C_F\r
-                       .word opcode_D_0,  opcode_D_1,  opcode_D_2,  opcode_D_3,  opcode_D_4,  opcode_D_5,  opcode_D_6,  opcode_D_7\r
-                       .word opcode_D_8,  opcode_D_9,  opcode_D_A,  opcode_D_B,  opcode_D_C,  opcode_D_D,  opcode_D_E,  opcode_D_F\r
-                       .word opcode_E_0,  opcode_DD_E1,opcode_E_2,  opcode_DD_E3,opcode_E_4,  opcode_DD_E5,opcode_E_6,  opcode_E_7\r
-                       .word opcode_E_8,  opcode_DD_E9,opcode_E_A,  opcode_E_B,  opcode_E_C,  opcode_E_D,  opcode_E_E,  opcode_E_F\r
-                       .word opcode_F_0,  opcode_F_1,  opcode_F_2,  opcode_F_3,  opcode_F_4,  opcode_F_5,  opcode_F_6,  opcode_F_7\r
-                       .word opcode_F_8,  opcode_DD_F9,opcode_F_A,  opcode_F_B,  opcode_F_C,  opcode_F_D,  opcode_F_E,  opcode_F_F\r
+               PIC_BT(  opcode_0_0);PIC_BT(  opcode_0_1);PIC_BT(  opcode_0_2);PIC_BT(  opcode_0_3);PIC_BT(  opcode_0_4);PIC_BT(  opcode_0_5);PIC_BT(  opcode_0_6);PIC_BT(  opcode_0_7)\r
+               PIC_BT(  opcode_0_8);PIC_BT(  opcode_DD_09);PIC_BT(opcode_0_A);PIC_BT(  opcode_0_B);PIC_BT(  opcode_0_C);PIC_BT(  opcode_0_D);PIC_BT(  opcode_0_E);PIC_BT(  opcode_0_F)\r
+               PIC_BT(  opcode_1_0);PIC_BT(  opcode_1_1);PIC_BT(  opcode_1_2);PIC_BT(  opcode_1_3);PIC_BT(  opcode_1_4);PIC_BT(  opcode_1_5);PIC_BT(  opcode_1_6);PIC_BT(  opcode_1_7)\r
+               PIC_BT(  opcode_1_8);PIC_BT(  opcode_DD_19);PIC_BT(opcode_1_A);PIC_BT(  opcode_1_B);PIC_BT(  opcode_1_C);PIC_BT(  opcode_1_D);PIC_BT(  opcode_1_E);PIC_BT(  opcode_1_F)\r
+               PIC_BT(  opcode_2_0);PIC_BT(  opcode_DD_21);PIC_BT(opcode_DD_22);PIC_BT(opcode_DD_23);PIC_BT(opcode_DD_24);PIC_BT(opcode_DD_25);PIC_BT(opcode_DD_26);PIC_BT(opcode_2_7)\r
+               PIC_BT(  opcode_2_8);PIC_BT(  opcode_DD_29);PIC_BT(opcode_DD_2A);PIC_BT(opcode_DD_2B);PIC_BT(opcode_DD_2C);PIC_BT(opcode_DD_2D);PIC_BT(opcode_DD_2E);PIC_BT(opcode_2_F)\r
+               PIC_BT(  opcode_3_0);PIC_BT(  opcode_3_1);PIC_BT(  opcode_3_2);PIC_BT(  opcode_3_3);PIC_BT(  opcode_DD_34);PIC_BT(opcode_DD_35);PIC_BT(opcode_DD_36);PIC_BT(opcode_3_7)\r
+               PIC_BT(  opcode_3_8);PIC_BT(  opcode_DD_39);PIC_BT(opcode_3_A);PIC_BT(  opcode_3_B);PIC_BT(  opcode_3_C);PIC_BT(  opcode_3_D);PIC_BT(  opcode_3_E);PIC_BT(  opcode_3_F)\r
+               PIC_BT(  opcode_4_0);PIC_BT(  opcode_4_1);PIC_BT(  opcode_4_2);PIC_BT(  opcode_4_3);PIC_BT(  opcode_DD_44);PIC_BT(opcode_DD_45);PIC_BT(opcode_DD_46);PIC_BT(opcode_4_7)\r
+               PIC_BT(  opcode_4_8);PIC_BT(  opcode_4_9);PIC_BT(  opcode_4_A);PIC_BT(  opcode_4_B);PIC_BT(  opcode_DD_4C);PIC_BT(opcode_DD_4D);PIC_BT(opcode_DD_4E);PIC_BT(opcode_4_F)\r
+               PIC_BT(  opcode_5_0);PIC_BT(  opcode_5_1);PIC_BT(  opcode_5_2);PIC_BT(  opcode_5_3);PIC_BT(  opcode_DD_54);PIC_BT(opcode_DD_55);PIC_BT(opcode_DD_56);PIC_BT(opcode_5_7)\r
+               PIC_BT(  opcode_5_8);PIC_BT(  opcode_5_9);PIC_BT(  opcode_5_A);PIC_BT(  opcode_5_B);PIC_BT(  opcode_DD_5C);PIC_BT(opcode_DD_5D);PIC_BT(opcode_DD_5E);PIC_BT(opcode_5_F)\r
+               PIC_BT(opcode_DD_60);PIC_BT(opcode_DD_61);PIC_BT(opcode_DD_62);PIC_BT(opcode_DD_63);PIC_BT(opcode_DD_64);PIC_BT(opcode_DD_65);PIC_BT(opcode_DD_66);PIC_BT(opcode_DD_67)\r
+               PIC_BT(opcode_DD_68);PIC_BT(opcode_DD_69);PIC_BT(opcode_DD_6A);PIC_BT(opcode_DD_6B);PIC_BT(opcode_DD_6C);PIC_BT(opcode_DD_6D);PIC_BT(opcode_DD_6E);PIC_BT(opcode_DD_6F)\r
+               PIC_BT(opcode_DD_70);PIC_BT(opcode_DD_71);PIC_BT(opcode_DD_72);PIC_BT(opcode_DD_73);PIC_BT(opcode_DD_74);PIC_BT(opcode_DD_75);PIC_BT(opcode_7_6);PIC_BT(  opcode_DD_77)\r
+               PIC_BT(  opcode_7_8);PIC_BT(  opcode_7_9);PIC_BT(  opcode_7_A);PIC_BT(  opcode_7_B);PIC_BT(  opcode_DD_7C);PIC_BT(opcode_DD_7D);PIC_BT(opcode_DD_7E);PIC_BT(opcode_7_F)\r
+               PIC_BT(  opcode_8_0);PIC_BT(  opcode_8_1);PIC_BT(  opcode_8_2);PIC_BT(  opcode_8_3);PIC_BT(  opcode_DD_84);PIC_BT(opcode_DD_85);PIC_BT(opcode_DD_86);PIC_BT(opcode_8_7)\r
+               PIC_BT(  opcode_8_8);PIC_BT(  opcode_8_9);PIC_BT(  opcode_8_A);PIC_BT(  opcode_8_B);PIC_BT(  opcode_DD_8C);PIC_BT(opcode_DD_8D);PIC_BT(opcode_DD_8E);PIC_BT(opcode_8_F)\r
+               PIC_BT(  opcode_9_0);PIC_BT(  opcode_9_1);PIC_BT(  opcode_9_2);PIC_BT(  opcode_9_3);PIC_BT(  opcode_DD_94);PIC_BT(opcode_DD_95);PIC_BT(opcode_DD_96);PIC_BT(opcode_9_7)\r
+               PIC_BT(  opcode_9_8);PIC_BT(  opcode_9_9);PIC_BT(  opcode_9_A);PIC_BT(  opcode_9_B);PIC_BT(  opcode_DD_9C);PIC_BT(opcode_DD_9D);PIC_BT(opcode_DD_9E);PIC_BT(opcode_9_F)\r
+               PIC_BT(  opcode_A_0);PIC_BT(  opcode_A_1);PIC_BT(  opcode_A_2);PIC_BT(  opcode_A_3);PIC_BT(  opcode_DD_A4);PIC_BT(opcode_DD_A5);PIC_BT(opcode_DD_A6);PIC_BT(opcode_A_7)\r
+               PIC_BT(  opcode_A_8);PIC_BT(  opcode_A_9);PIC_BT(  opcode_A_A);PIC_BT(  opcode_A_B);PIC_BT(  opcode_DD_AC);PIC_BT(opcode_DD_AD);PIC_BT(opcode_DD_AE);PIC_BT(opcode_A_F)\r
+               PIC_BT(  opcode_B_0);PIC_BT(  opcode_B_1);PIC_BT(  opcode_B_2);PIC_BT(  opcode_B_3);PIC_BT(  opcode_DD_B4);PIC_BT(opcode_DD_B5);PIC_BT(opcode_DD_B6);PIC_BT(opcode_B_7)\r
+               PIC_BT(  opcode_B_8);PIC_BT(  opcode_B_9);PIC_BT(  opcode_B_A);PIC_BT(  opcode_B_B);PIC_BT(  opcode_DD_BC);PIC_BT(opcode_DD_BD);PIC_BT(opcode_DD_BE);PIC_BT(opcode_B_F)\r
+               PIC_BT(  opcode_C_0);PIC_BT(  opcode_C_1);PIC_BT(  opcode_C_2);PIC_BT(  opcode_C_3);PIC_BT(  opcode_C_4);PIC_BT(  opcode_C_5);PIC_BT(  opcode_C_6);PIC_BT(  opcode_C_7)\r
+               PIC_BT(  opcode_C_8);PIC_BT(  opcode_C_9);PIC_BT(  opcode_C_A);PIC_BT(  opcode_DD_CB);PIC_BT(opcode_C_C);PIC_BT(  opcode_C_D);PIC_BT(  opcode_C_E);PIC_BT(  opcode_C_F)\r
+               PIC_BT(  opcode_D_0);PIC_BT(  opcode_D_1);PIC_BT(  opcode_D_2);PIC_BT(  opcode_D_3);PIC_BT(  opcode_D_4);PIC_BT(  opcode_D_5);PIC_BT(  opcode_D_6);PIC_BT(  opcode_D_7)\r
+               PIC_BT(  opcode_D_8);PIC_BT(  opcode_D_9);PIC_BT(  opcode_D_A);PIC_BT(  opcode_D_B);PIC_BT(  opcode_D_C);PIC_BT(  opcode_D_D);PIC_BT(  opcode_D_E);PIC_BT(  opcode_D_F)\r
+               PIC_BT(  opcode_E_0);PIC_BT(  opcode_DD_E1);PIC_BT(opcode_E_2);PIC_BT(  opcode_DD_E3);PIC_BT(opcode_E_4);PIC_BT(  opcode_DD_E5);PIC_BT(opcode_E_6);PIC_BT(  opcode_E_7)\r
+               PIC_BT(  opcode_E_8);PIC_BT(  opcode_DD_E9);PIC_BT(opcode_E_A);PIC_BT(  opcode_E_B);PIC_BT(  opcode_E_C);PIC_BT(  opcode_E_D);PIC_BT(  opcode_E_E);PIC_BT(  opcode_E_F)\r
+               PIC_BT(  opcode_F_0);PIC_BT(  opcode_F_1);PIC_BT(  opcode_F_2);PIC_BT(  opcode_F_3);PIC_BT(  opcode_F_4);PIC_BT(  opcode_F_5);PIC_BT(  opcode_F_6);PIC_BT(  opcode_F_7)\r
+               PIC_BT(  opcode_F_8);PIC_BT(  opcode_DD_F9);PIC_BT(opcode_F_A);PIC_BT(  opcode_F_B);PIC_BT(  opcode_F_C);PIC_BT(  opcode_F_D);PIC_BT(  opcode_F_E);PIC_BT(  opcode_F_F)\r
 \r
 ;@SBC A,N\r
 opcode_D_E:\r
@@ -5509,40 +5509,40 @@ opcode_E_C:
 ;@This should be caught at start\r
 opcode_E_D:\r
        ldrb r1,[z80pc],#1\r
-       ldr pc,[pc,r1, lsl #2]\r
+       PIC_XB(,r1, lsl #2)\r
 opcodes_ED:    .word 0x00000000\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_40,opcode_ED_41,opcode_ED_42,opcode_ED_43,opcode_ED_44,opcode_ED_45,opcode_ED_46,opcode_ED_47\r
-                       .word opcode_ED_48,opcode_ED_49,opcode_ED_4A,opcode_ED_4B,opcode_ED_44,opcode_ED_4D,opcode_ED_46,opcode_ED_4F\r
-                       .word opcode_ED_50,opcode_ED_51,opcode_ED_52,opcode_ED_53,opcode_ED_44,opcode_ED_45,opcode_ED_56,opcode_ED_57\r
-                       .word opcode_ED_58,opcode_ED_59,opcode_ED_5A,opcode_ED_5B,opcode_ED_44,opcode_ED_45,opcode_ED_5E,opcode_ED_5F\r
-                       .word opcode_ED_60,opcode_ED_61,opcode_ED_62,opcode_ED_63,opcode_ED_44,opcode_ED_45,opcode_ED_46,opcode_ED_67\r
-                       .word opcode_ED_68,opcode_ED_69,opcode_ED_6A,opcode_ED_6B,opcode_ED_44,opcode_ED_45,opcode_ED_46,opcode_ED_6F\r
-                       .word opcode_ED_70,opcode_ED_71,opcode_ED_72,opcode_ED_73,opcode_ED_44,opcode_ED_45,opcode_ED_56,opcode_ED_NF\r
-                       .word opcode_ED_78,opcode_ED_79,opcode_ED_7A,opcode_ED_7B,opcode_ED_44,opcode_ED_45,opcode_ED_5E,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_A0,opcode_ED_A1,opcode_ED_A2,opcode_ED_A3,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_A8,opcode_ED_A9,opcode_ED_AA,opcode_ED_AB,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_B0,opcode_ED_B1,opcode_ED_B2,opcode_ED_B3,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_B8,opcode_ED_B9,opcode_ED_BA,opcode_ED_BB,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
-                       .word opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF,opcode_ED_NF\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_40);PIC_BT(opcode_ED_41);PIC_BT(opcode_ED_42);PIC_BT(opcode_ED_43);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_45);PIC_BT(opcode_ED_46);PIC_BT(opcode_ED_47)\r
+               PIC_BT(opcode_ED_48);PIC_BT(opcode_ED_49);PIC_BT(opcode_ED_4A);PIC_BT(opcode_ED_4B);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_4D);PIC_BT(opcode_ED_46);PIC_BT(opcode_ED_4F)\r
+               PIC_BT(opcode_ED_50);PIC_BT(opcode_ED_51);PIC_BT(opcode_ED_52);PIC_BT(opcode_ED_53);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_45);PIC_BT(opcode_ED_56);PIC_BT(opcode_ED_57)\r
+               PIC_BT(opcode_ED_58);PIC_BT(opcode_ED_59);PIC_BT(opcode_ED_5A);PIC_BT(opcode_ED_5B);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_45);PIC_BT(opcode_ED_5E);PIC_BT(opcode_ED_5F)\r
+               PIC_BT(opcode_ED_60);PIC_BT(opcode_ED_61);PIC_BT(opcode_ED_62);PIC_BT(opcode_ED_63);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_45);PIC_BT(opcode_ED_46);PIC_BT(opcode_ED_67)\r
+               PIC_BT(opcode_ED_68);PIC_BT(opcode_ED_69);PIC_BT(opcode_ED_6A);PIC_BT(opcode_ED_6B);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_45);PIC_BT(opcode_ED_46);PIC_BT(opcode_ED_6F)\r
+               PIC_BT(opcode_ED_70);PIC_BT(opcode_ED_71);PIC_BT(opcode_ED_72);PIC_BT(opcode_ED_73);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_45);PIC_BT(opcode_ED_56);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_78);PIC_BT(opcode_ED_79);PIC_BT(opcode_ED_7A);PIC_BT(opcode_ED_7B);PIC_BT(opcode_ED_44);PIC_BT(opcode_ED_45);PIC_BT(opcode_ED_5E);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_A0);PIC_BT(opcode_ED_A1);PIC_BT(opcode_ED_A2);PIC_BT(opcode_ED_A3);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_A8);PIC_BT(opcode_ED_A9);PIC_BT(opcode_ED_AA);PIC_BT(opcode_ED_AB);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_B0);PIC_BT(opcode_ED_B1);PIC_BT(opcode_ED_B2);PIC_BT(opcode_ED_B3);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_B8);PIC_BT(opcode_ED_B9);PIC_BT(opcode_ED_BA);PIC_BT(opcode_ED_BB);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
+               PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF);PIC_BT(opcode_ED_NF)\r
 \r
 ;@XOR N\r
 opcode_E_E:\r
@@ -5631,8 +5631,6 @@ opcode_F_A:
        bne opcode_C_3          ;@unconditional JP\r
        add z80pc,z80pc,#2\r
        fetch 10\r
-MAIN_opcodes_POINTER: .word MAIN_opcodes\r
-EI_DUMMY_opcodes_POINTER: .word EI_DUMMY_opcodes\r
 ;@EI\r
 opcode_F_B:\r
        ldrb r1,[cpucontext,#z80if]\r
@@ -5642,8 +5640,9 @@ opcode_F_B:
 \r
        ldrb r0,[z80pc],#1\r
        eatcycles 4\r
-       ldr opcodes,EI_DUMMY_opcodes_POINTER\r
-       ldr pc,[r2,r0, lsl #2]\r
+       PIC_LDR(opcodes, r1, EI_DUMMY_opcodes)\r
+       ldr pc,[r2, r0, lsl #2]\r
+.pool\r
 \r
 ei_return:\r
        ;@point that program returns from EI to check interupts\r
@@ -5651,7 +5650,7 @@ ei_return:
        ;@ reset z80pc and opcode pointer\r
        ldrh r0,[cpucontext,#z80irq] @ 0x4C, irq and IFF bits\r
        sub z80pc,z80pc,#1\r
-       ldr opcodes,MAIN_opcodes_POINTER\r
+       PIC_LDR(opcodes, r1, MAIN_opcodes)\r
        ;@ check ints\r
        tst r0,#0xff\r
        movne r0,r0,lsr #8\r
@@ -5660,6 +5659,7 @@ ei_return:
 \r
        ;@ continue\r
        fetch 0\r
+.pool\r
 \r
 ;@CALL M,NN\r
 opcode_F_C:\r
@@ -7231,7 +7231,6 @@ opcode_DD_BE:
        fetch 19\r
 \r
 \r
-opcodes_DD_CB_LOCAL: .word opcodes_DD_CB\r
 opcode_DD_CB:\r
 ;@Looks up the opcode on the opcodes_DD_CB table and then \r
 ;@moves the PC to the location of the subroutine\r
@@ -7241,41 +7240,41 @@ opcode_DD_CB:
        mov r0,r0,lsr #16\r
 \r
        ldrb r1,[z80pc],#1\r
-       ldr pc,[pc,r1, lsl #2]\r
+       PIC_XB(,r1, lsl #2)\r
                .word 0x00\r
 opcodes_DD_CB:\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_06,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_0E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_16,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_1E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_26,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_2E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_36,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_3E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_46,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_4E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_56,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_5E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_66,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_6E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_76,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_7E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_86,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_8E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_96,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_9E,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_A6,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_AE,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_B6,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_BE,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_C6,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_CE,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_D6,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_DE,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_E6,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_EE,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_F6,opcode_DD_NF2\r
-               .word opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_NF2,opcode_DD_CB_FE,opcode_DD_NF2\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_06);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_0E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_16);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_1E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_26);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_2E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_36);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_3E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_46);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_4E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_56);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_5E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_66);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_6E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_76);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_7E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_86);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_8E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_96);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_9E);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_A6);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_AE);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_B6);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_BE);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_C6);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_CE);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_D6);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_DE);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_E6);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_EE);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_F6);PIC_BT(opcode_DD_NF2)\r
+       PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_NF2);PIC_BT(opcode_DD_CB_FE);PIC_BT(opcode_DD_NF2)\r
 \r
 ;@RLC (IX+N) \r
 opcode_DD_CB_06:\r
index c827fe2..26fede3 100644 (file)
@@ -211,7 +211,7 @@ enum { XT_UXTW=0x4, XT_UXTX=0x6, XT_LSL=0x7, XT_SXTW=0xc, XT_SXTX=0xe };
 #define A64_MOVT_IMM(rd, imm16, lsl16) \
        A64_INSN(0x9,0x3,0x2,lsl16,_,_,_,(imm16)&0xffff,rd)
 
-// rd = rn SHIFT imm6
+// rd = rn SHIFT imm5/imm6 (for Wn/Xn)
 #define A64_LSL_IMM(rd, rn, bits) /* UBFM */ \
        A64_INSN(0x9,0x2,0x4,_,32-(bits),_,31-(bits),rn,rd)
 #define A64_LSR_IMM(rd, rn, bits) /* UBFM */ \
@@ -229,7 +229,7 @@ enum { XT_UXTW=0x4, XT_UXTX=0x6, XT_LSL=0x7, XT_SXTW=0xc, XT_SXTX=0xe };
 #define A64_BFX_IMM(rd, rn, lsb, bits) /* UBFM */ \
        A64_INSN(0x9,0x2,0x4,_,lsb,_,bits-1,rn,rd)
 #define A64_BFI_IMM(rd, rn, lsb, bits) /* BFM */ \
-       A64_INSN(0x9,0x1,0x4,_,(32-lsb)&31,_,bits-1,rn,rd)
+       A64_INSN(0x9,0x1,0x4,_,-(lsb)&0x1f,_,bits-1,rn,rd)
 
 // multiplication
 
index 753c312..453801f 100644 (file)
@@ -971,9 +971,8 @@ static void emith_log_imm(int op, int rd, int rs, u32 imm)
        EMIT(MIPS_ASR_IMM(d, s, cnt))
 
 #if defined(__mips_isa_rev) && __mips_isa_rev >= 2
-#define emith_ror(d, s, cnt) do { \
-       EMIT(MIPS_ROR_IMM(d, s, cnt)); \
-} while (0)
+#define emith_ror(d, s, cnt) \
+       EMIT(MIPS_ROR_IMM(d, s, cnt))
 #else
 #define emith_ror(d, s, cnt) do { \
        EMIT(MIPS_LSL_IMM(AT, s, 32-(cnt))); \
@@ -985,9 +984,8 @@ static void emith_log_imm(int op, int rd, int rs, u32 imm)
        emith_ror(d, s, cnt)
 
 #if defined(__mips_isa_rev) && __mips_isa_rev >= 2
-#define emith_rol(d, s, cnt) do { \
-       EMIT(MIPS_ROR_IMM(d, s, 32-(cnt))); \
-} while (0)
+#define emith_rol(d, s, cnt) \
+       EMIT(MIPS_ROR_IMM(d, s, 32-(cnt)))
 #else
 #define emith_rol(d, s, cnt) do { \
        EMIT(MIPS_LSR_IMM(AT, s, 32-(cnt))); \
index f351d8e..ad5d428 100644 (file)
@@ -7,6 +7,7 @@
 @* See COPYING file in the top-level directory.
 @*
 
+#include "pico/arm_features.h"
 #include "pico/pico_int_offs.h"
 
 .extern Pico32x
 .text
 .align 2
 
+    PIC_LDR_INIT()
 
 .macro call_scan_prep cond est   @ &Pico.est
 .if \cond
-    ldr     r4, =PicoScan32xBegin
-    ldr     r5, =PicoScan32xEnd
+    PIC_LDR(r4, r6, PicoScan32xBegin)
+    PIC_LDR(r5, r6, PicoScan32xEnd)
     ldr     r6, [\est, #OFS_EST_DrawLineDest]
     ldr     r4, [r4]
     ldr     r5, [r5]
@@ -66,8 +68,8 @@
 \name:
     stmfd   sp!, {r4-r11,lr}
 
-    ldr     lr,=Pico
-    ldr     r10,=Pico32x
+    PIC_LDR(lr, r9, Pico)
+    PIC_LDR(r10,r9, Pico32x)
     ldr     r11, [lr, #OFS_Pico_est+OFS_EST_Draw2FB]
     ldrh    r10,[r10, #0x40] @ Pico32x.vdp_regs[0]
     add     r9, lr, #OFS_Pico_est+OFS_EST_HighPal   @ palmd
 \name:
     stmfd   sp!, {r4-r11,lr}
 
-    ldr     lr,=Pico
-    ldr     r10,=Pico32xMem
+    PIC_LDR(lr, r9, Pico)
+    PIC_LDR(r10,r9, Pico32xMem)
     ldr     r9,=OFS_PMEM32x_pal_native
     ldr     r10, [r10]
     ldr     r11, [lr, #OFS_Pico_est+OFS_EST_Draw2FB]
 \name:
     stmfd   sp!, {r4-r11,lr}
 
-    ldr     lr,=Pico
-    ldr     r10,=Pico32xMem
+    PIC_LDR(lr, r9, Pico)
+    PIC_LDR(r10,r9, Pico32xMem)
     ldr     r9,=OFS_PMEM32x_pal_native
     ldr     r10, [r10]
     ldr     r11, [lr, #OFS_Pico_est+OFS_EST_Draw2FB]
index fdec522..4b456f4 100644 (file)
 
 #endif
 
+// indexed branch (XB) via branch table (BT)
+#ifdef __PIC__
+#define PIC_XB(c,r,s)  add##c  pc, r, s
+#define PIC_BT(a)      b       a
+#else
+#define PIC_XB(c,r,s)  ldr##c  pc, [pc, r, s]
+#define PIC_BT(a)      .word   a
+#endif
+
+// load data address (LDR) either via literal pool or via GOT
+#ifdef __PIC__
+// can't use pool loads since ldr= only allows symbol or constants, not expr :-(
+#define PIC_LDR_INIT() \
+  .ifndef PIC_LDR_DEF; PIC_LDR_DEF=1; \
+  .macro pic_ldr       r t a; \
+       ldr     \r, [pc, $.LD\@-.-8]; \
+       ldr     \t, [pc, $.LD\@-.-4]; \
+  .LP\@:add    \r, pc; \
+       ldr     \r, [\r, \t]; \
+       add     pc, $4; \
+  .LD\@:.word  _GLOBAL_OFFSET_TABLE_-.LP\@-8; \
+       .word   \a(GOT); \
+  .endm; \
+  .endif;
+#define PIC_LDR(r,t,a) \
+       pic_ldr r, t, a
+#else
+#define PIC_LDR_INIT()
+#define PIC_LDR(r,t,a) \
+       ldr     r, =a
+#endif
+
 #endif /* __ARM_FEATURES_H__ */
index 04920b6..95ad09f 100644 (file)
@@ -6,6 +6,7 @@
 @* See COPYING file in the top-level directory.
 @*
 
+#include "../arm_features.h"
 #include "../pico_int_offs.h"
 
 .equiv PCM_STEP_SHIFT, 11
@@ -65,6 +66,7 @@
 .extern PicoWrite16_io
 .extern m68k_comm_check
 
+    PIC_LDR_INIT()
 
 @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
 @ r0=addr[in,out], r1,r2=tmp
 .macro cell_map
     ands    r1, r0, #0x01c000
-    ldrne   pc, [pc, r1, lsr #12]
-    beq     0f                          @ most common?
-    .long   0f
-    .long   0f
-    .long   0f
-    .long   0f
-    .long   1f
-    .long   1f
-    .long   2f
-    .long   3f
+    PIC_XB(ne ,r1, lsr #12)
+    b       0f                          @ most common?
+    PIC_BT(0f)
+    PIC_BT(0f)
+    PIC_BT(0f)
+    PIC_BT(0f)
+    PIC_BT(1f)
+    PIC_BT(1f)
+    PIC_BT(2f)
+    PIC_BT(3f)
 1: @ x16 cells
     and     r1, r0, #0x7e00             @ col
     and     r2, r0, #0x01fc             @ row
@@ -128,7 +130,7 @@ PicoReadM68k8_cell1:                    @ 0x220000 - 0x23ffff, cell arranged
     mov     r3, #0x0e0000
 0:
     cell_map
-    ldr     r1, =Pico
+    PIC_LDR(r1, r2, Pico)
     add     r0, r0, r3
     ldr     r1, [r1, #OFS_Pico_rom]   @ Pico.mcd (used everywhere)
     eor     r0, r0, #1
@@ -141,26 +143,26 @@ PicoRead8_mcd_io:
     cmp     r1, #0x2000                      @ a120xx?
     bne     PicoRead8_io
 
-    ldr     r1, =Pico
+    PIC_LDR(r1, r2, Pico)
     and     r0, r0, #0x3f
     ldr     r1, [r1, #OFS_Pico_rom]   @ Pico.mcd
     cmp     r0, #0x0e
-    ldrlt   pc, [pc, r0, lsl #2]
+    PIC_XB(lt ,r0, lsl #2)
     b       m_m68k_read8_hi
-    .long   m_m68k_read8_r00
-    .long   m_m68k_read8_r01
-    .long   m_m68k_read8_r02
-    .long   m_m68k_read8_r03
-    .long   m_m68k_read8_r04
-    .long   m_read_null               @ unused bits
-    .long   m_m68k_read8_r06
-    .long   m_m68k_read8_r07
-    .long   m_m68k_read8_r08
-    .long   m_m68k_read8_r09
-    .long   m_read_null               @ reserved
-    .long   m_read_null
-    .long   m_m68k_read8_r0c
-    .long   m_m68k_read8_r0d
+    PIC_BT(m_m68k_read8_r00)
+    PIC_BT(m_m68k_read8_r01)
+    PIC_BT(m_m68k_read8_r02)
+    PIC_BT(m_m68k_read8_r03)
+    PIC_BT(m_m68k_read8_r04)
+    PIC_BT(m_read_null)               @ unused bits
+    PIC_BT(m_m68k_read8_r06)
+    PIC_BT(m_m68k_read8_r07)
+    PIC_BT(m_m68k_read8_r08)
+    PIC_BT(m_m68k_read8_r09)
+    PIC_BT(m_read_null)               @ reserved
+    PIC_BT(m_read_null)
+    PIC_BT(m_m68k_read8_r0c)
+    PIC_BT(m_m68k_read8_r0d)
 m_m68k_read8_r00:
     add     r1, r1, #0x110000
     ldr     r0, [r1, #0x30]
@@ -238,7 +240,7 @@ PicoReadM68k16_cell1:                   @ 0x220000 - 0x23ffff, cell arranged
     mov     r3, #0x0e0000
 0:
     cell_map
-    ldr     r1, =Pico
+    PIC_LDR(r1, r2, Pico)
     add     r0, r0, r3
     ldr     r1, [r1, #OFS_Pico_rom]   @ Pico.mcd
     bic     r0, r0, #1
@@ -252,19 +254,19 @@ PicoRead16_mcd_io:
     bne     PicoRead16_io
 
 m_m68k_read16_m68k_regs:
-    ldr     r1, =Pico
+    PIC_LDR(r1, r2, Pico)
     and     r0, r0, #0x3e
     ldr     r1, [r1, #OFS_Pico_rom]   @ Pico.mcd
     cmp     r0, #0x0e
-    ldrlt   pc, [pc, r0, lsl #1]
+    PIC_XB(lt ,r0, lsl #1)
     b       m_m68k_read16_hi
-    .long   m_m68k_read16_r00
-    .long   m_m68k_read16_r02
-    .long   m_m68k_read16_r04
-    .long   m_m68k_read16_r06
-    .long   m_m68k_read16_r08
-    .long   m_read_null               @ reserved
-    .long   m_m68k_read16_r0c
+    PIC_BT(m_m68k_read16_r00)
+    PIC_BT(m_m68k_read16_r02)
+    PIC_BT(m_m68k_read16_r04)
+    PIC_BT(m_m68k_read16_r06)
+    PIC_BT(m_m68k_read16_r08)
+    PIC_BT(m_read_null)               @ reserved
+    PIC_BT(m_m68k_read16_r0c)
 m_m68k_read16_r00:
     add     r1, r1, #0x110000
     ldr     r0, [r1, #0x30]
@@ -329,7 +331,7 @@ PicoWriteM68k8_cell1:                   @ 0x220000 - 0x23ffff, cell arranged
 0:
     mov     r3, r1
     cell_map
-    ldr     r2, =Pico
+    PIC_LDR(r2, r1, Pico)
     add     r0, r0, r12
     ldr     r2, [r2, #OFS_Pico_rom]     @ Pico.mcd
     ldr     r2, [r2]
@@ -357,7 +359,7 @@ PicoWriteM68k16_cell1:                   @ 0x220000 - 0x23ffff, cell arranged
 0:
     mov     r3, r1
     cell_map
-    ldr     r1, =Pico
+    PIC_LDR(r1, r2, Pico)
     add     r0, r0, r12
     ldr     r1, [r1, #OFS_Pico_rom]     @ Pico.mcd
     bic     r0, r0, #1
@@ -399,7 +401,7 @@ PicoReadS68k8_dec0:                     @ 0x080000 - 0x0bffff
 PicoReadS68k8_dec1:
     mov     r3, #0x0a0000               @ + ^ / 2
 0:
-    ldr     r2, =Pico
+    PIC_LDR(r2, r1, Pico)
     eor     r0, r0, #2
     ldr     r2, [r2, #OFS_Pico_rom]     @ Pico.mcd
     movs    r0, r0, lsr #1              @ +4-6 <<16
@@ -431,7 +433,7 @@ m_s68k_read8_regs:
     bx      lr
 
 m_s68k_read8_comm:
-    ldr     r1, =Pico
+    PIC_LDR(r1, r2, Pico)
     ldr     r1, [r1, #OFS_Pico_rom]     @ Pico.mcd
     add     r1, r1, #0x110000
     ldrb    r1, [r1, r0]
@@ -444,7 +446,7 @@ m_s68k_read8_pcm:
     bne     m_read_null
 
     @ must not trash r3 and r12
-    ldr     r1, =Pico
+    PIC_LDR(r1, r2, Pico)
     bic     r0, r0, #0xff0000
     ldr     r1, [r1, #OFS_Pico_rom]     @ Pico.mcd
     mov     r2, #0x110000
@@ -479,7 +481,7 @@ PicoReadS68k16_dec0:                    @ 0x080000 - 0x0bffff
 PicoReadS68k16_dec1:
     mov     r3, #0x0a0000               @ + ^ / 2
 0:
-    ldr     r2, =Pico
+    PIC_LDR(r2, r1, Pico)
     eor     r0, r0, #2
     ldr     r2, [r2, #OFS_Pico_rom]     @ Pico.mcd
     mov     r0, r0, lsr #1              @ +4-6 <<16
@@ -505,12 +507,11 @@ m_s68k_read16_regs:
     mov     r0, #1
     b       cdc_host_r
 
-
 @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
 
 .macro m_s68k_write8_2M_decode
-    ldr     r2, =Pico
+    PIC_LDR(r2, ip, Pico)
     eor     r0, r0, #2
     ldr     r2, [r2, #OFS_Pico_rom]     @ Pico.mcd
     movs    r0, r0, lsr #1              @ +4-6 <<16
@@ -594,7 +595,7 @@ m_s68k_write8_pcm:
     bxlt    lr
 
 m_s68k_write8_pcm_ram:
-    ldr     r3, =Pico
+    PIC_LDR(r3, r2, Pico)
     bic     r0, r0, #0x00e000
     ldr     r3, [r3, #OFS_Pico_rom]     @ Pico.mcd
     mov     r0, r0, lsr #1
@@ -608,12 +609,11 @@ m_s68k_write8_pcm_ram:
     strb    r1, [r3, r0]
     bx      lr
 
-
 @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 
 
 .macro m_s68k_write16_2M_decode
-    ldr     r2, =Pico
+    PIC_LDR(r2, ip, Pico)
     eor     r0, r0, #2
     ldr     r2, [r2, #OFS_Pico_rom]     @ Pico.mcd
     mov     r0, r0, lsr #1              @ +4-6 <<16
@@ -694,7 +694,7 @@ m_s68k_write16_regs:
     bne     s68k_reg_write16
 
 m_s68k_write16_regs_spec:               @ special case
-    ldr     r2, =Pico
+    PIC_LDR(r2, r0, Pico)
     mov     r0, #0x110000
     ldr     r2, [r2, #OFS_Pico_rom]     @ Pico.mcd
     add     r0, r0, #0x00000f
@@ -707,7 +707,7 @@ m_s68k_write16_regs_spec:               @ special case
 .global s68k_write16
 
 s68k_read8:
-    ldr     r3, =s68k_read8_map
+    PIC_LDR(r3, r2, s68k_read8_map)
     bic     r0, r0, #0xff000000
     mov     r2, r0, lsr #16
     ldr     r3, [r3, r2, lsl #2]
@@ -718,7 +718,7 @@ s68k_read8:
     bx      r3
 
 s68k_read16:
-    ldr     r3, =s68k_read16_map
+    PIC_LDR(r3, r2, s68k_read16_map)
     bic     r0, r0, #0xff000000
     mov     r2, r0, lsr #16
     ldr     r3, [r3, r2, lsl #2]
@@ -729,7 +729,7 @@ s68k_read16:
     bx      r3
 
 s68k_read32:
-    ldr     r3, =s68k_read16_map
+    PIC_LDR(r3, r2, s68k_read16_map)
     bic     r0, r0, #0xff000000
     mov     r2, r0, lsr #16
     ldr     r3, [r3, r2, lsl #2]
@@ -755,7 +755,7 @@ s68k_read32:
     bx      lr
 
 s68k_write8:
-    ldr     r3, =s68k_write8_map
+    PIC_LDR(r3, r2, s68k_write8_map)
     bic     r0, r0, #0xff000000
     mov     r2, r0, lsr #16
     ldr     r3, [r3, r2, lsl #2]
@@ -766,7 +766,7 @@ s68k_write8:
     bx      r3
 
 s68k_write16:
-    ldr     r3, =s68k_write16_map
+    PIC_LDR(r3, r2, s68k_write16_map)
     bic     r0, r0, #0xff000000
     mov     r2, r0, lsr #16
     ldr     r3, [r3, r2, lsl #2]
@@ -777,7 +777,7 @@ s68k_write16:
     bx      r3
 
 s68k_write32:
-    ldr     r3, =s68k_write16_map
+    PIC_LDR(r3, r2, s68k_write16_map)
     bic     r0, r0, #0xff000000
     mov     r2, r0, lsr #16
     ldr     r3, [r3, r2, lsl #2]
index 333780c..ebeb346 100644 (file)
@@ -7,6 +7,7 @@
  * See COPYING file in the top-level directory.\r
  */\r
 \r
+#include "arm_features.h"\r
 #include "pico_int_offs.h"\r
 \r
 .equ SRR_MAPPED,    (1 <<  0)\r
 .global PicoWrite8_io\r
 .global PicoWrite16_io\r
 \r
+    PIC_LDR_INIT()\r
+\r
 PicoRead8_sram: @ u32 a\r
-    ldr     r3, =Pico\r
+    PIC_LDR(r3, r1, Pico)\r
     ldr     r1, [r3, #OFS_Pico_sv_end]\r
     cmp     r0, r1\r
     bgt     m_read8_nosram\r
@@ -74,7 +77,7 @@ m_read8_not_io:
     cmp     r2, #0x1000\r
     bne     PicoRead8_32x\r
 \r
-    ldr     r3, =Pico\r
+    PIC_LDR(r3, r1, Pico)\r
     mov     r1, r0\r
     ldr     r0, [r3, #OFS_Pico_m_rotate]\r
     add     r0, r0, #1\r
@@ -97,7 +100,7 @@ m_read8_not_io:
 @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
 \r
 PicoRead16_sram: @ u32 a, u32 d\r
-    ldr     r3, =Pico\r
+    PIC_LDR(r3, r1, Pico)\r
     ldr     r1, [r3, #OFS_Pico_sv_end]\r
     cmp     r0, r1\r
     bgt     m_read16_nosram\r
@@ -142,7 +145,7 @@ m_read16_not_io:
     cmp     r2, #0x1000\r
     bne     PicoRead16_32x\r
 \r
-    ldr     r3, =Pico\r
+    PIC_LDR(r3, r2, Pico)\r
     and     r2, r0, #0xff00\r
     ldr     r0, [r3, #OFS_Pico_m_rotate]\r
     add     r0, r0, #1\r
@@ -184,7 +187,7 @@ m_write8_not_z80ctl:
     eor     r2, r2, #0x003000\r
     eors    r2, r2, #0x0000f1\r
     bne     PicoWrite8_32x\r
-    ldr     r3, =Pico\r
+    PIC_LDR(r3, r2, Pico)\r
     ldrb    r2, [r3, #OFS_Pico_m_sram_reg]\r
     and     r1, r1, #(SRR_MAPPED|SRR_READONLY)\r
     bic     r2, r2, #(SRR_MAPPED|SRR_READONLY)\r
@@ -214,7 +217,7 @@ m_write16_not_z80ctl:
     eor     r2, r2, #0x003000\r
     eors    r2, r2, #0x0000f0\r
     bne     PicoWrite16_32x\r
-    ldr     r3, =Pico\r
+    PIC_LDR(r3, r2, Pico)\r
     ldrb    r2, [r3, #OFS_Pico_m_sram_reg]\r
     and     r1, r1, #(SRR_MAPPED|SRR_READONLY)\r
     bic     r2, r2, #(SRR_MAPPED|SRR_READONLY)\r
@@ -228,7 +231,7 @@ m_write16_not_z80ctl:
 .global m68k_write16\r
 \r
 m68k_read8:\r
-    ldr     r3, =m68k_read8_map\r
+    PIC_LDR(r3, r2, m68k_read8_map)\r
     bic     r0, r0, #0xff000000\r
     mov     r2, r0, lsr #16\r
     ldr     r3, [r3, r2, lsl #2]\r
@@ -239,7 +242,7 @@ m68k_read8:
     bx      r3\r
 \r
 m68k_read16:\r
-    ldr     r3, =m68k_read16_map\r
+    PIC_LDR(r3, r2, m68k_read16_map)\r
     bic     r0, r0, #0xff000000\r
     mov     r2, r0, lsr #16\r
     ldr     r3, [r3, r2, lsl #2]\r
@@ -250,7 +253,7 @@ m68k_read16:
     bx      r3\r
 \r
 m68k_read32:\r
-    ldr     r3, =m68k_read16_map\r
+    PIC_LDR(r3, r2, m68k_read16_map)\r
     bic     r0, r0, #0xff000000\r
     mov     r2, r0, lsr #16\r
     ldr     r3, [r3, r2, lsl #2]\r
@@ -276,7 +279,7 @@ m68k_read32:
     bx      lr\r
 \r
 m68k_write8:\r
-    ldr     r3, =m68k_write8_map\r
+    PIC_LDR(r3, r2, m68k_write8_map)\r
     bic     r0, r0, #0xff000000\r
     mov     r2, r0, lsr #16\r
     ldr     r3, [r3, r2, lsl #2]\r
@@ -287,7 +290,7 @@ m68k_write8:
     bx      r3\r
 \r
 m68k_write16:\r
-    ldr     r3, =m68k_write16_map\r
+    PIC_LDR(r3, r2, m68k_write16_map)\r
     bic     r0, r0, #0xff000000\r
     mov     r2, r0, lsr #16\r
     ldr     r3, [r3, r2, lsl #2]\r
@@ -298,7 +301,7 @@ m68k_write16:
     bx      r3\r
 \r
 m68k_write32:\r
-    ldr     r3, =m68k_write16_map\r
+    PIC_LDR(r3, r2, m68k_write16_map)\r
     bic     r0, r0, #0xff000000\r
     mov     r2, r0, lsr #16\r
     ldr     r3, [r3, r2, lsl #2]\r
similarity index 95%
rename from pico/sound/ym2612_arm.s
rename to pico/sound/ym2612_arm.S
index 9c436d4..7d4c609 100644 (file)
@@ -12,6 +12,8 @@
 
 @ vim:filetype=armasm
 
+#include "../arm_features.h"
+
 .equiv SLOT1, 0
 .equiv SLOT2, 2
 .equiv SLOT3, 1
@@ -34,6 +36,7 @@
 
 .text
 .align 2
+    PIC_LDR_INIT()
 
 @ r5=slot, r1=eg_cnt, trashes: r0,r2,r3
 @ writes output to routp, but only if vol_out changes
@@ -556,8 +559,8 @@ upd_algo0:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -573,8 +576,8 @@ upd_algo1:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -590,8 +593,8 @@ upd_algo2:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -607,8 +610,8 @@ upd_algo3:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -624,8 +627,8 @@ upd_algo4:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -641,8 +644,8 @@ upd_algo5:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -658,8 +661,8 @@ upd_algo6:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -675,8 +678,8 @@ upd_algo7:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -692,8 +695,8 @@ upd_slot1:
     stmfd   sp!, {r4-r10,lr}
     mov     lr, r0
 
-    ldr     r3, =ym_sin_tab
-    ldr     r5, =ym_tl_tab
+    PIC_LDR(r3, ip, ym_sin_tab)
+    PIC_LDR(r5, ip, ym_tl_tab)
     ldmia   lr, {r6-r7}
     ldr     r10, [lr, #0x54]
     ldr     r12, [lr, #0x4c]
@@ -781,7 +784,7 @@ eg_done:
     beq     crl_loop
 
     @ -- SLOT1 --
-    ldr     r3, =ym_tl_tab
+    PIC_LDR(r3, r2, ym_tl_tab)
 
     @ lr=context, r12=pack (stereo, lastchan, disabled, lfo_enabled | pan_r, pan_l, ams[2] | AMmasks[4] | FB[4] | lfo_ampm[16])
     @ r0-r2=scratch, r3=tl_tab, r5=scratch, r6-r7=vol_out[4], r10=op1_out
@@ -789,16 +792,16 @@ eg_done:
 
     @ -- SLOT2+ --
     and     r0, r4, #7
-    ldr     pc, [pc, r0, lsl #2]
+    PIC_XB(,r0, lsl #2)
     nop
-    .word   crl_algo0
-    .word   crl_algo1
-    .word   crl_algo2
-    .word   crl_algo3
-    .word   crl_algo4
-    .word   crl_algo5
-    .word   crl_algo6
-    .word   crl_algo7
+    PIC_BT(crl_algo0)
+    PIC_BT(crl_algo1)
+    PIC_BT(crl_algo2)
+    PIC_BT(crl_algo3)
+    PIC_BT(crl_algo4)
+    PIC_BT(crl_algo5)
+    PIC_BT(crl_algo6)
+    PIC_BT(crl_algo7)
     .pool
 
 crl_algo0:
index 5afc017..024ff75 100644 (file)
@@ -59,7 +59,7 @@ SRCS_COMMON += $(R)pico/memory_arm.S
 endif
 ifeq "$(asm_ym2612)" "1"
 DEFINES += _ASM_YM2612_C
-SRCS_COMMON += $(R)pico/sound/ym2612_arm.s
+SRCS_COMMON += $(R)pico/sound/ym2612_arm.S
 endif
 ifeq "$(asm_misc)" "1"
 DEFINES += _ASM_MISC_C
@@ -148,7 +148,7 @@ endif
 # --- Z80 ---
 ifeq "$(use_drz80)" "1"
 DEFINES += _USE_DRZ80
-SRCS_COMMON += $(R)cpu/DrZ80/drz80.s
+SRCS_COMMON += $(R)cpu/DrZ80/drz80.S
 endif
 #
 ifeq "$(use_cz80)" "1"
index 61c70bf..19c0b42 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * very basic mips disassembler for MIPS32/MIPS64 Release 1, only for picodrive
+ * very basic mips disassembler for MIPS32/MIPS64 Release 2, only for picodrive
  * Copyright (C) 2019 kub
  *
  * This work is licensed under the terms of MAME license.