\r
\r
#ifndef _ASM_MISC_C\r
-typedef struct\r
-{\r
- int b0;\r
- int b1;\r
- int b2;\r
- int b3;\r
- int b4;\r
- int b5;\r
- int b6;\r
- int b7;\r
-} intblock;\r
-\r
-PICO_INTERNAL_ASM void memcpy16(unsigned short *dest, unsigned short *src, int count)\r
-{\r
- if ((((long)dest | (long)src) & 3) == 0)\r
- {\r
- if (count >= 32) {\r
- memcpy32((int *)dest, (int *)src, count/2);\r
- count&=1;\r
- } else {\r
- for (; count >= 2; count -= 2, dest+=2, src+=2)\r
- *(int *)dest = *(int *)src;\r
- }\r
- }\r
- while (count--)\r
- *dest++ = *src++;\r
-}\r
-\r
-\r
PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count)\r
{\r
unsigned char *src_ = src;\r
}\r
\r
#ifndef _ASM_MISC_C_AMIPS\r
-PICO_INTERNAL_ASM void memcpy32(void *dest_in, const void *src_in, int count)\r
-{\r
- const intblock *bs = (intblock *) src_in;\r
- intblock *bd = (intblock *) dest_in;\r
- const int *src;\r
- int *dest;\r
-\r
- for (; count >= sizeof(*bd)/4; count -= sizeof(*bd)/4)\r
- *bd++ = *bs++;\r
-\r
- dest = (int *)bd; src = (const int *)bs;\r
- while (count--)\r
- *dest++ = *src++;\r
-}\r
-\r
-\r
PICO_INTERNAL_ASM void memset32(void *dest_in, int c, int count)\r
{\r
int *dest = dest_in;\r
nop
-.globl memcpy32 # int *dest, int *src, int count
-
-memcpy32:
-mc32_aloop:
- andi $t0, $a0, 0x3f
- beqz $t0, mc32_bloop_prep
- nop
- lw $t1, 0($a1)
- addiu $a2, -1
- sw $t1, 0($a0)
- beqz $a2, mc32_return
- addiu $a0, 4
- j mc32_aloop
- addiu $a1, 4
-
-mc32_bloop_prep:
- srl $t0, $a2, 4 # we will do 64 bytes per iteration (cache line)
- beqz $t0, mc32_bloop_end
-
-mc32_bloop:
- addiu $t0, -1
- cache 0x18, ($a0) # create dirty exclusive
- lw $t2, 0x00($a1)
- lw $t3, 0x04($a1)
- lw $t4, 0x08($a1)
- lw $t5, 0x0c($a1)
- lw $t6, 0x10($a1)
- lw $t7, 0x14($a1)
- lw $t8, 0x18($a1)
- lw $t9, 0x1c($a1)
- sw $t2, 0x00($a0)
- sw $t3, 0x04($a0)
- sw $t4, 0x08($a0)
- sw $t5, 0x0c($a0)
- sw $t6, 0x10($a0)
- sw $t7, 0x14($a0)
- sw $t8, 0x18($a0)
- sw $t9, 0x1c($a0)
- lw $t2, 0x20($a1)
- lw $t3, 0x24($a1)
- lw $t4, 0x28($a1)
- lw $t5, 0x2c($a1)
- lw $t6, 0x30($a1)
- lw $t7, 0x34($a1)
- lw $t8, 0x38($a1)
- lw $t9, 0x3c($a1)
- sw $t2, 0x20($a0)
- sw $t3, 0x24($a0)
- sw $t4, 0x28($a0)
- sw $t5, 0x2c($a0)
- sw $t6, 0x30($a0)
- sw $t7, 0x34($a0)
- sw $t8, 0x38($a0)
- sw $t9, 0x3c($a0)
- addiu $a0, 0x40
- bnez $t0, mc32_bloop
- addiu $a1, 0x40
-
-mc32_bloop_end:
- andi $a2, $a2, 0x0f
- beqz $a2, mc32_return
-
-mc32_cloop:
- lw $t1, 0($a1)
- addiu $a2, -1
- addiu $a1, 4
- sw $t1, 0($a0)
- bnez $a2, mc32_cloop
- addiu $a0, 4
-
-mc32_return:
- jr $ra
- nop
-
# vim:filetype=mips
* See COPYING file in the top-level directory.
*/
-.global memcpy16 @ unsigned short *dest, unsigned short *src, int count
-
-memcpy16:
- eor r3, r0, r1
- tst r3, #2
- bne mcp16_cant_align
-
- tst r0, #2
- ldrneh r3, [r1], #2
- subne r2, r2, #1
- strneh r3, [r0], #2
-
- subs r2, r2, #4
- bmi mcp16_fin
-
-mcp16_loop:
- ldmia r1!, {r3,r12}
- subs r2, r2, #4
- stmia r0!, {r3,r12}
- bpl mcp16_loop
-
-mcp16_fin:
- tst r2, #2
- ldrne r3, [r1], #4
- strne r3, [r0], #4
- ands r2, r2, #1
- bxeq lr
-
-mcp16_cant_align:
- ldrh r3, [r1], #2
- subs r2, r2, #1
- strh r3, [r0], #2
- bne mcp16_cant_align
-
- bx lr
-
-
-
@ 0x12345678 -> 0x34127856
@ r4=temp, lr=0x00ff00ff
.macro bswap reg
orr \reg, \reg, r4, lsl #8
.endm
-
@ dest must be halfword aligned, src can be unaligned
.global memcpy16bswap @ unsigned short *dest, void *src, int count
bx lr
-
-.global memcpy32 @ int *dest, int *src, int count
-
-memcpy32:
- stmfd sp!, {r4,lr}
-
- subs r2, r2, #4
- bmi mcp32_fin
-
-mcp32_loop:
- ldmia r1!, {r3,r4,r12,lr}
- subs r2, r2, #4
- stmia r0!, {r3,r4,r12,lr}
- bpl mcp32_loop
-
-mcp32_fin:
- tst r2, #3
- ldmeqfd sp!, {r4,pc}
- tst r2, #1
- ldrne r3, [r1], #4
- strne r3, [r0], #4
-
-mcp32_no_unal1:
- tst r2, #2
- ldmneia r1!, {r3,r12}
- ldmfd sp!, {r4,lr}
- stmneia r0!, {r3,r12}
- bx lr
-
-
-
.global memset32 @ int *dest, int c, int count
memset32:
if (!(PicoOpt & POPT_DIS_32C_BORDER))
pd += 32;
- memcpy32((int *)pd, (int *)(Pico.est.HighCol+8), 256/4);
+ memcpy(pd, Pico.est.HighCol + 8, 256);
}
void PicoDrawSetOutputMode4(pdso_t which)
extern int (*PicoDmaHook)(unsigned int source, int len, unsigned short **base, unsigned int *mask);\r
\r
// misc.c\r
-PICO_INTERNAL_ASM void memcpy16(unsigned short *dest, unsigned short *src, int count);\r
PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count);\r
-PICO_INTERNAL_ASM void memcpy32(void *dest, const void *src, int count); // 32bit word count\r
PICO_INTERNAL_ASM void memset32(void *dest, int c, int count);\r
\r
// eeprom.c\r
sram_size = 0x12000;\r
sram_data = Pico.sv.data;\r
if (sram_data)\r
- memcpy32((int *)sram_data, (int *)Pico_mcd->bram, 0x2000/4);\r
+ memcpy(sram_data, Pico_mcd->bram, 0x2000);\r
} else {\r
sram_size = 0x2000;\r
sram_data = Pico_mcd->bram;\r
ret = ret > 0 ? 0 : -1;\r
fclose(sramFile);\r
if ((PicoAHW & PAHW_MCD) && (PicoOpt&POPT_EN_MCD_RAMCART))\r
- memcpy32((int *)Pico_mcd->bram, (int *)sram_data, 0x2000/4);\r
+ memcpy(Pico_mcd->bram, sram_data, 0x2000);\r
} else {\r
// sram save needs some special processing\r
// see if we have anything to save\r
ym_active_chs = shared_ctl->ym_active_chs;\r
\r
// mix in ym buffer. is_buf_empty means nobody mixed there anything yet and it may contain trash\r
- if (is_buf_empty && ym_active_chs) memcpy32(buffer, ym_buf, length<<stereo);\r
+ if (is_buf_empty && ym_active_chs) memcpy(buffer, ym_buf, length << (stereo + 2));\r
else memset32(buffer, 0, length<<stereo);\r
\r
if (shared_ctl->writebuffsel == 1) {\r
ld_left = ld_lines;\r
\r
EmuScanBegin16_ld(num);\r
- memcpy32(Pico.est.DrawLineDest, oldline, 320 * gp2x_current_bpp / 8 / 4);\r
+ memcpy(Pico.est.DrawLineDest, oldline, 320 * gp2x_current_bpp / 8);\r
if (emu_scan_end)\r
emu_scan_end(ld_counter);\r
\r
bgr444_to_rgb32(localPal+0x80, Pico.est.HighPal+0x40);\r
}\r
else\r
- memcpy32(localPal+0x80, localPal, 0x40); // for spr prio mess\r
+ memcpy(localPal + 0x80, localPal, 0x40 * 4); // for spr prio mess\r
\r
return pallen;\r
}\r
}
else if (allow_as && (Pico.est.rendstatus & PDRAW_SPR_LO_ON_HI))
{
- memcpy32((int *)dpal+0x80/2, (void *)localPal, 0x40*2/4);
+ memcpy(dpal + 0x80/2, localPal, 0x40*2);
}
}