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

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 "picinfo14bit.h"
0012 #include "micropackage.h"
0013 
0014 #include <KLocalizedString>
0015 // #include <k3staticdeleter.h>
0016 
0017 #include <QGlobalStatic>
0018 
0019 // PicAsm14bit *PicAsm14bit::m_self = 0;
0020 // static K3StaticDeleter<PicAsm14bit> picAsm14BitStaticDeleter;
0021 
0022 Q_GLOBAL_STATIC(PicAsm14bit, globalPicAsm14bit);
0023 
0024 PicAsm14bit *PicAsm14bit::self()
0025 {
0026     //  if ( !m_self )
0027     //      picAsm14BitStaticDeleter.setObject( m_self, new PicAsm14bit() );
0028     //  return m_self;
0029     return globalPicAsm14bit;
0030 }
0031 
0032 PicInfo14bit::PicInfo14bit()
0033     : PicInfo()
0034 {
0035 }
0036 
0037 PicInfo14bit::~PicInfo14bit()
0038 {
0039 }
0040 
0041 PicAsm14bit::PicAsm14bit()
0042     : AsmInfo()
0043 {
0044     // Byte-orientated file register operations
0045     addInstruction("ADDWF", nullptr, "000111dfffffff");
0046     addInstruction("ANDWF", nullptr, "000101dfffffff");
0047     addInstruction("CLRF", nullptr, "0000011fffffff");
0048     addInstruction("CLRW", nullptr, "0000010xxxxxxx");
0049     addInstruction("COMF", nullptr, "001001dfffffff");
0050     addInstruction("DECF", nullptr, "000011dfffffff");
0051     addInstruction("DECFSZ", nullptr, "001011dfffffff");
0052     addInstruction("INCF", nullptr, "001010dfffffff");
0053     addInstruction("INCFSZ", nullptr, "001111dfffffff");
0054     addInstruction("IORWF", nullptr, "000100dfffffff");
0055     addInstruction("MOVF", nullptr, "001000dfffffff");
0056     addInstruction("MOVWF", nullptr, "0000001fffffff");
0057     addInstruction("NOP", nullptr, "0000000xx00000");
0058     addInstruction("RLF", nullptr, "001101dfffffff");
0059     addInstruction("RRF", nullptr, "001100dfffffff");
0060     addInstruction("SUBWF", nullptr, "000010dfffffff");
0061     addInstruction("SWAPF", nullptr, "001110dfffffff");
0062     addInstruction("XORWF", nullptr, "000110dfffffff");
0063 
0064     // Bit-orientated file register operations
0065     addInstruction("BCF", nullptr, "0100bbbfffffff");
0066     addInstruction("BSF", nullptr, "0101bbbfffffff");
0067     addInstruction("BTFSC", nullptr, "0110bbbfffffff");
0068     addInstruction("BTFSS", nullptr, "0111bbbfffffff");
0069 
0070     // Literal and control operations
0071     addInstruction("ADDLW", nullptr, "11111xkkkkkkkk");
0072     addInstruction("ANDLW", nullptr, "111001kkkkkkkk");
0073     addInstruction("CALL", nullptr, "100kkkkkkkkkkk");
0074     addInstruction("CLRWDT", nullptr, "00000001100100");
0075     addInstruction("GOTO", nullptr, "101kkkkkkkkkkk");
0076     addInstruction("IORLW", nullptr, "111000kkkkkkkk");
0077     addInstruction("MOVLW", nullptr, "1100xxkkkkkkkk");
0078     addInstruction("RETFIE", nullptr, "00000000001001");
0079     addInstruction("RETLW", nullptr, "1101xxkkkkkkkk");
0080     addInstruction("RETURN", nullptr, "00000000001000");
0081     addInstruction("SLEEP", nullptr, "00000000000011");
0082     addInstruction("SUBLW", nullptr, "11110xkkkkkkkk");
0083     addInstruction("XORLW", nullptr, "111010kkkkkkkk");
0084 }
0085 
0086 PicInfo16C8x::PicInfo16C8x()
0087     : PicInfo14bit()
0088 {
0089     delete m_package;
0090     m_package = new MicroPackage(18);
0091 
0092     m_package->assignPin(17, PicPin::type_bidir, "RA0", "PORTA", 0);
0093     m_package->assignPin(18, PicPin::type_bidir, "RA1", "PORTA", 1);
0094     m_package->assignPin(1, PicPin::type_bidir, "RA2", "PORTA", 2);
0095     m_package->assignPin(2, PicPin::type_bidir, "RA3", "PORTA", 3);
0096     m_package->assignPin(3, PicPin::type_open, "RA4", "PORTA", 4);
0097 
0098     m_package->assignPin(6, PicPin::type_bidir, "RB0", "PORTB", 0);
0099     m_package->assignPin(7, PicPin::type_bidir, "RB1", "PORTB", 1);
0100     m_package->assignPin(8, PicPin::type_bidir, "RB2", "PORTB", 2);
0101     m_package->assignPin(9, PicPin::type_bidir, "RB3", "PORTB", 3);
0102     m_package->assignPin(10, PicPin::type_bidir, "RB4", "PORTB", 4);
0103     m_package->assignPin(11, PicPin::type_bidir, "RB5", "PORTB", 5);
0104     m_package->assignPin(12, PicPin::type_bidir, "RB6", "PORTB", 6);
0105     m_package->assignPin(13, PicPin::type_bidir, "RB7", "PORTB", 7);
0106 
0107     m_package->assignPin(4, PicPin::type_mclr, "MCLR");
0108     m_package->assignPin(5, PicPin::type_vss, "VSS");
0109     m_package->assignPin(14, PicPin::type_vdd, "VDD");
0110     m_package->assignPin(15, PicPin::type_osc, "OSC2");
0111     m_package->assignPin(16, PicPin::type_osc, "OSC1");
0112 }
0113 
0114 PicInfo16C8x::~PicInfo16C8x()
0115 {
0116 }
0117 
0118 PicInfo16C84::PicInfo16C84()
0119     : PicInfo16C8x()
0120 {
0121     m_id = "P16C84";
0122 }
0123 
0124 PicInfo16C84::~PicInfo16C84()
0125 {
0126 }
0127 
0128 PicInfo16F84::PicInfo16F84()
0129     : PicInfo16C8x()
0130 {
0131     m_id = "P16F84";
0132 }
0133 
0134 PicInfo16F84::~PicInfo16F84()
0135 {
0136 }
0137 
0138 PicInfo16CR84::PicInfo16CR84()
0139     : PicInfo16F84()
0140 {
0141     m_id = "P16CR84";
0142 }
0143 
0144 PicInfo16CR84::~PicInfo16CR84()
0145 {
0146 }
0147 
0148 PicInfo16F83::PicInfo16F83()
0149     : PicInfo16C8x()
0150 {
0151     m_id = "P16F83";
0152 }
0153 
0154 PicInfo16F83::~PicInfo16F83()
0155 {
0156 }
0157 
0158 PicInfo16CR83::PicInfo16CR83()
0159     : PicInfo16F83()
0160 {
0161     m_id = "P16CR83";
0162 }
0163 PicInfo16CR83::~PicInfo16CR83()
0164 {
0165 }
0166 
0167 PicInfo16C61::PicInfo16C61()
0168     : PicInfo16C8x()
0169 {
0170     m_id = "P16C61";
0171 }
0172 
0173 PicInfo16C61::~PicInfo16C61()
0174 {
0175 }
0176 
0177 PicInfo16X6X::PicInfo16X6X()
0178     : PicInfo14bit()
0179 {
0180     m_id = "P16X6X";
0181 }
0182 
0183 PicInfo16X6X::~PicInfo16X6X()
0184 {
0185 }
0186 
0187 PicInfo16C62::PicInfo16C62()
0188     : PicInfo16X6X()
0189 {
0190     m_id = "P16C62";
0191 
0192     delete m_package;
0193     m_package = new MicroPackage(28);
0194 
0195     m_package->assignPin(2, PicPin::type_bidir, "RA0", "PORTA", 0);
0196     m_package->assignPin(3, PicPin::type_bidir, "RA1", "PORTA", 1);
0197     m_package->assignPin(4, PicPin::type_bidir, "RA2", "PORTA", 2);
0198     m_package->assignPin(5, PicPin::type_bidir, "RA3", "PORTA", 3);
0199     m_package->assignPin(6, PicPin::type_open, "RA4", "PORTA", 4);
0200     m_package->assignPin(7, PicPin::type_bidir, "RA5", "PORTA", 5);
0201 
0202     m_package->assignPin(21, PicPin::type_bidir, "RB0", "PORTB", 0);
0203     m_package->assignPin(22, PicPin::type_bidir, "RB1", "PORTB", 1);
0204     m_package->assignPin(23, PicPin::type_bidir, "RB2", "PORTB", 2);
0205     m_package->assignPin(24, PicPin::type_bidir, "RB3", "PORTB", 3);
0206     m_package->assignPin(25, PicPin::type_bidir, "RB4", "PORTB", 4);
0207     m_package->assignPin(26, PicPin::type_bidir, "RB5", "PORTB", 5);
0208     m_package->assignPin(27, PicPin::type_bidir, "RB6", "PORTB", 6);
0209     m_package->assignPin(28, PicPin::type_bidir, "RB7", "PORTB", 7);
0210 
0211     m_package->assignPin(11, PicPin::type_bidir, "RC0", "PORTC", 0);
0212     m_package->assignPin(12, PicPin::type_bidir, "RC1", "PORTC", 1);
0213     m_package->assignPin(13, PicPin::type_bidir, "RC2", "PORTC", 2);
0214     m_package->assignPin(14, PicPin::type_bidir, "RC3", "PORTC", 3);
0215     m_package->assignPin(15, PicPin::type_bidir, "RC4", "PORTC", 4);
0216     m_package->assignPin(16, PicPin::type_bidir, "RC5", "PORTC", 5);
0217     m_package->assignPin(17, PicPin::type_bidir, "RC6", "PORTC", 6);
0218     m_package->assignPin(18, PicPin::type_bidir, "RC7", "PORTC", 7);
0219 
0220     m_package->assignPin(1, PicPin::type_mclr, "MCLR");
0221     m_package->assignPin(8, PicPin::type_vss, "VSS");
0222     m_package->assignPin(9, PicPin::type_osc, "OSC1");
0223     m_package->assignPin(10, PicPin::type_osc, "OSC2");
0224     m_package->assignPin(19, PicPin::type_vss, "VSS");
0225     m_package->assignPin(20, PicPin::type_vdd, "VDD");
0226 }
0227 
0228 PicInfo16C62::~PicInfo16C62()
0229 {
0230 }
0231 
0232 PicInfo16C63::PicInfo16C63()
0233     : PicInfo16C62()
0234 {
0235     m_id = "P16C63";
0236 }
0237 
0238 PicInfo16C63::~PicInfo16C63()
0239 {
0240 }
0241 
0242 PicInfo16C64::PicInfo16C64()
0243     : PicInfo16X6X()
0244 {
0245     m_id = "P16C64";
0246 
0247     delete m_package;
0248     m_package = new MicroPackage(40);
0249 
0250     m_package->assignPin(2, PicPin::type_bidir, "RA0", "PORTA", 0);
0251     m_package->assignPin(3, PicPin::type_bidir, "RA1", "PORTA", 1);
0252     m_package->assignPin(4, PicPin::type_bidir, "RA2", "PORTA", 2);
0253     m_package->assignPin(5, PicPin::type_bidir, "RA3", "PORTA", 3);
0254     m_package->assignPin(6, PicPin::type_open, "RA4", "PORTA", 4);
0255     m_package->assignPin(7, PicPin::type_bidir, "RA5", "PORTB", 5);
0256 
0257     m_package->assignPin(33, PicPin::type_bidir, "RB0", "PORTB", 0);
0258     m_package->assignPin(34, PicPin::type_bidir, "RB1", "PORTB", 1);
0259     m_package->assignPin(35, PicPin::type_bidir, "RB2", "PORTB", 2);
0260     m_package->assignPin(36, PicPin::type_bidir, "RB3", "PORTB", 3);
0261     m_package->assignPin(37, PicPin::type_bidir, "RB4", "PORTB", 4);
0262     m_package->assignPin(38, PicPin::type_bidir, "RB5", "PORTB", 5);
0263     m_package->assignPin(39, PicPin::type_bidir, "RB6", "PORTB", 6);
0264     m_package->assignPin(40, PicPin::type_bidir, "RB7", "PORTB", 7);
0265 
0266     m_package->assignPin(15, PicPin::type_bidir, "RC0", "PORTC", 0);
0267     m_package->assignPin(16, PicPin::type_bidir, "RC1", "PORTC", 1);
0268     m_package->assignPin(17, PicPin::type_bidir, "RC2", "PORTC", 2);
0269     m_package->assignPin(18, PicPin::type_bidir, "RC3", "PORTC", 3);
0270     m_package->assignPin(23, PicPin::type_bidir, "RC4", "PORTC", 4);
0271     m_package->assignPin(24, PicPin::type_bidir, "RC5", "PORTC", 5);
0272     m_package->assignPin(25, PicPin::type_bidir, "RC6", "PORTC", 6);
0273     m_package->assignPin(26, PicPin::type_bidir, "RC7", "PORTC", 7);
0274 
0275     m_package->assignPin(19, PicPin::type_bidir, "RD0", "PORTD", 0);
0276     m_package->assignPin(20, PicPin::type_bidir, "RD1", "PORTD", 1);
0277     m_package->assignPin(21, PicPin::type_bidir, "RD2", "PORTD", 2);
0278     m_package->assignPin(22, PicPin::type_bidir, "RD3", "PORTD", 3);
0279     m_package->assignPin(27, PicPin::type_bidir, "RD4", "PORTD", 4);
0280     m_package->assignPin(28, PicPin::type_bidir, "RD5", "PORTD", 5);
0281     m_package->assignPin(29, PicPin::type_bidir, "RD6", "PORTD", 6);
0282     m_package->assignPin(30, PicPin::type_bidir, "RD7", "PORTD", 7);
0283 
0284     m_package->assignPin(8, PicPin::type_bidir, "RE0", "PORTE", 0);
0285     m_package->assignPin(9, PicPin::type_bidir, "RE1", "PORTE", 1);
0286     m_package->assignPin(10, PicPin::type_bidir, "RE2", "PORTE", 2);
0287 
0288     m_package->assignPin(1, PicPin::type_mclr, "MCLR");
0289     m_package->assignPin(11, PicPin::type_vdd, "VDD");
0290     m_package->assignPin(12, PicPin::type_vss, "VSS");
0291     m_package->assignPin(13, PicPin::type_osc, "OSC1");
0292     m_package->assignPin(14, PicPin::type_osc, "OSC2");
0293     m_package->assignPin(31, PicPin::type_vss, "VSS");
0294     m_package->assignPin(32, PicPin::type_vdd, "VDD");
0295 }
0296 
0297 PicInfo16C64::~PicInfo16C64()
0298 {
0299 }
0300 
0301 PicInfo16C65::PicInfo16C65()
0302     : PicInfo16C64()
0303 {
0304     m_id = "P16C65";
0305 }
0306 
0307 PicInfo16C65::~PicInfo16C65()
0308 {
0309 }
0310 
0311 PicInfo16F62x::PicInfo16F62x()
0312     : PicInfo16X6X()
0313 {
0314     m_id = "P16F62x";
0315 
0316     delete m_package;
0317     m_package = new MicroPackage(18);
0318 
0319     m_package->assignPin(17, PicPin::type_bidir, "RA0", "PORTA", 0);
0320     m_package->assignPin(18, PicPin::type_bidir, "RA1", "PORTA", 1);
0321     m_package->assignPin(1, PicPin::type_bidir, "RA2", "PORTA", 2);
0322     m_package->assignPin(2, PicPin::type_bidir, "RA3", "PORTA", 3);
0323     m_package->assignPin(3, PicPin::type_bidir, "RA4", "PORTA", 4);
0324     m_package->assignPin(4, PicPin::type_input, "RA5", "PORTA", 5);
0325     m_package->assignPin(15, PicPin::type_bidir, "RA6", "PORTA", 6);
0326     m_package->assignPin(16, PicPin::type_bidir, "RA7", "PORTA", 7);
0327 
0328     m_package->assignPin(6, PicPin::type_bidir, "RB0", "PORTB", 0);
0329     m_package->assignPin(7, PicPin::type_bidir, "RB1", "PORTB", 1);
0330     m_package->assignPin(8, PicPin::type_bidir, "RB2", "PORTB", 2);
0331     m_package->assignPin(9, PicPin::type_bidir, "RB3", "PORTB", 3);
0332     m_package->assignPin(10, PicPin::type_bidir, "RB4", "PORTB", 4);
0333     m_package->assignPin(11, PicPin::type_bidir, "RB5", "PORTB", 5);
0334     m_package->assignPin(12, PicPin::type_bidir, "RB6", "PORTB", 6);
0335     m_package->assignPin(13, PicPin::type_bidir, "RB7", "PORTB", 7);
0336 
0337     m_package->assignPin(5, PicPin::type_vss, "VSS");
0338     m_package->assignPin(14, PicPin::type_vdd, "VDD");
0339 }
0340 
0341 PicInfo16F62x::~PicInfo16F62x()
0342 {
0343     delete m_package;
0344     m_package = nullptr;
0345 }
0346 
0347 PicInfo16F627::PicInfo16F627()
0348     : PicInfo16F62x()
0349 {
0350     m_id = "P16F627";
0351 }
0352 
0353 PicInfo16F627::~PicInfo16F627()
0354 {
0355 }
0356 
0357 PicInfo16F628::PicInfo16F628()
0358     : PicInfo16F627()
0359 {
0360     m_id = "P16F628";
0361 }
0362 
0363 PicInfo16F628::~PicInfo16F628()
0364 {
0365 }
0366 
0367 PicInfo16F648::PicInfo16F648()
0368     : PicInfo16F628()
0369 {
0370     m_id = "P16F648";
0371 }
0372 
0373 PicInfo16F648::~PicInfo16F648()
0374 {
0375 }
0376 
0377 PicInfo16C71::PicInfo16C71()
0378     : PicInfo16C61()
0379 {
0380     m_id = "P16C71";
0381 }
0382 
0383 PicInfo16C71::~PicInfo16C71()
0384 {
0385 }
0386 
0387 PicInfo16C712::PicInfo16C712()
0388     : PicInfo16C62()
0389 {
0390     m_id = "P16C712";
0391 }
0392 
0393 PicInfo16C712::~PicInfo16C712()
0394 {
0395 }
0396 
0397 PicInfo16C716::PicInfo16C716()
0398     : PicInfo16C712()
0399 {
0400     m_id = "P16C716";
0401 }
0402 
0403 PicInfo16C716::~PicInfo16C716()
0404 {
0405 }
0406 
0407 PicInfo16C72::PicInfo16C72()
0408     : PicInfo16C62()
0409 {
0410     m_id = "P16C72";
0411 }
0412 
0413 PicInfo16C72::~PicInfo16C72()
0414 {
0415 }
0416 
0417 PicInfo16C73::PicInfo16C73()
0418     : PicInfo16C63()
0419 {
0420     m_id = "P16C73";
0421 }
0422 
0423 PicInfo16C73::~PicInfo16C73()
0424 {
0425 }
0426 
0427 PicInfo16C74::PicInfo16C74()
0428     : PicInfo16C65()
0429 {
0430     m_id = "P16C74";
0431 }
0432 
0433 PicInfo16C74::~PicInfo16C74()
0434 {
0435 }
0436 
0437 PicInfo16F873::PicInfo16F873()
0438     : PicInfo16C73()
0439 {
0440     m_id = "P16F873";
0441 }
0442 
0443 PicInfo16F873::~PicInfo16F873()
0444 {
0445 }
0446 
0447 PicInfo16F874::PicInfo16F874()
0448     : PicInfo16C74()
0449 {
0450     m_id = "P16F874";
0451 }
0452 
0453 PicInfo16F874::~PicInfo16F874()
0454 {
0455 }
0456 
0457 PicInfo16F877::PicInfo16F877()
0458     : PicInfo16F874()
0459 {
0460     m_id = "P16F877";
0461 }
0462 
0463 PicInfo16F877::~PicInfo16F877()
0464 {
0465 }