This script shows position and speed with subpixels nicely. It also highlights when it is possible to move faster than normal and also warns if too much speed is lost.
local AddrXWrap = 0x0642;
local AddrXScreen = 0x0658;
local AddrXSub = 0x062C;
local AddrXSpd = 0x06C6;
local AddrXSpdSub = 0x06B0;
local AddrY = 0x0684;
local AddrYSub = 0x066E;
local AddrYSpd = 0x06F2;
local AddrYSpdSub = 0x06DC;
while true do
emu.frameadvance();
--Position
XWrap=memory.readbyte(AddrXWrap);
XScreen=memory.readbyte(AddrXScreen);
X=XScreen*256+XWrap;
X=string.format("%04u",X);
XSub=memory.readbyte(AddrXSub);
XSub=string.format("%03u",XSub);
if XWrap>=0x20 and XWrap<0x80 then
BoostColor="green";
else
BoostColor="red";
end;
Y=memory.readbyte(AddrY);
Y=string.format("%03u",Y);
YSub=memory.readbyte(AddrYSub);
YSub=string.format("%03u",YSub);
XWrap=string.format("%02x",XWrap);
gui.text(1,9,X.."."..XSub,"white",0);
gui.text(50,9,Y.."."..YSub,"white",0);
gui.text(1,33,XWrap,BoostColor,0);
--Speed
XSpd=memory.readbytesigned(AddrXSpd);
if XSpd>=0 then
XSpdTextX=19;
else
XSpdTextX=14;
end;
XSpdSub=memory.readbyte(AddrXSpdSub);
if XSpd<0 then
XSpdSub=256-XSpdSub;
if XSpdSub~=0 then
XSpd=XSpd+1;
end;
if XSpd==0 then
XSpd="-"..YSpd;
end;
end;
XSpdSub=string.format("%03u",XSpdSub);
if XSpd==0 then
XSpdColor="red"
else
XSpdColor="white"
end;
YSpd=memory.readbytesigned(AddrYSpd);
if YSpd>=0 then
YSpdTextX=62;
else
YSpdTextX=57;
end;
YSpdSub=memory.readbyte(AddrYSpdSub);
if YSpd<0 then
YSpdSub=256-YSpdSub;
if YSpdSub~=0 then
YSpd=YSpd+1;
end;
if YSpd==0 then
YSpd="-"..YSpd;
end;
end;
YSpdSub=string.format("%03u",YSpdSub);
gui.text(XSpdTextX,17,XSpd.."."..XSpdSub,XSpdColor,0);
gui.text(YSpdTextX,17,YSpd.."."..YSpdSub,"white",0);
end