Browse code

Add source code of the uROM generator

Pawel Jablonski authored on 24/01/2021 21:45:08
Showing 14 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,328 @@
1
+# Doxyfile 1.8.16
2
+
3
+#---------------------------------------------------------------------------
4
+# Project related configuration options
5
+#---------------------------------------------------------------------------
6
+DOXYFILE_ENCODING      = UTF-8
7
+PROJECT_NAME           = "XiPU uROM Generator"
8
+PROJECT_NUMBER         =
9
+PROJECT_BRIEF          =
10
+PROJECT_LOGO           =
11
+OUTPUT_DIRECTORY       = 
12
+CREATE_SUBDIRS         = NO
13
+ALLOW_UNICODE_NAMES    = NO
14
+OUTPUT_LANGUAGE        = English
15
+OUTPUT_TEXT_DIRECTION  = None
16
+BRIEF_MEMBER_DESC      = YES
17
+REPEAT_BRIEF           = YES
18
+ABBREVIATE_BRIEF       =
19
+ALWAYS_DETAILED_SEC    = NO
20
+INLINE_INHERITED_MEMB  = NO
21
+FULL_PATH_NAMES        = NO
22
+STRIP_FROM_PATH        = 
23
+STRIP_FROM_INC_PATH    =
24
+SHORT_NAMES            = NO
25
+JAVADOC_AUTOBRIEF      = NO
26
+JAVADOC_BANNER         = NO
27
+QT_AUTOBRIEF           = NO
28
+MULTILINE_CPP_IS_BRIEF = NO
29
+INHERIT_DOCS           = YES
30
+SEPARATE_MEMBER_PAGES  = NO
31
+TAB_SIZE               = 4
32
+ALIASES                =
33
+OPTIMIZE_OUTPUT_FOR_C  = YES
34
+OPTIMIZE_OUTPUT_JAVA   = NO
35
+OPTIMIZE_FOR_FORTRAN   = NO
36
+OPTIMIZE_OUTPUT_VHDL   = NO
37
+OPTIMIZE_OUTPUT_SLICE  = NO
38
+EXTENSION_MAPPING      =
39
+MARKDOWN_SUPPORT       = NO
40
+TOC_INCLUDE_HEADINGS   =
41
+AUTOLINK_SUPPORT       = YES
42
+BUILTIN_STL_SUPPORT    = YES
43
+CPP_CLI_SUPPORT        = NO
44
+SIP_SUPPORT            = NO
45
+IDL_PROPERTY_SUPPORT   = YES
46
+DISTRIBUTE_GROUP_DOC   = NO
47
+GROUP_NESTED_COMPOUNDS = NO
48
+SUBGROUPING            = YES
49
+INLINE_GROUPED_CLASSES = NO
50
+INLINE_SIMPLE_STRUCTS  = NO
51
+TYPEDEF_HIDES_STRUCT   = NO
52
+LOOKUP_CACHE_SIZE      = 0
53
+#---------------------------------------------------------------------------
54
+# Build related configuration options
55
+#---------------------------------------------------------------------------
56
+EXTRACT_ALL            = YES
57
+EXTRACT_PRIVATE        = YES
58
+EXTRACT_PRIV_VIRTUAL   = NO
59
+EXTRACT_PACKAGE        = NO
60
+EXTRACT_STATIC         = YES
61
+EXTRACT_LOCAL_CLASSES  = YES
62
+EXTRACT_LOCAL_METHODS  = NO
63
+EXTRACT_ANON_NSPACES   = YES
64
+HIDE_UNDOC_MEMBERS     = NO
65
+HIDE_UNDOC_CLASSES     = NO
66
+HIDE_FRIEND_COMPOUNDS  = NO
67
+HIDE_IN_BODY_DOCS      = NO
68
+INTERNAL_DOCS          = NO
69
+CASE_SENSE_NAMES       = NO
70
+HIDE_SCOPE_NAMES       = NO
71
+HIDE_COMPOUND_REFERENCE= NO
72
+SHOW_INCLUDE_FILES     = YES
73
+SHOW_GROUPED_MEMB_INC  = YES
74
+FORCE_LOCAL_INCLUDES   = NO
75
+INLINE_INFO            = YES
76
+SORT_MEMBER_DOCS       = YES
77
+SORT_BRIEF_DOCS        = NO
78
+SORT_MEMBERS_CTORS_1ST = NO
79
+SORT_GROUP_NAMES       = NO
80
+SORT_BY_SCOPE_NAME     = NO
81
+STRICT_PROTO_MATCHING  = NO
82
+GENERATE_TODOLIST      = YES
83
+GENERATE_TESTLIST      = YES
84
+GENERATE_BUGLIST       = YES
85
+GENERATE_DEPRECATEDLIST= YES
86
+ENABLED_SECTIONS       =
87
+MAX_INITIALIZER_LINES  = 30
88
+SHOW_USED_FILES        = YES
89
+SHOW_FILES             = YES
90
+SHOW_NAMESPACES        = YES
91
+FILE_VERSION_FILTER    =
92
+LAYOUT_FILE            =
93
+CITE_BIB_FILES         =
94
+#---------------------------------------------------------------------------
95
+# Configuration options related to warning and progress messages
96
+#---------------------------------------------------------------------------
97
+QUIET                  = NO
98
+WARNINGS               = YES
99
+WARN_IF_UNDOCUMENTED   = YES
100
+WARN_IF_DOC_ERROR      = YES
101
+WARN_NO_PARAMDOC       = YES
102
+WARN_AS_ERROR          = YES
103
+WARN_FORMAT            = "$file:$line: $text "
104
+WARN_LOGFILE           = warnings.log
105
+#---------------------------------------------------------------------------
106
+# Configuration options related to the input files
107
+#---------------------------------------------------------------------------
108
+INPUT                  = ../src
109
+INPUT_ENCODING         = UTF-8
110
+FILE_PATTERNS          = *.h \
111
+                         *.cpp
112
+RECURSIVE              = NO
113
+EXCLUDE                =
114
+EXCLUDE_SYMLINKS       = NO
115
+EXCLUDE_PATTERNS       =
116
+EXCLUDE_SYMBOLS        =
117
+EXAMPLE_PATH           =
118
+EXAMPLE_PATTERNS       =
119
+EXAMPLE_RECURSIVE      = NO
120
+IMAGE_PATH             =
121
+INPUT_FILTER           =
122
+FILTER_PATTERNS        =
123
+FILTER_SOURCE_FILES    = NO
124
+FILTER_SOURCE_PATTERNS =
125
+USE_MDFILE_AS_MAINPAGE =
126
+#---------------------------------------------------------------------------
127
+# Configuration options related to source browsing
128
+#---------------------------------------------------------------------------
129
+SOURCE_BROWSER         = YES
130
+INLINE_SOURCES         = YES
131
+STRIP_CODE_COMMENTS    = NO
132
+REFERENCED_BY_RELATION = YES
133
+REFERENCES_RELATION    = YES
134
+REFERENCES_LINK_SOURCE = YES
135
+SOURCE_TOOLTIPS        = YES
136
+USE_HTAGS              = NO
137
+VERBATIM_HEADERS       = YES
138
+#---------------------------------------------------------------------------
139
+# Configuration options related to the alphabetical class index
140
+#---------------------------------------------------------------------------
141
+ALPHABETICAL_INDEX     = YES
142
+COLS_IN_ALPHA_INDEX    = 5
143
+IGNORE_PREFIX          =
144
+#---------------------------------------------------------------------------
145
+# Configuration options related to the HTML output
146
+#---------------------------------------------------------------------------
147
+GENERATE_HTML          = YES
148
+HTML_OUTPUT            =
149
+HTML_FILE_EXTENSION    = .html
150
+HTML_HEADER            =
151
+HTML_FOOTER            =
152
+HTML_STYLESHEET        =
153
+HTML_EXTRA_STYLESHEET  =
154
+HTML_EXTRA_FILES       =
155
+HTML_COLORSTYLE_HUE    = 220
156
+HTML_COLORSTYLE_SAT    = 100
157
+HTML_COLORSTYLE_GAMMA  = 80
158
+HTML_TIMESTAMP         = YES
159
+HTML_DYNAMIC_MENUS     = NO
160
+HTML_DYNAMIC_SECTIONS  = NO
161
+HTML_INDEX_NUM_ENTRIES = 100
162
+GENERATE_DOCSET        = NO
163
+DOCSET_FEEDNAME        = "Doxygen docs"
164
+DOCSET_BUNDLE_ID       = org.doxygen.Doxygen
165
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
166
+DOCSET_PUBLISHER_NAME  = Publisher
167
+GENERATE_HTMLHELP      = NO
168
+CHM_FILE               =
169
+HHC_LOCATION           =
170
+GENERATE_CHI           = NO
171
+CHM_INDEX_ENCODING     =
172
+BINARY_TOC             = NO
173
+TOC_EXPAND             = NO
174
+GENERATE_QHP           = NO
175
+QCH_FILE               =
176
+QHP_NAMESPACE          = org.doxygen.Project
177
+QHP_VIRTUAL_FOLDER     = doc
178
+QHP_CUST_FILTER_NAME   =
179
+QHP_CUST_FILTER_ATTRS  =
180
+QHP_SECT_FILTER_ATTRS  =
181
+QHG_LOCATION           =
182
+GENERATE_ECLIPSEHELP   = NO
183
+ECLIPSE_DOC_ID         = org.doxygen.Project
184
+DISABLE_INDEX          = NO
185
+GENERATE_TREEVIEW      = YES
186
+ENUM_VALUES_PER_LINE   = 4
187
+TREEVIEW_WIDTH         = 250
188
+EXT_LINKS_IN_WINDOW    = NO
189
+FORMULA_FONTSIZE       = 10
190
+FORMULA_TRANSPARENT    = YES
191
+USE_MATHJAX            = NO
192
+MATHJAX_FORMAT         = HTML-CSS
193
+MATHJAX_RELPATH        =
194
+MATHJAX_EXTENSIONS     =
195
+MATHJAX_CODEFILE       =
196
+SEARCHENGINE           = NO
197
+SERVER_BASED_SEARCH    = NO
198
+EXTERNAL_SEARCH        = NO
199
+SEARCHENGINE_URL       =
200
+SEARCHDATA_FILE        = searchdata.xml
201
+EXTERNAL_SEARCH_ID     =
202
+EXTRA_SEARCH_MAPPINGS  =
203
+#---------------------------------------------------------------------------
204
+# Configuration options related to the LaTeX output
205
+#---------------------------------------------------------------------------
206
+GENERATE_LATEX         = NO
207
+LATEX_OUTPUT           = latex
208
+LATEX_CMD_NAME         =
209
+MAKEINDEX_CMD_NAME     = makeindex
210
+LATEX_MAKEINDEX_CMD    = makeindex
211
+COMPACT_LATEX          = NO
212
+PAPER_TYPE             = a4
213
+EXTRA_PACKAGES         =
214
+LATEX_HEADER           =
215
+LATEX_FOOTER           =
216
+LATEX_EXTRA_STYLESHEET =
217
+LATEX_EXTRA_FILES      =
218
+PDF_HYPERLINKS         = YES
219
+USE_PDFLATEX           = YES
220
+LATEX_BATCHMODE        = NO
221
+LATEX_HIDE_INDICES     = NO
222
+LATEX_SOURCE_CODE      = NO
223
+LATEX_BIB_STYLE        = plain
224
+LATEX_TIMESTAMP        = NO
225
+LATEX_EMOJI_DIRECTORY  =
226
+#---------------------------------------------------------------------------
227
+# Configuration options related to the RTF output
228
+#---------------------------------------------------------------------------
229
+GENERATE_RTF           = NO
230
+RTF_OUTPUT             =
231
+COMPACT_RTF            = NO
232
+RTF_HYPERLINKS         = NO
233
+RTF_STYLESHEET_FILE    =
234
+RTF_EXTENSIONS_FILE    =
235
+RTF_SOURCE_CODE        = NO
236
+#---------------------------------------------------------------------------
237
+# Configuration options related to the man page output
238
+#---------------------------------------------------------------------------
239
+GENERATE_MAN           = NO
240
+MAN_OUTPUT             =
241
+MAN_EXTENSION          = .3
242
+MAN_SUBDIR             =
243
+MAN_LINKS              = NO
244
+#---------------------------------------------------------------------------
245
+# Configuration options related to the XML output
246
+#---------------------------------------------------------------------------
247
+GENERATE_XML           = NO
248
+XML_OUTPUT             = xml
249
+XML_PROGRAMLISTING     = YES
250
+XML_NS_MEMB_FILE_SCOPE = NO
251
+#---------------------------------------------------------------------------
252
+# Configuration options related to the DOCBOOK output
253
+#---------------------------------------------------------------------------
254
+GENERATE_DOCBOOK       = NO
255
+DOCBOOK_OUTPUT         = docbook
256
+DOCBOOK_PROGRAMLISTING = NO
257
+#---------------------------------------------------------------------------
258
+# Configuration options for the AutoGen Definitions output
259
+#---------------------------------------------------------------------------
260
+GENERATE_AUTOGEN_DEF   = NO
261
+#---------------------------------------------------------------------------
262
+# Configuration options related to the Perl module output
263
+#---------------------------------------------------------------------------
264
+GENERATE_PERLMOD       = NO
265
+PERLMOD_LATEX          = NO
266
+PERLMOD_PRETTY         = YES
267
+PERLMOD_MAKEVAR_PREFIX =
268
+#---------------------------------------------------------------------------
269
+# Configuration options related to the preprocessor
270
+#---------------------------------------------------------------------------
271
+ENABLE_PREPROCESSING   = YES
272
+MACRO_EXPANSION        = YES
273
+EXPAND_ONLY_PREDEF     = YES
274
+SEARCH_INCLUDES        = YES
275
+INCLUDE_PATH           = qtools \
276
+                         libmd5 \
277
+                         liblodepng \
278
+                         libmscgen
279
+INCLUDE_FILE_PATTERNS  =
280
+PREDEFINED             =
281
+EXPAND_AS_DEFINED      =
282
+SKIP_FUNCTION_MACROS   = YES
283
+#---------------------------------------------------------------------------
284
+# Configuration options related to external references
285
+#---------------------------------------------------------------------------
286
+TAGFILES               = qtools_docs/qtools.tag=../../qtools_docs/html
287
+GENERATE_TAGFILE       = doxygen.tag
288
+ALLEXTERNALS           = NO
289
+EXTERNAL_GROUPS        = YES
290
+EXTERNAL_PAGES         = YES
291
+#---------------------------------------------------------------------------
292
+# Configuration options related to the dot tool
293
+#---------------------------------------------------------------------------
294
+CLASS_DIAGRAMS         = YES
295
+DIA_PATH               =
296
+HIDE_UNDOC_RELATIONS   = NO
297
+HAVE_DOT               = YES
298
+DOT_NUM_THREADS        = 0
299
+DOT_FONTNAME           = Helvetica
300
+DOT_FONTSIZE           = 10
301
+DOT_FONTPATH           =
302
+CLASS_GRAPH            = YES
303
+COLLABORATION_GRAPH    = YES
304
+GROUP_GRAPHS           = YES
305
+UML_LOOK               = NO
306
+UML_LIMIT_NUM_FIELDS   = 10
307
+TEMPLATE_RELATIONS     = YES
308
+INCLUDE_GRAPH          = YES
309
+INCLUDED_BY_GRAPH      = YES
310
+CALL_GRAPH             = YES
311
+CALLER_GRAPH           = YES
312
+GRAPHICAL_HIERARCHY    = YES
313
+DIRECTORY_GRAPH        = YES
314
+DOT_IMAGE_FORMAT       = svg
315
+INTERACTIVE_SVG        = YES
316
+DOT_PATH               =
317
+DOTFILE_DIRS           =
318
+MSCFILE_DIRS           =
319
+DIAFILE_DIRS           =
320
+PLANTUML_JAR_PATH      =
321
+PLANTUML_CFG_FILE      =
322
+PLANTUML_INCLUDE_PATH  =
323
+DOT_GRAPH_MAX_NODES    = 100
324
+MAX_DOT_GRAPH_DEPTH    = 0
325
+DOT_TRANSPARENT        = NO
326
+DOT_MULTI_TARGETS      = NO
327
+GENERATE_LEGEND        = YES
328
+DOT_CLEANUP            = NO
0 329
new file mode 100644
... ...
@@ -0,0 +1,11 @@
1
+DOC_DIR = html
2
+DOC_TAG = doxygen.tag
3
+DOC_LOG = warnings.log
4
+
5
+all: clean
6
+	doxygen Doxyfile
7
+
8
+clean:
9
+	rm -rf $(DOC_DIR)
10
+	rm -f $(DOC_TAG)
11
+	rm -f $(DOC_LOG)
0 12
new file mode 100644
... ...
@@ -0,0 +1,127 @@
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 "instruction.h"
13
+
14
+//! Default constructor for creating an empty instruction
15
+Instruction::Instruction()
16
+{
17
+	this->opcode = 0;
18
+
19
+	this->arg0 = Arg::None;
20
+	this->arg1 = Arg::None;
21
+	this->arg2 = Arg::None;
22
+
23
+	this->c = Flag::Any;
24
+	this->z = Flag::Any;
25
+}
26
+
27
+/**
28
+ * Constructor using for create an instruction with a defined opcode
29
+ *
30
+ * @param opCode Opcode number
31
+ * @param arg0 First argument type
32
+ * @param arg1 Second argument type
33
+ * @param arg2 Third argument type
34
+ * @param c Which status of the carry flag is accepted
35
+ * @param z Which status of the zero flag is accepted
36
+ */
37
+Instruction::Instruction(unsigned char opcode, Arg arg0, Arg arg1, Arg arg2, Flag c, Flag z)
38
+{
39
+	this->opcode = opcode;
40
+
41
+	this->arg0 = arg0;
42
+	this->arg1 = arg1;
43
+	this->arg2 = arg2;
44
+
45
+	this->c = c;
46
+	this->z = z;
47
+}
48
+
49
+/**
50
+ * Add step to the step list of the instruction
51
+ *
52
+ * @param step Single step of the instruction
53
+ */
54
+void Instruction::addStep(const Step &step)
55
+{
56
+	this->stepList.append(step);
57
+}
58
+
59
+/**
60
+ * Get an opcode number of the instruction
61
+ *
62
+ * @return Opcode of the instruction
63
+ */
64
+unsigned char Instruction::getOpcode() const
65
+{
66
+	return(this->opcode);
67
+}
68
+
69
+/**
70
+ * Get a first argument type of the instruction
71
+ *
72
+ * @return Argument type
73
+ */
74
+Instruction::Arg Instruction::getArg0() const
75
+{
76
+	return(this->arg0);
77
+}
78
+
79
+/**
80
+ * Get a second argument type of the instruction
81
+ *
82
+ * @return Argument type
83
+ */
84
+Instruction::Arg Instruction::getArg1() const
85
+{
86
+	return(this->arg1);
87
+}
88
+
89
+/**
90
+ * Get a third argument type of the instruction
91
+ *
92
+ * @return Argument type
93
+ */
94
+Instruction::Arg Instruction::getArg2() const
95
+{
96
+	return(this->arg2);
97
+}
98
+
99
+/**
100
+ * Get a status of accepting the carry flag
101
+ *
102
+ * @return Accepting status of the carry flag
103
+ */
104
+Instruction::Flag Instruction::getC() const
105
+{
106
+	return(this->c);
107
+}
108
+
109
+/**
110
+ * Get a status of accepting the zero flag
111
+ *
112
+ * @return Accepting status of the zero flag
113
+ */
114
+Instruction::Flag Instruction::getZ() const
115
+{
116
+	return(this->z);
117
+}
118
+
119
+/**
120
+ * Get a step list of the instruction
121
+ *
122
+ * @return Step list of the instruction
123
+ */
124
+const QList<Step> &Instruction::getStepList() const
125
+{
126
+	return(this->stepList);
127
+}
0 128
new file mode 100644
... ...
@@ -0,0 +1,70 @@
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
+#ifndef INSTRUCTION_H
13
+#define INSTRUCTION_H
14
+
15
+#include <QList>
16
+
17
+#include "step.h"
18
+
19
+//! This class contains atomic steps for the control unit of defined instruction
20
+class Instruction
21
+{
22
+	public:
23
+		//! Definitions of the instruction argument types
24
+		enum class Arg
25
+		{
26
+			None, //!< Not argument
27
+			ABXY, //!< Main and auxiliary registers
28
+			AB, //!< Only main registers
29
+			Val256, //!< 8 bit unsigned value
30
+			Addr //!< 16 bit unsigned address
31
+		};
32
+
33
+		//! Tristate flag definition for carry and zero control bits
34
+		enum class Flag
35
+		{
36
+			Disable, //!< Only accept the disable value
37
+			Enable, //!< Only accept the enable value
38
+			Any //!< Accept both values
39
+		};
40
+
41
+		Instruction();
42
+		Instruction(unsigned char opcode, Arg arg0 = Arg::None, Arg arg1 = Arg::None, Arg arg2 = Arg::None, Flag c = Flag::Any, Flag z = Flag::Any);
43
+
44
+		void addStep(const Step &step);
45
+
46
+		unsigned char getOpcode() const;
47
+
48
+		Arg getArg0() const;
49
+		Arg getArg1() const;
50
+		Arg getArg2() const;
51
+
52
+		Flag getC() const;
53
+		Flag getZ() const;
54
+
55
+		const QList<Step> &getStepList() const;
56
+
57
+	private:
58
+		unsigned char opcode; //!< Opcode of defined instruction
59
+
60
+		Arg arg0; //!< First argument type
61
+		Arg arg1; //!< Second argument type
62
+		Arg arg2; //!< Third argument type
63
+
64
+		Flag c; //!< Carry flag accept status
65
+		Flag z; //!< Zero flag accept status
66
+
67
+		QList<Step> stepList; //!< Atomic list of steps for the control unit
68
+};
69
+
70
+#endif
0 71
new file mode 100644
... ...
@@ -0,0 +1,43 @@
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 <QCoreApplication>
13
+#include <QTextStream>
14
+
15
+#include "urom.h"
16
+
17
+static QString const UROM0_PATH = "urom0.bin"; //!< Path to the first microcode output file
18
+static QString const UROM1_PATH = "urom1.bin"; //!< Path to the second microcode output file
19
+
20
+//! Main entry function of the application
21
+int main(int, char **)
22
+{
23
+	QTextStream out(stdout);
24
+
25
+	// Create and generate the microcode
26
+	URom uRom = URom();
27
+
28
+	// Try to save the data to the output files
29
+	if(!uRom.saveFiles(UROM0_PATH, UROM1_PATH))
30
+	{
31
+		// If failed show the error message
32
+		out << "ERROR: Failed to save uROM data\n";
33
+
34
+		// Return the error code
35
+		return(-1);
36
+	}
37
+
38
+	// The data files were saved. Show the success message
39
+	out << "OK: uROM data has been saved successfully\n";
40
+
41
+	// Return the success code
42
+	return(0);
43
+}
0 44
new file mode 100644
... ...
@@ -0,0 +1,49 @@
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 "step.h"
13
+
14
+/**
15
+ * Step constructor
16
+ *
17
+ * @param busAR Which line of the main reading data bus is selected
18
+ * @param busAW Which line of the main writing data bus is selected
19
+ * @param busB Which line of the secondary reading data bus is selected
20
+ * @param busC Which line of the addressing data bus is selected
21
+ * @param aluS Seleted bits for ALU_S flags
22
+ * @param aluM Seleted bit for ALU_M flag
23
+ * @param aluC Seleted bit for ALU_C flag
24
+ */
25
+Step::Step(BusAR busAR, BusAW busAW, BusB busB, BusC busC, unsigned char aluS, bool aluM, bool aluC)
26
+{
27
+	QVector<unsigned char> code = { 0, 0 };
28
+
29
+	code[0] |= (static_cast<unsigned char>(busAR) << CODE_0_BUS_AR_POSITION);
30
+	code[0] |= (static_cast<unsigned char>(busAW) << CODE_0_BUS_AW_POSITION);
31
+	code[0] |= (static_cast<unsigned char>(busB) << CODE_0_BUS_B_POSITION);
32
+
33
+	code[1] |= (static_cast<unsigned char>(busC) << CODE_1_BUS_C_POSITION);
34
+	code[1] |= ((aluS & CODE_FLAG_S_MASK) << CODE_1_FLAG_S_POSITION);
35
+	code[1] |= ((aluM ? 1 : 0) << CODE_1_FLAG_M_POSITION);
36
+	code[1] |= ((aluC ? 1 : 0) << CODE_1_FLAG_C_POSITION);
37
+
38
+	this->uCode = UCode(code[0], code[1]);
39
+}
40
+
41
+/**
42
+ * Get a parsed microcode for the current step
43
+ *
44
+ * @return Parsed microcode
45
+ */
46
+const UCode &Step::getUCode() const
47
+{
48
+	return(this->uCode);
49
+}
0 50
new file mode 100644
... ...
@@ -0,0 +1,98 @@
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
+#ifndef STEP_H
13
+#define STEP_H
14
+
15
+#include <QVector>
16
+
17
+#include "ucode.h"
18
+
19
+/**
20
+ * This class contains a single step of the instruction.
21
+ * It is a raw describe how to set control lines for the step.
22
+ */
23
+class Step
24
+{
25
+	public:
26
+		static const int CODE_0_BUS_AR_POSITION = 0; //!< Position of bits for the main reading data bus
27
+		static const int CODE_0_BUS_AW_POSITION = 3; //!< Position of bits for the main writing data bus
28
+		static const int CODE_0_BUS_B_POSITION = 7; //!< Position of bits for the secondary reading data bus
29
+
30
+		static const int CODE_1_BUS_C_POSITION = 0; //!< Position of bits for the addressing data bus
31
+		static const int CODE_1_FLAG_S_POSITION = 2; //!< Position of bits for the ALU_S flags
32
+		static const int CODE_1_FLAG_M_POSITION = 6; //!< Position of bit for the ALU_M flag
33
+		static const int CODE_1_FLAG_C_POSITION = 7; //!< Position of bit for the ALU_C flag
34
+
35
+		static const int CODE_FLAG_S_MASK = 0x0f; //!< Mask for ALU_S flags
36
+
37
+		//! Line select defines for the main reading data bus
38
+		enum class BusAR
39
+		{
40
+			ABXY = 0, //!< Main and auxiliary registers
41
+			D, //!< Hidden data register
42
+			IN, //!< Input register
43
+			T, //!< ALU temp register
44
+			Ram, //!< RAM access
45
+			Flash, //!< FLASH access
46
+			PCL, //!< Program Counter Low register
47
+			PCH, //!< Program Counter High register
48
+			Default = 0
49
+		};
50
+
51
+		//! Line select defines for the main writing data bus
52
+		enum class BusAW
53
+		{
54
+			None = 0, //!< Not selected
55
+			ABXY, //!< Main and auxiliary registers
56
+			D, //!< Hidden data register
57
+			OUT, //!< Output register
58
+			ALU_T, //!< ALU operation
59
+			RPC, //!< Reset Program Counter
60
+			I, //!< Instruction register
61
+			Ram, //!< RAM access
62
+			PCL, //!< Program Counter Low register
63
+			PCH, //!< Program Counter High register
64
+			MAL, //!< Memory Address Low register
65
+			MAH, //!< Memory Address High register
66
+			PC_PLUS, //!< Increse Program Counter
67
+			SP_PLUS, //!< Increse Stack Pointer
68
+			SP_MINUS, //!< Decrese Stack Pointer
69
+			RPC_PLUS //!< Reset the step counter and increse Program Counter
70
+		};
71
+
72
+		//! Line select defines for the secondary reading data bus
73
+		enum class BusB
74
+		{
75
+			AB = 0, //!< Main registers
76
+			D, //!< Hidden data register
77
+			Default = 0
78
+		};
79
+
80
+		//! Line select defines for the addressing data bus
81
+		enum class BusC
82
+		{
83
+			PC = 0, //!< Full 16 bit Program Counter register
84
+			MA, //!< Full 16 bit Memory Address register
85
+			SP, //!< Full 16 bit Stack Pointer register
86
+			XY, //!< Full 16 bit auxiliary register
87
+			Default = 0
88
+		};
89
+
90
+		Step(BusAR busAR, BusAW busAW, BusB busB = BusB::Default, BusC busC = BusC::Default, unsigned char aluS = 0, bool aluM = false, bool aluC = false);
91
+
92
+		const UCode &getUCode() const;
93
+
94
+	private:
95
+		UCode uCode; //!< Parsed microcode for the current step
96
+};
97
+
98
+#endif
0 99
new file mode 100644
... ...
@@ -0,0 +1,54 @@
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 "ucode.h"
13
+
14
+/**
15
+ * Default constructor.
16
+ * It creates an object filled by zeros
17
+ */
18
+UCode::UCode()
19
+{
20
+	this->code[0] = 0;
21
+	this->code[1] = 0;
22
+}
23
+
24
+/**
25
+ * Constructor using for create a parsed microcode of the single step based on an input data
26
+ *
27
+ * @param code0 Low parsed microcode part
28
+ * @param code1 High parsed microcode part
29
+ */
30
+UCode::UCode(unsigned char code0, unsigned char code1)
31
+{
32
+	this->code[0] = code0;
33
+	this->code[1] = code1;
34
+}
35
+
36
+/**
37
+ * Get a value of the low microcode part
38
+ *
39
+ * @return Low microcode part
40
+ */
41
+unsigned char UCode::getCode0() const
42
+{
43
+	return(this->code[0]);
44
+}
45
+
46
+/**
47
+ * Get a value of the high microcode part
48
+ *
49
+ * @return High microcode part
50
+ */
51
+unsigned char UCode::getCode1() const
52
+{
53
+	return(this->code[1]);
54
+}
0 55
new file mode 100644
... ...
@@ -0,0 +1,31 @@
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
+#ifndef UCODE_H
13
+#define UCODE_H
14
+
15
+#include <QVector>
16
+
17
+//! This class contains a parsed microcode of the single step
18
+class UCode
19
+{
20
+	public:
21
+		UCode();
22
+		UCode(unsigned char code0, unsigned char code1);
23
+
24
+		unsigned char getCode0() const;
25
+		unsigned char getCode1() const;
26
+
27
+	private:
28
+		QVector<unsigned char> code = QVector<unsigned char>(2); //!< Low and high bytes of the microcode
29
+};
30
+
31
+#endif
0 32
new file mode 100644
... ...
@@ -0,0 +1,893 @@
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 "urom.h"
13
+
14
+//! Default constructor for creating an uROM. Generating a full instrution set.
15
+URom::URom()
16
+{
17
+	Instruction instruction;
18
+
19
+	// LOAD_I + RPC+1 // ======================================================
20
+
21
+	// NOP
22
+	// Fill whole instruction table as default
23
+	for(unsigned int i = 0; i < URomData::INSTRUCTION_QUANTITY; i++)
24
+	{
25
+		instruction = Instruction(static_cast<unsigned char>(i));
26
+		instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
27
+		instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
28
+		this->uRomData.addInstruction(instruction);
29
+	}
30
+
31
+	// LOAD_I + RPC // ========================================================
32
+
33
+	// HALT
34
+	instruction = Instruction(0b11111111);
35
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
36
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
37
+	this->uRomData.addInstruction(instruction);
38
+
39
+	// LOAD_I + STORE + RPC+1 // ==============================================
40
+
41
+	// LDF reg
42
+	instruction = Instruction(0b00000100, Instruction::Arg::ABXY);
43
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
44
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::ABXY, Step::BusB::Default, Step::BusC::XY));
45
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
46
+	this->uRomData.addInstruction(instruction);
47
+
48
+	// LDR reg
49
+	instruction = Instruction(0b00001000, Instruction::Arg::ABXY);
50
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
51
+	instruction.addStep(Step(Step::BusAR::Ram, Step::BusAW::ABXY, Step::BusB::Default, Step::BusC::XY));
52
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
53
+	this->uRomData.addInstruction(instruction);
54
+
55
+	// STR reg
56
+	instruction = Instruction(0b00001100, Instruction::Arg::ABXY);
57
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
58
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::XY));
59
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
60
+	this->uRomData.addInstruction(instruction);
61
+
62
+	// MOV reg, reg
63
+	instruction = Instruction(0b10000000, Instruction::Arg::ABXY, Instruction::Arg::ABXY);
64
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
65
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ABXY));
66
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
67
+	this->uRomData.addInstruction(instruction);
68
+
69
+	// IN reg
70
+	instruction = Instruction(0b00010000, Instruction::Arg::ABXY);
71
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
72
+	instruction.addStep(Step(Step::BusAR::IN, Step::BusAW::ABXY));
73
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
74
+	this->uRomData.addInstruction(instruction);
75
+
76
+	// OUT reg
77
+	instruction = Instruction(0b00010100, Instruction::Arg::ABXY);
78
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
79
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::OUT));
80
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
81
+	this->uRomData.addInstruction(instruction);
82
+
83
+	// LOAD_I + ALU + RPC+1 // ================================================
84
+
85
+	// CMP reg, reg
86
+	instruction = Instruction(0b11100000, Instruction::Arg::AB, Instruction::Arg::ABXY);
87
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
88
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b0110, false, true));
89
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
90
+	this->uRomData.addInstruction(instruction);
91
+
92
+	// LOAD_I + ALU + STORE + RPC+1 // ========================================
93
+
94
+	// INC reg
95
+	instruction = Instruction(0b00011000, Instruction::Arg::ABXY);
96
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
97
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
98
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
99
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
100
+	this->uRomData.addInstruction(instruction);
101
+
102
+	// INCC reg
103
+	instruction = Instruction(0b01110000, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Disable);
104
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
105
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
106
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
107
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
108
+	this->uRomData.addInstruction(instruction);
109
+
110
+	instruction = Instruction(0b01110000, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Enable);
111
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
112
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, true));
113
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
114
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
115
+	this->uRomData.addInstruction(instruction);
116
+
117
+	// DEC reg
118
+	instruction = Instruction(0b00011100, Instruction::Arg::ABXY);
119
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
120
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1111, false, true));
121
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
122
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
123
+	this->uRomData.addInstruction(instruction);
124
+
125
+	// DECC reg
126
+	instruction = Instruction(0b01110100, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Disable);
127
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
128
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1111, false, false));
129
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
130
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
131
+	this->uRomData.addInstruction(instruction);
132
+
133
+	instruction = Instruction(0b01110100, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Enable);
134
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
135
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1111, false, true));
136
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
137
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
138
+	this->uRomData.addInstruction(instruction);
139
+
140
+	// NOT reg
141
+	instruction = Instruction(0b00100000, Instruction::Arg::ABXY);
142
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
143
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, true, false));
144
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
145
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
146
+	this->uRomData.addInstruction(instruction);
147
+
148
+	// ADD reg, reg
149
+	instruction = Instruction(0b10010000, Instruction::Arg::AB, Instruction::Arg::ABXY);
150
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
151
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b1001, false, true));
152
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
153
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
154
+	this->uRomData.addInstruction(instruction);
155
+
156
+	// ADDC reg, reg
157
+	instruction = Instruction(0b10011000, Instruction::Arg::AB, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Flag::Disable);
158
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
159
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b1001, false, false));
160
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
161
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
162
+	this->uRomData.addInstruction(instruction);
163
+
164
+	instruction = Instruction(0b10011000, Instruction::Arg::AB, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Flag::Enable);
165
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
166
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b1001, false, true));
167
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
168
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
169
+	this->uRomData.addInstruction(instruction);
170
+
171
+	// SUB reg, reg
172
+	instruction = Instruction(0b10100000, Instruction::Arg::AB, Instruction::Arg::ABXY);
173
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
174
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b0110, false, false));
175
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
176
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
177
+	this->uRomData.addInstruction(instruction);
178
+
179
+	// SUBC reg, reg
180
+	instruction = Instruction(0b10101000, Instruction::Arg::AB, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Flag::Disable);
181
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
182
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b0110, false, false));
183
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
184
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
185
+	this->uRomData.addInstruction(instruction);
186
+
187
+	instruction = Instruction(0b10101000, Instruction::Arg::AB, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Flag::Enable);
188
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
189
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b0110, false, true));
190
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
191
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
192
+	this->uRomData.addInstruction(instruction);
193
+
194
+	// AND reg, reg
195
+	instruction = Instruction(0b10110000, Instruction::Arg::AB, Instruction::Arg::ABXY);
196
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
197
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b1011, true, false));
198
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
199
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
200
+	this->uRomData.addInstruction(instruction);
201
+
202
+	// OR reg, reg
203
+	instruction = Instruction(0b10111000, Instruction::Arg::AB, Instruction::Arg::ABXY);
204
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
205
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b1110, true, false));
206
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
207
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
208
+	this->uRomData.addInstruction(instruction);
209
+
210
+	// XOR reg, reg
211
+	instruction = Instruction(0b11000000, Instruction::Arg::AB, Instruction::Arg::ABXY);
212
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
213
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b0110, true, false));
214
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
215
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
216
+	this->uRomData.addInstruction(instruction);
217
+
218
+	// SHL reg
219
+	instruction = Instruction(0b01111000, Instruction::Arg::ABXY);
220
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
221
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
222
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
223
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
224
+	this->uRomData.addInstruction(instruction);
225
+
226
+	// CLR reg
227
+	instruction = Instruction(0b11001000, Instruction::Arg::ABXY);
228
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
229
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0011, false, false));
230
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
231
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
232
+	this->uRomData.addInstruction(instruction);
233
+
234
+	// LOAD_I + 8x ALU + STORE + RPC+1 // =====================================
235
+
236
+	// SHR reg
237
+	instruction = Instruction(0b01111100, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Disable);
238
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
239
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
240
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
241
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
242
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
243
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
244
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
245
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
246
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
247
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
248
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
249
+	this->uRomData.addInstruction(instruction);
250
+
251
+	instruction = Instruction(0b01111100, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Enable);
252
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
253
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
254
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
255
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
256
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
257
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
258
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
259
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
260
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
261
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
262
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
263
+	this->uRomData.addInstruction(instruction);
264
+
265
+	// SWAP reg
266
+	instruction = Instruction(0b01101100, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Disable);
267
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
268
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
269
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
270
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
271
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
272
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
273
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
274
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, false));
275
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
276
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
277
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
278
+	this->uRomData.addInstruction(instruction);
279
+
280
+	instruction = Instruction(0b01101100, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Enable);
281
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
282
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
283
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, true));
284
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
285
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, true));
286
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
287
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, true));
288
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1100, false, true));
289
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, true));
290
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
291
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
292
+	this->uRomData.addInstruction(instruction);
293
+
294
+	// LOAD_I + PC+1 + STORE + RPC+1 // =======================================
295
+
296
+	// MOV val, reg
297
+	instruction = Instruction(0b00100100, Instruction::Arg::Val256, Instruction::Arg::ABXY);
298
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
299
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
300
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::ABXY));
301
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
302
+	this->uRomData.addInstruction(instruction);
303
+
304
+	// OUT val
305
+	instruction = Instruction(0b00000010, Instruction::Arg::Val256);
306
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
307
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
308
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::OUT));
309
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
310
+	this->uRomData.addInstruction(instruction);
311
+
312
+	// LOAD_I + PC+1 + LOAD_D + STORE + RPC+1 // ===============================
313
+
314
+	// STR val
315
+	instruction = Instruction(0b00000001, Instruction::Arg::Val256);
316
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
317
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
318
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
319
+	instruction.addStep(Step(Step::BusAR::D, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::XY));
320
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
321
+	this->uRomData.addInstruction(instruction);
322
+
323
+	// LOAD_I + PC+1 + LOAD_D + ALU + RPC+1 // ================================
324
+
325
+	// CMP val, reg
326
+	instruction = Instruction(0b00101000, Instruction::Arg::Val256, Instruction::Arg::ABXY);
327
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
328
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
329
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
330
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b0110, false, true));
331
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
332
+	this->uRomData.addInstruction(instruction);
333
+
334
+	// LOAD_I + PC+1 + LOAD_D + ALU + STORE + RPC+1 // ========================
335
+
336
+	// ADD val, reg
337
+	instruction = Instruction(0b00101100, Instruction::Arg::Val256, Instruction::Arg::ABXY);
338
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
339
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
340
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
341
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b1001, false, true));
342
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
343
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
344
+	this->uRomData.addInstruction(instruction);
345
+
346
+	// ADDC val, reg
347
+	instruction = Instruction(0b00110000, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Disable);
348
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
349
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
350
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
351
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b1001, false, false));
352
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
353
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
354
+	this->uRomData.addInstruction(instruction);
355
+
356
+	instruction = Instruction(0b00110000, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Enable);
357
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
358
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
359
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
360
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b1001, false, true));
361
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
362
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
363
+	this->uRomData.addInstruction(instruction);
364
+
365
+	// SUB val, reg
366
+	instruction = Instruction(0b00110100, Instruction::Arg::Val256, Instruction::Arg::ABXY);
367
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
368
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
369
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
370
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b0110, false, false));
371
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
372
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
373
+	this->uRomData.addInstruction(instruction);
374
+
375
+	// SUBC val, reg
376
+	instruction = Instruction(0b00111000, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Disable);
377
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
378
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
379
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
380
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b0110, false, false));
381
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
382
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
383
+	this->uRomData.addInstruction(instruction);
384
+
385
+	instruction = Instruction(0b00111000, Instruction::Arg::ABXY, Instruction::Arg::None, Instruction::Arg::None, Instruction::Flag::Enable);
386
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
387
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
388
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
389
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b0110, false, true));
390
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
391
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
392
+	this->uRomData.addInstruction(instruction);
393
+
394
+	// AND val, reg
395
+	instruction = Instruction(0b00111100, Instruction::Arg::Val256, Instruction::Arg::ABXY);
396
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
397
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
398
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
399
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b1011, true, false));
400
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
401
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
402
+	this->uRomData.addInstruction(instruction);
403
+
404
+	// OR val, reg
405
+	instruction = Instruction(0b01000000, Instruction::Arg::Val256, Instruction::Arg::ABXY);
406
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
407
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
408
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
409
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b1110, true, false));
410
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
411
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
412
+	this->uRomData.addInstruction(instruction);
413
+
414
+	// XOR val, reg
415
+	instruction = Instruction(0b01000100, Instruction::Arg::Val256, Instruction::Arg::ABXY);
416
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
417
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
418
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
419
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b0110, true, false));
420
+	instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
421
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
422
+	this->uRomData.addInstruction(instruction);
423
+
424
+	// LOAD_I + PC+1 + LOAD_MAL + PC+1 + LOAD_MAH + STORE + RPC+1 // ==========
425
+
426
+	// LDF addr, reg
427
+	instruction = Instruction(0b01011000, Instruction::Arg::Addr, Instruction::Arg::ABXY);
428
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
429
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
430
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAL));
431
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
432
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAH));
433
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::ABXY, Step::BusB::Default, Step::BusC::MA));
434
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
435
+	this->uRomData.addInstruction(instruction);
436
+
437
+	// LDR addr, reg
438
+	instruction = Instruction(0b01011100, Instruction::Arg::Addr, Instruction::Arg::ABXY);
439
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
440
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
441
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAL));
442
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
443
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAH));
444
+	instruction.addStep(Step(Step::BusAR::Ram, Step::BusAW::ABXY, Step::BusB::Default, Step::BusC::MA));
445
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
446
+	this->uRomData.addInstruction(instruction);
447
+
448
+	// STR reg, addr
449
+	instruction = Instruction(0b01100000, Instruction::Arg::ABXY, Instruction::Arg::Addr);
450
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
451
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
452
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAL));
453
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
454
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAH));
455
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::MA));
456
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
457
+	this->uRomData.addInstruction(instruction);
458
+
459
+	// LOAD_I + PC+1 + LOAD_D +  PC+1 + LOAD_MAL + PC+1 + LOAD_MAH + STORE + RPC+1 //
460
+
461
+	// STR val, addr
462
+	instruction = Instruction(0b00000011, Instruction::Arg::Val256, Instruction::Arg::Addr);
463
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
464
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
465
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
466
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
467
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAL));
468
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
469
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAH));
470
+	instruction.addStep(Step(Step::BusAR::D, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::MA));
471
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
472
+	this->uRomData.addInstruction(instruction);
473
+
474
+	// LOAD_I + LOAD + LOAD + RPC+1 + LOAD_I + LOAD + RPC+1 // ================
475
+
476
+	// XCHG reg, reg
477
+	instruction = Instruction(0b11010000, Instruction::Arg::ABXY, Instruction::Arg::ABXY);
478
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
479
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::D));
480
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ABXY));
481
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
482
+	this->uRomData.addInstruction(instruction);
483
+
484
+	instruction = Instruction(0b11001100, Instruction::Arg::ABXY);
485
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
486
+	instruction.addStep(Step(Step::BusAR::D, Step::BusAW::ABXY));
487
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
488
+	this->uRomData.addInstruction(instruction);
489
+
490
+	// LOAD_I + PC+1 + LOAD_MAL + PC+1 + LOAD_MAH + 3x STORE + RPC+1 // =======
491
+
492
+	// XCHG addr, reg
493
+	instruction = Instruction(0b01001000, Instruction::Arg::Addr, Instruction::Arg::ABXY);
494
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
495
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
496
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAL));
497
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
498
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::MAH));
499
+	instruction.addStep(Step(Step::BusAR::Ram, Step::BusAW::D, Step::BusB::Default, Step::BusC::MA));
500
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::MA));
501
+	instruction.addStep(Step(Step::BusAR::D, Step::BusAW::ABXY));
502
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
503
+	this->uRomData.addInstruction(instruction);
504
+
505
+	// LOAD_I + PC+1 + LOAD_PCL + PC+1 + LOAD_PCH + STORE + RESET // ============
506
+
507
+	// JMP addr
508
+	instruction = Instruction(0b11110000, Instruction::Arg::Addr);
509
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
510
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
511
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
512
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
513
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
514
+	instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
515
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
516
+	this->uRomData.addInstruction(instruction);
517
+
518
+	// LOAD_I + PC+1 + LOAD_D + PC+1 + LOAD_PCH + STORE + RESET // ============
519
+	//		  + PC+1 + PC+1 + RPC+1 // ========================================
520
+
521
+	// JE addr
522
+	for(int c = 0; c < 2; c++)
523
+	{
524
+		for(int z = 0; z < 2; z++)
525
+		{
526
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
527
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
528
+
529
+			instruction = Instruction(0b11111000, Instruction::Arg::Addr, Instruction::Arg::None, Instruction::Arg::None, cFlag, zFlag);
530
+
531
+			if(c & z)
532
+			{
533
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
534
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
535
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
536
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
537
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
538
+				instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
539
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
540
+			}
541
+			else
542
+			{
543
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
544
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
545
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
546
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
547
+			}
548
+
549
+			this->uRomData.addInstruction(instruction);
550
+		}
551
+	}
552
+
553
+	// JNE addr
554
+	for(int c = 0; c < 2; c++)
555
+	{
556
+		for(int z = 0; z < 2; z++)
557
+		{
558
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
559
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
560
+
561
+			instruction = Instruction(0b11111001, Instruction::Arg::Addr, Instruction::Arg::None, Instruction::Arg::None, cFlag, zFlag);
562
+
563
+			if(!(c & z))
564
+			{
565
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
566
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
567
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
568
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
569
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
570
+				instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
571
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
572
+			}
573
+			else
574
+			{
575
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
576
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
577
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
578
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
579
+			}
580
+
581
+			this->uRomData.addInstruction(instruction);
582
+		}
583
+	}
584
+
585
+	// JG addr
586
+	for(int c = 0; c < 2; c++)
587
+	{
588
+		for(int z = 0; z < 2; z++)
589
+		{
590
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
591
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
592
+
593
+			instruction = Instruction(0b11111010, Instruction::Arg::Addr, Instruction::Arg::None, Instruction::Arg::None, cFlag, zFlag);
594
+
595
+			if(c & !z)
596
+			{
597
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
598
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
599
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
600
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
601
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
602
+				instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
603
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
604
+			}
605
+			else
606
+			{
607
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
608
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
609
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
610
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
611
+			}
612
+
613
+			this->uRomData.addInstruction(instruction);
614
+		}
615
+	}
616
+
617
+	// JGE addr
618
+	for(int c = 0; c < 2; c++)
619
+	{
620
+		for(int z = 0; z < 2; z++)
621
+		{
622
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
623
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
624
+
625
+			instruction = Instruction(0b11111011, Instruction::Arg::Addr, Instruction::Arg::None, Instruction::Arg::None, cFlag, zFlag);
626
+
627
+			if(c)
628
+			{
629
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
630
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
631
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
632
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
633
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
634
+				instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
635
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
636
+			}
637
+			else
638
+			{
639
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
640
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
641
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
642
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
643
+			}
644
+
645
+			this->uRomData.addInstruction(instruction);
646
+		}
647
+	}
648
+
649
+	// JL addr
650
+	for(int c = 0; c < 2; c++)
651
+	{
652
+		for(int z = 0; z < 2; z++)
653
+		{
654
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
655
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
656
+
657
+			instruction = Instruction(0b11111100, Instruction::Arg::Addr, Instruction::Arg::None, Instruction::Arg::None, cFlag, zFlag);
658
+
659
+			if(!c & !z)
660
+			{
661
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
662
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
663
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
664
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
665
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
666
+				instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
667
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
668
+			}
669
+			else
670
+			{
671
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
672
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
673
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
674
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
675
+			}
676
+
677
+			this->uRomData.addInstruction(instruction);
678
+		}
679
+	}
680
+
681
+	// JLE addr
682
+	for(int c = 0; c < 2; c++)
683
+	{
684
+		for(int z = 0; z < 2; z++)
685
+		{
686
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
687
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
688
+
689
+			instruction = Instruction(0b11111101, Instruction::Arg::Addr, Instruction::Arg::None, Instruction::Arg::None, cFlag, zFlag);
690
+
691
+			if((!c & !z) || (c & z))
692
+			{
693
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
694
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
695
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
696
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
697
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
698
+				instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
699
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
700
+			}
701
+			else
702
+			{
703
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
704
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
705
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
706
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
707
+			}
708
+
709
+			this->uRomData.addInstruction(instruction);
710
+		}
711
+	}
712
+
713
+	// LOAD_I + STORE + SP+1 + RPC+1 // =======================================
714
+
715
+	// PUSH reg
716
+	instruction = Instruction(0b01100100, Instruction::Arg::ABXY);
717
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
718
+	instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::SP));
719
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::SP_PLUS));
720
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
721
+	this->uRomData.addInstruction(instruction);
722
+
723
+	// LOAD_I + SP-1 + STORE + RPC+1 // =======================================
724
+
725
+	// POP reg
726
+	instruction = Instruction(0b01101000, Instruction::Arg::ABXY);
727
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
728
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::SP_MINUS));
729
+	instruction.addStep(Step(Step::BusAR::Ram, Step::BusAW::ABXY, Step::BusB::Default, Step::BusC::SP));
730
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
731
+	this->uRomData.addInstruction(instruction);
732
+
733
+	// LOAD_I + PC+1 + LOAD_D + PC+1 + LOAD_PCH + STORE + SP+1 + STORE + SP+1 + RESET //
734
+
735
+	// CALL addr
736
+	instruction = Instruction(0b11110001, Instruction::Arg::Addr);
737
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
738
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
739
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
740
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
741
+	instruction.addStep(Step(Step::BusAR::PCL, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::SP));
742
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::SP_PLUS));
743
+	instruction.addStep(Step(Step::BusAR::PCH, Step::BusAW::Ram, Step::BusB::Default, Step::BusC::SP));
744
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::SP_PLUS));
745
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
746
+	instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
747
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
748
+	this->uRomData.addInstruction(instruction);
749
+
750
+	// LOAD_I + SP-1 + STORE + SP-1 + STORE + RPC+1 // ========================
751
+
752
+	// RET
753
+	instruction = Instruction(0b11110010);
754
+	instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
755
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::SP_MINUS));
756
+	instruction.addStep(Step(Step::BusAR::Ram, Step::BusAW::PCH, Step::BusB::Default, Step::BusC::SP));
757
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::SP_MINUS));
758
+	instruction.addStep(Step(Step::BusAR::Ram, Step::BusAW::PCL, Step::BusB::Default, Step::BusC::SP));
759
+	instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
760
+	this->uRomData.addInstruction(instruction);
761
+
762
+	// LOAD_I + ALU + PC+1 + PC+1 + RPC+1 // ==================================
763
+	//              + ALU + STORE + PC+1 + LOAD_D + PC+1 + LOAD_PCH + STORE + RESET //
764
+
765
+	// LOOPE reg, reg, addr
766
+	for(int c = 0; c < 2; c++)
767
+	{
768
+		for(int z = 0; z < 2; z++)
769
+		{
770
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
771
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
772
+
773
+			instruction = Instruction(0b11101000, Instruction::Arg::AB, Instruction::Arg::ABXY, Instruction::Arg::Addr, cFlag, zFlag);
774
+			instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
775
+			instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::AB, Step::BusC::Default, 0b0110, false, true));
776
+
777
+			if(c & z)
778
+			{
779
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
780
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
781
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
782
+			}
783
+			else
784
+			{
785
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
786
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
787
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
788
+			}
789
+
790
+			instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
791
+			instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
792
+			instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
793
+			instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
794
+			instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
795
+			this->uRomData.addInstruction(instruction);
796
+		}
797
+	}
798
+
799
+	// LOAD_I + ALU + STORE + PC+1 + PC+1 + PC+1 + RPC+1 // ===================
800
+	//                             + ALU + STORE + PC+1 + LOAD_D + PC+1 + LOAD_PCH + STORE + RESET //
801
+
802
+	// LOOPE val, reg, addr
803
+	for(int c = 0; c < 2; c++)
804
+	{
805
+		for(int z = 0; z < 2; z++)
806
+		{
807
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
808
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
809
+
810
+			instruction = Instruction(0b01001100, Instruction::Arg::Val256, Instruction::Arg::ABXY, Instruction::Arg::Addr, cFlag, zFlag);
811
+			instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
812
+			instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
813
+			instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
814
+			instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b0110, false, true));
815
+
816
+			if(c & z)
817
+			{
818
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
819
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
820
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
821
+			}
822
+			else
823
+			{
824
+
825
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
826
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
827
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
828
+			}
829
+
830
+			instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
831
+			instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
832
+			instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0000, false, false));
833
+			instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
834
+			instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
835
+			this->uRomData.addInstruction(instruction);
836
+		}
837
+	}
838
+
839
+	// LOAD_I + ALU STORE + PC+1 + PC+1 + RPC+1 // ============================
840
+	//                    + ALU + STORE + PC+1 + LOAD_D + PC+1 + LOAD_PCH + STORE + RESET //
841
+
842
+	// LOOPZ reg, addr
843
+	for(int c = 0; c < 2; c++)
844
+	{
845
+		for(int z = 0; z < 2; z++)
846
+		{
847
+			Instruction::Flag cFlag = (c ? Instruction::Flag::Enable : Instruction::Flag::Disable);
848
+			Instruction::Flag zFlag = (z ? Instruction::Flag::Enable : Instruction::Flag::Disable);
849
+
850
+			instruction = Instruction(0b11110100, Instruction::Arg::ABXY, Instruction::Arg::Addr, Instruction::Arg::None, cFlag, zFlag);
851
+			instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::I));
852
+			instruction.addStep(Step(Step::BusAR::D, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b0011, false, false));
853
+			instruction.addStep(Step(Step::BusAR::T, Step::BusAW::D));
854
+			instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::D, Step::BusC::Default, 0b0110, false, true));
855
+
856
+			if(c & z)
857
+			{
858
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
859
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
860
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC_PLUS));
861
+			}
862
+			else
863
+			{
864
+
865
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
866
+				instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::D));
867
+				instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::PC_PLUS));
868
+			}
869
+
870
+			instruction.addStep(Step(Step::BusAR::Flash, Step::BusAW::PCH));
871
+			instruction.addStep(Step(Step::BusAR::D, Step::BusAW::PCL));
872
+			instruction.addStep(Step(Step::BusAR::ABXY, Step::BusAW::ALU_T, Step::BusB::Default, Step::BusC::Default, 0b1111, false, true));
873
+			instruction.addStep(Step(Step::BusAR::T, Step::BusAW::ABXY));
874
+			instruction.addStep(Step(Step::BusAR::Default, Step::BusAW::RPC));
875
+
876
+			this->uRomData.addInstruction(instruction);
877
+		}
878
+	}
879
+}
880
+
881
+/**
882
+ * Save a binary microcode to files
883
+ *
884
+ * @param urom0Path Path to the first output file
885
+ * @param urom1Path Path to the second output file
886
+ *
887
+ * @return Status of the save operation
888
+ */
889
+bool URom::saveFiles(const QString &urom0Path, const QString &urom1Path)
890
+{
891
+	// Try to save the data to the output files
892
+	return(this->uRomData.saveFiles(urom0Path, urom1Path));
893
+}
0 894
new file mode 100644
... ...
@@ -0,0 +1,31 @@
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
+#ifndef UROM_H
13
+#define UROM_H
14
+
15
+#include "step.h"
16
+#include "instruction.h"
17
+#include "uromdata.h"
18
+
19
+//! This class contains an uROM data
20
+class URom
21
+{
22
+	public:
23
+		URom();
24
+
25
+		bool saveFiles(const QString &urom0Path, const QString &urom1Path);
26
+
27
+	private:
28
+		URomData uRomData; //!< uROM data with an opcode table
29
+};
30
+
31
+#endif
0 32
new file mode 100644
... ...
@@ -0,0 +1,21 @@
1
+QT -= gui
2
+
3
+CONFIG += c++14 console
4
+CONFIG -= app_bundle
5
+
6
+DEFINES += QT_DEPRECATED_WARNINGS
7
+
8
+SOURCES += \
9
+    main.cpp \
10
+    urom.cpp \
11
+    ucode.cpp \
12
+    step.cpp \
13
+    instruction.cpp \
14
+    uromdata.cpp
15
+
16
+HEADERS += \
17
+    urom.h \
18
+    ucode.h \
19
+    step.h \
20
+    instruction.h \
21
+    uromdata.h
0 22
new file mode 100644
... ...
@@ -0,0 +1,112 @@
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 "uromdata.h"
13
+
14
+//! Default constructor for creating an empty uRom opcode table
15
+URomData::URomData()
16
+{
17
+	this->data[0].fill(0);
18
+	this->data[1].fill(0);
19
+}
20
+
21
+/**
22
+ * Add an instruction to the uROM opcode table
23
+ *
24
+ * @param instruction Instruction to add
25
+ */
26
+void URomData::addInstruction(const Instruction &instruction)
27
+{
28
+	int opcodeWidth = 1;
29
+
30
+	// Calculate how many consecutive opcodes the instruction uses
31
+	opcodeWidth *= ((instruction.getArg0() == Instruction::Arg::AB) ? 2 : 1);
32
+	opcodeWidth *= ((instruction.getArg0() == Instruction::Arg::ABXY) ? 4 : 1);
33
+
34
+	opcodeWidth *= ((instruction.getArg1() == Instruction::Arg::AB) ? 2 : 1);
35
+	opcodeWidth *= ((instruction.getArg1() == Instruction::Arg::ABXY) ? 4 : 1);
36
+
37
+	// Calculate how many steps is used by the instruction
38
+	int stepQuantity = qMin(instruction.getStepList().size(), INSTRUCTION_CYCLE_QUANTITY);
39
+
40
+	// Add instruction entrys to the opcode table
41
+	for(int i = 0; i < opcodeWidth; i++)
42
+	{
43
+		for(int s = 0; s < stepQuantity; s++)
44
+		{
45
+			// Calculate the base offset of the entry
46
+			int offsetBase = ((static_cast<int>(s) * INSTRUCTION_QUANTITY) + static_cast<int>(instruction.getOpcode()) + i);
47
+			Step step = instruction.getStepList().at(s);
48
+
49
+			// Fill only entries where the carry and the zero flags fit to the selected by instruction
50
+			for(int c = 0; c < 2; c++)
51
+			{
52
+				for(int z = 0; z < 2; z++)
53
+				{
54
+					if(!((instruction.getC() == Instruction::Flag::Any) || (static_cast<int>(instruction.getC()) == c)))
55
+					{
56
+						continue;
57
+					}
58
+
59
+					if(!((instruction.getZ() == Instruction::Flag::Any) || (static_cast<int>(instruction.getZ()) == z)))
60
+					{
61
+						continue;
62
+					}
63
+
64
+					int offset = (offsetBase + (c << ADDRESS_FLAG_C_POSITION) + (z << ADDRESS_FLAG_Z_POSITION));
65
+
66
+					this->data[0][offset] = step.getUCode().getCode0();
67
+					this->data[1][offset] = step.getUCode().getCode1();
68
+				}
69
+			}
70
+		}
71
+	}
72
+}
73
+
74
+/**
75
+ * Save a binary microcode to files
76
+ *
77
+ * @param urom0Path Path to the first output file
78
+ * @param urom1Path Path to the second output file
79
+ *
80
+ * @return Status of the save operation
81
+ */
82
+bool URomData::saveFiles(const QString &urom0Path, const QString &urom1Path)
83
+{
84
+	QFile urom0File(urom0Path);
85
+
86
+	// Try to save the first output file
87
+	if(urom0File.open(QIODevice::WriteOnly))
88
+	{
89
+		urom0File.write(reinterpret_cast<const char *>(this->data[0].constData()), UROM_SIZE);
90
+		urom0File.close();
91
+	}
92
+	else
93
+	{
94
+		return(false);
95
+	}
96
+
97
+	QFile urom1File(urom1Path);
98
+
99
+	// Try to save the second output file
100
+	if(urom1File.open(QIODevice::WriteOnly))
101
+	{
102
+		urom1File.write(reinterpret_cast<const char *>(this->data[1].constData()), UROM_SIZE);
103
+		urom1File.close();
104
+	}
105
+	else
106
+	{
107
+		return(false);
108
+	}
109
+
110
+	return(true);
111
+}
112
+
0 113
new file mode 100644
... ...
@@ -0,0 +1,43 @@
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
+#ifndef UROMDATA_H
13
+#define UROMDATA_H
14
+
15
+#include <QString>
16
+#include <QFile>
17
+#include <QVector>
18
+
19
+#include "instruction.h"
20
+
21
+//! This class contains a whole generated microcode for all instructions
22
+class URomData
23
+{
24
+	public:
25
+		static const int INSTRUCTION_QUANTITY = 256; //!< Support only for 256 opcodes
26
+		static const int INSTRUCTION_CYCLE_QUANTITY = 16; //!< Every instruction can get only 16 steps
27
+
28
+		static const int ADDRESS_FLAG_C_POSITION = 12; //!< Position of the carry bit received from ALU to the control unit
29
+		static const int ADDRESS_FLAG_Z_POSITION = 13; //!< Position of the zero bit received from ALU to the control unit
30
+
31
+		static const int UROM_SIZE = 32768; //!< uROM size for low and high banks
32
+
33
+		URomData();
34
+
35
+		void addInstruction(const Instruction &instruction);
36
+		bool saveFiles(const QString &urom0Path, const QString &urom1Path);
37
+
38
+	private:
39
+		//! Data container for low and high banks
40
+		QVector<QVector<unsigned char>> data = { QVector<unsigned char>(UROM_SIZE), QVector<unsigned char>(UROM_SIZE) };
41
+};
42
+
43
+#endif