mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-21 13:28:41 +00:00
This commit is contained in:
parent
9032d256cb
commit
d9ccd387c5
5 changed files with 50 additions and 9 deletions
|
|
@ -8,6 +8,18 @@ using Indy.IL2CPU.Assembler.X86;
|
|||
namespace Indy.IL2CPU.Tests.Assembler.X86 {
|
||||
[TestFixture]
|
||||
public class MoveTests: BaseTest {
|
||||
/*
|
||||
* situations to cover:
|
||||
* immediate to memory indirect + byte (8bit, 16bit, 32bit)
|
||||
* immediate to memory indirect + dword (8bit, 16bit, 32bit)
|
||||
* register to memory indirect + byte (8bit, 16bit, 32bit)
|
||||
* register to memory indirect + dword (8bit, 16bit, 32bit)
|
||||
* immediate to memoryreg indirect + byte (8bit, 16bit, 32bit)
|
||||
* immediate to memoryreg indirect + dword (8bit, 16bit, 32bit)
|
||||
* register to memoryreg indirect + byte (8bit, 16bit, 32bit)
|
||||
* register to memoryreg indirect + dword (8bit, 16bit, 32bit)
|
||||
* register to register (8bit, 16bit, 32bit)
|
||||
*/
|
||||
[Test]
|
||||
public void TestImmediateToRegister32() {
|
||||
new Move { DestinationReg = Registers.EAX, SourceValue = 1 };
|
||||
|
|
@ -72,5 +84,18 @@ namespace Indy.IL2CPU.Tests.Assembler.X86 {
|
|||
new Move { Size = 16, DestinationReg = Registers.EBP, DestinationIsIndirect = true, SourceValue = 72 };
|
||||
Verify();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestImmediateToMemorySimple32() {
|
||||
new Move { Size = 32, DestinationReg = Registers.EAX, DestinationIsIndirect = true, SourceValue = 65 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EBX, DestinationIsIndirect = true, SourceValue = 66 };
|
||||
new Move { Size = 32, DestinationReg = Registers.ECX, DestinationIsIndirect = true, SourceValue = 67 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EDX, DestinationIsIndirect = true, SourceValue = 68 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EDI, DestinationIsIndirect = true, SourceValue = 69 };
|
||||
new Move { Size = 32, DestinationReg = Registers.ESI, DestinationIsIndirect = true, SourceValue = 70 };
|
||||
new Move { Size = 32, DestinationReg = Registers.ESP, DestinationIsIndirect = true, SourceValue = 71 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EBP, DestinationIsIndirect = true, SourceValue = 72 };
|
||||
Verify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
use32
|
||||
org 0x200000
|
||||
mov dword [EAX], 0x41
|
||||
mov dword [EBX], 0x42
|
||||
mov dword [ECX], 0x43
|
||||
mov dword [EDX], 0x44
|
||||
mov dword [EDI], 0x45
|
||||
mov dword [ESI], 0x46
|
||||
mov dword [ESP], 0x47
|
||||
mov dword [EBP], 0x48
|
||||
Binary file not shown.
|
|
@ -85,6 +85,12 @@
|
|||
<ItemGroup>
|
||||
<EmbeddedResource Include="Assembler\X86\VerificationData\MoveTests\ImmediateToMemorySimple16.bin" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Assembler\X86\VerificationData\MoveTests\ImmediateToMemorySimple32.asm" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Assembler\X86\VerificationData\MoveTests\ImmediateToMemorySimple32.bin" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#define BINARY
|
||||
//#define BINARY
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -12,14 +12,14 @@ namespace TestApp {
|
|||
class Program {
|
||||
class Renderer : Y86 {
|
||||
public void DoRender() {
|
||||
new Move { Size = 8, DestinationReg = Registers.EAX, DestinationIsIndirect = true, SourceValue = 65 };
|
||||
new Move { Size = 8, DestinationReg = Registers.EBX, DestinationIsIndirect = true, SourceValue = 66 };
|
||||
new Move { Size = 8, DestinationReg = Registers.ECX, DestinationIsIndirect = true, SourceValue = 67 };
|
||||
new Move { Size = 8, DestinationReg = Registers.EDX, DestinationIsIndirect = true, SourceValue = 68 };
|
||||
new Move { Size = 8, DestinationReg = Registers.EDI, DestinationIsIndirect = true, SourceValue = 69 };
|
||||
new Move { Size = 8, DestinationReg = Registers.ESI, DestinationIsIndirect = true, SourceValue = 70 };
|
||||
new Move { Size = 8, DestinationReg = Registers.ESP, DestinationIsIndirect = true, SourceValue = 71 };
|
||||
new Move { Size = 8, DestinationReg = Registers.EBP, DestinationIsIndirect = true, SourceValue = 72 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EAX, DestinationIsIndirect = true, SourceValue = 65 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EBX, DestinationIsIndirect = true, SourceValue = 66 };
|
||||
new Move { Size = 32, DestinationReg = Registers.ECX, DestinationIsIndirect = true, SourceValue = 67 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EDX, DestinationIsIndirect = true, SourceValue = 68 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EDI, DestinationIsIndirect = true, SourceValue = 69 };
|
||||
new Move { Size = 32, DestinationReg = Registers.ESI, DestinationIsIndirect = true, SourceValue = 70 };
|
||||
new Move { Size = 32, DestinationReg = Registers.ESP, DestinationIsIndirect = true, SourceValue = 71 };
|
||||
new Move { Size = 32, DestinationReg = Registers.EBP, DestinationIsIndirect = true, SourceValue = 72 };
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue