From 92fe950b2496b880ad3f6b8a6de653fafea3d36b Mon Sep 17 00:00:00 2001 From: zeromus Date: Fri, 16 Sep 2011 02:47:53 +0000 Subject: [PATCH] lua-add vram_readword and vram_writeword --- desmume/src/lua-engine.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/desmume/src/lua-engine.cpp b/desmume/src/lua-engine.cpp index 5f97e9b3a..68f03f6eb 100644 --- a/desmume/src/lua-engine.cpp +++ b/desmume/src/lua-engine.cpp @@ -1750,6 +1750,14 @@ DEFINE_LUA_FUNCTION(memory_readbytesigned, "address") lua_pushinteger(L, value); return 1; } +DEFINE_LUA_FUNCTION(vram_readword, "address") +{ + int address = luaL_checkinteger(L,1); + u16 value = T1ReadWord(MMU.ARM9_LCD,address); + lua_settop(L,0); + lua_pushinteger(L, value); + return 1; +} DEFINE_LUA_FUNCTION(memory_readword, "address") { int address = luaL_checkinteger(L,1); @@ -1797,6 +1805,13 @@ DEFINE_LUA_FUNCTION(memory_writeword, "address,value") _MMU_write16(address, value); return 0; } +DEFINE_LUA_FUNCTION(vram_writeword, "address,value") +{ + int address = luaL_checkinteger(L,1); + u16 value = (u16)(luaL_checkinteger(L,2) & 0xFFFF); + T1WriteWord(MMU.ARM9_LCD,address,value); + return 0; +} DEFINE_LUA_FUNCTION(memory_writedword, "address,value") { int address = luaL_checkinteger(L,1);