SUB() public method

SUB mem8,imm8
public SUB ( ByteMemory target, Byte source ) : void
target ByteMemory
source Byte
return void
Esempio n. 1
0
	public void SUB_rmreg32_reg32 ()
	{
		// SUB EDX, ESI
		// SUB (R32.EDX, R32.ESI)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R32.EDX, R32.ESI);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x29, 0xf2 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB EDX, ESI' failed.");
	}
Esempio n. 2
0
	public void SUB_rmreg8_imm8 ()
	{
		// SUB DH, 0x6
		// SUB (R8.DH, 0x6)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R8.DH, 0x6);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x80, 0xee, 0x6 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB DH, 0x6' failed.");
	}
Esempio n. 3
0
	public void SUB_rmreg8_reg8 ()
	{
		// SUB AH, AL
		// SUB (R8.AH, R8.AL)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R8.AH, R8.AL);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x28, 0xc4 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB AH, AL' failed.");
	}
Esempio n. 4
0
	public void SUB_rmreg16_reg16 ()
	{
		// SUB BX, SP
		// SUB (R16.BX, R16.SP)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R16.BX, R16.SP);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x66, 0x29, 0xe3 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB BX, SP' failed.");
	}
Esempio n. 5
0
	public void SUB_mem16_reg16 ()
	{
		// SUB [0x12345678], DX
		// SUB (new WordMemory(null, null, null, 0, 0x12345678), R16.DX)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new WordMemory (null, null, null, 0, 0x12345678), R16.DX);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x66, 0x29, 0x15, 0x78, 0x56, 0x34, 0x12 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB [0x12345678], DX' failed.");
	}
Esempio n. 6
0
	public void SUB_mem32_imm8 ()
	{
		// SUB DWord [ESP + ESI*2 + 0x12345678], 0x3
		// SUB (new DWordMemory(null, R32.ESP, R32.ESI, 1, 0x12345678), 0x3)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new DWordMemory (null, R32.ESP, R32.ESI, 1, 0x12345678), 0x3);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x83, 0xac, 0x74, 0x78, 0x56, 0x34, 0x12, 0x3 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB DWord [ESP + ESI*2 + 0x12345678], 0x3' failed.");
	}
Esempio n. 7
0
	public void SUB_mem16_imm16 ()
	{
		// SUB Word [DS:ESI*4 + 0x12345678], 0x396
		// SUB (new WordMemory(Seg.DS, null, R32.ESI, 2, 0x12345678), 0x396)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new WordMemory (Seg.DS, null, R32.ESI, 2, 0x12345678), 0x396);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x3e, 0x66, 0x81, 0x2c, 0xb5, 0x78, 0x56, 0x34, 0x12, 0x96, 0x3 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB Word [DS:ESI*4 + 0x12345678], 0x396' failed.");
	}
Esempio n. 8
0
	public void SUB_rmreg16_imm8 ()
	{
		// SUB SP, 0x8
		// SUB (R16.SP, 0x8)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R16.SP, 0x8);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x66, 0x83, 0xec, 0x8 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB SP, 0x8' failed.");
	}
Esempio n. 9
0
	public void SUB_reg32_mem32 ()
	{
		// SUB ECX, [DS:ECX + 0x12345678]
		// SUB (R32.ECX, new DWordMemory(Seg.DS, R32.ECX, null, 0, 0x12345678))
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R32.ECX, new DWordMemory (Seg.DS, R32.ECX, null, 0, 0x12345678));
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x3e, 0x2b, 0x89, 0x78, 0x56, 0x34, 0x12 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB ECX, [DS:ECX + 0x12345678]' failed.");
	}
Esempio n. 10
0
	public void SUB_mem8_imm8 ()
	{
		// SUB Byte [ECX*1 + 0x12345678], 0x2
		// SUB (new ByteMemory(null, null, R32.ECX, 0, 0x12345678), 0x2)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new ByteMemory (null, null, R32.ECX, 0, 0x12345678), 0x2);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x80, 0xa9, 0x78, 0x56, 0x34, 0x12, 0x2 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB Byte [ECX*1 + 0x12345678], 0x2' failed.");
	}
