Results 1 to 9 of 9

Thread: [ASM] Town Cleaner code

  1. #1

    Default [ASM] Town Cleaner code

    I post my code here since I think it has been already made (nevertheless seperated in differents codes).

    EU Version:

    Code:
    94000130 FFFC0000
    023FF090 012FFF11
    E0000000 00000046
    E28F2001 E12FFF12
    490E480D 2A6D5A42
    2A89DD02 3A6EDA00
    DA002A1B 21FF5242
    31F10209 DD022A1E
    DA002A25 2A1B5243
    5243D100 D1002A89
    39025243 4770D5E6
    021E6D4C 00001FFE
    023FF090 E3520003
    D2000000 00000000
    US Version:

    Code:
    94000130 FFFC0000
    023FF090 012FFF11
    E0000000 00000046
    E28F2001 E12FFF12
    490E480D 2A6D5A42
    2A89DD02 3A6EDA00
    DA002A1B 21FF5242
    31F10209 DD022A1E
    DA002A25 2A1B5243
    5243D100 D1002A89
    39025243 4770D5E6
    021E3124 00001FFE
    023FF090 E3520003
    D2000000 00000000
    US 1.1 Version:

    Code:
    94000130 FFFC0000
    023FF090 012FFF11
    E0000000 00000046
    E28F2001 E12FFF12
    490E480D 2A6D5A42
    2A89DD02 3A6EDA00
    DA002A1B 21FF5242
    31F10209 DD022A1E
    DA002A25 2A1B5243
    5243D100 D1002A89
    39025243 4770D5E6
    021E36A4 00001FFE
    023FF090 E3520003
    D2000000 00000000
    ASM Source:



    Activator: A+B

    Features:

    - Revive all flowers
    - Water all flowers
    - Remove all weeds
    - Remove Rafflesias

    Thanks to Demonic.
    Last edited by MisterNobody; 07-13-2011 at 03:09 PM.

  2. #2

    Default

    You could compare to immediate values (up to two digits in thumb):

    Before:
    Code:
    ReviveFlowers:
    ldrh r2,[r0,r1]
    mov r3, #0x6F
    cmp r2,r3
    ble WaterFlowers
    mov r3, #0x89
    cmp r2,r3
    bge WaterFlowers
    sub r2,#0x6E
    After:
    Code:
    ReviveFlowers:
    ldrh r2,[r0,r1]
    cmp r2, #0x6F
    ble WaterFlowers
    cmp r2, #0x89
    bge WaterFlowers
    sub r2, #0x6E
    There's really no need to mov r3 by a byte and then compare. ^_^

    Edit: You should load the map with a 32-bit load XD
    Last edited by Demonic722; 07-12-2011 at 02:00 PM.
    3DS Friend Code: 4699-6293-3106

  3. The Following User Says Thank You to Demonic722 For This Useful Post:


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

    Default

    Code:
     mov r3, #0x6F  #Wilted Red Tulips start at 6E
    I'll read the rest later.
    Last edited by Maniac; 07-12-2011 at 06:07 PM.

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


  5. The Following User Says Thank You to Maniac For This Useful Post:


  6. #4

    Default

    Thanks for your advices.

    I've fixed the ASM source:



    Edit: The AR codes in the first post are fixed (2 lines shorter).
    Last edited by MisterNobody; 07-13-2011 at 03:05 PM.

  7. #5

    Default

    It looks like the code posted was compiled with a different source XD. Not only because of the limitation of
    only 1 "ldrh r0-r5, LabelHere" rule in thumb, but no where in the code 0xFFF1, or 0x1FFE is seen. o.o
    3DS Friend Code: 4699-6293-3106

  8. #6

    Default

    I've just changed 2-3 things because it doesn't want to compile with this source. But don't worry, the code seems to work, I've tested it myself. :P

  9. #7

    Default

    Quote Originally Posted by MisterNobody View Post
    I've just changed 2-3 things because it doesn't want to compile with this source. But don't worry, the code seems to work, I've tested it myself. :P
    It doesn't compile because you have two "ldrh r0-r5, LabelHere" things XD :P
    3DS Friend Code: 4699-6293-3106

  10. The Following User Says Thank You to Demonic722 For This Useful Post:


  11. #8

    Default

    Oh that's it ! Thank you I'm going to fix the source again. xD

  12. #9

    Default

    I made a remove all weeds, and rafflesia code today (In ASM) ^_^
    Look at what I did to get FFF1, maybe you could add that to your new source:

    Code:
    @Branch To Thumb
    add r0,pc,#1
    bx  r0
    .thumb
    
    @Fetch 0xfff1
    ldr r0, Map
    ldrh r1, MapOffset
    lsl r2, r1, #3
    add r2, #1
    
    Loop:
    ldrh r3,[r0,r1]
    cmp r3, #0x1B
    beq RemoveWeed
    blt NoWeed
    cmp r3, #0x1F
    blt NoWeed
    cmp r3, #0x24
    ble RemoveWeed
    bgt NoWeed
    b NoWeed
    
    RemoveWeed:
    strh r2,[r0,r1]
    
    NoWeed:
    sub r1, #2
    bpl Loop
    bx lr
    
    .arm
    Map:
    .long 0x021E3124
    MapOffset:
    .short 0x1FFE
    Last edited by Demonic722; 12-06-2020 at 04:23 PM.
    3DS Friend Code: 4699-6293-3106

  13. The Following User Says Thank You to Demonic722 For This Useful Post:


Posting Permissions

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