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 "picinfo12bit.h"
13 
14 #include <KLocalizedString>
15 //#include <k3staticdeleter.h>
16 
17 #include <QGlobalStatic>
18 
19 //PicAsm12bit *PicAsm12bit::m_self = 0;
20 //static K3StaticDeleter<PicAsm12bit> picAsm12BitStaticDeleter;
21 
22 Q_GLOBAL_STATIC(PicAsm12bit, globalPicAsm12bit);
23 
self()24 PicAsm12bit *PicAsm12bit::self()
25 {
26 //	if ( !m_self )
27 //		picAsm12BitStaticDeleter.setObject( m_self, new PicAsm12bit() );
28 //	return m_self;
29     return globalPicAsm12bit;
30 }
31 
32 
PicInfo12bit()33 PicInfo12bit::PicInfo12bit()
34 	: PicInfo()
35 {
36 }
37 
38 
~PicInfo12bit()39 PicInfo12bit::~PicInfo12bit()
40 {
41 }
42 
PicAsm12bit()43 PicAsm12bit::PicAsm12bit()
44 	: AsmInfo()
45 {
46 	// Byte-orientated file register operations
47 	addInstruction( "ADDWF",	nullptr,	"000111dfffff" );
48 	addInstruction( "ANDWF",	nullptr,	"000101dfffff" );
49 	addInstruction( "CLRF",		nullptr,	"0000011fffff" );
50 	addInstruction( "CLRW",		nullptr,	"000001000000" );
51 	addInstruction( "COMF",		nullptr,	"001001dfffff" );
52 	addInstruction( "DECF",		nullptr,	"000011dfffff" );
53 	addInstruction( "DECFSZ",	nullptr,	"001011dfffff" );
54 	addInstruction( "INCF",		nullptr,	"001010dfffff" );
55 	addInstruction( "INCFSZ",	nullptr,	"001111dfffff" );
56 	addInstruction( "IORWF",	nullptr,	"000100dfffff" );
57 	addInstruction( "MOVF",		nullptr,	"001000dfffff" );
58 	addInstruction( "MOVWF",	nullptr,	"0000001fffff" );
59 	addInstruction( "NOP",		nullptr,	"000000000000" );
60 	addInstruction( "RLF",		nullptr,	"001101dfffff" );
61 	addInstruction( "RRF",		nullptr,	"001100dfffff" );
62 	addInstruction( "SUBWF",	nullptr,	"000010dfffff" );
63 	addInstruction( "SWAPF",	nullptr,	"001110dfffff" );
64 	addInstruction( "XORWF",	nullptr,	"000110dfffff" );
65 
66 	// Bit-orientated file register operations
67 	addInstruction( "BCF",		nullptr,	"0100bbbfffff" );
68 	addInstruction( "BSF",		nullptr,	"0101bbbfffff" );
69 	addInstruction( "BTFSC",	nullptr,	"0110bbbfffff" );
70 	addInstruction( "BTFSS",	nullptr,	"0111bbbfffff" );
71 
72 	// Literal and control operations
73 	addInstruction( "ANDLW",	nullptr,	"1110kkkkkkkk" );
74 	addInstruction( "CALL",		nullptr,	"1001kkkkkkkk" );
75 	addInstruction( "CLRWDT",	nullptr,	"000000000100" );
76 	addInstruction( "GOTO",		nullptr,	"101kkkkkkkkk" );
77 	addInstruction( "IORLW",	nullptr,	"1101kkkkkkkk" );
78 	addInstruction( "MOVLW",	nullptr,	"1100kkkkkkkk" );
79 // 	addInstruction( "RETFIE",	0,	"00000000001001" );
80 	addInstruction( "OPTION",	nullptr,	"000000000010" );
81 	addInstruction( "RETLW",	nullptr,	"1000kkkkkkkk" );
82 // 	addInstruction( "RETURN",	0,	"00000000001000" );
83 	addInstruction( "SLEEP",	nullptr,	"000000000011" );
84 // 	addInstruction( "SUBLW",	0,	"11110xkkkkkkkk" );
85 	addInstruction( "TRIS",		nullptr,	"000000000fff" );
86 	addInstruction( "XORLW",	nullptr,	"1111kkkkkkkk" );
87 }
88 
89 
PicInfo16C54()90 PicInfo16C54::PicInfo16C54()
91 	: PicInfo12bit()
92 {
93 	m_id = "P16C54";
94 
95 	delete m_package;
96 	m_package = new MicroPackage(18);
97 
98 	m_package->assignPin( 17,	PicPin::type_bidir,	"RA0",	"PORTA", 0 );
99 	m_package->assignPin( 18,	PicPin::type_bidir,	"RA1",	"PORTA", 1 );
100 	m_package->assignPin( 1,	PicPin::type_bidir,	"RA2",  "PORTA", 2 );
101 	m_package->assignPin( 2,	PicPin::type_bidir,	"RA3",  "PORTA", 3 );
102 	m_package->assignPin( 3,	PicPin::type_open,	"RA4",  "PORTA", 4 );
103 
104 	m_package->assignPin( 6,	PicPin::type_bidir,	"RB0",  "PORTB", 0 );
105 	m_package->assignPin( 7,	PicPin::type_bidir,	"RB1",  "PORTB", 1 );
106 	m_package->assignPin( 8,	PicPin::type_bidir,	"RB2",  "PORTB", 2 );
107 	m_package->assignPin( 9,	PicPin::type_bidir,	"RB3",  "PORTB", 3 );
108 	m_package->assignPin( 10,	PicPin::type_bidir,	"RB4",	"PORTB", 4 );
109 	m_package->assignPin( 11,	PicPin::type_bidir,	"RB5",	"PORTB", 5 );
110 	m_package->assignPin( 12,	PicPin::type_bidir,	"RB6",	"PORTB", 6 );
111 	m_package->assignPin( 13,	PicPin::type_bidir,	"RB7",	"PORTB", 7 );
112 
113 	m_package->assignPin( 4,	PicPin::type_mclr,	"MCLR" );
114 	m_package->assignPin( 5,	PicPin::type_vss,	"VSS" );
115 	m_package->assignPin( 14,	PicPin::type_vdd,	"VDD" );
116 	m_package->assignPin( 15,	PicPin::type_osc,	"OSC2" );
117 	m_package->assignPin( 16,	PicPin::type_osc,	"OSC1" );
118 }
119 
~PicInfo16C54()120 PicInfo16C54::~PicInfo16C54()
121 {
122 }
123 
PicInfo16C55()124 PicInfo16C55::PicInfo16C55()
125 	: PicInfo12bit()
126 {
127 	m_id = "P16C55";
128 }
129 
~PicInfo16C55()130 PicInfo16C55::~PicInfo16C55()
131 {
132 }
133 
PicInfo12C508()134 PicInfo12C508::PicInfo12C508()
135 	: PicInfo12bit()
136 {
137 	m_id = "P12C508";
138 
139 	delete m_package;
140 	m_package = new MicroPackage(8);
141 
142 	m_package->assignPin( 7, PicPin::type_bidir, "GP0",	"GPIO", 0 );
143 	m_package->assignPin( 6, PicPin::type_bidir, "GP1",	"GPIO", 1 );
144 	m_package->assignPin( 5, PicPin::type_bidir, "GP2",	"GPIO", 2 );
145 	m_package->assignPin( 4, PicPin::type_input, "GP3",	"GPIO", 3 );
146 	m_package->assignPin( 3, PicPin::type_bidir, "GP4",	"GPIO", 4 );
147 	m_package->assignPin( 2, PicPin::type_bidir, "GP5",	"GPIO", 5 );
148 
149 	m_package->assignPin( 8, PicPin::type_vss, "VSS" );
150 	m_package->assignPin( 1, PicPin::type_vdd, "VDD" );
151 }
152 
~PicInfo12C508()153 PicInfo12C508::~PicInfo12C508()
154 {
155 }
156 
PicInfo12C509()157 PicInfo12C509::PicInfo12C509()
158 	: PicInfo12C508()
159 {
160 	m_id = "P12C509";
161 }
162 
~PicInfo12C509()163 PicInfo12C509::~PicInfo12C509()
164 {
165 }
166 
PicInfo12C671()167 PicInfo12C671::PicInfo12C671()
168 	: PicInfo12C508()
169 {
170 	m_id = "P12C671";
171 }
172 
~PicInfo12C671()173 PicInfo12C671::~PicInfo12C671()
174 {
175 }
176 
PicInfo12C672()177 PicInfo12C672::PicInfo12C672()
178 	: PicInfo12C508()
179 {
180 	m_id = "P12C672";
181 }
182 
~PicInfo12C672()183 PicInfo12C672::~PicInfo12C672()
184 {
185 }
186 
187