Skip to content

Instantly share code, notes, and snippets.

@taotao54321
Created November 1, 2021 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taotao54321/cd27c2b680f227a790225ee171954e6c to your computer and use it in GitHub Desktop.
Save taotao54321/cd27c2b680f227a790225ee171954e6c to your computer and use it in GitHub Desktop.
エキサイティングラリー (FC) HUD script (for FCEUX)
local function RD(addr)
return memory.readbyte(addr)
end
local function get_info()
local info = {}
info.x = 32 * 8 * RD(0x5A) + 8 * RD(0x58) + RD(0x56)
info.y = 16 * 8 * RD(0x5B) + 8 * RD(0x59) + RD(0x57)
info.speed = 0x100 * RD(0x77) + RD(0x78)
info.dir = RD(0x81)
info.temp = 0x100 * RD(0x7C) + RD(0x7B)
return info
end
local function on_draw()
local info = get_info()
gui.text(184, 0, string.format(" X:%d ", info.x))
gui.text(184, 8, string.format(" Y:%d ", info.y))
gui.text(184, 56, string.format(" SPD:0x%04X ", info.speed))
gui.text(184, 64, string.format(" DIR:0x%02X ", info.dir))
gui.text(184, 80, string.format(" TEMP:0x%04X ", info.temp))
end
local function main()
gui.opacity(0.8)
gui.register(on_draw)
end
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment