View Single Post
  #11    
Old February 6th, 2009 (04:27 AM).
Juan
Brazilian with a bad English
 
Join Date: Jun 2007
Location: Pindamonhangaba - SP
Age: 24
Nature: Adamant
Quote:
If you'd like. devkitARM, HAM, goldroad, MIDI2GBA, it's all good.
I could not use with goldroad.
I modified his routine, and changed some things.
Take:
Spoiler:
Code:
@define pokedata = 0x02024284
@define var1 = 0x020370B8
@define var2 = 0x020370BA
@define var3 = 0x020370BC
@define RAM_offset = 0x02123990
@thumb
thumb_code

main:
		push {pc}
		ldr r3, var1
		ldrh r3, [r3]
		ldr r4, var2
		ldrh r4, [r4]
	
	
		;the following two lines one can be removed 
		;as the script now checks which Pokémon was chosen
		;
		;cmp r3, r4
		;bgt error
		;
	
		b taken
	
;error:
;		mov r0, #1
;		ldr r1, var3
;		strh r0, [r1] 
;		pop {pc}

	
taken:
		ldr r0, pokedata
		mov r5, #0x64
		mul r5, r3 			;multiplies '100' by the index of Pokémon chosen
							;if r0 = 0, then r4 will be 0
		
		add r0, r0, r5			;calculates the offset of the selected Pokémon
		ldr r1, RAM_offset
		mov r2, 0x19		;25
		swi 0xC	
		
		sub r4, #0x1
		ldr r6,= 0x00
		mov r5, #0x0
		cmp r3, r4
		beq remove
		ldr r1, pokedata
		b fix
		
		
remove:
		strb r6, [r0]
		add r0, #0x01
		add r5, #0x01
		cmp r5, #0x64
		blt remove
		
		b finish
		

fix:
		ldr r7, pokedata
		mov r5, #0x64
		mul r5, r3
		add r1, r7, r5
		add r3, r3, #0x01
		mov r5, #0x64
		mul r5, r3
		add r0, r7, r5
		swi 0xC	
		cmp r3, r4
		blt fix
		mov r5, #0x0
		b remove
		
		
finish:
		mov r0, #0x00
		ldr r1, var3
		strh r0, [r1]
		pop {pc}


Return:
Spoiler:
Code:
@define pokedata = 0x02024284
@define var1 = 0x020370B8
@define var3 = 0x020370BC
@define RAM_offset = 0x02123990;0x02010000
@thumb
thumb_code

main:
		push {lr}
		ldr r5, var1
		ldrb r5, [r5]
		cmp r5, #0x05
		beq error
		mov r4, #0x64
		mul r4, r5
		ldr, r0, RAM_offset
		ldr, r1, pokedata
		add r1, r4
		ldr r2, #0x19
		swi 0xC
		ldr r1,= 0x00000000
		mov r4, #0x00
	
remove:
		str r1, [r0]
		add r0, #0x04
		add r4, #0x01
		cmp r2, #0x19
		blt remove

finish:
		mov r0, #0x00
		ldr r1, var3
		strh r0, [r1]
		pop {pc}
		
		
error:	
		mov r0, #0x01
		ldr r1, var3
		strh r0, [r1] 
		pop {pc}


Take:
Code:
00B5 C046 154B 1B88 154C 2488 FFE7 C046
1448 6425 5D43 4019 1349 1922 0CDF 013C
124E 0025 A342 01D0 0E49 05E0 0670 0130
0135 642D FADB 0CE0 0A4F 6425 5D43 7919
5B1C 6425 5D43 7819 0CDF A342 F4DB 0025
ECE7 0020 0649 0880 00BD 0000 B870 0302
BA70 0302 8442 0202 9039 1202 0000 0000
BC70 0302
Where:
84420202 = pokedata
B8700302 = var1(0x8000)
BA700302 = var2(0x8001)
BC700302 = var3(0x8002)
9039 1202 = RAM_offset

Return:
Code:
00B5 C046 0D4D 2D78 052D 12D0 6424 6C43
FBFF FAFF 211C F9FF 0CDF C046 0849 0024
0160 0430 0134 192A FADB 0020 0549 0880
00BD 0120 0349 0880 00BD 0000 B870 0302
0000 0000 BC70 0302
Where:
84420202 = pokedata
B8700302 = var1(0x8000)
BC700302 = var3(0x8002)
9039 1202 = RAM_offset

