Passing the pizza gauntlet
This commit is contained in:
parent
2e1cd12829
commit
1d6f62e319
16
core/cpu.c
16
core/cpu.c
|
@ -703,7 +703,7 @@ static int cpuBSArithmetic(VB *sim) {
|
|||
case 2:
|
||||
|
||||
/* Read the high source word */
|
||||
if (cpuRead(sim, bsSrcAddr + 1, VB_S32, (int32_t *) &src)) {
|
||||
if (cpuRead(sim, bsSrcAddr + 4, VB_S32, (int32_t *) &src)) {
|
||||
sim->cpu.step = 2;
|
||||
return 1;
|
||||
}
|
||||
|
@ -713,13 +713,14 @@ static int cpuBSArithmetic(VB *sim) {
|
|||
case 3:
|
||||
|
||||
/* Read the destination word */
|
||||
if (cpuRead(sim, bsDestAddr, VB_S32, (int32_t *) &dest)) {
|
||||
if (cpuRead(sim, bsDestAddr, VB_S32, (int32_t *) &auxBS.dest)) {
|
||||
sim->cpu.step = 3;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Perform the ALU operation */
|
||||
src = bsSrcBit < bsDestBit ?
|
||||
dest = auxBS.dest;
|
||||
src = bsSrcBit < bsDestBit ?
|
||||
auxBS.src << (bsDestBit - bsSrcBit ) :
|
||||
auxBS.src >> (bsSrcBit - bsDestBit)
|
||||
;
|
||||
|
@ -755,18 +756,19 @@ static int cpuBSArithmetic(VB *sim) {
|
|||
src = bsLength;
|
||||
|
||||
/* Advance to next output word */
|
||||
if (bsSrcBit + src >= 32)
|
||||
bsSrcAddr += 4;
|
||||
if (bsSrcBit + src >= 32) {
|
||||
bsSrcAddr += 4;
|
||||
auxBS.src >>= 32;
|
||||
sim->cpu.step = 2; /* Read high source word */
|
||||
} else sim->cpu.step = 3; /* Read destination word */
|
||||
if (bsDestBit + src >= 32)
|
||||
bsDestAddr += 4;
|
||||
bsSrcBit = (bsSrcBit + src) & 31;
|
||||
bsDestBit = (bsDestBit + src) & 31;
|
||||
bsLength -= src;
|
||||
auxBS.src >>= 32;
|
||||
|
||||
/* Update state */
|
||||
sim->cpu.clocks += cpuClocks(12); /* TODO: Research */
|
||||
sim->cpu.step = 2; /* Read high source word */
|
||||
}
|
||||
|
||||
/* Exit condition */
|
||||
|
|
Loading…
Reference in New Issue