Adjusting naming of all-caps structs, implementing native handle as a long
This commit is contained in:
+36
-36
@@ -73,7 +73,7 @@ static const int8_t CYCLES[] = {
|
||||
*****************************************************************************/
|
||||
|
||||
/* Integer addition */
|
||||
static int32_t cpuAdd(VUE *vue, int left, int right) {
|
||||
static int32_t cpuAdd(Vue *vue, int left, int right) {
|
||||
int32_t result = left + right;
|
||||
vue->cpu.psw_cy = (uint32_t) result < (uint32_t) left ? 1 : 0;
|
||||
vue->cpu.psw_s = result >> 31 & 1;
|
||||
@@ -83,7 +83,7 @@ static int32_t cpuAdd(VUE *vue, int left, int right) {
|
||||
}
|
||||
|
||||
/* Bitwise operation */
|
||||
static void cpuBitwise(VUE *vue, int32_t result) {
|
||||
static void cpuBitwise(Vue *vue, int32_t result) {
|
||||
vue->cpu.program[vue->cpu.inst.reg2] = result;
|
||||
vue->cpu.psw_ov = 0;
|
||||
vue->cpu.psw_s = result >> 31 & 1;
|
||||
@@ -94,7 +94,7 @@ static void cpuBitwise(VUE *vue, int32_t result) {
|
||||
#define cpuFloat(x) ((double) *(float *)&(x))
|
||||
|
||||
/* Determine whether the floating-point operands are reserved values */
|
||||
static vbool cpuFloatReserved(VUE *vue, vbool left) {
|
||||
static vbool cpuFloatReserved(Vue *vue, vbool left) {
|
||||
int32_t exponent; /* Operand exponent */
|
||||
int32_t operand; /* Current operand */
|
||||
int x; /* Iterator */
|
||||
@@ -126,7 +126,7 @@ static vbool cpuFloatReserved(VUE *vue, vbool left) {
|
||||
}
|
||||
|
||||
/* Convert a floating short to word */
|
||||
static void cpuFloatConvert(VUE *vue, vbool round) {
|
||||
static void cpuFloatConvert(Vue *vue, vbool round) {
|
||||
int32_t bits; /* Number of bits to shift */
|
||||
int32_t digits; /* Significant digits */
|
||||
int32_t result; /* Output value */
|
||||
@@ -187,7 +187,7 @@ static void cpuFloatConvert(VUE *vue, vbool round) {
|
||||
}
|
||||
|
||||
/* Floating-point result */
|
||||
static void cpuFloatResult(VUE *vue, vbool compare, double full) {
|
||||
static void cpuFloatResult(Vue *vue, vbool compare, double full) {
|
||||
int32_t bits = 0x7F7FFFFF; /* Binary representation of result */
|
||||
float result = *(float *)&bits; /* Operation output */
|
||||
|
||||
@@ -223,7 +223,7 @@ static void cpuFloatResult(VUE *vue, vbool compare, double full) {
|
||||
}
|
||||
|
||||
/* Read a system register */
|
||||
static int32_t cpuGetSystemRegister(VUE *vue, int32_t index) {
|
||||
static int32_t cpuGetSystemRegister(Vue *vue, int32_t index) {
|
||||
switch (index) {
|
||||
case VUE_ADTRE: return vue->cpu.adtre;
|
||||
case VUE_EIPC : return vue->cpu.eipc;
|
||||
@@ -264,7 +264,7 @@ static int32_t cpuGetSystemRegister(VUE *vue, int32_t index) {
|
||||
vue->cpu.program[vue->cpu.inst.reg2] = vue->cpu.access.value
|
||||
|
||||
/* Transfer program to another address */
|
||||
static void cpuJump(VUE *vue, int32_t address) {
|
||||
static void cpuJump(Vue *vue, int32_t address) {
|
||||
int level = vue->cpu.psw_np ? 2 : vue->cpu.psw_ep;
|
||||
vue->cpu.jumpFrom[level] = vue->cpu.pc;
|
||||
vue->cpu.jumpTo [level] = address;
|
||||
@@ -277,7 +277,7 @@ static void cpuJump(VUE *vue, int32_t address) {
|
||||
vue->cpu.inst.disp, type, vue->cpu.program[vue->cpu.inst.reg2])
|
||||
|
||||
/* Perform a bus read */
|
||||
static vbool cpuRead(VUE *vue, int32_t address, int8_t type, int8_t fetch) {
|
||||
static vbool cpuRead(Vue *vue, int32_t address, int8_t type, int8_t fetch) {
|
||||
|
||||
/* Perform the operation */
|
||||
vue->cpu.access.address = address;
|
||||
@@ -295,7 +295,7 @@ static vbool cpuRead(VUE *vue, int32_t address, int8_t type, int8_t fetch) {
|
||||
}
|
||||
|
||||
/* Write a system register */
|
||||
static int32_t cpuSetSystemRegister(VUE *vue, int32_t index, int32_t value,
|
||||
static int32_t cpuSetSystemRegister(Vue *vue, int32_t index, int32_t value,
|
||||
vbool debug) {
|
||||
switch (index) {
|
||||
case VUE_ADTRE: return vue->cpu.adtre = value & 0xFFFFFFFE;
|
||||
@@ -362,7 +362,7 @@ static int32_t cpuSetSystemRegister(VUE *vue, int32_t index, int32_t value,
|
||||
}
|
||||
|
||||
/* Arithmetic shift right */
|
||||
static void cpuShiftArithmetic(VUE *vue, int32_t value, int32_t bits) {
|
||||
static void cpuShiftArithmetic(Vue *vue, int32_t value, int32_t bits) {
|
||||
bits &= 31;
|
||||
|
||||
/* Nothing to do */
|
||||
@@ -382,7 +382,7 @@ static void cpuShiftArithmetic(VUE *vue, int32_t value, int32_t bits) {
|
||||
}
|
||||
|
||||
/* Logical shift left */
|
||||
static void cpuShiftLeft(VUE *vue, int32_t value, int32_t bits) {
|
||||
static void cpuShiftLeft(Vue *vue, int32_t value, int32_t bits) {
|
||||
bits &= 31;
|
||||
|
||||
/* Nothing to do */
|
||||
@@ -400,7 +400,7 @@ static void cpuShiftLeft(VUE *vue, int32_t value, int32_t bits) {
|
||||
}
|
||||
|
||||
/* Logical shift right */
|
||||
static void cpuShiftRight(VUE *vue, int32_t value, int32_t bits) {
|
||||
static void cpuShiftRight(Vue *vue, int32_t value, int32_t bits) {
|
||||
bits &= 31;
|
||||
|
||||
/* Nothing to do */
|
||||
@@ -418,7 +418,7 @@ static void cpuShiftRight(VUE *vue, int32_t value, int32_t bits) {
|
||||
}
|
||||
|
||||
/* Integer subtraction */
|
||||
static int32_t cpuSubtract(VUE *vue, int left, int right) {
|
||||
static int32_t cpuSubtract(Vue *vue, int left, int right) {
|
||||
int32_t result = left - right;
|
||||
vue->cpu.psw_cy = (uint32_t) result > (uint32_t) left ? 1 : 0;
|
||||
vue->cpu.psw_s = result >> 31 & 1;
|
||||
@@ -428,7 +428,7 @@ static int32_t cpuSubtract(VUE *vue, int left, int right) {
|
||||
}
|
||||
|
||||
/* Test a condition */
|
||||
static int8_t cpuTestCondition(VUE *vue, int32_t condition) {
|
||||
static int8_t cpuTestCondition(Vue *vue, int32_t condition) {
|
||||
switch (condition) {
|
||||
case 0: return vue->cpu.psw_ov;
|
||||
case 1: return vue->cpu.psw_cy;
|
||||
@@ -443,7 +443,7 @@ static int8_t cpuTestCondition(VUE *vue, int32_t condition) {
|
||||
}
|
||||
|
||||
/* Perform a bus write */
|
||||
static vbool cpuWrite(VUE *vue, int32_t address, int8_t type, int32_t value) {
|
||||
static vbool cpuWrite(Vue *vue, int32_t address, int8_t type, int32_t value) {
|
||||
|
||||
/* Prepare the operation */
|
||||
vue->cpu.access.address = address;
|
||||
@@ -503,7 +503,7 @@ static vbool cpuWrite(VUE *vue, int32_t address, int8_t type, int32_t value) {
|
||||
vue->cpu.inst.imm)
|
||||
|
||||
/* Branch on Condition */
|
||||
static void cpuBCOND(VUE *vue) {
|
||||
static void cpuBCOND(Vue *vue) {
|
||||
if (!cpuTestCondition(vue, vue->cpu.inst.cond & 15))
|
||||
return;
|
||||
vue->cpu.cycles = 2;
|
||||
@@ -511,7 +511,7 @@ static void cpuBCOND(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Compare and Exchange Interlocked */
|
||||
static void cpuCAXI(VUE *vue) {
|
||||
static void cpuCAXI(Vue *vue) {
|
||||
int32_t address =
|
||||
vue->cpu.program[vue->cpu.inst.reg1] + vue->cpu.inst.disp;
|
||||
int32_t left = vue->cpu.program[vue->cpu.inst.reg2];
|
||||
@@ -559,7 +559,7 @@ static void cpuCAXI(VUE *vue) {
|
||||
cpuFloatConvert(vue, VUE_TRUE)
|
||||
|
||||
/* Convert Word Integer to Short */
|
||||
static void cpuCVT_WS(VUE *vue) {
|
||||
static void cpuCVT_WS(Vue *vue) {
|
||||
int32_t bits = vue->cpu.program[vue->cpu.inst.reg1];
|
||||
float result = (float) bits;
|
||||
vue->cpu.program[vue->cpu.inst.reg2] = *(int32_t *)&result;
|
||||
@@ -571,7 +571,7 @@ static void cpuCVT_WS(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Divide */
|
||||
static void cpuDIV(VUE *vue) {
|
||||
static void cpuDIV(Vue *vue) {
|
||||
int32_t left = vue->cpu.program[vue->cpu.inst.reg2];
|
||||
int32_t right = vue->cpu.program[vue->cpu.inst.reg1];
|
||||
int32_t result;
|
||||
@@ -602,7 +602,7 @@ static void cpuDIV(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Divide Floating Short */
|
||||
static void cpuDIVF_S(VUE *vue) {
|
||||
static void cpuDIVF_S(Vue *vue) {
|
||||
int32_t left = vue->cpu.program[vue->cpu.inst.reg2];
|
||||
int32_t right = vue->cpu.program[vue->cpu.inst.reg1];
|
||||
|
||||
@@ -621,7 +621,7 @@ static void cpuDIVF_S(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Divide Unsigned */
|
||||
static void cpuDIVU(VUE *vue) {
|
||||
static void cpuDIVU(Vue *vue) {
|
||||
uint32_t left = vue->cpu.program[vue->cpu.inst.reg2];
|
||||
uint32_t right = vue->cpu.program[vue->cpu.inst.reg1];
|
||||
uint32_t result;
|
||||
@@ -691,13 +691,13 @@ static void cpuDIVU(VUE *vue) {
|
||||
vue->cpu.program[vue->cpu.inst.reg1]
|
||||
|
||||
/* Multiply Halfword */
|
||||
static void cpuMPYHW(VUE *vue) {
|
||||
static void cpuMPYHW(Vue *vue) {
|
||||
int32_t right = vue->cpu.program[vue->cpu.inst.reg1];
|
||||
vue->cpu.program[vue->cpu.inst.reg2] *= SIGN_EXTEND(17, right);
|
||||
}
|
||||
|
||||
/* Multiply */
|
||||
static void cpuMUL(VUE *vue) {
|
||||
static void cpuMUL(Vue *vue) {
|
||||
int64_t full = (int64_t) vue->cpu.program[vue->cpu.inst.reg2] *
|
||||
(int64_t) vue->cpu.program[vue->cpu.inst.reg1];
|
||||
int32_t lower = (int32_t) full;
|
||||
@@ -715,7 +715,7 @@ static void cpuMUL(VUE *vue) {
|
||||
cpuFloat(vue->cpu.program[vue->cpu.inst.reg1]))
|
||||
|
||||
/* Multiply Unsigned */
|
||||
static void cpuMULU(VUE *vue) {
|
||||
static void cpuMULU(Vue *vue) {
|
||||
uint64_t full = (uint64_t)(uint32_t) vue->cpu.program[vue->cpu.inst.reg2] *
|
||||
(uint64_t)(uint32_t) vue->cpu.program[vue->cpu.inst.reg1];
|
||||
int32_t lower = (int32_t) full;
|
||||
@@ -760,7 +760,7 @@ static void cpuMULU(VUE *vue) {
|
||||
vue->cpu.inst.imm)
|
||||
|
||||
/* Return from Trap or Interrupt */
|
||||
static void cpuRETI(VUE *vue) {
|
||||
static void cpuRETI(Vue *vue) {
|
||||
if (vue->cpu.psw_np) {
|
||||
vue->cpu.pc = vue->cpu.fepc;
|
||||
cpuSetSystemRegister(vue, VUE_PSW, vue->cpu.fepsw, VUE_FALSE);
|
||||
@@ -810,7 +810,7 @@ static void cpuRETI(VUE *vue) {
|
||||
vue->cpu.program[vue->cpu.inst.reg1])
|
||||
|
||||
/* Reverse Bits in Word */
|
||||
static void cpuREV(VUE *vue) {
|
||||
static void cpuREV(Vue *vue) {
|
||||
int32_t value = vue->cpu.program[vue->cpu.inst.reg1];
|
||||
value = (value >> 16 & 0x0000FFFF) | value << 16;
|
||||
value = (value >> 8 & 0x00FF00FF) | (value << 8 & 0xFF00FF00);
|
||||
@@ -856,14 +856,14 @@ static void cpuREV(VUE *vue) {
|
||||
cpuFloatConvert(vue, VUE_FALSE)
|
||||
|
||||
/* Exchange Byte */
|
||||
static void cpuXB(VUE *vue) {
|
||||
static void cpuXB(Vue *vue) {
|
||||
int32_t value = vue->cpu.program[vue->cpu.inst.reg2];
|
||||
vue->cpu.program[vue->cpu.inst.reg2] =
|
||||
(value & 0xFFFF0000) | (value >> 8 & 0xFF) | (value & 0xFF) << 8;
|
||||
}
|
||||
|
||||
/* Exchange Halfword */
|
||||
static void cpuXH(VUE *vue) {
|
||||
static void cpuXH(Vue *vue) {
|
||||
int32_t value = vue->cpu.program[vue->cpu.inst.reg2];
|
||||
vue->cpu.program[vue->cpu.inst.reg2] =
|
||||
(value >> 16 & 0xFFFF) | value << 16;
|
||||
@@ -886,7 +886,7 @@ static void cpuXH(VUE *vue) {
|
||||
*****************************************************************************/
|
||||
|
||||
/* Decode an instruction from its binary encoding */
|
||||
static void cpuDecode(VUE_INSTRUCTION *inst) {
|
||||
static void cpuDecode(VueInstruction *inst) {
|
||||
int8_t extend; /* Sign-extend the immediate operand */
|
||||
int32_t x; /* Working variable */
|
||||
|
||||
@@ -945,7 +945,7 @@ static void cpuDecode(VUE_INSTRUCTION *inst) {
|
||||
}
|
||||
|
||||
/* Check for an exception or interrupt */
|
||||
static vbool cpuTestException(VUE *vue) {
|
||||
static vbool cpuTestException(Vue *vue) {
|
||||
int32_t level; /* Interrupt level */
|
||||
|
||||
/* Check for an interrupt */
|
||||
@@ -968,7 +968,7 @@ static vbool cpuTestException(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Operations for execute stage */
|
||||
static vbool cpuExecute(VUE *vue) {
|
||||
static vbool cpuExecute(Vue *vue) {
|
||||
|
||||
/* Application callback */
|
||||
if (vue->onExecute != NULL) {
|
||||
@@ -1080,7 +1080,7 @@ static int32_t cpuSize(int32_t opcode) {
|
||||
}
|
||||
|
||||
/* Operations for fetch stage */
|
||||
static vbool cpuFetch(VUE *vue) {
|
||||
static vbool cpuFetch(Vue *vue) {
|
||||
|
||||
/* Read the bits from the bus */
|
||||
if (cpuRead(vue, vue->cpu.pc + (vue->cpu.fetch << 1),
|
||||
@@ -1109,7 +1109,7 @@ static vbool cpuFetch(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Operations for exception stage */
|
||||
static vbool cpuException(VUE *vue) {
|
||||
static vbool cpuException(Vue *vue) {
|
||||
vbool isIRQ; /* The exception is an interrupt */
|
||||
int32_t psw; /* Current value of PSW */
|
||||
|
||||
@@ -1172,7 +1172,7 @@ static vbool cpuException(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Process the simulation */
|
||||
static void cpuEmulate(VUE *vue, int32_t cycles) {
|
||||
static void cpuEmulate(Vue *vue, int32_t cycles) {
|
||||
|
||||
/* The CPU is in permanent halt */
|
||||
if (vue->cpu.stage == CPU_FATAL)
|
||||
@@ -1202,7 +1202,7 @@ vue->cpu.cycles = 0; /* DEBUG: Stop processing after execute */
|
||||
}
|
||||
|
||||
/* System reset */
|
||||
static void cpuReset(VUE *vue) {
|
||||
static void cpuReset(Vue *vue) {
|
||||
int32_t x;
|
||||
|
||||
/* Configure instance fields */
|
||||
@@ -1229,7 +1229,7 @@ static void cpuReset(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Determine the number of CPU cycles until something can happen */
|
||||
static int32_t cpuUntil(VUE *vue, int32_t cycles) {
|
||||
static int32_t cpuUntil(Vue *vue, int32_t cycles) {
|
||||
if (vue->cpu.stage == CPU_FATAL || vue->cpu.stage == CPU_HALT)
|
||||
return cycles;
|
||||
return cycles < 0 ? vue->cpu.cycles :
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/* System reset */
|
||||
static void pakReset(VUE *vue) {
|
||||
static void pakReset(Vue *vue) {
|
||||
vue->pak.wcr_exp1w = 0;
|
||||
vue->pak.wcr_rom1w = 0;
|
||||
}
|
||||
|
||||
+37
-37
@@ -141,7 +141,7 @@ extern "C" {
|
||||
*****************************************************************************/
|
||||
|
||||
/* Forward references */
|
||||
typedef struct VUE VUE;
|
||||
typedef struct Vue Vue;
|
||||
|
||||
/* Boolean */
|
||||
typedef int vbool;
|
||||
@@ -152,12 +152,12 @@ typedef struct {
|
||||
int32_t value; /* Value read/to write */
|
||||
int8_t fetch; /* Index of machine code unit */
|
||||
int8_t type; /* Data type */
|
||||
} VUE_ACCESS;
|
||||
} VueAccess;
|
||||
|
||||
/* Exception state */
|
||||
typedef struct {
|
||||
uint16_t code; /* Exception code */
|
||||
} VUE_EXCEPTION;
|
||||
} VueException;
|
||||
|
||||
/* Instruction state */
|
||||
typedef struct {
|
||||
@@ -172,36 +172,36 @@ typedef struct {
|
||||
uint8_t reg2; /* Destination/left register */
|
||||
uint8_t size; /* Number of bytes in encoding */
|
||||
uint8_t subopcode; /* Instruction subopcode */
|
||||
} VUE_INSTRUCTION;
|
||||
} VueInstruction;
|
||||
|
||||
/* Callbacks */
|
||||
typedef int32_t (*VUE_ONEXCEPTION)(VUE *, VUE_EXCEPTION *);
|
||||
typedef int32_t (*VUE_ONEXECUTE )(VUE *, VUE_INSTRUCTION *);
|
||||
typedef int32_t (*VUE_ONREAD )(VUE *, VUE_ACCESS *);
|
||||
typedef int32_t (*VUE_ONWRITE )(VUE *, VUE_ACCESS *);
|
||||
typedef int32_t (*VueOnException)(Vue *, VueException *);
|
||||
typedef int32_t (*VueOnExecute )(Vue *, VueInstruction *);
|
||||
typedef int32_t (*VueOnRead )(Vue *, VueAccess *);
|
||||
typedef int32_t (*VueOnWrite )(Vue *, VueAccess *);
|
||||
|
||||
/* Emulation state */
|
||||
struct VUE {
|
||||
struct Vue {
|
||||
int32_t breakCode; /* Application break code */
|
||||
uint8_t wram[0x10000]; /* System memory */
|
||||
|
||||
/* Callback handlers */
|
||||
VUE_ONEXCEPTION onException;
|
||||
VUE_ONEXECUTE onExecute;
|
||||
VUE_ONREAD onRead;
|
||||
VUE_ONWRITE onWrite;
|
||||
VueOnException onException;
|
||||
VueOnExecute onExecute;
|
||||
VueOnRead onRead;
|
||||
VueOnWrite onWrite;
|
||||
|
||||
/* CPU state */
|
||||
struct {
|
||||
VUE_ACCESS access; /* Access state */
|
||||
VUE_EXCEPTION exception; /* Exception state */
|
||||
VUE_INSTRUCTION inst; /* Instruction state */
|
||||
int32_t cycles; /* Cycles until next stage */
|
||||
int32_t jumpFrom[3]; /* Source PCs of most recent jumps */
|
||||
int32_t jumpTo [3]; /* Destination PCs of most recent jumps */
|
||||
uint16_t irq; /* Interrupt lines */
|
||||
int fetch; /* Fetch unit index */
|
||||
int stage; /* Current processing stage */
|
||||
VueAccess access; /* Access state */
|
||||
VueException exception; /* Exception state */
|
||||
VueInstruction inst; /* Instruction state */
|
||||
int32_t cycles; /* Cycles until next stage */
|
||||
int32_t jumpFrom[3]; /* Source PCs of most recent jumps */
|
||||
int32_t jumpTo [3]; /* Destination PCs of most recent jumps */
|
||||
uint16_t irq; /* Interrupt lines */
|
||||
int fetch; /* Fetch unit index */
|
||||
int stage; /* Current processing stage */
|
||||
|
||||
/* Program registers */
|
||||
int32_t program[32];
|
||||
@@ -265,21 +265,21 @@ struct VUE {
|
||||
* Function Prototypes *
|
||||
*****************************************************************************/
|
||||
|
||||
VUEAPI int32_t vueEmulate (VUE *vue, int32_t maxCycles);
|
||||
VUEAPI int32_t vueGetBreakCode(VUE *vue);
|
||||
VUEAPI int32_t vueGetRegister (VUE *vue, int32_t index, vbool system);
|
||||
VUEAPI void vueInitialize (VUE *vue);
|
||||
VUEAPI int32_t vueRead (VUE *vue, uint32_t address, int32_t type);
|
||||
VUEAPI vbool vueReadBytes (VUE *vue, uint32_t address, uint8_t *dest, uint32_t length);
|
||||
VUEAPI void vueReset (VUE *vue);
|
||||
VUEAPI void vueSetException(VUE *vue, VUE_ONEXCEPTION callback);
|
||||
VUEAPI void vueSetExecute (VUE *vue, VUE_ONEXECUTE callback);
|
||||
VUEAPI void vueSetRead (VUE *vue, VUE_ONREAD callback);
|
||||
VUEAPI int32_t vueSetRegister (VUE *vue, int32_t index, vbool system, int32_t value);
|
||||
VUEAPI vbool vueSetROM (VUE *vue, uint8_t *rom, uint32_t size);
|
||||
VUEAPI void vueSetWrite (VUE *vue, VUE_ONWRITE callback);
|
||||
VUEAPI void vueWrite (VUE *vue, uint32_t address, int32_t type, int32_t value);
|
||||
VUEAPI vbool vueWriteBytes (VUE *vue, uint32_t address, uint8_t *src, uint32_t length);
|
||||
VUEAPI int32_t vueEmulate (Vue *vue, int32_t maxCycles);
|
||||
VUEAPI int32_t vueGetBreakCode(Vue *vue);
|
||||
VUEAPI int32_t vueGetRegister (Vue *vue, int32_t index, vbool system);
|
||||
VUEAPI void vueInitialize (Vue *vue);
|
||||
VUEAPI int32_t vueRead (Vue *vue, uint32_t address, int32_t type);
|
||||
VUEAPI vbool vueReadBytes (Vue *vue, uint32_t address, uint8_t *dest, uint32_t length);
|
||||
VUEAPI void vueReset (Vue *vue);
|
||||
VUEAPI void vueSetException(Vue *vue, VueOnException callback);
|
||||
VUEAPI void vueSetExecute (Vue *vue, VueOnExecute callback);
|
||||
VUEAPI void vueSetRead (Vue *vue, VueOnRead callback);
|
||||
VUEAPI int32_t vueSetRegister (Vue *vue, int32_t index, vbool system, int32_t value);
|
||||
VUEAPI vbool vueSetROM (Vue *vue, uint8_t *rom, uint32_t size);
|
||||
VUEAPI void vueSetWrite (Vue *vue, VueOnWrite callback);
|
||||
VUEAPI void vueWrite (Vue *vue, uint32_t address, int32_t type, int32_t value);
|
||||
VUEAPI vbool vueWriteBytes (Vue *vue, uint32_t address, uint8_t *src, uint32_t length);
|
||||
|
||||
|
||||
|
||||
|
||||
+15
-15
@@ -155,7 +155,7 @@ static void writeBytes(uint8_t *data, uint32_t datlen, uint32_t address,
|
||||
*****************************************************************************/
|
||||
|
||||
/* Process the simulation */
|
||||
int32_t vueEmulate(VUE *vue, int32_t maxCycles) {
|
||||
int32_t vueEmulate(Vue *vue, int32_t maxCycles) {
|
||||
int32_t cycles; /* Number of cycles to process */
|
||||
|
||||
/* Process up to the given number of cycles */
|
||||
@@ -200,12 +200,12 @@ int32_t vueEmulate(VUE *vue, int32_t maxCycles) {
|
||||
}
|
||||
|
||||
/* Retrieve the application break code */
|
||||
int32_t vueGetBreakCode(VUE *vue) {
|
||||
int32_t vueGetBreakCode(Vue *vue) {
|
||||
return vue == NULL ? 0 : vue->breakCode;
|
||||
}
|
||||
|
||||
/* Retrieve the value of a register */
|
||||
int32_t vueGetRegister(VUE *vue, int32_t index, vbool system) {
|
||||
int32_t vueGetRegister(Vue *vue, int32_t index, vbool system) {
|
||||
|
||||
/* Error checking */
|
||||
if (vue == NULL)
|
||||
@@ -229,7 +229,7 @@ int32_t vueGetRegister(VUE *vue, int32_t index, vbool system) {
|
||||
}
|
||||
|
||||
/* Prepare an emulation state context for use */
|
||||
void vueInitialize(VUE *vue) {
|
||||
void vueInitialize(Vue *vue) {
|
||||
if (vue == NULL)
|
||||
return;
|
||||
vue->onException = NULL;
|
||||
@@ -241,7 +241,7 @@ void vueInitialize(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Read a value from the CPU bus */
|
||||
int32_t vueRead(VUE *vue, uint32_t address, int32_t type) {
|
||||
int32_t vueRead(Vue *vue, uint32_t address, int32_t type) {
|
||||
|
||||
/* Error checking */
|
||||
if (vue == NULL)
|
||||
@@ -257,7 +257,7 @@ int32_t vueRead(VUE *vue, uint32_t address, int32_t type) {
|
||||
}
|
||||
|
||||
/* Read bytes from the CPU bus */
|
||||
vbool vueReadBytes(VUE *vue, uint32_t address, uint8_t *dest, uint32_t length){
|
||||
vbool vueReadBytes(Vue *vue, uint32_t address, uint8_t *dest, uint32_t length){
|
||||
uint32_t count; /* Bytes to read in one iteration */
|
||||
|
||||
/* Error checking */
|
||||
@@ -289,7 +289,7 @@ vbool vueReadBytes(VUE *vue, uint32_t address, uint8_t *dest, uint32_t length){
|
||||
}
|
||||
|
||||
/* Initialize all system components */
|
||||
void vueReset(VUE *vue) {
|
||||
void vueReset(Vue *vue) {
|
||||
uint32_t x; /* Iterator */
|
||||
|
||||
/* Error checking */
|
||||
@@ -304,25 +304,25 @@ void vueReset(VUE *vue) {
|
||||
}
|
||||
|
||||
/* Specify an exception breakpoint callback */
|
||||
void vueSetException(VUE *vue, VUE_ONEXCEPTION callback) {
|
||||
void vueSetException(Vue *vue, VueOnException callback) {
|
||||
if (vue != NULL)
|
||||
vue->onException = callback;
|
||||
}
|
||||
|
||||
/* Specify an execute breakpoint callback */
|
||||
void vueSetExecute(VUE *vue, VUE_ONEXECUTE callback) {
|
||||
void vueSetExecute(Vue *vue, VueOnExecute callback) {
|
||||
if (vue != NULL)
|
||||
vue->onExecute = callback;
|
||||
}
|
||||
|
||||
/* Specify a read breakpoint callback */
|
||||
void vueSetRead(VUE *vue, VUE_ONREAD callback) {
|
||||
void vueSetRead(Vue *vue, VueOnRead callback) {
|
||||
if (vue != NULL)
|
||||
vue->onRead = callback;
|
||||
}
|
||||
|
||||
/* Specify a value for a register */
|
||||
int32_t vueSetRegister(VUE *vue, int32_t index, vbool system, int32_t value) {
|
||||
int32_t vueSetRegister(Vue *vue, int32_t index, vbool system, int32_t value) {
|
||||
return vue == NULL ? 0 :
|
||||
index == VUE_PC && system ? vue->cpu.pc = value & 0xFFFFFFFE :
|
||||
index < 0 || index > 31 ? 0 :
|
||||
@@ -332,7 +332,7 @@ int32_t vueSetRegister(VUE *vue, int32_t index, vbool system, int32_t value) {
|
||||
}
|
||||
|
||||
/* Specify a new ROM buffer */
|
||||
vbool vueSetROM(VUE *vue, uint8_t *rom, uint32_t size) {
|
||||
vbool vueSetROM(Vue *vue, uint8_t *rom, uint32_t size) {
|
||||
|
||||
/* Error checking */
|
||||
if (
|
||||
@@ -349,13 +349,13 @@ vbool vueSetROM(VUE *vue, uint8_t *rom, uint32_t size) {
|
||||
}
|
||||
|
||||
/* Specify a write breakpoint callback */
|
||||
void vueSetWrite(VUE *vue, VUE_ONREAD callback) {
|
||||
void vueSetWrite(Vue *vue, VueOnRead callback) {
|
||||
if (vue != NULL)
|
||||
vue->onWrite = callback;
|
||||
}
|
||||
|
||||
/* Write a value to the CPU bus */
|
||||
void vueWrite(VUE *vue, uint32_t address, int32_t type, int32_t value) {
|
||||
void vueWrite(Vue *vue, uint32_t address, int32_t type, int32_t value) {
|
||||
|
||||
/* Error checking */
|
||||
if (vue == NULL)
|
||||
@@ -374,7 +374,7 @@ void vueWrite(VUE *vue, uint32_t address, int32_t type, int32_t value) {
|
||||
}
|
||||
|
||||
/* Write bytes to the CPU bus */
|
||||
vbool vueWriteBytes(VUE *vue, uint32_t address, uint8_t *src, uint32_t length){
|
||||
vbool vueWriteBytes(Vue *vue, uint32_t address, uint8_t *src, uint32_t length){
|
||||
uint32_t count; /* Bytes to write in one iteration */
|
||||
|
||||
/* Error checking */
|
||||
|
||||
Reference in New Issue
Block a user