Script:
Spoiler:
Quote:
#alias @ $

#dynamic 0x800000

#org $start 'Code to take a Pokemon
lock
faceplayer
checkflag 0x200
if 0x1 goto $return
special2 LASTRESULT 0x84 'check how many Pokémon have on the team (no eggs)
copyvar 0x8001 LASTRESULT
compare 0x8001 0x2
if 0x0 goto $1poke 'if less than two, the script does not run
special 0xBC 'choose a pokemon
waitstate
subvar LASTRESULT 0x1
comparevars 0x8004 LASTRESULT
if 0x4 goto $none 'if choose none pokemon, the script stop
copyvar 0x8000 0x8004

callasm 0x800001 'callasm 0x(address + 1) Of course then I inserted this code at 0x800001
compare 0x8002 0x1 'If error occurred.
if 0x1 goto $error
msgbox $1 0x6
setflag 0x200
release
end

#org $error
msgbox $2 0x6
release
end

#org $return
countpokemon
compare 0x800D 0x5
if 0x1 goto $error 'If there’s no room for the return.
copyvar 0x8000 0x800D
callasm 0x800101 'Callasm 0x(address +1) Mine was 0x800100
compare 0x8002 0x1 'Error Check
if 0x1 goto $error
msgbox $3 0x6
clearflag 0x200
release
end

#org $1poke
msgbox $4 0x6
release
end

#org $none
msgbox $5 0x6
release
end


#org $1
= Pokemon taken.

#org $2
= Error occurred.

#org $3
= Pokemon returned

#org $4
= You must have at least two\nPokémon!

#org $5
= No Pokémon has been chosen!



If want to use other variables, or in other versions:
BPRE:
Spoiler:
Code:
$020370B8	0x8000
$020370BA	0x8001
$020370BC	0x8002
$020370BE	0x8003
$020370C0	0x8004
$020370C2	0x8005
$020370C4	0x8006
$020370C6	0x8007
$020370C8	0x8008
$020370CA	0x8009
$020370CC	0x800A
$020370CE	0x800B
$020370D0	0x800D (LASTRESULT)
$020370D4	0x800C (PLAYERFACING)
$0203AD30	0x800E


AXVE:
Spoiler:
Code:
$0202E8C4	0x8000
$0202E8C6	0x8001
$0202E8C8	0x8002
$0202E8CA	0x8003
$0202E8CC	0x8004
$0202E8CE	0x8005
$0202E8D0	0x8006
$0202E8D2	0x8007
$0202E8D4	0x8008
$0202E8D6	0x8009
$0202E8D8	0x800A
$0202E8DA	0x800B
$0202E8DC	0x800D (LASTRESULT)
$0202E8E0	0x800C (PLAYERFACING)
$0203855E	0x800E


AXPE:
Spoiler:
Code:
$0202E8C4	0x8000
$0202E8C6	0x8001
$0202E8C8	0x8002
$0202E8CA	0x8003
$0202E8CC	0x8004
$0202E8CE	0x8005
$0202E8D0	0x8006
$0202E8D2	0x8007
$0202E8D4	0x8008
$0202E8D6	0x8009
$0202E8D8	0x800A
$0202E8DA	0x800B
$0202E8DC	0x800D (LASTRESULT)
$0202E8E0	0x800C (PLAYERFACING)
$0203855E	0x800E


PBEE:
Spoiler:
Code:
$020375D8	0x8000
$020375DA	0x8001
$020375DC	0x8002
$020375DE	0x8003
$020375E0	0x8004
$020375E2	0x8005
$020375E4	0x8006
$020375E6	0x8007
$020375E8	0x8008
$020375EA	0x8009
$020375EC	0x800A
$020375EE	0x800B
$020375F0	0x800D (LASTRESULT)
$020375F4	0x800C (PLAYERFACING)
$0203CE7C	0x800E


Quote:
Also, how do you compile all of this information?
Download the program "goldroad", save the routine in a text file.
Drag the file from the routine to the Goldroad, and a file .GBA will be generated, which is routinely compilled.
__________________
Reply With Quote