Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mterwoord committed Jun 15, 2016
1 parent f6f0bab commit 1dc41f1
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 44 deletions.
30 changes: 6 additions & 24 deletions Users/Orvid/OrvidTestOS/AsmMouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,7 @@ public override void AssembleNew(object aAssembler, object aMethodInfo)
SourceValue = 1
};

new Jump
{
DestinationLabel = "mouse_read_exit"
};
XS.Jump("mouse_read_exit");
}

XS.Label("mouse_read_ready");
Expand Down Expand Up @@ -289,10 +286,7 @@ public override void AssembleNew(object aAssembler, object aMethodInfo)
SourceValue = 1
};

new Jump
{
DestinationLabel = "mouse_write_exit"
};
XS.Jump("mouse_write_exit");
}

XS.Label("mouse_write_ok1");
Expand Down Expand Up @@ -343,10 +337,7 @@ public override void AssembleNew(object aAssembler, object aMethodInfo)
SourceValue = 1
};

new Jump
{
DestinationLabel = "mouse_write_exit"
};
XS.Jump("mouse_write_exit");
}

XS.Label("mouse_write_ok");
Expand Down Expand Up @@ -403,10 +394,7 @@ public override void AssembleNew(object aAssembler, object aMethodInfo)
SourceValue = 1
};

new Jump
{
DestinationLabel = "mouse_write_exit"
};
XS.Jump("mouse_write_exit");
}

XS.Label("mouse_write_ok3");
Expand Down Expand Up @@ -523,10 +511,7 @@ public override void AssembleNew(object aAssembler, object aMethodInfo)
{
DestinationLabel = "mouse_cmd_wait"
};
new Jump
{
DestinationLabel = "mouse_cmd_error"
};
XS.Jump("mouse_cmd_error");
}

XS.Label("mouse_cmd_send");
Expand Down Expand Up @@ -585,10 +570,7 @@ public override void AssembleNew(object aAssembler, object aMethodInfo)
DestinationReg = RegistersEnum.AH,
SourceValue = 0x01
};
new Jump
{
DestinationLabel = "mouse_cmd_exit"
};
XS.Jump("mouse_cmd_exit");
}

XS.Label("mouse_cmd_ok");
Expand Down
7 changes: 2 additions & 5 deletions source/Cosmos.IL2CPU/AppAssembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ protected void MethodBegin(MethodInfo aMethod)
XS.Compare(xName, 1, destinationIsIndirect: true, size: RegisterSize.Byte8);
new ConditionalJump { Condition = ConditionalTestEnum.Equal, DestinationLabel = ".BeforeQuickReturn" };
XS.Set(xName, 1, destinationIsIndirect: true, size: RegisterSize.Byte8);
new Jump { DestinationLabel = ".AfterCCTorAlreadyCalledCheck" };
XS.Jump(".AfterCCTorAlreadyCalledCheck");
XS.Label(".BeforeQuickReturn");
XS.Set(OldToNewRegister(RegistersEnum.ECX), 0);
XS.Return();
Expand Down Expand Up @@ -838,10 +838,7 @@ protected void Call(MethodBase aMethod)

protected void Jump(string aLabelName)
{
new Jump
{
DestinationLabel = aLabelName
};
XS.Jump(aLabelName);
}

protected FieldInfo ResolveField(MethodInfo method, string fieldId, bool aOnlyInstance)
Expand Down
5 changes: 1 addition & 4 deletions source/Cosmos.IL2CPU/CosmosAssembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,7 @@ public void Initialize()
XS.Label(".loop");
new ClearInterruptFlag();
new Halt();
new Jump
{
DestinationLabel = ".loop"
};
XS.Jump(".loop");

