Cleanup adjustments
This commit is contained in:
parent
7e31fbd582
commit
e97b52e944
|
@ -91,11 +91,6 @@
|
|||
#define CPU_XORBSU 82
|
||||
#define CPU_XORNBSU 83
|
||||
|
||||
/* Functional operand types */
|
||||
#define CPU_LITERAL 0
|
||||
#define CPU_MEMORY 1
|
||||
#define CPU_REGISTER 2
|
||||
|
||||
/* Bit string operations */
|
||||
#define CPU_AND_BS 0
|
||||
#define CPU_ANDN_BS 1
|
||||
|
|
22
core/vb.c
22
core/vb.c
|
@ -643,6 +643,7 @@ VBAPI vbOnWrite vbGetWriteCallback(VB *sim) {
|
|||
VBAPI VB* vbInit(VB *sim) {
|
||||
sim->cart.ram = NULL;
|
||||
sim->cart.rom = NULL;
|
||||
sim->ph.enabled = 0;
|
||||
sim->vsu.out.samples = NULL;
|
||||
sim->onExecute = NULL;
|
||||
sim->onFetch = NULL;
|
||||
|
@ -652,7 +653,7 @@ VBAPI VB* vbInit(VB *sim) {
|
|||
sim->onSamples = NULL;
|
||||
sim->onWrite = NULL;
|
||||
sim->peer = NULL;
|
||||
sim->ph.enabled = 0;
|
||||
sim->tag = NULL;
|
||||
vbReset(sim);
|
||||
return sim;
|
||||
}
|
||||
|
@ -716,28 +717,28 @@ VBAPI int vbSetCartROM(VB *sim, void *rom, uint32_t size) {
|
|||
/* Specify a new exception callback handler */
|
||||
VBAPI vbOnException vbSetExceptionCallback(VB *sim, vbOnException callback) {
|
||||
vbOnException prev = sim->onException;
|
||||
sim->onException = callback;
|
||||
sim->onException = callback;
|
||||
return prev;
|
||||
}
|
||||
|
||||
/* Specify a new execute callback handler */
|
||||
VBAPI vbOnExecute vbSetExecuteCallback(VB *sim, vbOnExecute callback) {
|
||||
vbOnExecute prev = sim->onExecute;
|
||||
sim->onExecute = callback;
|
||||
sim->onExecute = callback;
|
||||
return prev;
|
||||
}
|
||||
|
||||
/* Specify a new fetch callback handler */
|
||||
VBAPI vbOnFetch vbSetFetchCallback(VB *sim, vbOnFetch callback) {
|
||||
vbOnFetch prev = sim->onFetch;
|
||||
sim->onFetch = callback;
|
||||
sim->onFetch = callback;
|
||||
return prev;
|
||||
}
|
||||
|
||||
/* Specify a new frame callback handler */
|
||||
VBAPI vbOnFrame vbSetFrameCallback(VB *sim, vbOnFrame callback) {
|
||||
vbOnFrame prev = sim->onFrame;
|
||||
sim->onFrame = callback;
|
||||
sim->onFrame = callback;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
@ -749,7 +750,7 @@ VBAPI uint16_t vbSetKeys(VB *sim, uint16_t keys) {
|
|||
/* Specify a new link callback handler */
|
||||
VBAPI vbOnLink vbSetLinkCallback(VB *sim, vbOnLink callback) {
|
||||
vbOnLink prev = sim->onLink;
|
||||
sim->onLink = callback;
|
||||
sim->onLink = callback;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
@ -774,6 +775,8 @@ VBAPI int vbSetOption(VB *sim, int key, int value) {
|
|||
VBAPI void vbSetPeer(VB *sim, VB *peer) {
|
||||
if (sim->peer == peer)
|
||||
return;
|
||||
if (sim->peer != NULL)
|
||||
sim->peer->peer = NULL;
|
||||
sim->peer = peer;
|
||||
if (peer == NULL)
|
||||
return;
|
||||
|
@ -784,6 +787,7 @@ VBAPI void vbSetPeer(VB *sim, VB *peer) {
|
|||
|
||||
/* Specify a new value for the program counter */
|
||||
VBAPI uint32_t vbSetProgramCounter(VB *sim, uint32_t value) {
|
||||
sim->cpu.clocks = 0;
|
||||
sim->cpu.operation = CPU_FETCH;
|
||||
sim->cpu.pc = sim->cpu.nextPC = value & 0xFFFFFFFE;
|
||||
sim->cpu.step = 0;
|
||||
|
@ -798,7 +802,7 @@ VBAPI int32_t vbSetProgramRegister(VB *sim, unsigned index, int32_t value) {
|
|||
/* Specify a new read callback handler */
|
||||
VBAPI vbOnRead vbSetReadCallback(VB *sim, vbOnRead callback) {
|
||||
vbOnRead prev = sim->onRead;
|
||||
sim->onRead = callback;
|
||||
sim->onRead = callback;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
@ -829,7 +833,7 @@ VBAPI uint32_t vbSetSystemRegister(VB *sim, unsigned index, uint32_t value) {
|
|||
/* Specify a new write callback handler */
|
||||
VBAPI vbOnWrite vbSetWriteCallback(VB *sim, vbOnWrite callback) {
|
||||
vbOnWrite prev = sim->onWrite;
|
||||
sim->onWrite = callback;
|
||||
sim->onWrite = callback;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
@ -841,7 +845,7 @@ VBAPI size_t vbSizeOf() {
|
|||
/* Specify a simulation's userdata pointer */
|
||||
VBAPI void* vbSetUserData(VB *sim, void *tag) {
|
||||
void *prev = sim->tag;
|
||||
sim->tag = tag;
|
||||
sim->tag = tag;
|
||||
return prev;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@ static void vsuEmulate(VB *sim, uint32_t clocks) {
|
|||
|
||||
/* Wait for the current sample to finish */
|
||||
if (sim->vsu.clocks != 0)
|
||||
continue;
|
||||
return;
|
||||
|
||||
/* Compute the output sample */
|
||||
output[0] = output[1] = 0;
|
||||
|
|
Loading…
Reference in New Issue