• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[ASM & Hex] Display in-battle messages via ASM [FR]

239
Posts
8
Years
  • Age 31
  • Seen yesterday
Hello all,

I'm working on altering the battle engine to implement more complex move effects such as gravity, etc, but a big issue I've stumbled upon is how to display a message in battle for things such as turn counters being reduced to zero, ground attacks missing pokemon In Air, and so on.

Here is an example of the routine I'm trying to implement. It reduces the values in a block of RAM for turn counters each turn. If the value is reduced to zero, I am trying to link to function to run a battle script that displays a message before restarting the loop.

Code:
TurnCounters:
	ldr r0, .startRAM
	mov r1, #0x0	
	mov r2, #0x6
	add r2, r0, r2

CounterLoop:
	ldrb r3, [r0]
	cmp r3, #0x0
	beq NextIter
	sub r3, #0x1
	strb r3, [r0]
	cmp r3, #0x0
	bne NextIter

Message:
        push {r0-r3}
	ldr r0, =(0x08908828)	@battle script to run (for test purposes I'm just loading one message)
	ldr r2, =(0x0801BC24 +1)
	bl link2
        pop {r0-r3}

NextIter:
	cmp r0, r2
	beq Exit
	add r0, r0, #0x1
	b CounterLoop

Exit:
    ldr r1, =(0x03004F90)
    ldrb r0, [r1, #0x13]
    cmp r0, #0xFE
    bhi return
    add r0, #0x1
    strb r0, [r1, #0x13]
    ldr r2, =(0x08013CBC + 1)

link2:
    bx r2

From what I can tell, 0801bc24 loads the battle script from r0 into 02023d74 and then strores 08015C74 which loads a command from the battle command table into 03004f84. All I have listed for 03004f84 is "bc" so I'm not positive what it is used for.

My battle script being loaded is as follows:
Code:
setword 0x0203C020 0x8908762
printstring 0x184
waitmessage 0x40
end

Anyways, my routine is broken in that it simply does not display any message.

Any help is appreciated. Thanks :)
 
Back
Top