本帖最后由 jiangzhengwenjz 于 2015-7-11 16:00 编辑
update:- .thumb
- .align 2
- main:
- ldr r6, =0x080b5000
- mov r2, lr
- cmp r2, r6
- bge secondroutine
- sub r0, r0, r1 @get the initial table pointer
- mov r4, r1
- b adjust
- secondroutine:
- sub r0, r0, r4 @get the initial table pointer
- mov r1, r4
- adjust:
- lsr r1, r1, #3
- lsl r1, r1, #2
- @r5 contains the pointer location - 4
- getlength:
- sub r6, r5, r0
- cmp r6, #0x14
- beq fivesets
- cmp r6, #0x28
- beq tensets
- twelvesets:
- mov r7, #0x18
- b compare
- fivesets:
- mov r1, r4
- b day
- tensets:
- mov r7, #0x14
- compare:
- ldr r2, =0x03005CFA
- ldrb r2, [r2, #0]
- cmp r2, #0x11
- bge night
- cmp r2, #0x6
- bge day
- night:
- add r0, r0, r7
- day:
- add r4, r0, r1
- originalroutine:
- ldrb r0, [r4, #1]
- ldrb r1, [r4, #0]
- cmp r0, r1
- bcc location
- ldrb r7, [r4]
- add r6, r0, #0
- b back
- location:
- ldrb r7, [r4, #1]
- ldrb r6, [r4, #0]
- back:
- ldr r4, =0x080B4C8B
- bx r4
复制代码- .thumb
- .align 2
- main:
- pop {r0}
- ldrb r0, [r0]
- ldr r1, [r5, #4] @get the table pointer
- lsl r0, r0, #2
- push {r3, r7}
- mov r3, r0
- adjust:
- lsr r0, r0, #3
- lsl r0, r0, #2
- getlength:
- sub r6, r5, r1
- cmp r6, #0x14
- beq fivesets
- cmp r6, #0x28
- beq tensets
- twelvesets:
- mov r7, #0x18
- b compare
- fivesets:
- mov r0, r3
- b day
- tensets:
- mov r7, #0x14
- compare:
- ldr r6, =0x3005cfa
- ldrb r6, [r6]
- cmp r6, #0x11
- bge night
- cmp r6, #0x6
- bge day
- night:
- add r1, r1, r7
- day:
- add r0, r0, r1
- back:
- pop {r3, r7}
- ldrh r0, [r0, #2] @get the species num
- ldr r1, =0x80b5015
- bx r1
复制代码 增加叫声昼夜:- .thumb
- .align 2
- push {r2, r7, lr}
- @r1, r4, r5, r6 can be freely used, r1=table pointer
- lsr r0, r0, #0x16 @ogcode
- ldr r6, [r4, #4]
- cmp r1, r6
- bne adjust2 @r5 is pointer location - 4
- @r4 is pointer location - 4
- adjust:
- add r5, r4, #0 @r5 is pointer location - 4
- adjust2:
- add r2, r0, #0 @r2 = not adjusted
- lsr r0, r0, #3
- lsl r0, r0, #2 @adjust r0
- getlength:
- sub r6, r5, r1
- cmp r6, #0x14
- beq fivesets
- cmp r6, #0x28
- beq tensets
- twelvesets:
- mov r7, #0x18
- b compare
- fivesets:
- add r0, r2, #0 @restore r0
- b day
- tensets:
- mov r7, #0x14
- compare:
- ldr r4, =0x3005cfa
- ldrb r4, [r4]
- cmp r4, #0x11
- bge night
- cmp r4, #0x6
- bge day
- night:
- add r1, r1, r7
- day:
- add r0, r0, r1
- pop {r2, r7, pc}
复制代码 于080B5820h处用bl跳转至此程序 |