From 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 01:49:02 +0000 Subject: Added KDE3 version of ktechlab git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/micro/asminfo.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/micro/asminfo.h (limited to 'src/micro/asminfo.h') 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 +#include +#include + +/** +@author David Saxton +*/ +struct Instruction +{ + QString operand; + QString description; + QString opcode; +}; +typedef QValueList 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 -- cgit v1.2.1