# Forum Game Boy Advance Games Klonoa Heroes: Densetsu no Star Medal Game: Klonoa Heroes: Densetsu no Star Medal

Post subject: Klonoa Heroes: Densetsu no Star Medal
###### jlun2
Skilled player (1717)
###### jlun2
Skilled player (1717)
From the discord for this game: This only works on the 1st time you see the character screen for Klonoa. 0x69F0 (IWRAM) is initialized to 1, but on viewing Klonoa it gets set to 0. You have 1 frame to add a point in a stat, which the game then tries to subtract, causing it to go to 65535. For Guntz, on the 1st time you get him, change to him. 0x6A94 (IWRAM) is initialized to 10, and only gets set to 0 once you view his stats. Switch to him with L, then press Up + Right. This causes the game to try giving it +1 AGI, before it gets subtracted from 0 to 65535. This resets on level for Klonoa so you have to avoid all the gems. If you can somehow go OoB in part 3 of the final boss, you can instantly skip it: The RNG is probably 0x19C8 IWRAM. The algorithm seems to be:
```Language: lua```--[[
3. Load the constant 41C64E6D from ROM to r0
4. r0 = r0 * r1 = 41C64E6D * RNG
5. Load the constant 00003039 from ROM to r1
6. r0 = r0 * r1 =  (41C64E6D * RNG) + 00003039
7. Load the constant 7FFFFFFF from ROM to r1
8. r0 = r0 & r1 = ((0x41C64E6D * RNG) + 0x00003039) & 0x7FFFFFFF
9. Store r0 to RNG address
]]--
function MUL(Rm, Rs, Rn)
--http://tasvideos.org/forum/viewtopic.php?p=489512#489512
--Rd = (Rm * Rs + Rn)[31:0]
local reslow = Rm * (Rs%0x10000) -- Rm multiplied with lower 16 bits of Rs
local reshigh = Rm * (math.floor(Rs/0x10000)%0x10000) -- Rm multiplied with higher 16 bits of Rs (shifted down)
reshigh = reshigh%0x10000 -- only 16 bits can matter here if result is 32 bits

local result = (reshigh*0x10000 + reslow + Rn)%0x100000000 -- recombine and cut off to 32 bits
return result
end

function klonoa_rng(current_rng)
return bit.band(MUL(current_rng, 0x41C64E6D, 0) + 0x00003039, 0x7FFFFFFF)
end
``````
Speed: both IWRAM 0228 X speed 0230 Y speed Going to diagonally looks slower, but it is the same due to pythagorean. Klonoa: Walking: 1 direction: 392 diagonal: 277 Special: Same as above Sword (Land): 1 direction: 672 diagonal: 474 Sword (Water): 1 direction: 774 diagonal: 541 Guntz: 1 direction: 336 diagonal: 238 Special: Same as above Pango: 1 direction: 308 diagonal: 217 Special: 1 direction: 616 diagonal: 434 Getting hit (Same for underwater): Normal: 1 direction: 512 diagonal: 362 Crit: 1 direction: 1536 diagonal: 1086 Underwater: 1 direction: 508 diagonal: 357 So using the sword would be faster than Pango's special if not for the fact you stop for a bit every swing Edit: Bumping to an npc from the side can give Klonoa 1024 speed. Anything less is slower, so only do this if it gives you 1024 speed.