User File #40537966076771555

Upload All User Files

#40537966076771555 - Super Mario World 64 lua

smw64.lua
Game: Super Mario World 64 ( Genesis, see all files )
820 downloads
Uploaded 7/22/2017 2:54 PM by xy2_ (see all 139)
rom: Super Mario World 64(Unl).bin
-- Genesis Super Mario World 64, TASing script 
-- Simple watch of some values
-- Written by xy2_, 2017

-- Globals --------------------------------------------------------------------
-- Transparent colors
local TColor={
[0]=0x7700FF00, -- Green
    0x77FFFF00, -- Yellow
    0x77FF0000, -- Red
}

-- Draws our adresses on screen
-------------------------------------------------------------------------------
local function DisplayHud()
-------------------------------------------------------------------------------

	-- Colored P-Meter
	local pmeter= memory.read_s16_be(0x0114,"68K RAM")
	if pmeter <= 31 then
		gui.pixelText(212, 0, string.format("%6d", pmeter), 0xFFFFFFFF, TColor[2])
	elseif pmeter <= 64 then
		gui.pixelText(212, 0, string.format("%6d", pmeter))
	elseif pmeter < 112 then
		gui.pixelText(212, 0, string.format("%6d", pmeter), 0xFFFFFFFF, TColor[1])
	else
		gui.pixelText(212, 0, string.format("%6d", pmeter), 0xFFFFFFFF, TColor[0])
	end

	-- Animation counter
	local anim= memory.read_s8(0xC41F, "68K RAM")
	gui.pixelText(212, 7, string.format("%6d", anim))

	-- X and Y position
	for i= 0,1 do
		local addr= 0x122 + 0x2*i
		gui.pixelText(212, 14+7*i, string.format("%6d",memory.read_s16_be(addr,"68K RAM")))
	end

	-- Gravity
	local grav= memory.read_u8(0xC41D, "68K RAM")
	gui.pixelText(212, 28, string.format("%6d", grav))

end

-- Main loop
while true do
	DisplayHud()
	emu.frameadvance()
end