| 1553 | } |
| 1554 | |
| 1555 | static 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 | |
| 1566 | static int memory_readword(lua_State *L) |
| 1567 | { |
no test coverage detected