Results 1 to 9 of 9

Thread: Text activator (ASM)

  1. #1

    Default Text activator (ASM)

    I'm having trouble making a text activator. I figured I'd start out simple, so here's what I have:

    Code:
    ldr r0, =0x021D88FE        
    ldr r5, =0x022AF136 
    
    @check if code should run
    checkF:
    ldrb r6, [r5] 
    add r5,#1
    cmp r6,#0x06
    beq checkL
    b exit
    
    checkL:
    ldrb r6, [r5]
    add r5,#1
    cmp r6,#0x0C
    beq checkA
    b exit
    
    checkA:
    ldrb r6, [r5]
    add r5,#2
    cmp r6,#0x01
    beq run
    b exit
    
    run:
    mov r8, #0x0019
    strh r8, [r0]
    b exit
    
    exit:
    bx lr
    I want it so when you say "FLA" it'll put a blue rose in slot one of your pockets, but when I did the code without "b exit" after the run section, it just froze, and when I added "b exit" nothing happened
    This is my siggy. I'll make it better when I stop being lazy

  2. #2
    Chris (Administrator) Vash's Avatar
    Join Date
    Sep 2007
    Location
    Teh Interwebz
    Posts
    1,992
    Blog Entries
    27

    Default Re: Text activator (ASM)

    There's no conditional for when you compare and it's not equal.

    After Check F, get rid of b exit and add bne checkF. Also, after Check L, get rid of b exit and add bne checkF
    Animal Crossing: City Folk
    ACToolkit - NPC_Tool - PattView

  3. #3

    Default Re: Text activator (ASM)

    Quote Originally Posted by Vash
    There's no conditional for when you compare and it's not equal.

    After Check F, get rid of b exit and add bne checkF. Also, after Check L, get rid of b exit and add bne checkF
    wouldn't bne checkF make it start over from the most recent character?

    I want it to check if you typed FLA (only as first 3 characters) and if you did it makes your first inventory slot a blue rose, if not it doesn't do anything
    This is my siggy. I'll make it better when I stop being lazy

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

    Default Re: Text activator (ASM)

    ... A snippet from one of my codes...

    Code:
    ldrh r1, Activator
    ldr r0, Text
    ldrh r2,[r0]
    cmp r2, r1
    bxne lr
    Code:
    Text:
    .long 0x22AF136
    Activator:
    .ascii "zr"
    >___> it works btw though thats obviously not the full code.

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


  5. #5
    Chris (Administrator) Vash's Avatar
    Join Date
    Sep 2007
    Location
    Teh Interwebz
    Posts
    1,992
    Blog Entries
    27

    Default Re: Text activator (ASM)

    Quote Originally Posted by itsmeGames
    Quote Originally Posted by Vash
    There's no conditional for when you compare and it's not equal.

    After Check F, get rid of b exit and add bne checkF. Also, after Check L, get rid of b exit and add bne checkF
    wouldn't bne checkF make it start over from the most recent character?

    I want it to check if you typed FLA (only as first 3 characters) and if you did it makes your first inventory slot a blue rose, if not it doesn't do anything
    Well yes, but when it compares and it's not equal you want the entire check to start over. If it confirms F then not L and you make it keep checking L instead of going back to F you could get something like this:

    Character says: Fart!
    Check reads F and moves on to second check for L
    Character then says: SLOW connection.
    Check reads L in second message and moves on to A check.
    Character finally says: SCAMMER!
    Check reads A in the third message and you get the final code effect.

    I know it's highly unlikely, but each time you encounter a Not Equal in your compare you want to completely restart the check. It's really up to you, though. You at least need to add something for NE. Even if it is restarting the current check instead of all the checks.

    I hope this wasn't too confusing...

    Code:
    ldr r0, =0x021D88FE        
    ldr r5, =0x022AF136 
    
    @check if code should run
    checkF:
    ldrb r6, [r5] 
    add r5,#1
    cmp r6,#0x06
    beq checkL
    bne checkF
    
    checkL:
    ldrb r6, [r5]
    add r5,#1
    cmp r6,#0x0C
    beq checkA
    bne checkF
    
    checkA:
    ldrb r6, [r5]
    add r5,#2
    cmp r6,#0x01
    beq run
    bne checkF
    
    run:
    mov r8, #0x0019
    strh r8, [r0]
    b exit
    
    exit:
    bx lr
    Animal Crossing: City Folk
    ACToolkit - NPC_Tool - PattView

  6. #6

    Default Re: Text activator (ASM)

    Quote Originally Posted by Vash
    Quote Originally Posted by itsmeGames
    Quote Originally Posted by Vash
    There's no conditional for when you compare and it's not equal.

    After Check F, get rid of b exit and add bne checkF. Also, after Check L, get rid of b exit and add bne checkF
    wouldn't bne checkF make it start over from the most recent character?

    I want it to check if you typed FLA (only as first 3 characters) and if you did it makes your first inventory slot a blue rose, if not it doesn't do anything
    Well yes, but when it compares and it's not equal you want the entire check to start over. If it confirms F then not L and you make it keep checking L instead of going back to F you could get something like this:

    Character says: Fart!
    Check reads F and moves on to second check for L
    Character then says: SLOW connection.
    Check reads L in second message and moves on to A check.
    Character finally says: SCAMMER!
    Check reads A in the third message and you get the final code effect.

    I know it's highly unlikely, but each time you encounter a Not Equal in your compare you want to completely restart the check. It's really up to you, though. You at least need to add something for NE. Even if it is restarting the current check instead of all the checks.

    I hope this wasn't too confusing...

    Code:
    ldr r0, =0x021D88FE        
    ldr r5, =0x022AF136 
    
    @check if code should run
    checkF:
    ldrb r6, [r5] 
    add r5,#1
    cmp r6,#0x06
    beq checkL
    bne checkF
    
    checkL:
    ldrb r6, [r5]
    add r5,#1
    cmp r6,#0x0C
    beq checkA
    bne checkF
    
    checkA:
    ldrb r6, [r5]
    add r5,#2
    cmp r6,#0x01
    beq run
    bne checkF
    
    run:
    mov r8, #0x0019
    strh r8, [r0]
    b exit
    
    exit:
    bx lr
    I get it now, but I think I'll just go with Maniac's way
    This is my siggy. I'll make it better when I stop being lazy

  7. #7
    Chris (Administrator) Vash's Avatar
    Join Date
    Sep 2007
    Location
    Teh Interwebz
    Posts
    1,992
    Blog Entries
    27

    Default Re: Text activator (ASM)

    Yeah, I never thought to use that as a latch. Muchhhh simpler.

    Edit: Make sure that after you use the text values, change the ZR part at the end of your main code to something else so it doesn't create an infinite loop.
    Animal Crossing: City Folk
    ACToolkit - NPC_Tool - PattView

  8. #8

    Default Re: Text activator (ASM)

    yeah, he told me that on MSN
    This is my siggy. I'll make it better when I stop being lazy

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

    Default Re: Text activator (ASM)

    Dang straight >__> lol Good luck btw

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


Posting Permissions

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