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:
 | 
					        case 2:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Read the high source word */
 | 
					            /* 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;
 | 
					                sim->cpu.step = 2;
 | 
				
			||||||
                return 1;
 | 
					                return 1;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -713,13 +713,14 @@ static int cpuBSArithmetic(VB *sim) {
 | 
				
			||||||
        case 3:
 | 
					        case 3:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Read the destination word */
 | 
					            /* 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;
 | 
					                sim->cpu.step = 3;
 | 
				
			||||||
                return 1;
 | 
					                return 1;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Perform the ALU operation */
 | 
					            /* Perform the ALU operation */
 | 
				
			||||||
            src = bsSrcBit < bsDestBit ?
 | 
					            dest = auxBS.dest;
 | 
				
			||||||
 | 
					            src  = bsSrcBit < bsDestBit ?
 | 
				
			||||||
                auxBS.src << (bsDestBit - bsSrcBit ) :
 | 
					                auxBS.src << (bsDestBit - bsSrcBit ) :
 | 
				
			||||||
                auxBS.src >> (bsSrcBit  - bsDestBit)
 | 
					                auxBS.src >> (bsSrcBit  - bsDestBit)
 | 
				
			||||||
            ;
 | 
					            ;
 | 
				
			||||||
| 
						 | 
					@ -755,18 +756,19 @@ static int cpuBSArithmetic(VB *sim) {
 | 
				
			||||||
                src = bsLength;
 | 
					                src = bsLength;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Advance to next output word */
 | 
					            /* Advance to next output word */
 | 
				
			||||||
            if (bsSrcBit  + src >= 32)
 | 
					            if (bsSrcBit + src >= 32) {
 | 
				
			||||||
                bsSrcAddr  += 4;
 | 
					                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)
 | 
					            if (bsDestBit + src >= 32)
 | 
				
			||||||
                bsDestAddr += 4;
 | 
					                bsDestAddr += 4;
 | 
				
			||||||
            bsSrcBit    = (bsSrcBit  + src) & 31;
 | 
					            bsSrcBit    = (bsSrcBit  + src) & 31;
 | 
				
			||||||
            bsDestBit   = (bsDestBit + src) & 31;
 | 
					            bsDestBit   = (bsDestBit + src) & 31;
 | 
				
			||||||
            bsLength   -= src;
 | 
					            bsLength   -= src;
 | 
				
			||||||
            auxBS.src >>= 32;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Update state */
 | 
					            /* Update state */
 | 
				
			||||||
            sim->cpu.clocks += cpuClocks(12); /* TODO: Research */
 | 
					            sim->cpu.clocks += cpuClocks(12); /* TODO: Research */
 | 
				
			||||||
            sim->cpu.step    = 2; /* Read high source word */
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Exit condition */
 | 
					    /* Exit condition */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue