local XTEXT = 660
local YTEXT = 20
while true do
local XPOS = memory.read_u32_le( 0x88414 )
local YPOS = memory.read_u32_le( 0x88418 )
local NB0 = 0
local NB1 = 0
local NB2 = 0
local NB3 = 0
local NB4 = 0
local NB255 = 0
local NBT = 0
for i=0, 31 do
local BASE = 0x9B6F4+i*256
local T = memory.read_u8(BASE)
local M = memory.read_u16_le(BASE-0x44)
--memory.write_u8(BASE, 0)
local U = memory.read_u8(BASE+0xC) --0xC
if T==0 then NB0 = NB0 + 1 end
if T==1 then NB1 = NB1 + 1 end
if T==2 then NB2 = NB2 + 1 end
if T==3 then NB3 = NB3 + 1 end
if T==4 then NB4 = NB4 + 1 end
if T==255 then NB255 = NB255 + 1 end
if M==0 then NBT = NBT + 1 end
--if memory.read_s8(BASE)==1 then
local X = memory.read_s32_le(BASE+0x10)
local Y = memory.read_s32_le(BASE+0x14)
if M~=0 then
-- M = M-0x80116000
if math.floor((X)/256)==math.floor((XPOS)/256) then
if math.floor((Y)/192)==math.floor((YPOS)/192) then
gui.drawText(150+((X) % 256)/256*500, 45+((Y) % 192)/192*380, i+1)
end
end
end
-- gui.drawText(XTEXT - 40 + math.floor(i/16)*100, YTEXT + 0 + i*15 - math.floor(i/16)*16*15, i, "white")
-- gui.drawText(XTEXT - 20 + math.floor(i/16)*100, YTEXT + 0 + i*15 - math.floor(i/16)*16*15, T .. " " .. string.format("%X", M), "white")
--gui.drawText(XTEXT + 0 + math.floor(i/16)*80, YTEXT + 0 + i*15 - math.floor(i/16)*16*15, X, "white")
--gui.drawText(XTEXT + 40 + math.floor(i/16)*80, YTEXT + 0 + i*15 - math.floor(i/16)*16*15, Y, "white")
--end
-- if i==0 then
-- gui.drawText(XTEXT - 00, YTEXT + 400, X .. " " .. Y, "white")
-- end
end
-- gui.drawText(XTEXT - 0, YTEXT + 250, NB0, "white")
-- gui.drawText(XTEXT - 0, YTEXT + 265, NB1, "white")
-- gui.drawText(XTEXT - 0, YTEXT + 280, NB2, "white")
-- gui.drawText(XTEXT - 0, YTEXT + 295, NB3, "white")
-- gui.drawText(XTEXT - 0, YTEXT + 310, NB4, "white")
-- gui.drawText(XTEXT - 0, YTEXT + 325, NB255, "white")
-- gui.drawText(XTEXT - 0, YTEXT + 365, 32-NB0, "white")
-- gui.drawText(XTEXT - 0, YTEXT + 365, "Entities loaded : " .. string.format("%2d", 32-NBT) .. "/32", "white")
gui.drawText(140, 14, "Entities loaded : " .. string.format("%2d", 32-NBT) .. "/32", "white")
-- gui.drawText(150, 50, "te")
-- gui.drawText(650, 430, "te")
emu.frameadvance()
end
--73509