1 /***************************************************************************
2  *   Copyright (C) 2003,2005 by David Saxton                               *
3  *   david@bluehaze.org                                                    *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  ***************************************************************************/
10 
11 #include "asminfo.h"
12 
13 #include <QDebug>
14 
AsmInfo()15 AsmInfo::AsmInfo()
16 {
17 }
18 
19 
~AsmInfo()20 AsmInfo::~AsmInfo()
21 {
22 }
23 
24 
addInstruction(const QString & operand,const QString & description,const QString & opcode)25 void AsmInfo::addInstruction( const QString & operand, const QString & description, const QString & opcode )
26 {
27 	Instruction instruction;
28 	instruction.operand = operand;
29 	instruction.description = description;
30 	instruction.opcode = opcode;
31 	m_instructionList.append( instruction );
32 	m_operandList.append( operand );
33 }
34 
35 
setToString(Set set)36 QString AsmInfo::setToString( Set set )
37 {
38 	switch (set)
39 	{
40 		case AsmInfo::PIC12:
41 			return QString::fromLatin1("PIC12");
42 
43 		case AsmInfo::PIC14:
44 			return QString::fromLatin1("PIC14");
45 
46 		case AsmInfo::PIC16:
47 			return QString::fromLatin1("PIC16");
48 	}
49 
50 	qWarning() << Q_FUNC_INFO << "Unrecognized set="<<set<<endl;
51 	return QString::null;
52 }
53 
54 
stringToSet(const QString & set)55 AsmInfo::Set AsmInfo::stringToSet( const QString & set )
56 {
57 	if ( set == QString::fromLatin1("PIC12") )
58 		return PIC12;
59 
60 	if ( set == QString::fromLatin1("PIC14") )
61 		return PIC14;
62 
63 	if ( set == QString::fromLatin1("PIC16") )
64 		return PIC16;
65 
66 // 	qWarning() << Q_FUNC_INFO << "Unrecognized set="<<set<<endl;
67 	return PIC14;
68 }
69