Esempio n. 11
0
	public void SUB_reg16_mem16 ()
	{
		// SUB CX, [CS:0x12345678]
		// SUB (R16.CX, new WordMemory(Seg.CS, null, null, 0, 0x12345678))
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R16.CX, new WordMemory (Seg.CS, null, null, 0, 0x12345678));
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x2e, 0x66, 0x2b, 0xd, 0x78, 0x56, 0x34, 0x12 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB CX, [CS:0x12345678]' failed.");
	}
Esempio n. 12
0
	public void SUB_reg8_mem8 ()
	{
		// SUB BH, [CS:ECX + 0x12345678]
		// SUB (R8.BH, new ByteMemory(Seg.CS, R32.ECX, null, 0, 0x12345678))
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R8.BH, new ByteMemory (Seg.CS, R32.ECX, null, 0, 0x12345678));
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x2e, 0x2a, 0xb9, 0x78, 0x56, 0x34, 0x12 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB BH, [CS:ECX + 0x12345678]' failed.");
	}
Esempio n. 13
0
	public void SUB_mem32_reg32 ()
	{
		// SUB [ESP + EDX*2 + 0x12345678], ESP
		// SUB (new DWordMemory(null, R32.ESP, R32.EDX, 1, 0x12345678), R32.ESP)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new DWordMemory (null, R32.ESP, R32.EDX, 1, 0x12345678), R32.ESP);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x29, 0xa4, 0x54, 0x78, 0x56, 0x34, 0x12 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB [ESP + EDX*2 + 0x12345678], ESP' failed.");
	}
Esempio n. 14
0
	public void SUB_rmreg16_imm16 ()
	{
		// SUB CX, 0xa8a
		// SUB (R16.CX, 0xa8a)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R16.CX, 0xa8a);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x66, 0x81, 0xe9, 0x8a, 0xa };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB CX, 0xa8a' failed.");
	}
Esempio n. 15
0
	public void SUB_mem32_imm32 ()
	{
		// SUB DWord [EDX + EDI*4 + 0x12345678], 0x435fcbf
		// SUB (new DWordMemory(null, R32.EDX, R32.EDI, 2, 0x12345678), 0x435fcbf)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new DWordMemory (null, R32.EDX, R32.EDI, 2, 0x12345678), 0x435fcbf);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x81, 0xac, 0xba, 0x78, 0x56, 0x34, 0x12, 0xbf, 0xfc, 0x35, 0x4 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB DWord [EDX + EDI*4 + 0x12345678], 0x435fcbf' failed.");
	}
Esempio n. 16
0
	public void SUB_rmreg32_imm32 ()
	{
		// SUB ESI, 0xbfdafd2
		// SUB (R32.ESI, 0xbfdafd2)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R32.ESI, 0xbfdafd2);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x81, 0xee, 0xd2, 0xaf, 0xfd, 0xb };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB ESI, 0xbfdafd2' failed.");
	}
Esempio n. 17
0
	public void SUB_mem16_imm8 ()
	{
		// SUB Word [DS:EAX*8], 0x7
		// SUB (new WordMemory(Seg.DS, null, R32.EAX, 3), 0x7)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new WordMemory (Seg.DS, null, R32.EAX, 3), 0x7);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x3e, 0x66, 0x83, 0x2c, 0xc5, 0x0, 0x0, 0x0, 0x0, 0x7 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB Word [DS:EAX*8], 0x7' failed.");
	}
Esempio n. 18
0
	public void SUB_rmreg32_imm8 ()
	{
		// SUB ECX, 0xb
		// SUB (R32.ECX, 0xb)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (R32.ECX, 0xb);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x83, 0xe9, 0xb };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB ECX, 0xb' failed.");
	}
Esempio n. 19
0
	public void SUB_mem8_reg8 ()
	{
		// SUB [FS:EDI*4 + 0x12345678], BL
		// SUB (new ByteMemory(Seg.FS, null, R32.EDI, 2, 0x12345678), R8.BL)
		MemoryStream memoryStream = new MemoryStream ();
		Assembly asm = new Assembly ();
		asm.SUB (new ByteMemory (Seg.FS, null, R32.EDI, 2, 0x12345678), R8.BL);
		asm.Encode (memoryStream);
		byte [] target = new byte [] { 0x64, 0x28, 0x1c, 0xbd, 0x78, 0x56, 0x34, 0x12 };
		Assert.IsTrue (CompareData (memoryStream, target), "'SUB [FS:EDI*4 + 0x12345678], BL' failed.");
	}