if (mComPort > 0)
{
Expand Down
8 changes: 4 additions & 4 deletions source/Cosmos.IL2CPU/IL/Ceq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
XS.Pop(XSRegisters.OldToNewRegister(RegistersEnum.EAX));
new Compare { DestinationReg = RegistersEnum.EAX, SourceReg = RegistersEnum.ESP, SourceIsIndirect = true };
new ConditionalJump { Condition = ConditionalTestEnum.Equal, DestinationLabel = Label.LastFullLabel + ".True" };
new Jump { DestinationLabel = Label.LastFullLabel + ".False" };
XS.Jump(Label.LastFullLabel + ".False");
XS.Label(".True");
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 4);
new Push { DestinationValue = 1 };
new Jump { DestinationLabel = xNextLabel };
XS.Jump(xNextLabel);
XS.Label(".False");
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 4);
new Push { DestinationValue = 0 };
new Jump { DestinationLabel = xNextLabel };
XS.Jump(xNextLabel);
}
}
else if (xSize > 4)
Expand Down Expand Up @@ -93,7 +93,7 @@ public override void Execute(MethodInfo aMethod, ILOpCode aOpCode)
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 8);
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.EAX), 1);
XS.Push(XSRegisters.OldToNewRegister(RegistersEnum.EAX));
new Jump { DestinationLabel = xNextLabel };
XS.Jump(xNextLabel);
XS.Label(Label.LastFullLabel + ".False");
//eax = 0
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 8);
Expand Down
4 changes: 2 additions & 2 deletions source/Cosmos.IL2CPU/IL/Cgt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
XS.Pop(XSRegisters.OldToNewRegister(RegistersEnum.EAX));
new Compare { DestinationReg = RegistersEnum.EAX, SourceReg = RegistersEnum.ESP, SourceIsIndirect = true };
new ConditionalJump { Condition = ConditionalTestEnum.LessThan, DestinationLabel = LabelTrue };
new Jump { DestinationLabel = LabelFalse };
XS.Jump(LabelFalse);
XS.Label(LabelTrue );
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 4);
new Push { DestinationValue = 1 };
new Jump { DestinationLabel = xNextLabel };
XS.Jump(xNextLabel);
XS.Label(LabelFalse );
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 4);
new CPUx86.Push { DestinationValue = 0 };
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.IL2CPU/IL/Cgt_Un.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
new Compare { DestinationReg = RegistersEnum.EAX, SourceReg = RegistersEnum.ESP, SourceIsIndirect = true };

new ConditionalJump { Condition = ConditionalTestEnum.Below, DestinationLabel = LabelTrue };
new Jump { DestinationLabel = LabelFalse };
XS.Jump(LabelFalse);
XS.Label(LabelTrue );
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 4);
new Push { DestinationValue = 1 };
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.IL2CPU/IL/Clt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
XS.Push(XSRegisters.OldToNewRegister(RegistersEnum.ECX));
new Compare { DestinationReg = RegistersEnum.EAX, SourceReg = RegistersEnum.ESP, SourceIsIndirect = true };
new ConditionalJump { Condition = ConditionalTestEnum.LessThan, DestinationLabel = LabelTrue };
new Jump { DestinationLabel = LabelFalse };
XS.Jump(LabelFalse);
XS.Label(LabelTrue );
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 4);
new Push { DestinationValue = 1 };
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.IL2CPU/IL/Clt_Un.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
XS.Push(XSRegisters.OldToNewRegister(RegistersEnum.ECX));
new Compare { DestinationReg = RegistersEnum.EAX, SourceReg = RegistersEnum.ESP, SourceIsIndirect = true };
new ConditionalJump { Condition = ConditionalTestEnum.Below, DestinationLabel = LabelTrue };
new Jump { DestinationLabel = LabelFalse };
XS.Jump(LabelFalse);
XS.Label(LabelTrue );
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.ESP), 4);
new Push { DestinationValue = 1 };
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.IL2CPU/IL/Mul_Ovf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void DoExecute(uint xStackContentSize, string aBaseLabel)
// add LEFT_LOW * RIGHT_HIGH + RIGHT_LOW + LEFT_HIGH to high dword of last result
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.EDX), XSRegisters.OldToNewRegister(RegistersEnum.ECX));

new Jump { DestinationLabel = MoveReturnValue };
XS.Jump(MoveReturnValue);

XS.Label(Simple32Multiply);
//mov RIGHT_LOW to eax
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.IL2CPU/IL/Mul_Ovf_Un.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void DoExecute(uint xStackContentSize, string aBaseLabel)
// add LEFT_LOW * RIGHT_HIGH + RIGHT_LOW + LEFT_HIGH to high dword of last result
XS.Add(XSRegisters.OldToNewRegister(RegistersEnum.EDX), XSRegisters.OldToNewRegister(RegistersEnum.ECX));

new Jump { DestinationLabel = MoveReturnValue };
XS.Jump(MoveReturnValue);

XS.Label(Simple32Multiply);
//mov RIGHT_LOW to eax
Expand Down

0 comments on commit 1dc41f1

Please sign in to comment.