Page 1 of 4 123 ... LastLast
Results 1 to 10 of 39

Thread: Still Need ASM Help

  1. #1

    Cool Still Need ASM Help

    I tried making a code involving checks, but my game freezes. It's supposed to check the slots that are empty and put a hockey mask in all of those slots.

    Here's what I did:

    First source (froze):
    Code:
    removed
    Second source (does nothing):
    Code:
    removed

    Please help me so I can continue learning ASM.
    Last edited by Demonic722; 06-14-2010 at 06:51 PM.
    3DS Friend Code: 4699-6293-3106

  2. #2

    Default

    EDIT: Wrong information!
    Last edited by TQX; 06-01-2010 at 06:48 AM.

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

    Default

    Try this.. /: bit tired.. running on 14 hours of sleep over 3 days so i might of missed something. Please send me an msn message or aim message when you can, I will forget to check back on this I'm guessing.
    ldr r0, Slot @r0 = 0x021D88FE
    ldrh r1, Mask @r1 =0x144E
    ldrh r2, Check @r2 = 0xFFF1
    mov r3, #0x1c
    add r3, r0,r3

    Loop:
    cmp r0, r3
    bge End
    ldrh r4, [r0]
    cmp r4, r2
    beq StoreCheck
    strh r1, [r3]
    b Loop

    StoreCheck:
    subs r3, #0x2
    bpl Loop

    End:
    bx lr


    Slot:
    .long 0x21D88FE

    Mask:
    .short 0x144E

    Check:
    .short 0xFFF1
    Last edited by Maniac; 06-01-2010 at 08:12 AM.

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


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

    Default

    Code:
    ldr r0,=0x21D88FE
    ldrh r1,=0xFFF1
    ldrh r2,=0x144E
    mov r4,#0x1C
    
    CheckSlots:
    ldrh r3,[r0,r4]   @load the item in (first item slot+r4, basically the last slot first, then second to last, etc)
    cmp r3,r1        @check if its empty
    bne DontStore  @if not, dont store the mask
    strh r2,[r0,r4]   @store the mask in (first item slot +r4)
    DontStore:
    subs r4,#2       @subtract #2 from r4 so we go back one slot the next time around
    bpl CheckSlots  
    bx lr
    compiles into
    Code:
    023FF090 012FFF11
    E0000000 00000038
    E59F0024 E1DF12B4
    E1DF22B4 E3A0401C
    E19030B4 E1530001
    1A000000 E18020B4
    E2544002 5AFFFFF9
    E12FFF1E 021D88FE
    0000FFF1 0000144E
    023FF090 E3520003
    could be shorter in THUMB mode
    Always willing to help with anything, code-related or not. :]

  5. #5

    Default

    Thanks, DragonBoy! Maniac, I tried IMing you on AIM using the user name "JPMayIII," but you never responded. I'll use my other aim account (Demonic722) so expect a message from me shortly! :P
    3DS Friend Code: 4699-6293-3106

  6. #6

    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

  7. #7
    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. :]

  8. #8
    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. :]

  9. #9

    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

  10. #10
    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. :]

Posting Permissions

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