I'm having more problems, Dragonboy. I thought I could finish this but it refuses to compile for some reason. Maybe there are too many registers or registers that shouldn't be used?
I wanted to make my Search & Replace code activate by typing "re" short for replace. Here's my source:
Code:
ldr r0, word
ldr r2, text
ldrh r1, [r2]
cmp r1, r0
bxne lr
ldrh r0, activated
strh r0, [r2]
ldr r3, mapslot
ldrh r4, searchitem
ldrh r5, replaceitem
ldrh r8, 0x1FFE
MapLoop:
ldrh r12, [r3, r8]
cmp r12, r4
bne Replace
strh r5, [r3, r8]
Replace:
subs r8, #2
bpl MapLoop
bx lr
word:
.ascii "re"
activated:
.ascii "ok"
text:
.long 0x22AF136
mapslot:
.long 0x21E3124
searchitem:
.short 0x144E
replaceitem:
.short 0xFFF1
My successful Search & Replace (normal activator since I don't know how to add an activator in a source yet):
Code:
ldr r0, =0x21E3124
ldrh r2, =0xFFF1
ldrh r3, =0x144E
ldrh r1, =0x1FFE
MapLoop:
ldrh r4, [r0, r1]
cmp r4, r2
bne Replace
strh r3, [r0, r1]
Replace:
subs r1, #2
bpl MapLoop
bx lr
I made my own source since the Wiki isn't up.
The code [L+R]:
Code:
94000130 FCFF0000
023FF090 012FFF11
E0000000 0000003C
E59F0024 E1DF22B4
E1DF32B4 E1DF12B4
E19040B1 E1540002
1A000000 E18030B1
E2511002 5AFFFFF9
E12FFF1E 021E3124
0000FFF1 0000144E
00001FFE 00000000
023FF090 E3520003
D2000000 00000000
Same as before replace FFF1 with XXXX (any hex) and 144E with YYYY (any hex).