1 #include <stdio.h> 2 3 unsigned int mem1[] = { 4 0x0485b210, 0x0485b190, 0x0485b1b0, 0x0485b260, 5 0x0485b280, 0x0485b400, 0x0485b420, 0x0485b2f0, 6 0x0485b300, 0x0485b3c0, 0x0485b3d0, 0x0485b470, 7 0x0485b490, 0x048608b0, 0x048608a0, 0x048601f0, 8 0x0485f240, 0x0485f1b0, 0x04860020, 0x0485f4d0, 9 0x0485fb00, 0x048607b0, 0x04860470, 0x04860440, 10 0x048606c0, 0x048604b0, 0x048605b0, 0x0485ac10, 11 0x0485a570, 0x0485ac90, 0x0485ae60, 0x0485bc10, 12 0x0485ba70, 0x0485c384, 0x0485df30, 0x0485ac00, 13 0x04861560, 0x04861680, 0x04863700, 0x048617dc, 14 0x0485e0d0, 0x0485e6a0, 0x0485ee80, 0x04860e10, 15 0x04860f20, 0x04860fd0, 0x04863300, 0x04863378, 16 0x0487b000, 0x04863490, 0x04858648, 0x0485810c, 17 0x04868eb0, 0x00000001, 0x00000000, 0x00000000, 18 0x00000000, 0x0487b010, 0x0487b010, 0x0487b018, 19 0x0487b018, 0xffffffff, 0xffffffff, 0x00000000, 20 0x00000000, 0x04019280, 0x84024238, 0x048572d0, 21 0x04883000, 0x0487b2cc, 0x0487af24, 0x04873000, 22 0x04853000, 0x04863000, 0x0487b2d8, 0x0487d340, 23 0x048665b0, 0x0487b2dc, 0x0487b2d0, 0x0487b2e8, 24 0x0485c384, 0x0485df30, 0x04857eb0, 0x048589f8, 25 0x048587e0, 0x0487b2fc, 0x048579c0, 0x0487b2f0, 26 0x0487b2e4, 0x0487b2d4, 0x04863490, 0x04868ef0, 27 0x04858c2c, 0x0487b000, 0x048639a0, 0x0487b340, 28 0x04858d68, 0x04858648, 0x04858f18, 0x04857978 29 }; 30 31 unsigned int mem2[100]; 32 33 int main () 34 { 35 int i, out; 36 for (i = 0; i < 100; i++) 37 mem2[i] = 0; 38 39 __asm__ volatile( 40 "move $s0, %1\n\t" // s0 addr mem1 41 "move $a2, %2\n\t" // a2 addr mem2 42 " li $v0, 0\n\t" // v0 counter 43 " li $a1, 0x190\n\t" // a1 mem len 44 " begin:\n\t" 45 "addu $v1, $s0, $v0\n\t" 46 "lw $a0, 0($v1)\n\t" 47 "addu $v1, $a2, $v0\n\t" 48 "addiu $v0, $v0, 4\n\t" 49 "sw $a0, 0($v1)\n\t" 50 "bne $v0, $a1, begin\n\t" 51 : "=&r" (out) 52 : "r" (mem1), "r" (mem2) 53 : "s0", "a1", "a2", "v0", "v1", "cc", "memory" 54 ); 55 for (i = 0; i < 100; i = i+4) 56 printf("0x%x, 0x%x, 0x%x, 0x%x\n", mem2[i], mem2[i+1], mem2[i+2], mem2[i+3]); 57 } 58