This page documents information about Earthworm Jim 2
. Many of the tricks demonstrated here are near impossible in real time and documented for the purposes of creating Tool-assisted Speedruns.
$ffa172 - camera x $ffa174 - camera y $ffa1d4 - RNG $fffc2a - config pointer. loads events for puppy love $fffc9a - reserved config pointer $fffc7b - puppy toss position. 0 causes 3 bounces, 2 causes 1 bounce. $fffc87 - puppy counter $fffc88+offset - speeds for puppies, offset = puppy counter
$25d482 - puppy speed table $275fea-$277b79 - approximate limits of puppy config table
gui.register(function()
camx = memory.readword(0xffa172)
camy = memory.readword(0xffa174)
Objects()
Bounce()
end)
function Objects()
local base0 = 0xffa2ea
for i=0,0x23 do
local base = base0+i*0x6e
local id = memory.readbyte(base)
if id>0 and id~=0x82 then
local hp = memory.readbytesigned(base+1)
local x = memory.readword(base+2)-4096-camx
local y = memory.readword(base+4)-4096-camy
--local x = Clamp(x,0,310)
--local y = Clamp(y,0,214)
local dx = memory.readwordsigned(base+0x18)
local dy = memory.readwordsigned(base+0x1a)
local hitboxbase = memory.readlong(base+0x14)
local x1 = memory.readbyte(hitboxbase+2)
local x2 = memory.readbyte(hitboxbase+4)
local y1 = memory.readbyte(hitboxbase+3)
local y2 = memory.readbyte(hitboxbase+5)
--PostRngRoll(base,x,y)
if x1>0 and x2>0 and y1>0 and y2>0 then
local of = 124
x1 = x1+x-of
x2 = x2+x-of
y1 = y1+y-of
y2 = y2+y-of
gui.box(x1,y1,x2,y2,0,"green")
end
if hp>0 then
gui.text(x,y-2,hp,"green")
end
end
end
end
function Bounce()
if memory.readbyte(0xffa515)==0x60
then offset = 8
else offset = 0 end
local counter = memory.readbyte(0xfffc87)
local a0 = 0xfffc88
local d0 = SHIFT(memory.readbyte(a0+counter),-5)+offset
local a3 = 0x25d482
local vel = memory.readword(a3+d0)
local bounce = 0
if vel == 0x200 then bounce = 3
elseif vel == 0x3e0 then bounce = 1
else bounce = 2
end
gui.text(0,0,string.format("next bounce: %d",bounce))
end
function Dump()
for p=0x275fea,0x277b79 do
local a = memory.readbyte(p)
if a==0x62 then
table.insert(bombs,string.format("%X",p))
elseif a==8 then
table.insert(goback,string.format("%X",p))
elseif a==3 then
table.insert(goforth,string.format("%X",p))
end
end
print("bombs:")
print(bombs)
print("")
print("goback:")
print(goback)
print("")
print("goforth:")
print(goforth)
print("")
end
64 - force Psyclow up 63 - force him down 30-32 - do the spawn 62 - bomb 68 - globe 70 - puppy 03 - jump forth through config table 08 - jump back through config table 7a - end of batch, wait how player handles the objects 2b,2d,0 - just skip
26:C2CE 48 E7 MOVEM.L {d0-a7}[70 00],-(SP) 26:C2D2 52 47 ADDQ.W #1,D7 26:C2D4 22 39 MOVE.L ($00FFA1D4),D1 26:C2DA 24 01 MOVE.L D1,D2 26:C2DC 5E 82 ADDQ.L #7,D2 26:C2DE D2 81 ADD.L D1,D1 26:C2E0 D2 81 ADD.L D1,D1 26:C2E2 26 01 MOVE.L D1,D3 26:C2E4 D2 81 ADD.L D1,D1 26:C2E6 D2 82 ADD.L D2,D1 26:C2E8 D2 83 ADD.L D3,D1 26:C2EA 23 C1 MOVE.L D1,($00FFA1D4) 26:C2F0 24 01 MOVE.L D1,D2 26:C2F2 48 42 SWAP.W D2 26:C2F4 B5 41 EOR.W D2,D1 26:C2F6 CE C1 MULU.W D1,D7 26:C2F8 48 47 SWAP.W D7 26:C2FA 4C DF MOVEM.L (SP)+,{a7-d0}[00 0e] 26:C2FE 4E 75 RTS