Advertisement
Guest User

Telefang 2 Stat Notes (Power)

a guest
Jul 11th, 2011
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 KB | None | 0 0
  1. Possible addresses:
  2.  
  3. 08104374 (likely)
  4. 08136862
  5. 08136AB2
  6.  
  7. ----
  8.  
  9. Notes:
  10.  
  11. Known info:
  12.  
  13. The byte labled "Base HP 1" (at http://datacrystal.romhacking.net/wiki/Keitai_Denjuu_Telefang_2:ROM_map) actually appears to be a pointer a lookup table (with 100 bytes each) that is dependent on the current level of the Denjuu. The values rise as the levels do, and each tables have different growth rates. The table starts at 0x4F7DD0 in ROM.
  14.  
  15. The byte labled "Base HP 2" is not fully understood, but is known to have different effects depending on whether it is above 0x80 or not.
  16.  
  17. It is not known whether this all applies to HP or whether this applies to other stats as well, as not much research has been done yet.
  18.  
  19. Code:
  20.  
  21. 08104374 4C45 ldr r4,=84F6BD8h ;0x4F6BD8 = ROM address for Denjuu stat/move data in Power 2
  22. 08104376 78B1 ldrb r1,[r6,2h] ;Take index number of current Denjuu
  23. 08104378 0048 lsl r0,r1,1h ;
  24. 0810437A 1840 add r0,r0,r1 ;
  25. 0810437C 00C0 lsl r0,r0,3h ;
  26. 0810437E 1A43 sub r3,r0,r1 ;Multiply it by 23d (stats array size)
  27. 08104380 4668 mov r0,r13 ;
  28. 08104382 1881 add r1,r0,r2 ;
  29. 08104384 1898 add r0,r3,r2 ;
  30. 08104386 1900 add r0,r0,r4 ;Add result to starting address of Denjuu data to find stats for specific Denjuu
  31. 08104388 7800 ldrb r0,[r0] ;Load data from array in ROM and store it starting at 0x03007D64
  32. 0810438A 7008 strb r0,[r1] ;
  33. 0810438C 1C50 add r0,r2,1 ;
  34. 0810438E 0600 lsl r0,r0,18h ;
  35. 08104390 0E02 lsr r2,r0,18h ;
  36. 08104392 2A16 cmp r2,16h ;
  37. 08104394 D9F4 bls 8104380h ;Do this for entire array
  38. 08104396 00FD lsl r5,r7,3h ;Multiply current Denjuu (in order of Denjuu that befriended you) by 36d/24h to obtain address offset
  39. 08104398 19EC add r4,r5,r7 ;
  40. 0810439A 00A4 lsl r4,r4,2h ;
  41. 0810439C 2180 mov r1,80h ;Set starting RAM address to 0x2000000
  42. 0810439E 0489 lsl r1,r1,12h ;
  43. 081043A0 1864 add r4,r4,r1 ;Add previous two results together
  44. 081043A2 78A0 ldrb r0,[r4,2h] ;Load Denjuu's level from address above and output to 0x03004113
  45. 081043A4 70F0 strb r0,[r6,3h] ;
  46. 081043A6 4668 mov r0,r13 ;
  47. 081043A8 7840 ldrb r0,[r0,1h] ;Load data from RAM address 0x03007D65 (Seemingly Base HP 1?)
  48. 081043AA 78F1 ldrb r1,[r6,3h] ;Load data from RAM address 0x03004113 (Level of currently selected Denjuu)
  49. 081043AC 466A mov r2,r13 ;
  50. 081043AE 7892 ldrb r2,[r2,2h] ;Load data from RAM address 0x03007D66 (Seemingly Base HP 2?)
  51. 081043B0 F000FCBC bl 8104D2Ch ;Jump to 0x08104D2C?
  52.  
  53.  
  54. 08104D2C B510 push r4,r14 ;
  55. 08104D2E 0600 lsl r0,r0,18h ;Only preserve first 8 bits?
  56. 08104D30 0E00 lsr r0,r0,18h ;
  57. 08104D32 0609 lsl r1,r1,18h ;
  58. 08104D34 0E09 lsr r1,r1,18h ;
  59. 08104D36 0612 lsl r2,r2,18h ;
  60. 08104D38 0E14 lsr r4,r2,18h ;
  61. 08104D3A 4B09 ldr r3,=84F7DD0h ;Load number 0x084F7DD0
  62. 08104D3C 2264 mov r2,64h ;
  63. 08104D3E 4350 mul r0,r2 ;Multiply Base HP 1 by 100d
  64. 08104D40 1840 add r0,r0,r1 ;Add level to previous result
  65. 08104D42 18C0 add r0,r0,r3 ;Add 0x84F7DD0 to previous result (seriously)
  66. 08104D44 7802 ldrb r2,[r0] ;Dereference this address (yes, this is a pointer -- remember to subtract 0x08000000 to obtain a ROM address)
  67. 08104D46 2C80 cmp r4,80h ;Compare Base HP 2 to 0x80
  68. 08104D48 D90C bls 8104D64h ;If Base HP 2 <= 0x80 then jump to 0x08104D64
  69. ;If Base HP 2 > 0x80 then:
  70. 08104D4A 1C20 mov r0,r4 ;
  71. 08104D4C 3880 sub r0,80h ;(Base HP 2) -= 0x80
  72. 08104D4E 4350 mul r0,r2 ;Multiply this result by result from table obtained from 0x08104D44
  73. 08104D50 2800 cmp r0,0h ;Compare result with 0x0
  74. 08104D52 DA00 bge 8104D56h ;If result >= 0 then jump to 0x08104D56
  75. 08104D54 307F add r0,7Fh ;If result < 0: result += 0x7F
  76. 08104D56 0240 lsl r0,r0,9h ;Multiply result by 512, clear out first 9 bits
  77. 08104D58 0C00 lsr r0,r0,10h ;Divide result by 65536 (with these two operations, this effectively divides by 128)
  78. 08104D5A 1810 add r0,r2,r0 ;Add this to value obtained from table
  79. 08104D5C E00B b 8104D76h ;Jump to 08104D76
  80. 08104D5E 0000 lsl r0,r0,0h ;Haven't figured out anything beyond this yet
  81. 08104D60 7DD0 ldrb r0,[r2,17h] ;
  82. 08104D62 084F lsr r7,r1,1h ;
  83. 08104D64 2080 mov r0,80h ;
  84. 08104D66 1B00 sub r0,r0,r4 ;
  85. 08104D68 4350 mul r0,r2 ;
  86. 08104D6A 2800 cmp r0,0h ;
  87. 08104D6C DA00 bge 8104D70h ;
  88. 08104D6E 307F add r0,7Fh ;
  89. 08104D70 0240 lsl r0,r0,9h ;
  90. 08104D72 0C00 lsr r0,r0,10h ;
  91. 08104D74 1A10 sub r0,r2,r0 ;
  92. 08104D76 0400 lsl r0,r0,10h ;
  93. 08104D78 0C02 lsr r2,r0,10h ;
  94. 08104D7A 1C10 mov r0,r2 ;
  95. 08104D7C BC10 pop r4 ;
  96. 08104D7E BC02 pop r1 ;
  97. 08104D80 4708 bx r1 ;
  98. 08104D82 0000 lsl r0,r0,0h ;
  99. 08104D84 B530 push r4,r5,r14 ;
  100. 08104D86 0600 lsl r0,r0,18h ;
  101. 08104D88 0E00 lsr r0,r0,18h ;
  102. 08104D8A 2200 mov r2,0h ;
  103. 08104D8C 4D09 ldr r5,=3002B97h ;
  104. 08104D8E 4C0A ldr r4,=84F80F0h ;
  105. 08104D90 3801 sub r0,1h ;
  106. 08104D92 0041 lsl r1,r0,1h ;
  107. 08104D94 1809 add r1,r1,r0 ;
  108. 08104D96 004B lsl r3,r1,1h ;
  109. 08104D98 1951 add r1,r2,r5 ;
  110. 08104D9A 1898 add r0,r3,r2 ;
  111. 08104D9C 1900 add r0,r0,r4 ;
  112. 08104D9E 7800 ldrb r0,[r0] ;
  113. 08104DA0 7008 strb r0,[r1] ;
  114. 08104DA2 1C50 add r0,r2,1 ;
  115. 08104DA4 0400 lsl r0,r0,10h ;
  116. 08104DA6 0C02 lsr r2,r0,10h ;
  117. 08104DA8 2A05 cmp r2,5h ;
  118. 08104DAA D9F5 bls 8104D98h ;
  119. 08104DAC BC30 pop r4,r5 ;
  120. 08104DAE BC01 pop r0 ;
  121. 08104DB0 4700 bx r0 ;
  122. 08104DB2 0000 lsl r0,r0,0h ;
  123. 08104DB4 2B97 cmp r3,97h ;
  124. 08104DB6 0300 lsl r0,r0,0Ch ;
  125. 08104DB8 80F0 strh r0,[r6,6h] ;
  126. 08104DBA 084F lsr r7,r1,1h ;
  127. 08104DBC B570 push r4-r6,r14 ;
  128. 08104DBE 2600 mov r6,0h ;
  129. 08104DC0 0075 lsl r5,r6,1h ;
  130. 08104DC2 1C28 mov r0,r5 ;
  131. 08104DC4 3010 add r0,10h ;
  132. 08104DC6 0600 lsl r0,r0,18h ;
  133. 08104DC8 0E00 lsr r0,r0,18h ;
  134. 08104DCA 00B4 lsl r4,r6,2h ;
  135. 08104DCC 19A4 add r4,r4,r6 ;
  136. 08104DCE 1CE1 add r1,r4,3 ;
  137. 08104DD0 0609 lsl r1,r1,18h ;
  138. 08104DD2 0E09 lsr r1,r1,18h ;
  139. 08104DD4 2208 mov r2,8h ;
  140. 08104DD6 F7FEFDDD bl 8103994h ;
  141.  
  142.  
  143. Other notes:
  144. RAM:
  145. 03004112: Index number of currently selected Denjuu
  146. 03004113: Level of currently selected Denjuu
  147. 03007D64: Data for currently selected Denjuu
  148. 03007D65: Possibly Base HP 1?
  149. 03007D66: Possibly Base HP 2?
  150. 03004126: Index number of currently selected Denjuu (in order of them befriending you, not species)
  151.  
  152. ROM:
  153. 4F7DD0: Apparently a table for HP (and possibly other stats) for each Denjuu?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement