Imported Upstream version 2.9.0
[debian/cc1111] / sim / ucsim / s51.src / regs51.h
1 /*
2  * Simulator of microcontrollers (regs51.h)
3  *
4  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5  * 
6  * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
7  *
8  */
9
10 /* This file is part of microcontroller simulator: ucsim.
11
12 UCSIM is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 UCSIM is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with UCSIM; see the file COPYING.  If not, write to the Free
24 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 02111-1307, USA. */
26 /*@1@*/
27
28 #ifndef REGS51_HEADER
29 #define REGS51_HEADER
30
31
32 /* Address of SFR registers */
33
34 #define ACC     0xe0 /* Accumulator */
35 #define B       0xf0 /* B register (scondary accumulator) */
36 #define PSW     0xd0 /* Program Status Word */
37 #define SP      0x81 /* Stack Pointer */
38 #define DPL     0x82 /* Data Pointer Low byte */
39 #define DPH     0x83 /* Data Pointer High byte */
40 #define DPL1    0x84 /* 2nd Data Pointer Low byte */
41 #define DPH1    0x85 /* 2nd Data Pointer High byte */
42 #define DPS     0x86 /* DPS 1H=DPTR is DPL1/DPH1, 2H=AUTO DPTR INCR */
43 #define P0      0x80 /* Port #0 */
44 #define P1      0x90 /* Port #1 */
45 #define P2      0xa0 /* Port #2 */
46 #define P3      0xb0 /* Port #3 */
47 #define IP      0xb8 /* Intrrupt Priority */
48 #define IE      0xa8 /* Interrupt Enable */
49 #define TMOD    0x89 /* Timer MODe */
50 #define TCON    0x88 /* Timer CONtrol */
51 #define T2CON   0xc8 /* Timer #2 CONtrol */
52 #define TH0     0x8c /* Timer #0 High byte */
53 #define TL0     0x8a /* Timer #0 Low byte */
54 #define TH1     0x8d /* Timer #1 High byte */
55 #define TL1     0x8b /* Timer #1 Low byte */
56 #define SCON    0x98 /* Serial line CONtrol */
57 #define TH2     0xcd /* Timer #2 High byte */
58 #define TL2     0xcc /* Timer #2 Low byte */
59 #define RCAP2H  0xcb /* Capture Register of Timer #2 High byte */
60 #define RCAP2L  0xca /* Capture Register of Timer #2 Low byte */
61 #define SBUF    0x99 /* Serial line BUFfer */
62 #define PCON    0x87 /* Power CONtrol */
63
64 #define AUXR    0x8e /* Auxiliary Register */
65 #define AUXR1   0xa2 /* Secondary Aux Register */
66
67 #define P4      0x80
68 #define DPXL    0x84 /* */
69 #define DPL1    0x84 /* 2nd Data Pointer Low byte */
70 #define DPH1    0x85 /* 2nd Data Pointer High byte */
71 #define DPS     0x86 /* DPS 1H=DPTR is DPL1/DPH1,... */
72 #define EXIF    0x91 /* */
73 #define P4CNT   0x92 /* */
74 #define DPX     0x93 /* Data Pointer HHigh byte */
75 #define DPX1    0x95 /* Data Pointer HHigh byte */
76 #define ESP     0x9b /* Extended Stack Pointer */
77 #define ACON    0x9d /* */
78 #define P5      0xa1
79 #define P5CNT   0xa2 /* */
80 #define C0C     0xa3 /* */
81 #define WDTRST  0xa6 /* */
82 #define IE0     0xa8 /* */
83 #define SADDR   0xa9 /* */
84 #define IPH0    0xb7 /* */
85 #define IPH     0xb7
86 #define IPL0    0xb8 /* */
87 #define SADEN   0xb9 /* */
88 #define SPH     0xbd /* */
89 #define PMR     0xc4 /* */
90 #define MCON    0xc6 /* */
91 #define TA      0xc7 /* */
92 #define T2MOD   0xc9 /* */
93 #define COR     0xce /* */
94 #define PSW1    0xd1 /* */
95 #define MCNT0   0xd1
96 #define MCNT1   0xd2
97 #define MA      0xd3 /* MA register from math accelerator */
98 #define MB      0xd4 /* MB register from math accelerator */
99 #define MC      0xd5 /* MC register from math accelerator */
100 #define CCON    0xd8 /* */
101 #define CMOD    0xd9 /* */
102 #define WDCON   0xd8 /* */
103 #define CCAPM0  0xda /* */
104 #define CCAPM1  0xdb /* */
105 #define CCAPM2  0xdc /* */
106 #define CCAPM3  0xdd /* */
107 #define CCAPM4  0xde /* */
108 #define C1C     0xe3 /* */
109 #define CL      0xe9 /* */
110 #define CCAP0L  0xea /* */
111 #define CCAP1L  0xeb /* */
112 #define CCAP2L  0xec /* */
113 #define CCAP3L  0xed /* */
114 #define CCAP4L  0xee /* */
115 #define CH      0xf9 /* */
116 #define CCAP0H  0xfa /* */
117 #define CCAP1H  0xfb /* */
118 #define CCAP2H  0xfc /* */
119 #define CCAP3H  0xfd /* */
120 #define CCAP4H  0xfe /* */
121
122 /* Bit masks of flag bits in PSW (0xd0)*/
123
124 #define bmCY    0x80 /* carry */
125 #define bmAC    0x40 /* acarry */
126 #define bmF0    0x20 /* flag 0 */
127 #define bmRS1   0x10 /* register select 1 */
128 #define bmRS0   0x08 /* register select 0 */
129 #define bmOV    0x04 /* arithmetic overflow */
130 #define bmP     0x01 /* parity, set by hardware */
131
132 /* Bit masks in PCON (0x87) */
133
134 #define bmSMOD1 0x80
135 #define bmSMOD  0x80
136 #define bmSMOD0 0x40
137 #define bmPOF   0x10
138 #define bmGF1   0x08
139 #define bmGF0   0x04
140 #define bmPD    0x02
141 #define bmIDL   0x01
142
143 /* Bit masks in IE (0xa8) */
144
145 #define bmEA    0x80
146 #define bmEC    0x40
147 #define bmET2   0x20
148 #define bmES    0x10
149 #define bmET1   0x08
150 #define bmEX1   0x04
151 #define bmET0   0x02
152 #define bmEX0   0x01
153
154 /* Bit masks in IP (0xb8) */
155
156 #define bmPPC   0x40
157 #define bmPT2   0x20
158 #define bmPS    0x10
159 #define bmPT1   0x08
160 #define bmPX1   0x04
161 #define bmPT0   0x02
162 #define bmPX0   0x01
163
164 /* Bit masks in IPL0 (0xb8) */
165
166 #define bmIPL0_6 0x40
167 #define bmIPL0_5 0x20
168 #define bmIPL0_4 0x10
169 #define bmIPL0_3 0x08
170 #define bmIPL0_2 0x04
171 #define bmIPL0_1 0x02
172 #define bmIPL0_0 0x01
173
174 /* Bit masks in IPH0 (0xb7) */
175
176 #define bmIPH0_6 0x40
177 #define bmIPH0_5 0x20
178 #define bmIPH0_4 0x10
179 #define bmIPH0_3 0x08
180 #define bmIPH0_2 0x04
181 #define bmIPH0_1 0x02
182 #define bmIPH0_0 0x01
183
184 /* Bit masks in P1 (0x90) */
185
186 #define bmCEX4  0x80
187 #define bmCEX3  0x40
188 #define bmCEX2  0x20
189 #define bmCEX1  0x10
190 #define bmCEX0  0x08
191 #define bmECI   0x04
192 #define bmT2EX  0x02
193 #define bmT2    0x01
194
195 /* Bit masks in P3 (0xb0) */
196
197 #define bmRXD   0x01
198 #define bmTXD   0x02
199 #define bm_INT0 0x04
200 #define bm_INT1 0x08
201 #define bmT0    0x10
202 #define bmT1    0x20
203 #define bm_WR   0x40
204 #define bm_RD   0x80
205
206 /* Bit masks in TMOD (0x89) */
207
208 #define bmGATE1 0x80
209 #define bmC_T1  0x40
210 #define bmM11   0x20
211 #define bmM01   0x10
212 #define bmGATE0 0x08
213 #define bmC_T0  0x04
214 #define bmM10   0x02
215 #define bmM00   0x01
216
217 /* Bit masks in TCON (0x88) */
218
219 #define bmTF1   0x80
220 #define bmTR1   0x40
221 #define bmTF0   0x20
222 #define bmTR0   0x10
223 #define bmIE1   0x08
224 #define bmIT1   0x04
225 #define bmIE0   0x02
226 #define bmIT0   0x01
227
228 /* Bit masks in AUXR (0x8e) */
229
230 #define bmEXTRAM  0x02
231 #define bmDISABLE 0x01
232
233 /* Bit masks in AUXR1 (0xa2) */
234
235 #define bmENBOOT  0x20
236 #define bmGF2     0x08
237 #define bmDPS     0x01
238
239 /* Bit masks in T2CON (0xc8) */
240
241 #define bmTF2    0x80
242 #define bmEXF2   0x40
243 #define bmRCLK   0x20
244 #define bmTCLK   0x10
245 #define bmEXEN2  0x08
246 #define bmTR2    0x04
247 #define bmC_T2   0x02
248 #define bmCP_RL2 0x01
249
250 /* Bit masks in SCON (0x98) */
251
252 #define bmFE_SM0 0x80
253 #define bmFE    0x80
254 #define bmSM0   0x80
255 #define bmSM1   0x40
256 #define bmSM2   0x20
257 #define bmREN   0x10
258 #define bmTB8   0x08
259 #define bmRB8   0x04
260 #define bmTI    0x02
261 #define bmRI    0x01
262
263 /* Bit masks in T2MOD (0xc9) */
264
265 #define bmT2OE  0x02
266 #define bmDCEN  0x01
267
268 /* Bit masks in CMOD (0xd9) */
269
270 #define bmCIDL  0x80
271 #define bmWDTE  0x40
272 #define bmCPS1  0x04
273 #define bmCPS0  0x02
274 #define bmECF   0x01
275
276 /* Bit masks in CCON (0xd8) */
277
278 #define bmCF    0x80
279 #define bmCR    0x40
280 #define bmCCF4  0x10
281 #define bmCCF3  0x08
282 #define bmCCF2  0x04
283 #define bmCCF1  0x02
284 #define bmCCF0  0x01
285
286 /* Bit masks in CCAPM0 (0xda) */
287
288 #define bmECOM0 0x40
289 #define bmCAPP0 0x20
290 #define bmCAPN0 0x10
291 #define bmMAT0  0x08
292 #define bmTOG0  0x04
293 #define bmPWM0  0x02
294 #define bmECCF0 0x01
295
296 /* Bit masks in CCAPM1 (0xdb) */
297
298 #define bmECOM1 0x40
299 #define bmCAPP1 0x20
300 #define bmCAPN1 0x10
301 #define bmMAT1  0x08
302 #define bmTOG1  0x04
303 #define bmPWM1  0x02
304 #define bmECCF1 0x01
305
306 /* Bit masks in CCAPM2 (0xdc) */
307
308 #define bmECOM2 0x40
309 #define bmCAPP2 0x20
310 #define bmCAPN2 0x10
311 #define bmMAT2  0x08
312 #define bmTOG2  0x04
313 #define bmPWM2  0x02
314 #define bmECCF2 0x01
315
316 /* Bit masks in CCAPM3 (0xdd) */
317
318 #define bmECOM3 0x40
319 #define bmCAPP3 0x20
320 #define bmCAPN3 0x10
321 #define bmMAT3  0x08
322 #define bmTOG3  0x04
323 #define bmPWM3  0x02
324 #define bmECCF3 0x01
325
326 /* Bit masks in CCAPM4 (0xde) */
327
328 #define bmECOM4 0x40
329 #define bmCAPP4 0x20
330 #define bmCAPN4 0x10
331 #define bmMAT4  0x08
332 #define bmTOG4  0x04
333 #define bmPWM4  0x02
334 #define bmECCF4 0x01
335
336 #define bmECOM  0x40
337 #define bmCAPP  0x20
338 #define bmCAPN  0x10
339 #define bmMAT   0x08
340 #define bmTOG   0x04
341 #define bmPWM   0x02
342 #define bmEDDF  0x01
343
344
345 #endif
346
347 /* End of s51.src/regs51.h */