Fix botched disassembler backport
This commit is contained in:
+2
-2
@@ -572,7 +572,7 @@ static uint32_t dasmLine(DasmOutput *ret, unsigned index,
|
|||||||
line->isPC = isPC;
|
line->isPC = isPC;
|
||||||
|
|
||||||
/* Fetch first code halfword */
|
/* Fetch first code halfword */
|
||||||
code[0] = vbFetch(sim, address);
|
code[0] = vbRead(sim, address, VB_U16);
|
||||||
line->code[0] = code[0];
|
line->code[0] = code[0];
|
||||||
line->code[1] = code[0] >> 8;
|
line->code[1] = code[0] >> 8;
|
||||||
|
|
||||||
@@ -583,7 +583,7 @@ static uint32_t dasmLine(DasmOutput *ret, unsigned index,
|
|||||||
|
|
||||||
/* Fetch second code halfword if necessary */
|
/* Fetch second code halfword if necessary */
|
||||||
if (line->codeLength == 4) {
|
if (line->codeLength == 4) {
|
||||||
code[1] = vbFetch(sim, address + 2);
|
code[1] = vbRead(sim, address + 2, VB_U16);
|
||||||
line->code[2] = code[1];
|
line->code[2] = code[1];
|
||||||
line->code[3] = code[1] >> 8;
|
line->code[3] = code[1] >> 8;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -257,7 +257,7 @@ static void* isxFrom(uint8_t *bytes, size_t length, size_t *romLength) {
|
|||||||
src < lowMax + 0x1000001 - highMin;
|
src < lowMax + 0x1000001 - highMin;
|
||||||
src <<= 1
|
src <<= 1
|
||||||
);
|
);
|
||||||
rom = VBU_REALLOC(NULL, src);
|
rom = VBU_MEMMGR(NULL, src);
|
||||||
if (rom == NULL)
|
if (rom == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
*romLength = src;
|
*romLength = src;
|
||||||
|
|||||||
+16
-16
@@ -5,29 +5,29 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <vbu.h>
|
#include <vbu.h>
|
||||||
|
|
||||||
/* Memory management */
|
|
||||||
#ifndef VBU_REALLOC
|
|
||||||
#include <stdlib.h>
|
|
||||||
#define VBU_REALLOC realloc
|
|
||||||
#else
|
|
||||||
extern void* VBU_REALLOC(void *, size_t);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************** Library Functions *****************************/
|
/***************************** Library Functions *****************************/
|
||||||
|
|
||||||
/* Sign-extend an integer of variable width */
|
/* Memory manager */
|
||||||
static int32_t SignExtend(int32_t value, int32_t bits) {
|
#ifdef VBU_MEMMGR
|
||||||
#ifndef VB_SIGNED_PROPAGATE
|
extern void* VBU_MEMMGR(void *ptr, size_t size);
|
||||||
value &= ~((uint32_t) 0xFFFFFFFF << bits);
|
|
||||||
bits = (int32_t) 1 << (bits - (int32_t) 1);
|
|
||||||
return (value ^ bits) - bits;
|
|
||||||
#else
|
#else
|
||||||
return value << (32 - bits) >> (32 - bits);
|
#include <stdlib.h>
|
||||||
#endif
|
static void* VBU_MEMMGR(void *ptr, size_t size) {
|
||||||
|
|
||||||
|
/* Free a buffer */
|
||||||
|
if (size == 0) {
|
||||||
|
if (ptr != NULL)
|
||||||
|
free(ptr);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create or resize a buffer */
|
||||||
|
return realloc(ptr, size);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************** Sub-Modules ********************************/
|
/******************************** Sub-Modules ********************************/
|
||||||
|
|||||||
Reference in New Issue
Block a user