Exemplo n.º 1
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   cpu.of = cpu.af = cpu.cf = false;
   cpu.flagResult = (op1.get32() & immd);
   cpu.flagStatus = SZP;
   return Branch.None;
 }
Exemplo n.º 2
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   Reg op2 = cpu.regs[op2Index];
   cpu.zf(cpu.zf());
   cpu.cf(((op1.get16() & (1 << (op2.get16() & (16 - 1)))) != 0));
   return Branch.None;
 }
Exemplo n.º 3
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   cpu.of = cpu.af = cpu.cf = false;
   cpu.flagResult = (byte) (op1.get8() ^ op2.get8(cpu));
   op1.set8((byte) cpu.flagResult);
   cpu.flagStatus = SZP;
   return Branch.None;
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   cpu.flagOp1 = op1.get32();
   cpu.flagOp2 = op2.get32(cpu);
   cpu.flagResult = (cpu.flagOp1 - cpu.flagOp2);
   op1.set32(cpu.flagResult);
   cpu.flagIns = UCodes.SUB32;
   cpu.flagStatus = OSZAPC;
   return Branch.None;
 }
Exemplo n.º 6
0
 public Branch execute(Processor cpu) {
   Reg op2 = cpu.regs[op2Index];
   int add = (cpu.cf() ? 1 : 0);
   cpu.flagOp1 = op1.get8(cpu);
   cpu.flagOp2 = op2.get8();
   cpu.flagResult = (byte) (cpu.flagOp1 - (cpu.flagOp2 + add));
   op1.set8(cpu, (byte) cpu.flagResult);
   cpu.flagIns = UCodes.SBB8;
   cpu.flagStatus = OSZAPC;
   return Branch.None;
 }
Exemplo n.º 7
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   Reg op2 = cpu.regs[op2Index];
   cpu.flagOp1 = (byte) op1.get8();
   cpu.flagOp2 = (byte) op2.get8();
   cpu.flagResult = (byte) (cpu.flagOp1 + cpu.flagOp2);
   op1.set8((byte) cpu.flagResult);
   cpu.flagIns = UCodes.ADD8;
   cpu.flagStatus = OSZAPC;
   return Branch.None;
 }
Exemplo n.º 8
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   Reg op2 = cpu.regs[op2Index];
   boolean incf = cpu.cf();
   cpu.flagOp1 = op1.get8();
   cpu.flagOp2 = op2.get8();
   cpu.flagResult = (byte) (cpu.flagOp1 + cpu.flagOp2 + (incf ? 1 : 0));
   op1.set8((byte) cpu.flagResult);
   cpu.flagIns = UCodes.ADC8;
   cpu.flagStatus = OSZAPC;
   return Branch.None;
 }
Exemplo n.º 9
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   boolean incf =
       Processor.getCarryFlag(
           cpu.flagStatus, cpu.cf, cpu.flagOp1, cpu.flagOp2, cpu.flagResult, cpu.flagIns);
   cpu.flagOp1 = op1.get16();
   cpu.flagOp2 = immb;
   cpu.flagResult = (short) (cpu.flagOp1 + cpu.flagOp2 + (incf ? 1 : 0));
   op1.set16((short) cpu.flagResult);
   cpu.flagIns = UCodes.ADC16;
   cpu.flagStatus = OSZAPC;
   return Branch.None;
 }
Exemplo n.º 10
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   int iop1 = (short) op1.get16();
   int iop2 = (short) cpu.r_eax.get16();
   int res32 = (((int) (short) iop1) * ((short) iop2));
   cpu.r_eax.set16((short) res32);
   cpu.r_edx.set16((short) (res32 >> 16));
   cpu.setOSZAPC_Logic16(res32);
   if (res32 != (short) res32) {
     cpu.of(true);
     cpu.cf(true);
   }
   return Branch.None;
 }
Exemplo n.º 11
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   Reg op2 = cpu.regs[op2Index];
   int bit = 1 << (op2.get16() & (16 - 1));
   cpu.cf = (0 != (op1.get16() & bit));
   cpu.flagStatus &= NCF;
   op1.set16((short) (op1.get16() & ~bit));
   return Branch.None;
 }
Exemplo n.º 12
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   op1.set16((short) op2.get16(cpu));
   return Branch.None;
 }
Exemplo n.º 13
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   int tmp = op2.get32(cpu);
   if (!cpu.sf()) op1.set32(tmp);
   return Branch.None;
 }
Exemplo n.º 14
0
 public Branch execute(Processor cpu) {
   Reg op1 = cpu.regs[op1Index];
   Segment seg = cpu.segs[segIndex];
   op1.set16((short) seg.getSelector());
   return Branch.None;
 }