1 /***************************************************************************
2  *   Copyright (C) 2003-2004 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 "micropackage.h"
12 #include "picinfo14bit.h"
13 
14 #include <KLocalizedString>
15 // #include <k3staticdeleter.h>
16 
17 #include <QGlobalStatic>
18 
19 // PicAsm14bit *PicAsm14bit::m_self = 0;
20 // static K3StaticDeleter<PicAsm14bit> picAsm14BitStaticDeleter;
21 
22 Q_GLOBAL_STATIC(PicAsm14bit, globalPicAsm14bit);
23 
self()24 PicAsm14bit *PicAsm14bit::self()
25 {
26 //	if ( !m_self )
27 //		picAsm14BitStaticDeleter.setObject( m_self, new PicAsm14bit() );
28 //	return m_self;
29     return globalPicAsm14bit;
30 }
31 
32 
PicInfo14bit()33 PicInfo14bit::PicInfo14bit()
34 	: PicInfo()
35 {
36 }
37 
38 
~PicInfo14bit()39 PicInfo14bit::~PicInfo14bit()
40 {
41 }
42 
43 
PicAsm14bit()44 PicAsm14bit::PicAsm14bit()
45 	: AsmInfo()
46 {
47 	// Byte-orientated file register operations
48 	addInstruction( "ADDWF",	nullptr,	"000111dfffffff" );
49 	addInstruction( "ANDWF",	nullptr,	"000101dfffffff" );
50 	addInstruction( "CLRF",		nullptr,	"0000011fffffff" );
51 	addInstruction( "CLRW",		nullptr,	"0000010xxxxxxx" );
52 	addInstruction( "COMF",		nullptr,	"001001dfffffff" );
53 	addInstruction( "DECF",		nullptr,	"000011dfffffff" );
54 	addInstruction( "DECFSZ",	nullptr,	"001011dfffffff" );
55 	addInstruction( "INCF",		nullptr,	"001010dfffffff" );
56 	addInstruction( "INCFSZ",	nullptr,	"001111dfffffff" );
57 	addInstruction( "IORWF",	nullptr,	"000100dfffffff" );
58 	addInstruction( "MOVF",		nullptr,	"001000dfffffff" );
59 	addInstruction( "MOVWF",	nullptr,	"0000001fffffff" );
60 	addInstruction( "NOP",		nullptr,	"0000000xx00000" );
61 	addInstruction( "RLF",		nullptr,	"001101dfffffff" );
62 	addInstruction( "RRF",		nullptr,	"001100dfffffff" );
63 	addInstruction( "SUBWF",	nullptr,	"000010dfffffff" );
64 	addInstruction( "SWAPF",	nullptr,	"001110dfffffff" );
65 	addInstruction( "XORWF",	nullptr,	"000110dfffffff" );
66 
67 	// Bit-orientated file register operations
68 	addInstruction( "BCF",		nullptr,	"0100bbbfffffff" );
69 	addInstruction( "BSF",		nullptr,	"0101bbbfffffff" );
70 	addInstruction( "BTFSC",	nullptr,	"0110bbbfffffff" );
71 	addInstruction( "BTFSS",	nullptr,	"0111bbbfffffff" );
72 
73 	// Literal and control operations
74 	addInstruction( "ADDLW",	nullptr,	"11111xkkkkkkkk" );
75 	addInstruction( "ANDLW",	nullptr,	"111001kkkkkkkk" );
76 	addInstruction( "CALL",		nullptr,	"100kkkkkkkkkkk" );
77 	addInstruction( "CLRWDT",	nullptr,	"00000001100100" );
78 	addInstruction( "GOTO",		nullptr,	"101kkkkkkkkkkk" );
79 	addInstruction( "IORLW",	nullptr,	"111000kkkkkkkk" );
80 	addInstruction( "MOVLW",	nullptr,	"1100xxkkkkkkkk" );
81 	addInstruction( "RETFIE",	nullptr,	"00000000001001" );
82 	addInstruction( "RETLW",	nullptr,	"1101xxkkkkkkkk" );
83 	addInstruction( "RETURN",	nullptr,	"00000000001000" );
84 	addInstruction( "SLEEP",	nullptr,	"00000000000011" );
85 	addInstruction( "SUBLW",	nullptr,	"11110xkkkkkkkk" );
86 	addInstruction( "XORLW",	nullptr,	"111010kkkkkkkk" );
87 }
88 
PicInfo16C8x()89 PicInfo16C8x::PicInfo16C8x()
90 	: PicInfo14bit()
91 {
92 	delete m_package;
93 	m_package = new MicroPackage(18);
94 
95 	m_package->assignPin( 17,	PicPin::type_bidir,	"RA0",	"PORTA", 0 );
96 	m_package->assignPin( 18,	PicPin::type_bidir,	"RA1",	"PORTA", 1 );
97 	m_package->assignPin( 1,	PicPin::type_bidir,	"RA2",  "PORTA", 2 );
98 	m_package->assignPin( 2,	PicPin::type_bidir,	"RA3",  "PORTA", 3 );
99 	m_package->assignPin( 3,	PicPin::type_open,	"RA4",  "PORTA", 4 );
100 
101 	m_package->assignPin( 6,	PicPin::type_bidir,	"RB0",  "PORTB", 0 );
102 	m_package->assignPin( 7,	PicPin::type_bidir,	"RB1",  "PORTB", 1 );
103 	m_package->assignPin( 8,	PicPin::type_bidir,	"RB2",  "PORTB", 2 );
104 	m_package->assignPin( 9,	PicPin::type_bidir,	"RB3",  "PORTB", 3 );
105 	m_package->assignPin( 10,	PicPin::type_bidir,	"RB4",	"PORTB", 4 );
106 	m_package->assignPin( 11,	PicPin::type_bidir,	"RB5",	"PORTB", 5 );
107 	m_package->assignPin( 12,	PicPin::type_bidir,	"RB6",	"PORTB", 6 );
108 	m_package->assignPin( 13,	PicPin::type_bidir,	"RB7",	"PORTB", 7 );
109 
110 	m_package->assignPin( 4,	PicPin::type_mclr,	"MCLR" );
111 	m_package->assignPin( 5,	PicPin::type_vss,	"VSS" );
112 	m_package->assignPin( 14,	PicPin::type_vdd,	"VDD" );
113 	m_package->assignPin( 15,	PicPin::type_osc,	"OSC2" );
114 	m_package->assignPin( 16,	PicPin::type_osc,	"OSC1" );
115 }
116 
~PicInfo16C8x()117 PicInfo16C8x::~PicInfo16C8x()
118 {
119 }
120 
PicInfo16C84()121 PicInfo16C84::PicInfo16C84()
122 	: PicInfo16C8x()
123 {
124 	m_id = "P16C84";
125 }
126 
~PicInfo16C84()127 PicInfo16C84::~PicInfo16C84()
128 {
129 }
130 
PicInfo16F84()131 PicInfo16F84::PicInfo16F84()
132 	: PicInfo16C8x()
133 {
134 	m_id = "P16F84";
135 }
136 
~PicInfo16F84()137 PicInfo16F84::~PicInfo16F84()
138 {
139 }
140 
PicInfo16CR84()141 PicInfo16CR84::PicInfo16CR84()
142 	: PicInfo16F84()
143 {
144 	m_id = "P16CR84";
145 }
146 
~PicInfo16CR84()147 PicInfo16CR84::~PicInfo16CR84()
148 {
149 }
150 
PicInfo16F83()151 PicInfo16F83::PicInfo16F83()
152 	: PicInfo16C8x()
153 {
154 	m_id = "P16F83";
155 }
156 
~PicInfo16F83()157 PicInfo16F83::~PicInfo16F83()
158 {
159 }
160 
PicInfo16CR83()161 PicInfo16CR83::PicInfo16CR83()
162 	: PicInfo16F83()
163 {
164 	m_id = "P16CR83";
165 }
~PicInfo16CR83()166 PicInfo16CR83::~PicInfo16CR83()
167 {
168 }
169 
PicInfo16C61()170 PicInfo16C61::PicInfo16C61()
171 	: PicInfo16C8x()
172 {
173 	m_id = "P16C61";
174 }
175 
~PicInfo16C61()176 PicInfo16C61::~PicInfo16C61()
177 {
178 }
179 
PicInfo16X6X()180 PicInfo16X6X::PicInfo16X6X()
181 	: PicInfo14bit()
182 {
183 	m_id = "P16X6X";
184 }
185 
~PicInfo16X6X()186 PicInfo16X6X::~PicInfo16X6X()
187 {
188 }
189 
PicInfo16C62()190 PicInfo16C62::PicInfo16C62()
191 	: PicInfo16X6X()
192 {
193 	m_id = "P16C62";
194 
195 	delete m_package;
196 	m_package = new MicroPackage(28);
197 
198 	m_package->assignPin( 2,	PicPin::type_bidir,	"RA0",	"PORTA", 0 );
199 	m_package->assignPin( 3,	PicPin::type_bidir,	"RA1",	"PORTA", 1 );
200 	m_package->assignPin( 4,	PicPin::type_bidir,	"RA2",  "PORTA", 2 );
201 	m_package->assignPin( 5,	PicPin::type_bidir,	"RA3",  "PORTA", 3 );
202 	m_package->assignPin( 6,	PicPin::type_open,	"RA4",  "PORTA", 4 );
203 	m_package->assignPin( 7,	PicPin::type_bidir,	"RA5",  "PORTA", 5 );
204 
205 	m_package->assignPin( 21,	PicPin::type_bidir,	"RB0",  "PORTB", 0 );
206 	m_package->assignPin( 22,	PicPin::type_bidir,	"RB1",  "PORTB", 1 );
207 	m_package->assignPin( 23,	PicPin::type_bidir,	"RB2",  "PORTB", 2 );
208 	m_package->assignPin( 24,	PicPin::type_bidir,	"RB3",	"PORTB", 3 );
209 	m_package->assignPin( 25,	PicPin::type_bidir,	"RB4",	"PORTB", 4 );
210 	m_package->assignPin( 26,	PicPin::type_bidir,	"RB5",	"PORTB", 5 );
211 	m_package->assignPin( 27,	PicPin::type_bidir,	"RB6",	"PORTB", 6 );
212 	m_package->assignPin( 28,	PicPin::type_bidir,	"RB7",	"PORTB", 7 );
213 
214 	m_package->assignPin( 11,	PicPin::type_bidir,	"RC0",  "PORTC", 0 );
215 	m_package->assignPin( 12,	PicPin::type_bidir,	"RC1",  "PORTC", 1 );
216 	m_package->assignPin( 13,	PicPin::type_bidir,	"RC2",  "PORTC", 2 );
217 	m_package->assignPin( 14,	PicPin::type_bidir,	"RC3",	"PORTC", 3 );
218 	m_package->assignPin( 15,	PicPin::type_bidir,	"RC4",	"PORTC", 4 );
219 	m_package->assignPin( 16,	PicPin::type_bidir,	"RC5",	"PORTC", 5 );
220 	m_package->assignPin( 17,	PicPin::type_bidir,	"RC6",	"PORTC", 6 );
221 	m_package->assignPin( 18,	PicPin::type_bidir,	"RC7",	"PORTC", 7 );
222 
223 	m_package->assignPin( 1,	PicPin::type_mclr,	"MCLR" );
224 	m_package->assignPin( 8,	PicPin::type_vss,	"VSS" );
225 	m_package->assignPin( 9,	PicPin::type_osc,	"OSC1" );
226 	m_package->assignPin( 10,	PicPin::type_osc,	"OSC2" );
227 	m_package->assignPin( 19,	PicPin::type_vss,	"VSS" );
228 	m_package->assignPin( 20,	PicPin::type_vdd,	"VDD" );
229 }
230 
~PicInfo16C62()231 PicInfo16C62::~PicInfo16C62()
232 {
233 
234 }
235 
PicInfo16C63()236 PicInfo16C63::PicInfo16C63()
237 	: PicInfo16C62()
238 {
239 	m_id = "P16C63";
240 }
241 
~PicInfo16C63()242 PicInfo16C63::~PicInfo16C63()
243 {
244 }
245 
PicInfo16C64()246 PicInfo16C64::PicInfo16C64()
247 	: PicInfo16X6X()
248 {
249 	m_id = "P16C64";
250 
251 	delete m_package;
252 	m_package = new MicroPackage(40);
253 
254 	m_package->assignPin( 2,	PicPin::type_bidir,	"RA0",	"PORTA", 0 );
255 	m_package->assignPin( 3,	PicPin::type_bidir,	"RA1",	"PORTA", 1 );
256 	m_package->assignPin( 4,	PicPin::type_bidir,	"RA2",  "PORTA", 2 );
257 	m_package->assignPin( 5,	PicPin::type_bidir,	"RA3",  "PORTA", 3 );
258 	m_package->assignPin( 6,	PicPin::type_open,	"RA4",  "PORTA", 4 );
259 	m_package->assignPin( 7,	PicPin::type_bidir,	"RA5",  "PORTB", 5 );
260 
261 	m_package->assignPin( 33,	PicPin::type_bidir,	"RB0",  "PORTB", 0 );
262 	m_package->assignPin( 34,	PicPin::type_bidir,	"RB1",  "PORTB", 1 );
263 	m_package->assignPin( 35,	PicPin::type_bidir,	"RB2",  "PORTB", 2 );
264 	m_package->assignPin( 36,	PicPin::type_bidir,	"RB3",	"PORTB", 3 );
265 	m_package->assignPin( 37,	PicPin::type_bidir,	"RB4",	"PORTB", 4 );
266 	m_package->assignPin( 38,	PicPin::type_bidir,	"RB5",	"PORTB", 5 );
267 	m_package->assignPin( 39,	PicPin::type_bidir,	"RB6",	"PORTB", 6 );
268 	m_package->assignPin( 40,	PicPin::type_bidir,	"RB7",	"PORTB", 7 );
269 
270 	m_package->assignPin( 15,	PicPin::type_bidir,	"RC0",  "PORTC", 0 );
271 	m_package->assignPin( 16,	PicPin::type_bidir,	"RC1",  "PORTC", 1 );
272 	m_package->assignPin( 17,	PicPin::type_bidir,	"RC2",  "PORTC", 2 );
273 	m_package->assignPin( 18,	PicPin::type_bidir,	"RC3",	"PORTC", 3 );
274 	m_package->assignPin( 23,	PicPin::type_bidir,	"RC4",	"PORTC", 4 );
275 	m_package->assignPin( 24,	PicPin::type_bidir,	"RC5",	"PORTC", 5 );
276 	m_package->assignPin( 25,	PicPin::type_bidir,	"RC6",	"PORTC", 6 );
277 	m_package->assignPin( 26,	PicPin::type_bidir,	"RC7",	"PORTC", 7 );
278 
279 	m_package->assignPin( 19,	PicPin::type_bidir,	"RD0",  "PORTD", 0 );
280 	m_package->assignPin( 20,	PicPin::type_bidir,	"RD1",  "PORTD", 1 );
281 	m_package->assignPin( 21,	PicPin::type_bidir,	"RD2",  "PORTD", 2 );
282 	m_package->assignPin( 22,	PicPin::type_bidir,	"RD3",	"PORTD", 3 );
283 	m_package->assignPin( 27,	PicPin::type_bidir,	"RD4",	"PORTD", 4 );
284 	m_package->assignPin( 28,	PicPin::type_bidir,	"RD5",	"PORTD", 5 );
285 	m_package->assignPin( 29,	PicPin::type_bidir,	"RD6",	"PORTD", 6 );
286 	m_package->assignPin( 30,	PicPin::type_bidir,	"RD7",	"PORTD", 7 );
287 
288 	m_package->assignPin( 8,	PicPin::type_bidir,	"RE0",  "PORTE", 0 );
289 	m_package->assignPin( 9,	PicPin::type_bidir,	"RE1",  "PORTE", 1 );
290 	m_package->assignPin( 10,	PicPin::type_bidir,	"RE2",  "PORTE", 2 );
291 
292 	m_package->assignPin( 1,	PicPin::type_mclr,	"MCLR" );
293 	m_package->assignPin( 11,	PicPin::type_vdd,	"VDD" );
294 	m_package->assignPin( 12,	PicPin::type_vss,	"VSS" );
295 	m_package->assignPin( 13,	PicPin::type_osc,	"OSC1" );
296 	m_package->assignPin( 14,	PicPin::type_osc,	"OSC2" );
297 	m_package->assignPin( 31,	PicPin::type_vss,	"VSS" );
298 	m_package->assignPin( 32,	PicPin::type_vdd,	"VDD" );
299 }
300 
~PicInfo16C64()301 PicInfo16C64::~PicInfo16C64()
302 {
303 }
304 
PicInfo16C65()305 PicInfo16C65::PicInfo16C65()
306 	: PicInfo16C64()
307 {
308 	m_id = "P16C65";
309 }
310 
~PicInfo16C65()311 PicInfo16C65::~PicInfo16C65()
312 {
313 }
314 
PicInfo16F62x()315 PicInfo16F62x::PicInfo16F62x()
316 	: PicInfo16X6X()
317 {
318 	m_id = "P16F62x";
319 
320 	delete m_package;
321 	m_package = new MicroPackage(18);
322 
323 	m_package->assignPin( 17,	PicPin::type_bidir,	"RA0",	"PORTA", 0 );
324 	m_package->assignPin( 18,	PicPin::type_bidir,	"RA1",	"PORTA", 1 );
325 	m_package->assignPin( 1,	PicPin::type_bidir,	"RA2",  "PORTA", 2 );
326 	m_package->assignPin( 2,	PicPin::type_bidir,	"RA3",  "PORTA", 3 );
327 	m_package->assignPin( 3,	PicPin::type_bidir,	"RA4",  "PORTA", 4 );
328 	m_package->assignPin( 4,	PicPin::type_input,	"RA5",  "PORTA", 5 );
329 	m_package->assignPin( 15,	PicPin::type_bidir,	"RA6",  "PORTA", 6 );
330 	m_package->assignPin( 16,	PicPin::type_bidir,	"RA7",  "PORTA", 7 );
331 
332 	m_package->assignPin( 6,	PicPin::type_bidir,	"RB0",  "PORTB", 0 );
333 	m_package->assignPin( 7,	PicPin::type_bidir,	"RB1",  "PORTB", 1 );
334 	m_package->assignPin( 8,	PicPin::type_bidir,	"RB2",  "PORTB", 2 );
335 	m_package->assignPin( 9,	PicPin::type_bidir,	"RB3",  "PORTB", 3 );
336 	m_package->assignPin( 10,	PicPin::type_bidir,	"RB4",	"PORTB", 4 );
337 	m_package->assignPin( 11,	PicPin::type_bidir,	"RB5",	"PORTB", 5 );
338 	m_package->assignPin( 12,	PicPin::type_bidir,	"RB6",	"PORTB", 6 );
339 	m_package->assignPin( 13,	PicPin::type_bidir,	"RB7",	"PORTB", 7 );
340 
341 	m_package->assignPin( 5,	PicPin::type_vss,	"VSS" );
342 	m_package->assignPin( 14,	PicPin::type_vdd,	"VDD" );
343 }
344 
~PicInfo16F62x()345 PicInfo16F62x::~PicInfo16F62x()
346 {
347 	delete m_package;
348 	m_package = nullptr;
349 }
350 
PicInfo16F627()351 PicInfo16F627::PicInfo16F627()
352 	: PicInfo16F62x()
353 {
354 	m_id = "P16F627";
355 }
356 
~PicInfo16F627()357 PicInfo16F627::~PicInfo16F627()
358 {
359 }
360 
PicInfo16F628()361 PicInfo16F628::PicInfo16F628()
362 	: PicInfo16F627()
363 {
364 	m_id = "P16F628";
365 }
366 
~PicInfo16F628()367 PicInfo16F628::~PicInfo16F628()
368 {
369 }
370 
PicInfo16F648()371 PicInfo16F648::PicInfo16F648()
372 	: PicInfo16F628()
373 {
374 	m_id = "P16F648";
375 }
376 
~PicInfo16F648()377 PicInfo16F648::~PicInfo16F648()
378 {
379 }
380 
381 
PicInfo16C71()382 PicInfo16C71::PicInfo16C71()
383 	: PicInfo16C61()
384 {
385 	m_id = "P16C71";
386 }
387 
~PicInfo16C71()388 PicInfo16C71::~PicInfo16C71()
389 {
390 }
391 
PicInfo16C712()392 PicInfo16C712::PicInfo16C712()
393 	: PicInfo16C62()
394 {
395 	m_id = "P16C712";
396 }
397 
~PicInfo16C712()398 PicInfo16C712::~PicInfo16C712()
399 {
400 }
401 
PicInfo16C716()402 PicInfo16C716::PicInfo16C716()
403 	: PicInfo16C712()
404 {
405 	m_id = "P16C716";
406 }
407 
~PicInfo16C716()408 PicInfo16C716::~PicInfo16C716()
409 {
410 }
411 
PicInfo16C72()412 PicInfo16C72::PicInfo16C72()
413 	: PicInfo16C62()
414 {
415 	m_id = "P16C72";
416 }
417 
~PicInfo16C72()418 PicInfo16C72::~PicInfo16C72()
419 {
420 }
421 
422 
PicInfo16C73()423 PicInfo16C73::PicInfo16C73()
424 	: PicInfo16C63()
425 {
426 	m_id = "P16C73";
427 }
428 
~PicInfo16C73()429 PicInfo16C73::~PicInfo16C73()
430 {
431 }
432 
PicInfo16C74()433 PicInfo16C74::PicInfo16C74()
434 	: PicInfo16C65()
435 {
436 	m_id = "P16C74";
437 }
438 
~PicInfo16C74()439 PicInfo16C74::~PicInfo16C74()
440 {
441 }
442 
PicInfo16F873()443 PicInfo16F873::PicInfo16F873()
444 	: PicInfo16C73()
445 {
446 	m_id = "P16F873";
447 }
448 
~PicInfo16F873()449 PicInfo16F873::~PicInfo16F873()
450 {
451 }
452 
PicInfo16F874()453 PicInfo16F874::PicInfo16F874()
454 	: PicInfo16C74()
455 {
456 	m_id = "P16F874";
457 }
458 
~PicInfo16F874()459 PicInfo16F874::~PicInfo16F874()
460 {
461 }
462 
PicInfo16F877()463 PicInfo16F877::PicInfo16F877()
464 	: PicInfo16F874()
465 {
466 	m_id = "P16F877";
467 }
468 
~PicInfo16F877()469 PicInfo16F877::~PicInfo16F877()
470 {
471 }
472 
473