예제 #1
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   if (op2.get16(cpu) == 0) {
     cpu.zf(true);
   } else {
     cpu.zf(false);
     op1.set16(31 - StaticOpcodes.numberOfLeadingZeros(0xFFFF & op2.get16(cpu)));
   }
   return Branch.None;
 }
예제 #2
0
 public Branch execute(Processor cpu) {
   cpu.flagOp1 = (short) op1.get16(cpu);
   cpu.flagOp2 = (short) immw;
   cpu.flagResult = (short) (cpu.flagOp1 - cpu.flagOp2);
   op1.set16(cpu, (short) cpu.flagResult);
   cpu.flagIns = UCodes.SUB16;
   cpu.flagStatus = OSZAPC;
   return Branch.None;
 }
예제 #3
0
 public Branch execute(Processor cpu) {
   int shift = 1 & 0x1f;
   shift %= 16 + 1;
   long val = 0xFFFF & op1.get16(cpu);
   val |= cpu.cf() ? 1L << 16 : 0;
   val = (val << shift) | (val >>> (16 + 1 - shift));
   op1.set16(cpu, (short) (int) val);
   boolean bit31 = (val & (1L << (16 - 1))) != 0;
   boolean bit32 = (val & (1L << (16))) != 0;
   cpu.cf(bit32);
   if (shift == 1) cpu.of(bit31 ^ bit32);
   return Branch.None;
 }
예제 #4
0
 public Branch execute(Processor cpu) {
   int shift = cpu.r_cl.get8() & (16 - 1);
   int reg0 = 0xFFFF & op1.get16(cpu);
   int res = (reg0 << shift) | (reg0 >>> (16 - shift));
   op1.set16(cpu, (short) res);
   boolean bit0 = (res & 1) != 0;
   boolean bit31 = (res & (1 << (16 - 1))) != 0;
   if ((0x1F & cpu.r_cl.get8()) > 0) {
     cpu.cf = bit0;
     cpu.of = bit0 ^ bit31;
     cpu.flagStatus &= NOFCF;
   }
   return Branch.None;
 }
예제 #5
0
파일: lldt_Ew_mem.java 프로젝트: agimat/JPC
  public Branch execute(Processor cpu) {
    int selector = op1.get16(cpu) & 0xffff;

    if (selector == 0) {
      cpu.ldtr = SegmentFactory.NULL_SEGMENT;
    } else {
      Segment newSegment = cpu.getSegment(selector & ~0x4);
      if (newSegment.getType() != 0x02)
        throw new ProcessorException(ProcessorException.Type.GENERAL_PROTECTION, selector, true);

      if (!(newSegment.isPresent()))
        throw new ProcessorException(ProcessorException.Type.GENERAL_PROTECTION, selector, true);
      cpu.ldtr = newSegment;
    }
    return Branch.None;
  }
예제 #6
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   op1.set16((short) op2.get16(cpu));
   return Branch.None;
 }