-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBranch.cs
44 lines (38 loc) · 1.32 KB
/
Branch.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace armsimGUI
{
public class Branch : Instruction
{
public bool LBit { get; private set; }
public int immediateVal { get; private set; }
public byte type { get; private set; }
public Branch(uint data)
{
this.instructionData = data;
isBranch = true;
}
public override void ExecuteInstruction(bool generateDisasm)
{
uint data = this.instructionData;
uint test = Memory.ExtractBits(this.instructionData, 20, 27);
if (type == 0x0a) ops.B(this, generateDisasm);
else if (type == 0x0b) ops.BL(this, generateDisasm);
else if (Memory.ExtractBits(this.instructionData, 20, 27) >> 20 == 0x12 && Memory.ExtractBits(this.instructionData, 4, 7) >> 4 == 0x01) ops.BX(this, generateDisasm);
}
public void LoadLBit(uint data)
{
LBit = Memory.TestFlagInData(data, 24);
}
internal override void LoadImmediateInt()
{
immediateVal = (int)Memory.ExtractBits(instructionData, 0, 23);
}
internal override void LoadType()
{
type = (byte)(Memory.ExtractBits(instructionData, 24, 27) >> 24);
}
}
}