MCPcopy Create free account
hub / github.com/TASEmulators/fceux / GetWord

Function GetWord

src/lua-engine.cpp:1555–1564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1553}
1554
1555static int GetWord(lua_State *L, bool isSigned)
1556{
1557 // little endian, unless the high byte address is specified as a 2nd parameter
1558 uint16 addressLow = luaL_checkinteger(L, 1);
1559 uint16 addressHigh = addressLow + 1;
1560 if (lua_type(L, 2) == LUA_TNUMBER)
1561 addressHigh = luaL_checkinteger(L, 2);
1562 uint16 result = GetMem(addressLow) | (GetMem(addressHigh) << 8);
1563 return isSigned ? (int16)result : result;
1564}
1565
1566static int memory_readword(lua_State *L)
1567{

Callers 2

memory_readwordFunction · 0.85
memory_readwordsignedFunction · 0.85

Calls 3

luaL_checkintegerFunction · 0.85
lua_typeFunction · 0.85
GetMemFunction · 0.85

Tested by

no test coverage detected