diff --git a/src/api.h b/src/api.h index 41b48af52..737049aa8 100644 --- a/src/api.h +++ b/src/api.h @@ -354,7 +354,7 @@ enum \ \ macro(peek, \ - "peek(addr res=8) -> value", \ + "peek(addr bits=8) -> value", \ \ "This function allows to read the memory from TIC.\n" \ "It's useful to access resources created with the integrated tools like sprite, maps, sounds, " \ @@ -362,21 +362,21 @@ enum "Never dream to sound a sprite?\n" \ "Address are in hexadecimal format but values are decimal.\n" \ "To write to a memory address, use `poke()`.\n" \ - "`res` allowed to be 1,2,4,8.", \ + "`bits` allowed to be 1,2,4,8.", \ 2, \ u8, \ - tic_mem*, s32 address, s32 res) \ + tic_mem*, s32 address, s32 bits) \ \ \ macro(poke, \ - "poke(addr value res=8)", \ + "poke(addr value bits=8)", \ \ "This function allows you to write a single byte to any address in TIC's RAM.\n" \ "The address should be specified in hexadecimal format, the value in decimal.\n" \ - "`res` allowed to be 1,2,4,8.", \ + "`bits` allowed to be 1,2,4,8.", \ 3, \ void, \ - tic_mem*, s32 address, u8 value, s32 res) \ + tic_mem*, s32 address, u8 value, s32 bits) \ \ \ macro(peek4, \ diff --git a/src/api/js.c b/src/api/js.c index 2ba33c3fd..554c7ab84 100644 --- a/src/api/js.c +++ b/src/api/js.c @@ -497,10 +497,10 @@ static duk_ret_t duk_mset(duk_context* duk) static duk_ret_t duk_peek(duk_context* duk) { s32 address = duk_to_int(duk, 0); - s32 res = duk_opt_int(duk, 1, BITS_IN_BYTE); + s32 bits = duk_opt_int(duk, 1, BITS_IN_BYTE); tic_mem* tic = (tic_mem*)getDukCore(duk); - duk_push_uint(duk, tic_api_peek(tic, address, res)); + duk_push_uint(duk, tic_api_peek(tic, address, bits)); return 1; } @@ -508,10 +508,10 @@ static duk_ret_t duk_poke(duk_context* duk) { s32 address = duk_to_int(duk, 0); u8 value = duk_to_int(duk, 1); - s32 res = duk_opt_int(duk, 2, BITS_IN_BYTE); + s32 bits = duk_opt_int(duk, 2, BITS_IN_BYTE); tic_mem* tic = (tic_mem*)getDukCore(duk); - tic_api_poke(tic, address, value, res); + tic_api_poke(tic, address, value, bits); return 0; } diff --git a/src/api/lua.c b/src/api/lua.c index 7efc8ff4a..a33108012 100644 --- a/src/api/lua.c +++ b/src/api/lua.c @@ -59,15 +59,15 @@ static s32 lua_peek(lua_State* lua) if(top >= 1) { s32 address = getLuaNumber(lua, 1); - s32 res = BITS_IN_BYTE; + s32 bits = BITS_IN_BYTE; if(top == 2) - res = getLuaNumber(lua, 2); + bits = getLuaNumber(lua, 2); - lua_pushinteger(lua, tic_api_peek(tic, address, res)); + lua_pushinteger(lua, tic_api_peek(tic, address, bits)); return 1; } - else luaL_error(lua, "invalid parameters, peek(addr,res)\n"); + else luaL_error(lua, "invalid parameters, peek(addr,bits)\n"); return 0; } @@ -81,14 +81,14 @@ static s32 lua_poke(lua_State* lua) { s32 address = getLuaNumber(lua, 1); u8 value = getLuaNumber(lua, 2); - s32 res = BITS_IN_BYTE; + s32 bits = BITS_IN_BYTE; if(top == 3) - res = getLuaNumber(lua, 3); + bits = getLuaNumber(lua, 3); - tic_api_poke(tic, address, value, res); + tic_api_poke(tic, address, value, bits); } - else luaL_error(lua, "invalid parameters, poke(addr,val,res)\n"); + else luaL_error(lua, "invalid parameters, poke(addr,val,bits)\n"); return 0; } diff --git a/src/api/squirrel.c b/src/api/squirrel.c index 3d40d2c50..e2b1ea71b 100644 --- a/src/api/squirrel.c +++ b/src/api/squirrel.c @@ -126,12 +126,12 @@ static SQInteger squirrel_peek(HSQUIRRELVM vm) return sq_throwerror(vm, "invalid parameters, peek(address)"); s32 address = getSquirrelNumber(vm, 2); - s32 res = BITS_IN_BYTE; + s32 bits = BITS_IN_BYTE; if(top == 3) - res = getSquirrelNumber(vm, 3); + bits = getSquirrelNumber(vm, 3); - sq_pushinteger(vm, tic_api_peek(tic, address, res)); + sq_pushinteger(vm, tic_api_peek(tic, address, bits)); return 1; } @@ -145,12 +145,12 @@ static SQInteger squirrel_poke(HSQUIRRELVM vm) s32 address = getSquirrelNumber(vm, 2); u8 value = getSquirrelNumber(vm, 3); - s32 res = BITS_IN_BYTE; + s32 bits = BITS_IN_BYTE; if(top == 4) - res = getSquirrelNumber(vm, 4); + bits = getSquirrelNumber(vm, 4); - tic_api_poke(tic, address, value, res); + tic_api_poke(tic, address, value, bits); return 0; } diff --git a/src/api/wren.c b/src/api/wren.c index ea7cf771b..e6ded052e 100644 --- a/src/api/wren.c +++ b/src/api/wren.c @@ -89,8 +89,8 @@ class TIC {\n\ foreign static clip(x, y, w, h)\n\ foreign static peek(addr)\n\ foreign static poke(addr, val)\n\ - foreign static peek(addr, res)\n\ - foreign static poke(addr, val, res)\n\ + foreign static peek(addr, bits)\n\ + foreign static poke(addr, val, bits)\n\ foreign static peek4(addr)\n\ foreign static poke4(addr, val)\n\ foreign static memcpy(dst, src, size)\n\ @@ -950,12 +950,12 @@ static void wren_peek(WrenVM* vm) tic_mem* tic = (tic_mem*)getWrenCore(vm); s32 address = getWrenNumber(vm, 1); - s32 res = BITS_IN_BYTE; + s32 bits = BITS_IN_BYTE; if(wrenGetSlotCount(vm) > 2) - res = getWrenNumber(vm, 2); + bits = getWrenNumber(vm, 2); - wrenSetSlotDouble(vm, 0, tic_api_peek(tic, address, res)); + wrenSetSlotDouble(vm, 0, tic_api_peek(tic, address, bits)); } static void wren_poke(WrenVM* vm) @@ -964,11 +964,11 @@ static void wren_poke(WrenVM* vm) s32 address = getWrenNumber(vm, 1); u8 value = getWrenNumber(vm, 2) & 0xff; - s32 res = BITS_IN_BYTE; + s32 bits = BITS_IN_BYTE; if(wrenGetSlotCount(vm) > 3) - res = getWrenNumber(vm, 3); + bits = getWrenNumber(vm, 3); - tic_api_poke(tic, address, value, res); + tic_api_poke(tic, address, value, bits); } static void wren_peek4(WrenVM* vm) diff --git a/src/core/core.c b/src/core/core.c index b48996b95..2488c0cad 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -42,7 +42,7 @@ static_assert(sizeof(tic_map) < 1024 * 32, "tic_map"); static_assert(sizeof(tic_vram) == TIC_VRAM_SIZE, "tic_vram"); static_assert(sizeof(tic_ram) == TIC_RAM_SIZE, "tic_ram"); -u8 tic_api_peek(tic_mem* memory, s32 address, s32 res) +u8 tic_api_peek(tic_mem* memory, s32 address, s32 bits) { if (address < 0) return 0; @@ -50,7 +50,7 @@ u8 tic_api_peek(tic_mem* memory, s32 address, s32 res) const u8* ram = (u8*)&memory->ram; enum{RamBits = sizeof(tic_ram) * BITS_IN_BYTE}; - switch(res) + switch(bits) { case 1: if(address < RamBits / 1) return tic_tool_peek1(ram, address); case 2: if(address < RamBits / 2) return tic_tool_peek2(ram, address); @@ -61,7 +61,7 @@ u8 tic_api_peek(tic_mem* memory, s32 address, s32 res) return 0; } -void tic_api_poke(tic_mem* memory, s32 address, u8 value, s32 res) +void tic_api_poke(tic_mem* memory, s32 address, u8 value, s32 bits) { if (address < 0) return; @@ -70,7 +70,7 @@ void tic_api_poke(tic_mem* memory, s32 address, u8 value, s32 res) u8* ram = (u8*)&memory->ram; enum{RamBits = sizeof(tic_ram) * BITS_IN_BYTE}; - switch(res) + switch(bits) { case 1: if(address < RamBits / 1) {tic_tool_poke1(ram, address, value); core->state.memmask[address >> 2] = 1;} break; case 2: if(address < RamBits / 2) {tic_tool_poke2(ram, address, value); core->state.memmask[address >> 1] = 1;} break;