-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoadStoreMultiple.cs
91 lines (82 loc) · 3.14 KB
/
LoadStoreMultiple.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace armsimGUI
{
/// <summary>
/// Class: LoadStoreMultiple
/// Inherits: Instruction
/// Purpose: Contains logic to load the register list of a Load/Store Multiple instruction
/// Methods: LoadStoreMultiple(uint)
/// LoadRegList()
/// </summary>
public class LoadStoreMultiple : Instruction
{
public bool P { get; private set; } // P bit
public bool U { get; private set; } // U bit
public bool B { get; private set; } // B bit
public bool W { get; private set; } // W bit
public bool L { get; private set; } // L bit
public uint regList { get; private set; } // list of registers to load
public LoadStoreMultiple(uint data)
{
instructionData = data;
isBranch = false;
}
public override void ExecuteInstruction(bool generateDisasm)
{
bool bit20 = Instruction.TestBit(this.instructionData, 20); // test bit 20
if (bit20) ops.LDMFD(this, generateDisasm);
else ops.STMFD(this, generateDisasm);
}
//--------------------------------------------------------------
// Purpose: Loads regList
// Returns: nothing
//--------------------------------------------------------------
internal override void LoadRegList()
{
regList = Memory.ExtractBits(instructionData, 0, 15);
}
//--------------------------------------------------------------
// Purpose: Loads the P property
// Returns: nothing
//--------------------------------------------------------------
internal override void LoadP()
{
P = Memory.TestFlagInData(instructionData, 24);
}
//--------------------------------------------------------------
// Purpose: Loads the B property
// Returns: nothing
//--------------------------------------------------------------
internal override void LoadB()
{
B = Memory.TestFlagInData(instructionData, 22);
}
//--------------------------------------------------------------
// Purpose: Loads the L property
// Returns: nothing
//--------------------------------------------------------------
internal override void LoadL()
{
L = Memory.TestFlagInData(instructionData, 20);
}
//--------------------------------------------------------------
// Purpose: Loads the U property
// Returns: nothing
//--------------------------------------------------------------
internal override void LoadU()
{
U = Memory.TestFlagInData(instructionData, 23);
}
//--------------------------------------------------------------
// Purpose: Loads the W property
// Returns: nothing
//--------------------------------------------------------------
internal override void LoadW()
{
W = Memory.TestFlagInData(instructionData, 21);
}
}
}