File indexing completed on 2024-06-16 11:34:37

0001 /***************************************************************************
0002  *   Copyright (C) 2003-2004 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 "picinfo12bit.h"
0012 #include "micropackage.h"
0013 
0014 #include <KLocalizedString>
0015 //#include <k3staticdeleter.h>
0016 
0017 #include <QGlobalStatic>
0018 
0019 // PicAsm12bit *PicAsm12bit::m_self = 0;
0020 // static K3StaticDeleter<PicAsm12bit> picAsm12BitStaticDeleter;
0021 
0022 Q_GLOBAL_STATIC(PicAsm12bit, globalPicAsm12bit);
0023 
0024 PicAsm12bit *PicAsm12bit::self()
0025 {
0026     //  if ( !m_self )
0027     //      picAsm12BitStaticDeleter.setObject( m_self, new PicAsm12bit() );
0028     //  return m_self;
0029     return globalPicAsm12bit;
0030 }
0031 
0032 PicInfo12bit::PicInfo12bit()
0033     : PicInfo()
0034 {
0035 }
0036 
0037 PicInfo12bit::~PicInfo12bit()
0038 {
0039 }
0040 
0041 PicAsm12bit::PicAsm12bit()
0042     : AsmInfo()
0043 {
0044     // Byte-orientated file register operations
0045     addInstruction("ADDWF", nullptr, "000111dfffff");
0046     addInstruction("ANDWF", nullptr, "000101dfffff");
0047     addInstruction("CLRF", nullptr, "0000011fffff");
0048     addInstruction("CLRW", nullptr, "000001000000");
0049     addInstruction("COMF", nullptr, "001001dfffff");
0050     addInstruction("DECF", nullptr, "000011dfffff");
0051     addInstruction("DECFSZ", nullptr, "001011dfffff");
0052     addInstruction("INCF", nullptr, "001010dfffff");
0053     addInstruction("INCFSZ", nullptr, "001111dfffff");
0054     addInstruction("IORWF", nullptr, "000100dfffff");
0055     addInstruction("MOVF", nullptr, "001000dfffff");
0056     addInstruction("MOVWF", nullptr, "0000001fffff");
0057     addInstruction("NOP", nullptr, "000000000000");
0058     addInstruction("RLF", nullptr, "001101dfffff");
0059     addInstruction("RRF", nullptr, "001100dfffff");
0060     addInstruction("SUBWF", nullptr, "000010dfffff");
0061     addInstruction("SWAPF", nullptr, "001110dfffff");
0062     addInstruction("XORWF", nullptr, "000110dfffff");
0063 
0064     // Bit-orientated file register operations
0065     addInstruction("BCF", nullptr, "0100bbbfffff");
0066     addInstruction("BSF", nullptr, "0101bbbfffff");
0067     addInstruction("BTFSC", nullptr, "0110bbbfffff");
0068     addInstruction("BTFSS", nullptr, "0111bbbfffff");
0069 
0070     // Literal and control operations
0071     addInstruction("ANDLW", nullptr, "1110kkkkkkkk");
0072     addInstruction("CALL", nullptr, "1001kkkkkkkk");
0073     addInstruction("CLRWDT", nullptr, "000000000100");
0074     addInstruction("GOTO", nullptr, "101kkkkkkkkk");
0075     addInstruction("IORLW", nullptr, "1101kkkkkkkk");
0076     addInstruction("MOVLW", nullptr, "1100kkkkkkkk");
0077     //  addInstruction( "RETFIE",   0,  "00000000001001" );
0078     addInstruction("OPTION", nullptr, "000000000010");
0079     addInstruction("RETLW", nullptr, "1000kkkkkkkk");
0080     //  addInstruction( "RETURN",   0,  "00000000001000" );
0081     addInstruction("SLEEP", nullptr, "000000000011");
0082     //  addInstruction( "SUBLW",    0,  "11110xkkkkkkkk" );
0083     addInstruction("TRIS", nullptr, "000000000fff");
0084     addInstruction("XORLW", nullptr, "1111kkkkkkkk");
0085 }
0086 
0087 PicInfo16C54::PicInfo16C54()
0088     : PicInfo12bit()
0089 {
0090     m_id = "P16C54";
0091 
0092     delete m_package;
0093     m_package = new MicroPackage(18);
0094 
0095     m_package->assignPin(17, PicPin::type_bidir, "RA0", "PORTA", 0);
0096     m_package->assignPin(18, PicPin::type_bidir, "RA1", "PORTA", 1);
0097     m_package->assignPin(1, PicPin::type_bidir, "RA2", "PORTA", 2);
0098     m_package->assignPin(2, PicPin::type_bidir, "RA3", "PORTA", 3);
0099     m_package->assignPin(3, PicPin::type_open, "RA4", "PORTA", 4);
0100 
0101     m_package->assignPin(6, PicPin::type_bidir, "RB0", "PORTB", 0);
0102     m_package->assignPin(7, PicPin::type_bidir, "RB1", "PORTB", 1);
0103     m_package->assignPin(8, PicPin::type_bidir, "RB2", "PORTB", 2);
0104     m_package->assignPin(9, PicPin::type_bidir, "RB3", "PORTB", 3);
0105     m_package->assignPin(10, PicPin::type_bidir, "RB4", "PORTB", 4);
0106     m_package->assignPin(11, PicPin::type_bidir, "RB5", "PORTB", 5);
0107     m_package->assignPin(12, PicPin::type_bidir, "RB6", "PORTB", 6);
0108     m_package->assignPin(13, PicPin::type_bidir, "RB7", "PORTB", 7);
0109 
0110     m_package->assignPin(4, PicPin::type_mclr, "MCLR");
0111     m_package->assignPin(5, PicPin::type_vss, "VSS");
0112     m_package->assignPin(14, PicPin::type_vdd, "VDD");
0113     m_package->assignPin(15, PicPin::type_osc, "OSC2");
0114     m_package->assignPin(16, PicPin::type_osc, "OSC1");
0115 }
0116 
0117 PicInfo16C54::~PicInfo16C54()
0118 {
0119 }
0120 
0121 PicInfo16C55::PicInfo16C55()
0122     : PicInfo12bit()
0123 {
0124     m_id = "P16C55";
0125 }
0126 
0127 PicInfo16C55::~PicInfo16C55()
0128 {
0129 }
0130 
0131 PicInfo12C508::PicInfo12C508()
0132     : PicInfo12bit()
0133 {
0134     m_id = "P12C508";
0135 
0136     delete m_package;
0137     m_package = new MicroPackage(8);
0138 
0139     m_package->assignPin(7, PicPin::type_bidir, "GP0", "GPIO", 0);
0140     m_package->assignPin(6, PicPin::type_bidir, "GP1", "GPIO", 1);
0141     m_package->assignPin(5, PicPin::type_bidir, "GP2", "GPIO", 2);
0142     m_package->assignPin(4, PicPin::type_input, "GP3", "GPIO", 3);
0143     m_package->assignPin(3, PicPin::type_bidir, "GP4", "GPIO", 4);
0144     m_package->assignPin(2, PicPin::type_bidir, "GP5", "GPIO", 5);
0145 
0146     m_package->assignPin(8, PicPin::type_vss, "VSS");
0147     m_package->assignPin(1, PicPin::type_vdd, "VDD");
0148 }
0149 
0150 PicInfo12C508::~PicInfo12C508()
0151 {
0152 }
0153 
0154 PicInfo12C509::PicInfo12C509()
0155     : PicInfo12C508()
0156 {
0157     m_id = "P12C509";
0158 }
0159 
0160 PicInfo12C509::~PicInfo12C509()
0161 {
0162 }
0163 
0164 PicInfo12C671::PicInfo12C671()
0165     : PicInfo12C508()
0166 {
0167     m_id = "P12C671";
0168 }
0169 
0170 PicInfo12C671::~PicInfo12C671()
0171 {
0172 }
0173 
0174 PicInfo12C672::PicInfo12C672()
0175     : PicInfo12C508()
0176 {
0177     m_id = "P12C672";
0178 }
0179 
0180 PicInfo12C672::~PicInfo12C672()
0181 {
0182 }