diff --git a/nn.lua b/nn.lua index dea421c..bf83e28 100644 --- a/nn.lua +++ b/nn.lua @@ -1,3 +1,4 @@ +local assert = assert local ceil = math.ceil local cos = math.cos local exp = math.exp diff --git a/smb.lua b/smb.lua index 43f907d..cb073b2 100644 --- a/smb.lua +++ b/smb.lua @@ -1,6 +1,16 @@ -- disassembly used for reference: -- https://gist.githubusercontent.com/1wErt3r/4048722/raw/59e88c0028a58c6d7b9156749230ccac647bc7d4/SMBDIS.ASM +local band = bit.band +local floor = math.floor +local emu = emu +local gui = gui + +local util = require("util") +local R = memory.readbyteunsigned +local W = memory.writebyte +local function S(addr) return util.signbyte(R(addr)) end + local rotation_offsets = { -- FIXME: not all of these are pixel-perfect. 0, -40, -- 0x00 6, -38, @@ -36,11 +46,6 @@ local rotation_offsets = { -- FIXME: not all of these are pixel-perfect. -8, -38, } -local util = require("util") -local R = memory.readbyteunsigned -local W = memory.writebyte -local function S(addr) return util.signbyte(R(addr)) end - -- TODO: reinterface to one "input" array visible to main.lua. local sprite_input = {} local tile_input = {} @@ -48,9 +53,6 @@ local extra_input = {} local overlay = false -local band = bit.band -local floor = math.floor - local function get_timer() return R(0x7F8) * 100 + R(0x7F9) * 10 + R(0x7FA) end