From 9760505eafcaecdcbb19af56ef9e23b531c487e4 Mon Sep 17 00:00:00 2001 From: kub Date: Tue, 3 Dec 2019 23:52:13 +0100 Subject: [PATCH] remove textrels with -fPIC/-fPIE (for android/ios) --- cpu/DrZ80/{drz80.s => drz80.S} | 293 +++++++++++----------- cpu/drc/emit_arm64.c | 4 +- cpu/drc/emit_mips.c | 10 +- pico/32x/draw_arm.S | 18 +- pico/arm_features.h | 32 +++ pico/cd/memory_arm.S | 110 ++++---- pico/memory_arm.S | 27 +- pico/sound/{ym2612_arm.s => ym2612_arm.S} | 59 ++--- platform/common/common.mak | 4 +- platform/common/dismips.c | 2 +- 10 files changed, 298 insertions(+), 261 deletions(-) rename cpu/DrZ80/{drz80.s => drz80.S} (90%) rename pico/sound/{ym2612_arm.s => ym2612_arm.S} (95%) diff --git a/cpu/DrZ80/drz80.s b/cpu/DrZ80/drz80.S similarity index 90% rename from cpu/DrZ80/drz80.s rename to cpu/DrZ80/drz80.S index c2a64df3..4d592b16 100644 --- a/cpu/DrZ80/drz80.s +++ b/cpu/DrZ80/drz80.S @@ -5,6 +5,8 @@ ;@ For commercial use, separate licencing terms must be obtained. +#include "../../pico/arm_features.h" + .data .align 4 @@ -102,6 +104,7 @@ DrZ80Ver: .long 0x0001 ;@--------------------------------------- .text + PIC_LDR_INIT() .if DRZ80_XMAP @@ -1370,7 +1373,7 @@ DrZ80Run: blne DoInterrupt .endif - ldr opcodes,MAIN_opcodes_POINTER2 + PIC_LDR(opcodes, r0, MAIN_opcodes) cmp z80_icount,#0 ;@ irq might have used all cycles ldrplb r0,[z80pc],#1 @@ -1382,11 +1385,7 @@ z80_execute_end: stmia cpucontext,{z80pc-z80sp} ;@ save Z80 registers mov r0,z80_icount ldmia sp!,{r4-r12,pc} ;@ restore registers from stack and return to C code - -MAIN_opcodes_POINTER2: .word MAIN_opcodes -.if INTERRUPT_MODE -Interrupt_local: .word Interrupt -.endif +.pool DoInterrupt: .if INTERRUPT_MODE @@ -1395,8 +1394,9 @@ DoInterrupt: ;@ save everything back into DrZ80 context stmia cpucontext,{z80pc-z80sp} ;@ save Z80 registers stmfd sp!,{r3,r4,r5,lr} ;@ save rest of regs on stack + PIC_LDR(r2, r3, Interrupt) mov lr,pc - ldr pc,Interrupt_local + bx r2 ldmfd sp!,{r3,r4,r5,lr} ;@ load regs from stack ;@ reload regs from DrZ80 context ldmia cpucontext,{z80pc-z80sp} ;@ load Z80 registers @@ -4469,7 +4469,6 @@ opcode_2_6: and z80hl,z80hl,#0xFF<<16 orr z80hl,z80hl,r1, lsl #24 fetch 7 -DAATABLE_LOCAL: .word DAATable ;@DAA opcode_2_7: mov r1,z80a, lsr #24 @@ -4479,13 +4478,14 @@ opcode_2_7: orrne r1,r1,#512 tst z80f,#1<= 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))); \ diff --git a/pico/32x/draw_arm.S b/pico/32x/draw_arm.S index f351d8e0..ad5d428b 100644 --- a/pico/32x/draw_arm.S +++ b/pico/32x/draw_arm.S @@ -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 @@ -17,11 +18,12 @@ .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 @@ -192,8 +194,8 @@ \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] @@ -361,8 +363,8 @@ \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] diff --git a/pico/arm_features.h b/pico/arm_features.h index fdec5229..4b456f45 100644 --- a/pico/arm_features.h +++ b/pico/arm_features.h @@ -49,4 +49,36 @@ #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__ */ diff --git a/pico/cd/memory_arm.S b/pico/cd/memory_arm.S index 04920b62..95ad09ff 100644 --- a/pico/cd/memory_arm.S +++ b/pico/cd/memory_arm.S @@ -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() @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -73,16 +75,16 @@ @ 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] diff --git a/pico/memory_arm.S b/pico/memory_arm.S index 333780c1..ebeb346b 100644 --- a/pico/memory_arm.S +++ b/pico/memory_arm.S @@ -7,6 +7,7 @@ * See COPYING file in the top-level directory. */ +#include "arm_features.h" #include "pico_int_offs.h" .equ SRR_MAPPED, (1 << 0) @@ -24,8 +25,10 @@ .global PicoWrite8_io .global PicoWrite16_io + PIC_LDR_INIT() + PicoRead8_sram: @ u32 a - ldr r3, =Pico + PIC_LDR(r3, r1, Pico) ldr r1, [r3, #OFS_Pico_sv_end] cmp r0, r1 bgt m_read8_nosram @@ -74,7 +77,7 @@ m_read8_not_io: cmp r2, #0x1000 bne PicoRead8_32x - ldr r3, =Pico + PIC_LDR(r3, r1, Pico) mov r1, r0 ldr r0, [r3, #OFS_Pico_m_rotate] add r0, r0, #1 @@ -97,7 +100,7 @@ m_read8_not_io: @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ PicoRead16_sram: @ u32 a, u32 d - ldr r3, =Pico + PIC_LDR(r3, r1, Pico) ldr r1, [r3, #OFS_Pico_sv_end] cmp r0, r1 bgt m_read16_nosram @@ -142,7 +145,7 @@ m_read16_not_io: cmp r2, #0x1000 bne PicoRead16_32x - ldr r3, =Pico + PIC_LDR(r3, r2, Pico) and r2, r0, #0xff00 ldr r0, [r3, #OFS_Pico_m_rotate] add r0, r0, #1 @@ -184,7 +187,7 @@ m_write8_not_z80ctl: eor r2, r2, #0x003000 eors r2, r2, #0x0000f1 bne PicoWrite8_32x - ldr r3, =Pico + PIC_LDR(r3, r2, Pico) ldrb r2, [r3, #OFS_Pico_m_sram_reg] and r1, r1, #(SRR_MAPPED|SRR_READONLY) bic r2, r2, #(SRR_MAPPED|SRR_READONLY) @@ -214,7 +217,7 @@ m_write16_not_z80ctl: eor r2, r2, #0x003000 eors r2, r2, #0x0000f0 bne PicoWrite16_32x - ldr r3, =Pico + PIC_LDR(r3, r2, Pico) ldrb r2, [r3, #OFS_Pico_m_sram_reg] and r1, r1, #(SRR_MAPPED|SRR_READONLY) bic r2, r2, #(SRR_MAPPED|SRR_READONLY) @@ -228,7 +231,7 @@ m_write16_not_z80ctl: .global m68k_write16 m68k_read8: - ldr r3, =m68k_read8_map + PIC_LDR(r3, r2, m68k_read8_map) bic r0, r0, #0xff000000 mov r2, r0, lsr #16 ldr r3, [r3, r2, lsl #2] @@ -239,7 +242,7 @@ m68k_read8: bx r3 m68k_read16: - ldr r3, =m68k_read16_map + PIC_LDR(r3, r2, m68k_read16_map) bic r0, r0, #0xff000000 mov r2, r0, lsr #16 ldr r3, [r3, r2, lsl #2] @@ -250,7 +253,7 @@ m68k_read16: bx r3 m68k_read32: - ldr r3, =m68k_read16_map + PIC_LDR(r3, r2, m68k_read16_map) bic r0, r0, #0xff000000 mov r2, r0, lsr #16 ldr r3, [r3, r2, lsl #2] @@ -276,7 +279,7 @@ m68k_read32: bx lr m68k_write8: - ldr r3, =m68k_write8_map + PIC_LDR(r3, r2, m68k_write8_map) bic r0, r0, #0xff000000 mov r2, r0, lsr #16 ldr r3, [r3, r2, lsl #2] @@ -287,7 +290,7 @@ m68k_write8: bx r3 m68k_write16: - ldr r3, =m68k_write16_map + PIC_LDR(r3, r2, m68k_write16_map) bic r0, r0, #0xff000000 mov r2, r0, lsr #16 ldr r3, [r3, r2, lsl #2] @@ -298,7 +301,7 @@ m68k_write16: bx r3 m68k_write32: - ldr r3, =m68k_write16_map + PIC_LDR(r3, r2, m68k_write16_map) bic r0, r0, #0xff000000 mov r2, r0, lsr #16 ldr r3, [r3, r2, lsl #2] diff --git a/pico/sound/ym2612_arm.s b/pico/sound/ym2612_arm.S similarity index 95% rename from pico/sound/ym2612_arm.s rename to pico/sound/ym2612_arm.S index 9c436d41..7d4c609a 100644 --- a/pico/sound/ym2612_arm.s +++ b/pico/sound/ym2612_arm.S @@ -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: diff --git a/platform/common/common.mak b/platform/common/common.mak index 5afc0171..024ff75f 100644 --- a/platform/common/common.mak +++ b/platform/common/common.mak @@ -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" diff --git a/platform/common/dismips.c b/platform/common/dismips.c index 61c70bfe..19c0b427 100644 --- a/platform/common/dismips.c +++ b/platform/common/dismips.c @@ -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. -- 2.39.5