Page 1 of 2 12 LastLast
Results 1 to 10 of 39

Thread: Still Need ASM Help

Hybrid View

  1. #1

    Default

    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).
    3DS Friend Code: 4699-6293-3106

  2. #2
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Code:
    @Convert to thumb
    add r2,pc,#1           
    bx r2
    .thumb
    
    ldr r0, TextPointer
    ldr r0,[r0]
    ldrh r1,=0x3C16
    ldrh r3,[r0,r1]
    ldrh r2,Activator
    cmp r3,r2
    bne Exit
    strh r1,[r0,r1]
    
    ldr r0,Map
    ldrh r1,=0x1FFE
    ldrh r2,=0xFFF1
    ldrh r3,=0x144E
    
    Search:
    ldrh r4,[r0,r1]
    cmp r4,r2
    bne NotReplace
    strh r3,[r0,r1]
    NotReplace:
    sub r1,#2
    bpl Search
    
    Exit:
    bx lr
    
    .arm
    TextPointer:
    .long 0x21CAF6C
    Map:
    .long 0x21E3124
    Activator:
    .ascii "re"
    Code:
    023FF090 012FFF11
    E0000000 0000004C
    E28F2001 E12FFF12
    6800480B 5A43490B
    42934A08 5241D10A
    49094805 4B0A4A09
    42945A44 5243D100
    D5F93902 00004770
    021E3124 00006572
    021CAF6C 00003C16
    00001FFE 0000FFF1
    0000144E 00000000
    023FF090 E3520003
    try that

    Just type "re" and it should work
    Always willing to help with anything, code-related or not. :]

  3. #3
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    By the way the only reason yours wouldn't compile is because of a typo XD

    You put: ldrh r8, 0x1FFE
    if you put
    ldrh r8,=0x1FFE
    it compiles
    Always willing to help with anything, code-related or not. :]

  4. #4

    Default

    So will my code work too? Compared to my source, your source is smaller and probably more efficient. Is thumb more efficient with codes like this?

    Edit: Fixed typos.
    3DS Friend Code: 4699-6293-3106

  5. #5
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Quote Originally Posted by Demonic View Post
    So will my code work too? (will check later) and your source is so small..compared to all my registers o_O is thumb more efficient with codes like these?
    I dunno if it'll work, I haven't tried it. And the longer a code is, the more efficient it is to use THUMB. (of course I usually make ALL my codes in THUMB) Text activators are picky, sometimes it won't compile for random reasons.
    Always willing to help with anything, code-related or not. :]

  6. #6

    Default

    Nice! I just typed "re" into the chat box without submitting it and it erased the hockey masks. Could you tell me another reason why my code doesn't activate besides the fact that there was a typo that I fixed? :P

    Code Source again:

    Code:
    removed
    Which compiled to:
    Code:
    removed
    Last edited by Demonic722; 06-23-2010 at 03:56 PM.
    3DS Friend Code: 4699-6293-3106

  7. #7
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Well, for one, when doing text activators, you should put
    ldrh r0, word
    instead of
    ldr r0,word
    may not help, but it should
    Always willing to help with anything, code-related or not. :]

  8. #8
    J.P. (Global Moderator) Maniac's Avatar
    Join Date
    Sep 2007
    Location
    Ohio, USA
    Posts
    2,083
    Blog Entries
    5

    Default

    Locked as requested.

    Say what you mean, mean what you say, and let your actions speak for you.


  9. #9
    J.P. (Global Moderator) Maniac's Avatar
    Join Date
    Sep 2007
    Location
    Ohio, USA
    Posts
    2,083
    Blog Entries
    5

    Default

    Quote Originally Posted by dragonboy269 View Post
    By the way the only reason yours wouldn't compile is because of a typo XD

    You put: ldrh r8, 0x1FFE
    if you put
    ldrh r8,=0x1FFE
    it compiles
    Can i just... slap you for teaching bad habits? I've told you this sometimes takes more room than needed.. l:

    Say what you mean, mean what you say, and let your actions speak for you.


  10. #10
    Member
    Join Date
    Aug 2008
    Location
    Arizona
    Posts
    1,073
    Blog Entries
    2

    Default

    Sorry XD I've gotten used to a lot of bad habits. Most of my sources are unreadable because I've done weird things to make them compile as short as they possibly can. >_<
    Besides I haven't made a code in 3 months, and that code wasn't for ACWW it was for ACCF
    I'll work on re-making my codes in a "readable" way. XD
    Always willing to help with anything, code-related or not. :]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •