Compare commits
No commits in common. "main" and "float-code-fix" have entirely different histories.
main
...
float-code
|
@ -234,7 +234,7 @@ static int cpuOnExecute(VB *sim) {
|
||||||
#define VB_ON_READ VB_DIRECT_READ
|
#define VB_ON_READ VB_DIRECT_READ
|
||||||
#endif
|
#endif
|
||||||
static int cpuRead(VB *sim, uint32_t address, int type, int32_t *value) {
|
static int cpuRead(VB *sim, uint32_t address, int type, int32_t *value) {
|
||||||
uint32_t cycles = 0; /* TODO: Research this */
|
uint32_t cycles = 4; /* TODO: Research this */
|
||||||
|
|
||||||
/* Retrieve the value from the simulation state directly */
|
/* Retrieve the value from the simulation state directly */
|
||||||
busRead(sim, address, type, value);
|
busRead(sim, address, type, value);
|
||||||
|
@ -289,7 +289,7 @@ static int cpuReadFetch(VB *sim, int fetch, uint32_t address, int32_t *value) {
|
||||||
#endif
|
#endif
|
||||||
static int cpuWrite(VB *sim, uint32_t address, int type, int32_t value) {
|
static int cpuWrite(VB *sim, uint32_t address, int type, int32_t value) {
|
||||||
int cancel = 0;
|
int cancel = 0;
|
||||||
uint32_t cycles = 0; /* TODO: Research this */
|
uint32_t cycles = 3; /* TODO: Research this */
|
||||||
|
|
||||||
/* Reset pseudo-halt */
|
/* Reset pseudo-halt */
|
||||||
if (sim->ph.enabled)
|
if (sim->ph.enabled)
|
||||||
|
|
|
@ -900,7 +900,7 @@ VBAPI vbOnWrite vbSetWriteCallback(VB *sim, vbOnWrite callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine the size of a simulation instance */
|
/* Determine the size of a simulation instance */
|
||||||
VBAPI size_t vbSizeOf(void) {
|
VBAPI size_t vbSizeOf() {
|
||||||
return sizeof (VB);
|
return sizeof (VB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ VBAPI vbOnSamples vbSetSamplesCallback (VB *sim, vbOnSamples callback);
|
||||||
VBAPI uint32_t vbSetSystemRegister (VB *sim, unsigned index, uint32_t value);
|
VBAPI uint32_t vbSetSystemRegister (VB *sim, unsigned index, uint32_t value);
|
||||||
VBAPI void* vbSetUserData (VB *sim, void *tag);
|
VBAPI void* vbSetUserData (VB *sim, void *tag);
|
||||||
VBAPI vbOnWrite vbSetWriteCallback (VB *sim, vbOnWrite callback);
|
VBAPI vbOnWrite vbSetWriteCallback (VB *sim, vbOnWrite callback);
|
||||||
VBAPI size_t vbSizeOf (void);
|
VBAPI size_t vbSizeOf ();
|
||||||
VBAPI int32_t vbWrite (VB *sim, uint32_t address, int type, int32_t value);
|
VBAPI int32_t vbWrite (VB *sim, uint32_t address, int type, int32_t value);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -984,7 +984,7 @@ static void vipDrawHBias(VB *sim, World *world) {
|
||||||
/* Process all visible lines */
|
/* Process all visible lines */
|
||||||
param = &sim->vip.ram[world->paramBase +
|
param = &sim->vip.ram[world->paramBase +
|
||||||
((y1 - world->gy) << 2) + (i << 1)];
|
((y1 - world->gy) << 2) + (i << 1)];
|
||||||
for (y = y1; y < y2; y++, param += 4) {
|
for (y = y1; y < y2; y++, param += 2) {
|
||||||
|
|
||||||
/* Configure window bounds */
|
/* Configure window bounds */
|
||||||
wnd.y1 = y;
|
wnd.y1 = y;
|
||||||
|
@ -992,7 +992,7 @@ static void vipDrawHBias(VB *sim, World *world) {
|
||||||
|
|
||||||
/* Draw the background into the window */
|
/* Draw the background into the window */
|
||||||
vipDrawBackground(sim->vip.shadow[i], &wnd, world,
|
vipDrawBackground(sim->vip.shadow[i], &wnd, world,
|
||||||
mx - busReadBuffer(param, VB_S16), my);
|
mx + busReadBuffer(param, VB_S16), my);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
44
core/vsu.c
44
core/vsu.c
|
@ -132,19 +132,14 @@ static void vsuEmulateChannel(VB *sim, Channel *chan) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Envelope modification */
|
/* Envelope modification */
|
||||||
if (chan->env.clocks == 0) {
|
if (chan->env.enb && !chan->env.modmask && chan->env.clocks == 0) {
|
||||||
uint8_t new_envelope = chan->env.value;
|
|
||||||
if (chan->env.dir == 0 && chan->env.value != 0)
|
if (chan->env.dir == 0 && chan->env.value != 0)
|
||||||
new_envelope--;
|
chan->env.value--;
|
||||||
else if (chan->env.dir == 1 && chan->env.value != 15)
|
else if (chan->env.dir == 1 && chan->env.value != 15)
|
||||||
new_envelope++;
|
chan->env.value++;
|
||||||
else if (chan->env.rep && chan->env.modmask != 2) {
|
else if (chan->env.rep)
|
||||||
new_envelope = chan->env.reload;
|
chan->env.value = chan->env.reload;
|
||||||
chan->env.modmask = 0;
|
else chan->env.modmask = 1;
|
||||||
} else if (!chan->env.modmask)
|
|
||||||
chan->env.modmask = 1;
|
|
||||||
if (chan->env.enb && !chan->env.modmask)
|
|
||||||
chan->env.value = new_envelope;
|
|
||||||
chan->env.clocks = ((uint32_t) chan->env.interval + 1) * 307220;
|
chan->env.clocks = ((uint32_t) chan->env.interval + 1) * 307220;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +215,6 @@ static void vsuWriteEV0(VB *sim, int index, uint8_t value) {
|
||||||
chan->env.interval = value & 7;
|
chan->env.interval = value & 7;
|
||||||
chan->env.value = value >> 4 & 15;
|
chan->env.value = value >> 4 & 15;
|
||||||
chan->env.reload = chan->env.value;
|
chan->env.reload = chan->env.value;
|
||||||
if (chan->env.modmask == 1) chan->env.modmask = 2;
|
|
||||||
if (index == 4) {
|
if (index == 4) {
|
||||||
chan->freqmod = vsuCheckFreqMod(sim);
|
chan->freqmod = vsuCheckFreqMod(sim);
|
||||||
vsuNextFreqMod(sim, chan);
|
vsuNextFreqMod(sim, chan);
|
||||||
|
@ -237,12 +231,6 @@ static void vsuWriteEV1(VB *sim, int index, uint8_t value) {
|
||||||
/* Parse fields */
|
/* Parse fields */
|
||||||
chan->env.enb = value & 1;
|
chan->env.enb = value & 1;
|
||||||
chan->env.rep = value >> 1 & 1;
|
chan->env.rep = value >> 1 & 1;
|
||||||
if (
|
|
||||||
!chan->env.rep && (
|
|
||||||
(chan->env.reload == 0 && chan->env.dir == 0) ||
|
|
||||||
(chan->env.reload == 15 && chan->env.dir == 1)
|
|
||||||
)
|
|
||||||
) chan->env.modmask = 1;
|
|
||||||
|
|
||||||
/* Processing by channel */
|
/* Processing by channel */
|
||||||
switch (index) {
|
switch (index) {
|
||||||
|
@ -298,12 +286,7 @@ static void vsuWriteINT(VB *sim, int index, uint8_t value) {
|
||||||
/* Update state */
|
/* Update state */
|
||||||
chan->int_.clocks = 76805 * ((uint32_t) chan->int_.interval + 1);
|
chan->int_.clocks = 76805 * ((uint32_t) chan->int_.interval + 1);
|
||||||
chan->env.modmask = 0;
|
chan->env.modmask = 0;
|
||||||
if (
|
if (chan->env.enb)
|
||||||
!chan->env.rep && (
|
|
||||||
(chan->env.reload == 0 && chan->env.dir == 0) ||
|
|
||||||
(chan->env.reload == 15 && chan->env.dir == 1)
|
|
||||||
)
|
|
||||||
) chan->env.modmask = 1;
|
|
||||||
chan->env.clocks = 307220 * ((uint32_t) chan->env.interval + 1);
|
chan->env.clocks = 307220 * ((uint32_t) chan->env.interval + 1);
|
||||||
if (index != 5) {
|
if (index != 5) {
|
||||||
chan->wave.sample = 0;
|
chan->wave.sample = 0;
|
||||||
|
@ -394,7 +377,7 @@ static void vsuEmulate(VB *sim, uint32_t clocks) {
|
||||||
|
|
||||||
/* Clocks until next state change */
|
/* Clocks until next state change */
|
||||||
chan->until = chan->clocks;
|
chan->until = chan->clocks;
|
||||||
if (chan->env.enb && chan->env.modmask != 2 &&
|
if (chan->env.enb && !chan->env.modmask &&
|
||||||
chan->env.clocks < chan->until)
|
chan->env.clocks < chan->until)
|
||||||
chan->until = chan->env.clocks;
|
chan->until = chan->env.clocks;
|
||||||
if (chan->int_.auto_ && chan->int_.clocks < chan->until)
|
if (chan->int_.auto_ && chan->int_.clocks < chan->until)
|
||||||
|
@ -404,7 +387,7 @@ static void vsuEmulate(VB *sim, uint32_t clocks) {
|
||||||
|
|
||||||
/* Manage clocks */
|
/* Manage clocks */
|
||||||
chan->clocks -= chan->until;
|
chan->clocks -= chan->until;
|
||||||
if (chan->env.enb && chan->env.modmask != 2)
|
if (chan->env.enb && !chan->env.modmask)
|
||||||
chan->env.clocks -= chan->until;
|
chan->env.clocks -= chan->until;
|
||||||
if (chan->int_.auto_)
|
if (chan->int_.auto_)
|
||||||
chan->int_.clocks -= chan->until;
|
chan->int_.clocks -= chan->until;
|
||||||
|
@ -548,7 +531,14 @@ static void vsuReset(VB *sim) {
|
||||||
|
|
||||||
/* Write a typed value to the VSU bus */
|
/* Write a typed value to the VSU bus */
|
||||||
static void vsuWrite(VB*sim,uint32_t address,int type,int32_t value,int debug){
|
static void vsuWrite(VB*sim,uint32_t address,int type,int32_t value,int debug){
|
||||||
(void) type;
|
|
||||||
|
/* Only byte writes are allowed */
|
||||||
|
switch (type) {
|
||||||
|
case VB_S16:
|
||||||
|
case VB_U16:
|
||||||
|
case VB_S32:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Unmapped */
|
/* Unmapped */
|
||||||
if (address & 1)
|
if (address & 1)
|
||||||
|
|
Loading…
Reference in New Issue