Miscellaneous bug fixes

This commit is contained in:
Guy Perfect 2024-10-19 22:56:23 -05:00
parent e9f5437c1f
commit 50903c7513
4 changed files with 15 additions and 19 deletions

View File

@ -89,7 +89,7 @@ static int32_t busReadMisc(VB *sim, uint8_t address, int type) {
/* Unmapped */
switch (type) {
case VB_S8 : case VB_U8 : if (address & 3) return 0; break;
case VB_S16: case VB_U16: if (address & 1) return 0;
case VB_S16: case VB_U16: if (address & 2) return 0;
}
/* Access by register */
@ -117,7 +117,7 @@ static void busWriteMisc(VB *sim, uint8_t address, int type, int32_t value) {
/* Unmapped */
switch (type) {
case VB_S8 : case VB_U8 : if (address & 3) return; break;
case VB_S16: case VB_U16: if (address & 1) return;
case VB_S16: case VB_U16: if (address & 2) return;
}
/* Access by register */

View File

@ -1831,7 +1831,7 @@ static uint32_t cpuUntil(VB *sim, uint32_t clocks) {
return
sim->cpu.operation == CPU_HALTING &&
!(sim->cpu.psw.id | sim->cpu.psw.ep | sim->cpu.psw.np) &&
IRQ_LEVELS[sim->cpu.irq] < sim->cpu.psw.i
IRQ_LEVELS[sim->cpu.irq] >= sim->cpu.psw.i
? 0 : clocks;
}

View File

@ -103,7 +103,7 @@ struct VB {
uint8_t soft_ck; /* Controller communication signal */
/* Simulation state */
uint8_t keys; /* Next input bits */
uint16_t keys; /* Next input bits */
int step; /* Software read processing phase */
} pad;

View File

@ -606,7 +606,7 @@ static void vipDrawObjects(VB *sim, int group) {
start = group == 0 ? 0 : (sim->vip.spt[group - 1] + 1) & 1023;
stop = sim->vip.spt[group];
top = (int32_t) sim->vip.xp.sbcount << 3;
for (o = stop;; o = (o - 1) & 1023) {
for (o = stop; o != -1; o = o == start ? -1 : (o - 1) & 1023) {
obj = &sim->vip.ram[0x3E000 | o << 3];
/* Validate object is enabled */
@ -655,15 +655,12 @@ static void vipDrawObjects(VB *sim, int group) {
pixel = src[sy << 1 | sx >> 2] >> ((sx & 3) << 1) & 3;
if (pixel != 0)
dest[y] = plt[pixel]; /* TODO: Research clocks */
} /* x */
} /* y */
} /* x */
} /* i */
/* All objects have been drawn */
if (o == start)
break;
}
}
@ -795,10 +792,9 @@ static void vipDrawWorld(VB *sim, uint8_t *world, uint16_t attr) {
dx = (int32_t) (int16_t) vipParam(param|6) << 7;
dy = (int32_t) (int16_t) vipParam(param|8) << 7;
mp = (int32_t) (int16_t) vipParam(param|2);
mx = ((int32_t) (int16_t) vipParam(param ) << 13) +
dx * (left - ((mp < 0) ^ i ? mp : 0));
my = ((int32_t) (int16_t) vipParam(param | 4) << 13) +
dy * (left - ((mp < 0) ^ i ? mp : 0));
mp = left - wx - ((mp < 0) ^ i ? mp : 0);
mx = ((int32_t) (int16_t) vipParam(param ) << 13) + dx*mp;
my = ((int32_t) (int16_t) vipParam(param|4) << 13) + dy*mp;
param += 16;
}
@ -882,7 +878,7 @@ static void vipRender(VB *sim) {
attr = busReadBuffer(world, VB_U16);
/* Non-graphical world */
if (attr & 0x0020) /* END */
if (attr & 0x0040) /* END */
break; /* Control world */
if ((attr & 0xC000) == 0) /* LON, RON */
continue; /* Dummy world */