diff --git a/core/vip.c b/core/vip.c index d8d92be..0860890 100644 --- a/core/vip.c +++ b/core/vip.c @@ -1085,11 +1085,13 @@ static void vipDrawAffine(VB *sim, World *world) { pixel = cell->pixels[(py & 7) << 3 | (px & 7)]; if (pixel != 0) *col = cell->palette[pixel]; - } - } + } /* x */ + + } /* y */ + + } /* i */ - } } /* Draw an object group into shadow memory */ diff --git a/util/disassembler.c b/util/disassembler.c index 5b06997..2f1a596 100644 --- a/util/disassembler.c +++ b/util/disassembler.c @@ -1,4 +1,4 @@ -/* This file is included into vb.c and cannot be compiled on its own. */ +/* This file is included into vbu.c and cannot be compiled on its own. */ #ifdef VBUAPI @@ -449,12 +449,6 @@ static VBU_DasmLine* dasmGrow( return *lines == NULL ? NULL : &(*lines)[index]; } -/* Determine the size of an instruction */ -static uint32_t dasmInstSize(VB *sim, uint32_t address) { - unsigned opcode = vbRead(sim, address, VB_U16) >> 10 & 63; - return opcode < 0x20 || opcode == 0x32 || opcode == 0x36 ? 2 : 4; -} - /* Format an operand */ static void dasmOperand(char *dest, VBU_DasmConfig *config, VBU_DasmLine *line, uint8_t type) { @@ -515,7 +509,7 @@ static int dasmLine(VB *sim, uint32_t *address, uint32_t pc, /* Process non-text members */ line = &(*lines)[index]; line->address = *address; - line->codeLength = dasmInstSize(sim, *address); + line->codeLength = vbuCodeSize(sim, *address); line->isPC = *address == pc; for (x = 0; x < line->codeLength; x++) line->code[x] = vbRead(sim, *address + x, VB_U8); @@ -660,7 +654,7 @@ static VBU_DasmLine* dasmDisassemble(VB *sim, uint32_t address, } /* Check if the instruction contains the reference address */ - size = dasmInstSize(sim, addr); + size = vbuCodeSize(sim, addr); if (address - addr < size) break; addr += addr != pc && pc - addr < size ? pc - addr : size; @@ -674,7 +668,7 @@ static VBU_DasmLine* dasmDisassemble(VB *sim, uint32_t address, /* Keep decoding until the first line of output */ else for (; line < 0; line++) - addr += dasmInstSize(sim, addr); + addr += vbuCodeSize(sim, addr); /* Working variables */ size = length * sizeof (VBU_DasmLine); diff --git a/util/vbu.c b/util/vbu.c index 38b854b..1918cbe 100644 --- a/util/vbu.c +++ b/util/vbu.c @@ -38,6 +38,12 @@ static int32_t SignExtend(int32_t value, int32_t bits) { /******************************* API Commands ********************************/ +/* Determine the size in bytes of an instruction */ +VBUAPI int vbuCodeSize(VB *sim, uint32_t address) { + int opcode = vbRead(sim, address, VB_U16) >> 10 & 63; + return opcode < 0x20 || opcode == 0x32 || opcode == 0x36 ? 2 : 4; +} + /* Initialize disassembler options with default settings */ VBUAPI VBU_DasmConfig* vbuDasmInit(VBU_DasmConfig *config) { config->bcondNotation = VBU_JOINED; diff --git a/util/vbu.h b/util/vbu.h index 6fd4287..4bf095f 100644 --- a/util/vbu.h +++ b/util/vbu.h @@ -85,6 +85,7 @@ typedef struct { /******************************* API Commands ********************************/ +VBUAPI int vbuCodeSize (VB *sim, uint32_t address); VBUAPI VBU_DasmConfig* vbuDasmInit (VBU_DasmConfig *config); VBUAPI VBU_DasmLine* vbuDisassemble(VB *sim, uint32_t address, VBU_DasmConfig *config, unsigned length, int line);