Browse code

Add source code of the assembler compiler

Pawel Jablonski authored on 14/12/2022 19:04:16
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,73 @@
1
+/*
2
+ * Author: Pawel Jablonski
3
+ * E-mail: pj@xirx.net
4
+ * WWW: xirx.net
5
+ * GIT: git.xirx.net
6
+ *
7
+ * License: You can use this code however you like
8
+ * but leave information about the original author.
9
+ * Code is free for non-commercial and commercial use.
10
+ */
11
+
12
+#include "codesection.h"
13
+
14
+/**
15
+ * Constructor for creating a code section
16
+ *
17
+ * @param name Name of the code section
18
+ */
19
+CodeSection::CodeSection(const QString &name)
20
+{
21
+	this->name = name;
22
+	this->address = 0;
23
+}
24
+
25
+/**
26
+ * Add a code item to the code section
27
+ *
28
+ * @param codeItem Code item
29
+ */
30
+void CodeSection::addCodeItem(const QSharedPointer<CodeItem> &codeItem)
31
+{
32
+	this->codeItemList.append(codeItem);
33
+}
34
+
35
+/**
36
+ * Get the name of the code section
37
+ *
38
+ * @return Name of the code section
39
+ */
40
+const QString &CodeSection::getName() const
41
+{
42
+	return(this->name);
43
+}
44
+
45
+/**
46
+ * Get the code item list
47
+ *
48
+ * @return Code item list
49
+ */
50
+QList<QSharedPointer<CodeItem>> &CodeSection::getCodeItemList()
51
+{
52
+	return(this->codeItemList);
53
+}
54
+
55
+/**
56
+ * Set the address in the memory
57
+ *
58
+ * @param address Address in the memory
59
+ */
60
+void CodeSection::setAddress(unsigned int address)
61
+{
62
+	this->address = address;
63
+}
64
+
65
+/**
66
+ * Get the address in the memory
67
+ *
68
+ * @return Address in the memory
69
+ */
70
+unsigned int CodeSection::getAddress() const
71
+{
72
+	return(this->address);
73
+}