I was testing this yesterday, it's because camera speed gets confused: it's 2 byte for whatever purpose. And these 2 bytes must be set accordingly, like whenever one is negative, the other must also be negative. But when you warp around the screen, one of them gets positive, another gets negative, resulting in value of -250 and such, and when the cam needs to actually scroll (when you arrive to the middle of the screen from the other side), it uses that speed value and goes way to the left, so that camera position is also around -250.
Jump to contents of $22 happens when a new object is about to be spawned by scrolling (I guess?), but it gets written with values of $24, and that is what breaks I think. I was about to trace this for a few frames, but got tired. Hold on.
Download GnG.luaLanguage: lua
function stuff()
Xcam = memory.readwordsigned(0x64)
DXcam = memory.readwordsigned(0x5d)
Objects()
--Sprites()
gui.text(30, 0, DXcam) -- don't crop 8 scanlines to see
gui.text(30, 10, Xcam)
end
function Objects()
for i = 0, 0x15 do
local color = "#ffaa00ff"
local id = memory.readbyte(0x4f0+i)
local y = memory.readbyte(0x509+i)
local spr = memory.readbyte(0x522+i)
local pal = memory.readbyte(0x53b+i)
local x = memory.readbyte(0x554+i)
if id<80 then color = "#22ccccff" end -- offscreen
if id> 0 then
gui.text(x,y,string.format("\n%X",id),color,"#000000ff")
end
end
end
function Sprites()
local base0 = 0x480
for i = 0, 16 do
local base = base0 + i*4
local y = memory.readbyte(base+0)
if y==0xff then break end
local spr = memory.readbyte(base+1)
local pal = memory.readbyte(base+2)
local x = memory.readbyte(base+3)
gui.text(x,y,i,"#ffaa00ff")
end
end
gui.register(stuff)