-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathemulator.cc
More file actions
47 lines (37 loc) · 1.17 KB
/
emulator.cc
File metadata and controls
47 lines (37 loc) · 1.17 KB
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
// This file is part of the PiEMU Project
// Licensing information can be found in the LICENSE file
// (C) 2014 Nandor Licker. All rights reserved.
#include "common.h"
// -----------------------------------------------------------------------------
Emulator::Emulator(const Args& args)
: args(args)
, mem(*this, args.ram, args.vram)
{
memset(&thumbState, 0, sizeof(THUMBState));
mem.LoadImage(args.image, 0);
thumbState.pc = 8;
}
// -----------------------------------------------------------------------------
Emulator::~Emulator()
{
}
// -----------------------------------------------------------------------------
void Emulator::Run()
{
ThumbExecute(this);
}
// -----------------------------------------------------------------------------
void Emulator::DumpTHUMB(std::ostream& os)
{
os << "THUMB State:" << std::endl;
for (int i = 0; i < 8; ++i)
{
os << "$r" << i << ": "
<< std::setfill('0') << std::setw(8) << std::hex
<< thumbState.r[i] << std::endl;
}
os << "N:" << (thumbState.n ? 1 : 0) << " "
<< "Z:" << (thumbState.z ? 1 : 0) << " "
<< "C:" << (thumbState.c ? 1 : 0) << " "
<< "V:" << (thumbState.v ? 1 : 0) << std::endl;
}