View Single Post
  #50    
Old September 1st, 2010 (9:30 PM).
JPAN JPAN is offline
pokemon rom researcher
     
    Join Date: Dec 2008
    Posts: 104
    You can use this routine to clear 0x1000 bytes. Just replace the last pointer for the one you will be using.
    Code:
    .align 2
    .thumb
    Fill_memory: push {r4-r7, lr}
        mov r4, #0x10
        lsl r4, r4, #0x8 /*value = 0x1000*/
        ldr r5, start_addr
        add r4, r5, r4
        mov r0, #0x0
        mov r1, #0x0
        mov r2, #0x0
        mov r3, #0x0
    fill_loop:  stmia r5!, {r0-r3}
        cmp r4, r5
        bgt fill_loop
        pop {r4-r7,pc}
    .hword 0x0000    
    start_addr:  .word 0x0203f000 /*change as needed*/
    or, in byte code, this:
    Code:
    f0 b5 10 24 240205 4d 2c 19 00 20 00 21 00 22
    00 23 0f c5 ac 42 fc dc f0 bd 00 00 00 f0 03 02
    The last bolded bytes are the pointer you wish to use. replace for your own. The bolded number above is the instruction needed to replace to make different sizes. For instance, if your replace 10 with 20, you will clear 0x2000 bytes. This code will always cover 0x100 bytes minimum (0x1).
    __________________
    Here are the links for my work


    Currently working on:
    Battle Script Documentation
    Another large project
    Reply With Quote