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

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 "picinfo16bit.h"
0012 #include "micropackage.h"
0013 
0014 #include <KLocalizedString>
0015 // #include <k3staticdeleter.h>
0016 
0017 #include <QGlobalStatic>
0018 
0019 // PicAsm16bit *PicAsm16bit::m_self = 0;
0020 // static K3StaticDeleter<PicAsm16bit> picAsm16BitStaticDeleter;
0021 
0022 Q_GLOBAL_STATIC(PicAsm16bit, globalPicAsm16bit);
0023 
0024 PicAsm16bit *PicAsm16bit::self()
0025 {
0026     //  if ( !m_self )
0027     //      picAsm16BitStaticDeleter.setObject( m_self, new PicAsm16bit() );
0028     //  return m_self;
0029     return globalPicAsm16bit;
0030 }
0031 
0032 PicInfo16bit::PicInfo16bit()
0033     : PicInfo()
0034 {
0035 }
0036 
0037 PicInfo16bit::~PicInfo16bit()
0038 {
0039 }
0040 
0041 PicAsm16bit::PicAsm16bit()
0042     : AsmInfo()
0043 {
0044     // 16 bit Asm instructions for PICs
0045 
0046     // Byte-orientated file register operations
0047     addInstruction("ADDWF", nullptr, "000111dfffffff");
0048     addInstruction("ANDWF", nullptr, "000101dfffffff");
0049     addInstruction("CLRF", nullptr, "0000011fffffff");
0050     addInstruction("CLRW", nullptr, "0000010xxxxxxx");
0051     addInstruction("COMF", nullptr, "001001dfffffff");
0052     addInstruction("DECF", nullptr, "000011dfffffff");
0053     addInstruction("DECFSZ", nullptr, "001011dfffffff");
0054     addInstruction("INCF", nullptr, "001010dfffffff");
0055     addInstruction("INCFSZ", nullptr, "001111dfffffff");
0056     addInstruction("IORWF", nullptr, "000100dfffffff");
0057     addInstruction("MOVF", nullptr, "001000dfffffff");
0058     addInstruction("MOVWF", nullptr, "0000001fffffff");
0059     addInstruction("NOP", nullptr, "0000000xx00000");
0060     addInstruction("RLF", nullptr, "001101dfffffff");
0061     addInstruction("RRF", nullptr, "001100dfffffff");
0062     addInstruction("SUBWF", nullptr, "000010dfffffff");
0063     addInstruction("SWAPF", nullptr, "001110dfffffff");
0064     addInstruction("XORWF", nullptr, "000110dfffffff");
0065 
0066     // Bit-orientated file register operations
0067     addInstruction("BCF", nullptr, "0100bbbfffffff");
0068     addInstruction("BSF", nullptr, "0101bbbfffffff");
0069     addInstruction("BTFSC", nullptr, "0110bbbfffffff");
0070     addInstruction("BTFSS", nullptr, "0111bbbfffffff");
0071 
0072     // Literal and control operations
0073     addInstruction("ADDLW", nullptr, "11111xkkkkkkkk");
0074     addInstruction("ANDLW", nullptr, "111001kkkkkkkk");
0075     addInstruction("CALL", nullptr, "100kkkkkkkkkkk");
0076     addInstruction("CLRWDT", nullptr, "00000001100100");
0077     addInstruction("GOTO", nullptr, "101kkkkkkkkkkk");
0078     addInstruction("IORLW", nullptr, "111000kkkkkkkk");
0079     addInstruction("MOVLW", nullptr, "1100xxkkkkkkkk");
0080     addInstruction("RETFIE", nullptr, "00000000001001");
0081     addInstruction("RETLW", nullptr, "1101xxkkkkkkkk");
0082     addInstruction("RETURN", nullptr, "00000000001000");
0083     addInstruction("SLEEP", nullptr, "00000000000011");
0084     addInstruction("SUBLW", nullptr, "11110xkkkkkkkk");
0085     addInstruction("XORLW", nullptr, "111010kkkkkkkk");
0086 }
0087 
0088 PicInfo17C7xx::PicInfo17C7xx()
0089     : PicInfo16bit()
0090 {
0091     m_id = "P17C7xx";
0092 }
0093 
0094 PicInfo17C7xx::~PicInfo17C7xx()
0095 {
0096 }
0097 
0098 PicInfo17C75x::PicInfo17C75x()
0099     : PicInfo17C7xx()
0100 {
0101     m_id = "P17C75x";
0102 }
0103 
0104 PicInfo17C75x::~PicInfo17C75x()
0105 {
0106 }
0107 
0108 PicInfo17C752::PicInfo17C752()
0109     : PicInfo17C75x()
0110 {
0111     m_id = "P17C752";
0112 }
0113 
0114 PicInfo17C752::~PicInfo17C752()
0115 {
0116 }
0117 
0118 PicInfo17C756::PicInfo17C756()
0119     : PicInfo17C75x()
0120 {
0121     m_id = "P17C756";
0122 }
0123 
0124 PicInfo17C756::~PicInfo17C756()
0125 {
0126 }
0127 
0128 PicInfo17C756A::PicInfo17C756A()
0129     : PicInfo17C75x()
0130 {
0131     m_id = "P17C756A";
0132 }
0133 
0134 PicInfo17C756A::~PicInfo17C756A()
0135 {
0136 }
0137 
0138 PicInfo17C762::PicInfo17C762()
0139     : PicInfo17C75x()
0140 {
0141     m_id = "P17C762";
0142 }
0143 
0144 PicInfo17C762::~PicInfo17C762()
0145 {
0146 }
0147 
0148 PicInfo17C766::PicInfo17C766()
0149     : PicInfo17C75x()
0150 {
0151     m_id = "P17C766";
0152 }
0153 
0154 PicInfo17C766::~PicInfo17C766()
0155 {
0156 }
0157 
0158 PicInfo18Cxx2::PicInfo18Cxx2()
0159     : PicInfo16bit()
0160 {
0161     m_id = "P18Cxx2";
0162 }
0163 
0164 PicInfo18Cxx2::~PicInfo18Cxx2()
0165 {
0166 }
0167 
0168 PicInfo18C2x2::PicInfo18C2x2()
0169     : PicInfo16bit()
0170 {
0171     m_id = "P18C2x2";
0172 }
0173 
0174 PicInfo18C2x2::~PicInfo18C2x2()
0175 {
0176 }
0177 
0178 PicInfo18C242::PicInfo18C242()
0179     : PicInfo18C2x2()
0180 {
0181     m_id = "P18C242";
0182 }
0183 
0184 PicInfo18C242::~PicInfo18C242()
0185 {
0186 }
0187 
0188 PicInfo18C252::PicInfo18C252()
0189     : PicInfo18C242()
0190 {
0191     m_id = "P18C252";
0192 }
0193 
0194 PicInfo18C252::~PicInfo18C252()
0195 {
0196 }
0197 
0198 PicInfo18C4x2::PicInfo18C4x2()
0199     : PicInfo16bit()
0200 {
0201     m_id = QString::fromLatin1("P18C4x2");
0202 
0203     delete m_package;
0204     m_package = new MicroPackage(40);
0205 
0206     m_package->assignPin(2, PicPin::type_bidir, "RA0", "PORTA", 0);
0207     m_package->assignPin(3, PicPin::type_bidir, "RA1", "PORTA", 1);
0208     m_package->assignPin(4, PicPin::type_bidir, "RA2", "PORTA", 2);
0209     m_package->assignPin(5, PicPin::type_bidir, "RA3", "PORTA", 3);
0210     m_package->assignPin(6, PicPin::type_open, "RA4", "PORTA", 4);
0211     m_package->assignPin(7, PicPin::type_bidir, "RA5", "PORTB", 5);
0212 
0213     m_package->assignPin(33, PicPin::type_bidir, "RB0", "PORTB", 0);
0214     m_package->assignPin(34, PicPin::type_bidir, "RB1", "PORTB", 1);
0215     m_package->assignPin(35, PicPin::type_bidir, "RB2", "PORTB", 2);
0216     m_package->assignPin(36, PicPin::type_bidir, "RB3", "PORTB", 3);
0217     m_package->assignPin(37, PicPin::type_bidir, "RB4", "PORTB", 4);
0218     m_package->assignPin(38, PicPin::type_bidir, "RB5", "PORTB", 5);
0219     m_package->assignPin(39, PicPin::type_bidir, "RB6", "PORTB", 6);
0220     m_package->assignPin(40, PicPin::type_bidir, "RB7", "PORTB", 7);
0221 
0222     m_package->assignPin(15, PicPin::type_bidir, "RC0", "PORTC", 0);
0223     m_package->assignPin(16, PicPin::type_bidir, "RC1", "PORTC", 1);
0224     m_package->assignPin(17, PicPin::type_bidir, "RC2", "PORTC", 2);
0225     m_package->assignPin(18, PicPin::type_bidir, "RC3", "PORTC", 3);
0226     m_package->assignPin(23, PicPin::type_bidir, "RC4", "PORTC", 4);
0227     m_package->assignPin(24, PicPin::type_bidir, "RC5", "PORTC", 5);
0228     m_package->assignPin(25, PicPin::type_bidir, "RC6", "PORTC", 6);
0229     m_package->assignPin(26, PicPin::type_bidir, "RC7", "PORTC", 7);
0230 
0231     m_package->assignPin(19, PicPin::type_bidir, "RD0", "PORTD", 0);
0232     m_package->assignPin(20, PicPin::type_bidir, "RD1", "PORTD", 1);
0233     m_package->assignPin(21, PicPin::type_bidir, "RD2", "PORTD", 2);
0234     m_package->assignPin(22, PicPin::type_bidir, "RD3", "PORTD", 3);
0235     m_package->assignPin(27, PicPin::type_bidir, "RD4", "PORTD", 4);
0236     m_package->assignPin(28, PicPin::type_bidir, "RD5", "PORTD", 5);
0237     m_package->assignPin(29, PicPin::type_bidir, "RD6", "PORTD", 6);
0238     m_package->assignPin(30, PicPin::type_bidir, "RD7", "PORTD", 7);
0239 
0240     m_package->assignPin(8, PicPin::type_bidir, "RE0", "PORTE", 0);
0241     m_package->assignPin(9, PicPin::type_bidir, "RE1", "PORTE", 1);
0242     m_package->assignPin(10, PicPin::type_bidir, "RE2", "PORTE", 2);
0243 
0244     m_package->assignPin(1, PicPin::type_mclr, "MCLR");
0245     m_package->assignPin(11, PicPin::type_vdd, "VDD");
0246     m_package->assignPin(12, PicPin::type_vss, "VSS");
0247     m_package->assignPin(13, PicPin::type_osc, "OSC1");
0248     m_package->assignPin(14, PicPin::type_osc, "OSC2");
0249     m_package->assignPin(31, PicPin::type_vss, "VSS");
0250     m_package->assignPin(32, PicPin::type_vdd, "VDD");
0251 }
0252 
0253 PicInfo18C4x2::~PicInfo18C4x2()
0254 {
0255     delete m_package;
0256     m_package = nullptr;
0257 }
0258 
0259 PicInfo18C442::PicInfo18C442()
0260     : PicInfo18C4x2()
0261 {
0262     m_id = QString::fromLatin1("P18C442");
0263 }
0264 
0265 PicInfo18C442::~PicInfo18C442()
0266 {
0267 }
0268 
0269 PicInfo18C452::PicInfo18C452()
0270     : PicInfo18C442()
0271 {
0272     m_id = QString::fromLatin1("P18C452");
0273 }
0274 
0275 PicInfo18C452::~PicInfo18C452()
0276 {
0277 }
0278 
0279 PicInfo18F442::PicInfo18F442()
0280     : PicInfo18C442()
0281 {
0282     m_id = QString::fromLatin1("P18F442");
0283 }
0284 
0285 PicInfo18F442::~PicInfo18F442()
0286 {
0287 }
0288 
0289 PicInfo18F248::PicInfo18F248()
0290     : PicInfo18F442()
0291 {
0292     m_id = QString::fromLatin1("P18F248");
0293 }
0294 
0295 PicInfo18F248::~PicInfo18F248()
0296 {
0297 }
0298 
0299 PicInfo18F452::PicInfo18F452()
0300     : PicInfo18F442()
0301 {
0302     m_id = QString::fromLatin1("P18F452");
0303 }
0304 
0305 PicInfo18F452::~PicInfo18F452()
0306 {
0307 }
0308 
0309 PicInfo18Fxx20::PicInfo18Fxx20()
0310     : PicInfo16bit()
0311 {
0312     m_id = QString::fromLatin1("P18Fxx20");
0313 }
0314 
0315 PicInfo18Fxx20::~PicInfo18Fxx20()
0316 {
0317 }
0318 
0319 PicInfo18F1220::PicInfo18F1220()
0320     : PicInfo18Fxx20()
0321 {
0322     m_id = QString::fromLatin1("P18F1220");
0323 
0324     delete m_package;
0325     m_package = new MicroPackage(18);
0326 
0327     m_package->assignPin(1, PicPin::type_bidir, "RA0", "PORTA", 0);
0328     m_package->assignPin(2, PicPin::type_bidir, "RA1", "PORTA", 1);
0329     m_package->assignPin(6, PicPin::type_bidir, "RA2", "PORTA", 2);
0330     m_package->assignPin(7, PicPin::type_bidir, "RA3", "PORTA", 3);
0331     m_package->assignPin(3, PicPin::type_open, "RA4", "PORTA", 4);
0332     m_package->assignPin(4, PicPin::type_open, "RA5", "PORTA", 5);
0333     m_package->assignPin(15, PicPin::type_open, "RA6", "PORTA", 6);
0334     m_package->assignPin(16, PicPin::type_open, "RA7", "PORTA", 7);
0335 
0336     m_package->assignPin(8, PicPin::type_bidir, "RB0", "PORTB", 0);
0337     m_package->assignPin(9, PicPin::type_bidir, "RB1", "PORTB", 1);
0338     m_package->assignPin(17, PicPin::type_bidir, "RB2", "PORTB", 2);
0339     m_package->assignPin(18, PicPin::type_bidir, "RB3", "PORTB", 3);
0340     m_package->assignPin(10, PicPin::type_bidir, "RB4", "PORTB", 4);
0341     m_package->assignPin(11, PicPin::type_bidir, "RB5", "PORTB", 5);
0342     m_package->assignPin(12, PicPin::type_bidir, "RB6", "PORTB", 6);
0343     m_package->assignPin(13, PicPin::type_bidir, "RB7", "PORTB", 7);
0344 
0345     m_package->assignPin(5, PicPin::type_vss, "VSS");
0346     m_package->assignPin(14, PicPin::type_vdd, "VDD");
0347 }
0348 
0349 PicInfo18F1220::~PicInfo18F1220()
0350 {
0351 }
0352 
0353 PicInfo18F1320::PicInfo18F1320()
0354     : PicInfo18F1220()
0355 {
0356     m_id = QString::fromLatin1("P18F1320");
0357 }
0358 
0359 PicInfo18F1320::~PicInfo18F1320()
0360 {
0361 }