summaryrefslogtreecommitdiffstats
path: root/src/micro/asminfo.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 01:49:02 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-24 01:49:02 +0000
commit5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 (patch)
treebad482b7afa4cdf47422d60a5dd2c61c7e333b09 /src/micro/asminfo.h
downloadktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.tar.gz
ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.zip
Added KDE3 version of ktechlab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/micro/asminfo.h')
-rw-r--r--src/micro/asminfo.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/micro/asminfo.h b/src/micro/asminfo.h
new file mode 100644
index 0000000..2026b7d
--- /dev/null
+++ b/src/micro/asminfo.h
@@ -0,0 +1,71 @@
+/***************************************************************************
+ * Copyright (C) 2003,2005 by David Saxton *
+ * david@bluehaze.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ ***************************************************************************/
+
+#ifndef ASMINFO_H
+#define ASMINFO_H
+
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qvaluelist.h>
+
+/**
+@author David Saxton
+*/
+struct Instruction
+{
+ QString operand;
+ QString description;
+ QString opcode;
+};
+typedef QValueList<Instruction> InstructionList;
+
+/**
+@short Base class for all instruction sets
+@author David Saxton
+*/
+class AsmInfo
+{
+public:
+ AsmInfo();
+ virtual ~AsmInfo();
+
+ enum Set
+ {
+ PIC12 = 1 << 0,
+ PIC14 = 1 << 1,
+ PIC16 = 1 << 2
+ };
+ enum { AsmSetAll = PIC12 | PIC14 | PIC16 };
+
+ static QString setToString( Set set );
+ static Set stringToSet( const QString & set );
+
+ /**
+ * @return the instruction set in use
+ */
+ virtual Set set() const = 0;
+ /**
+ * Returns a list of instruction operands (all uppercase).
+ */
+ QStringList operandList() const { return m_operandList; }
+ /**
+ * @param operand is the name of the instruction - eg 'addwf' or 'clrwdt'.
+ * @param description is instruction description - eg 'Add W and f'.
+ * @param opcode' is the 14-bit code for the instruction, eg
+ * '000111dfffffff'for addwf.
+ */
+ void addInstruction( const QString &operand, const QString &description, const QString &opcode );
+
+private:
+ InstructionList m_instructionList;
+ QStringList m_operandList;
+};
+
+#endif