File indexing completed on 2024-04-21 05:43:48

0001 /***************************************************************************
0002  *   Copyright (C) 2003,2005 by David Saxton                               *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #include "asminfo.h"
0012 
0013 #include <ktechlab_debug.h>
0014 
0015 AsmInfo::AsmInfo()
0016 {
0017 }
0018 
0019 AsmInfo::~AsmInfo()
0020 {
0021 }
0022 
0023 void AsmInfo::addInstruction(const QString &operand, const QString &description, const QString &opcode)
0024 {
0025     Instruction instruction;
0026     instruction.operand = operand;
0027     instruction.description = description;
0028     instruction.opcode = opcode;
0029     m_instructionList.append(instruction);
0030     m_operandList.append(operand);
0031 }
0032 
0033 QString AsmInfo::setToString(Set set)
0034 {
0035     switch (set) {
0036     case AsmInfo::PIC12:
0037         return QString::fromLatin1("PIC12");
0038 
0039     case AsmInfo::PIC14:
0040         return QString::fromLatin1("PIC14");
0041 
0042     case AsmInfo::PIC16:
0043         return QString::fromLatin1("PIC16");
0044     }
0045 
0046     qCWarning(KTL_LOG) << "Unrecognized set=" << set;
0047     return QString();
0048 }
0049 
0050 AsmInfo::Set AsmInfo::stringToSet(const QString &set)
0051 {
0052     if (set == QString::fromLatin1("PIC12"))
0053         return PIC12;
0054 
0055     if (set == QString::fromLatin1("PIC14"))
0056         return PIC14;
0057 
0058     if (set == QString::fromLatin1("PIC16"))
0059         return PIC16;
0060 
0061     //  qCWarning(KTL_LOG) << "Unrecognized set="<<set;
0062     return PIC14;
0063 }