* sdcc/sim/ucsim/s51.src/glob.cc: Minor fix.
[fw/sdcc] / 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 P0      0x80 /* Port #0 */
41 #define P1      0x90 /* Port #1 */
42 #define P2      0xa0 /* Port #2 */
43 #define P3      0xb0 /* Port #3 */
44 #define IP      0xb8 /* Intrrupt Priority */
45 #define IE      0xa8 /* Interrupt Enable */
46 #define TMOD    0x89 /* Timer MODe */
47 #define TCON    0x88 /* Timer CONtrol */
48 #define T2CON   0xc8 /* Timer #2 CONtrol */
49 #define TH0     0x8c /* Timer #0 High byte */
50 #define TL0     0x8a /* Timer #0 Low byte */
51 #define TH1     0x8d /* Timer #1 High byte */
52 #define TL1     0x8b /* Timer #1 Low byte */
53 #define SCON    0x98 /* Serial line CONtrol */
54 #define TH2     0xcd /* Timer #2 High byte */
55 #define TL2     0xcc /* Timer #2 Low byte */
56 #define RCAP2H  0xcb /* Capture Register of Timer #2 High byte */
57 #define RCAP2L  0xca /* Capture Register of Timer #2 Low byte */
58 #define SBUF    0x99 /* Serial line BUFfer */
59 #define PCON    0x87 /* Power CONtrol */
60
61 #define AUXR    0x8e /* Auxiliary Register */
62 #define AUXR1   0xa2 /* Secondary Aux Register */
63
64 #define DPXL    0x84 /* */
65 #define DPL1    0x84 /* 2nd Data Pointer Low byte */
66 #define DPH1    0x85 /* 2nd Data Pointer High byte */
67 #define DPS     0x86 /* DPS 1H=DPTR is DPL1/DPH1,... */
68 #define DPX     0x93 /* Data Pointer HHigh byte */
69 #define DPX1    0x95 /* Data Pointer HHigh byte */
70 #define ESP     0x9B /* Extended Stack Pointer */
71 #define ACON    0x9D /* */
72 #define WDTRST  0xa6 /* */
73 #define IE0     0xa8 /* */
74 #define SADDR   0xa9 /* */
75 #define IPH0    0xb7 /* */
76 #define IPH     0xb7
77 #define IPL0    0xb8 /* */
78 #define SADEN   0xb9 /* */
79 #define SPH     0xbd /* */
80 #define T2MOD   0xc9 /* */
81 #define PSW1    0xd1 /* */
82 #define MCNT0   0xd1
83 #define MCNT1   0xd2
84 #define MA      0xd3 /* MA register from math accelerator */
85 #define MB      0xd4 /* MB register from math accelerator */
86 #define MC      0xd5 /* MC register from math accelerator */
87 #define CCON    0xd8 /* */
88 #define CMOD    0xd9 /* */
89 #define CCAPM0  0xda /* */
90 #define CCAPM1  0xdb /* */
91 #define CCAPM2  0xdc /* */
92 #define CCAPM3  0xdd /* */
93 #define CCAPM4  0xde /* */
94 #define CL      0xe9 /* */
95 #define CCAP0L  0xea /* */
96 #define CCAP1L  0xeb /* */
97 #define CCAP2L  0xec /* */
98 #define CCAP3L  0xed /* */
99 #define CCAP4L  0xee /* */
100 #define CH      0xf9 /* */
101 #define CCAP0H  0xfa /* */
102 #define CCAP1H  0xfb /* */
103 #define CCAP2H  0xfc /* */
104 #define CCAP3H  0xfd /* */
105 #define CCAP4H  0xfe /* */
106
107 /* Bit masks of flag bits in PSW (0xd0)*/
108
109 #define bmCY    0x80 /* carry */
110 #define bmAC    0x40 /* acarry */
111 #define bmF0    0x20 /* flag 0 */
112 #define bmRS1   0x10 /* register select 1 */
113 #define bmRS0   0x08 /* register select 0 */
114 #define bmOV    0x04 /* arithmetic overflow */
115 #define bmP     0x01 /* parity, set by hardware */
116
117 /* Bit masks in PCON (0x87) */
118
119 #define bmSMOD1 0x80
120 #define bmSMOD  0x80
121 #define bmSMOD0 0x40
122 #define bmPOF   0x10
123 #define bmGF1   0x08
124 #define bmGF0   0x04
125 #define bmPD    0x02
126 #define bmIDL   0x01
127
128 /* Bit masks in IE (0xa8) */
129
130 #define bmEA    0x80
131 #define bmEC    0x40
132 #define bmET2   0x20
133 #define bmES    0x10
134 #define bmET1   0x08
135 #define bmEX1   0x04
136 #define bmET0   0x02
137 #define bmEX0   0x01
138
139 /* Bit masks in IP (0xb8) */
140
141 #define bmPPC   0x40
142 #define bmPT2   0x20
143 #define bmPS    0x10
144 #define bmPT1   0x08
145 #define bmPX1   0x04
146 #define bmPT0   0x02
147 #define bmPX0   0x01
148
149 /* Bit masks in IPL0 (0xb8) */
150
151 #define bmIPL0_6 0x40
152 #define bmIPL0_5 0x20
153 #define bmIPL0_4 0x10
154 #define bmIPL0_3 0x08
155 #define bmIPL0_2 0x04
156 #define bmIPL0_1 0x02
157 #define bmIPL0_0 0x01
158
159 /* Bit masks in IPH0 (0xb7) */
160
161 #define bmIPH0_6 0x40
162 #define bmIPH0_5 0x20
163 #define bmIPH0_4 0x10
164 #define bmIPH0_3 0x08
165 #define bmIPH0_2 0x04
166 #define bmIPH0_1 0x02
167 #define bmIPH0_0 0x01
168
169 /* Bit masks in P1 (0x90) */
170
171 #define bmCEX4  0x80
172 #define bmCEX3  0x40
173 #define bmCEX2  0x20
174 #define bmCEX1  0x10
175 #define bmCEX0  0x08
176 #define bmECI   0x04
177 #define bmT2EX  0x02
178 #define bmT2    0x01
179
180 /* Bit masks in P3 (0xb0) */
181
182 #define bmRXD   0x01
183 #define bmTXD   0x02
184 #define bm_INT0 0x04
185 #define bm_INT1 0x08
186 #define bmT0    0x10
187 #define bmT1    0x20
188 #define bm_WR   0x40
189 #define bm_RD   0x80
190
191 /* Bit masks in TMOD (0x89) */
192
193 #define bmGATE1 0x80
194 #define bmC_T1  0x40
195 #define bmM11   0x20
196 #define bmM01   0x10
197 #define bmGATE0 0x08
198 #define bmC_T0  0x04
199 #define bmM10   0x02
200 #define bmM00   0x01
201
202 /* Bit masks in TCON (0x88) */
203
204 #define bmTF1   0x80
205 #define bmTR1   0x40
206 #define bmTF0   0x20
207 #define bmTR0   0x10
208 #define bmIE1   0x08
209 #define bmIT1   0x04
210 #define bmIE0   0x02
211 #define bmIT0   0x01
212
213 /* Bit masks in AUXR (0x8e) */
214
215 #define bmEXTRAM  0x02
216 #define bmDISABLE 0x01
217
218 /* Bit masks in AUXR1 (0xa2) */
219
220 #define bmENBOOT  0x20
221 #define bmGF2     0x08
222 #define bmDPS     0x01
223
224 /* Bit masks in T2CON (0xc8) */
225
226 #define bmTF2    0x80
227 #define bmEXF2   0x40
228 #define bmRCLK   0x20
229 #define bmTCLK   0x10
230 #define bmEXEN2  0x08
231 #define bmTR2    0x04
232 #define bmC_T2   0x02
233 #define bmCP_RL2 0x01
234
235 /* Bit masks in SCON (0x98) */
236
237 #define bmFE_SM0 0x80
238 #define bmFE    0x80
239 #define bmSM0   0x80
240 #define bmSM1   0x40
241 #define bmSM2   0x20
242 #define bmREN   0x10
243 #define bmTB8   0x08
244 #define bmRB8   0x04
245 #define bmTI    0x02
246 #define bmRI    0x01
247
248 /* Bit masks in T2MOD (0xc9) */
249
250 #define bmT2OE  0x02
251 #define bmDCEN  0x01
252
253 /* Bit masks in CMOD (0xd9) */
254
255 #define bmCIDL  0x80
256 #define bmWDTE  0x40
257 #define bmCPS1  0x04
258 #define bmCPS0  0x02
259 #define bmECF   0x01
260
261 /* Bit masks in CCON (0xd8) */
262
263 #define bmCF    0x80
264 #define bmCR    0x40
265 #define bmCCF4  0x10
266 #define bmCCF3  0x08
267 #define bmCCF2  0x04
268 #define bmCCF1  0x02
269 #define bmCCF0  0x01
270
271 /* Bit masks in CCAPM0 (0xda) */
272
273 #define bmECOM0 0x40
274 #define bmCAPP0 0x20
275 #define bmCAPN0 0x10
276 #define bmMAT0  0x08
277 #define bmTOG0  0x04
278 #define bmPWM0  0x02
279 #define bmECCF0 0x01
280
281 /* Bit masks in CCAPM1 (0xdb) */
282
283 #define bmECOM1 0x40
284 #define bmCAPP1 0x20
285 #define bmCAPN1 0x10
286 #define bmMAT1  0x08
287 #define bmTOG1  0x04
288 #define bmPWM1  0x02
289 #define bmECCF1 0x01
290
291 /* Bit masks in CCAPM2 (0xdc) */
292
293 #define bmECOM2 0x40
294 #define bmCAPP2 0x20
295 #define bmCAPN2 0x10
296 #define bmMAT2  0x08
297 #define bmTOG2  0x04
298 #define bmPWM2  0x02
299 #define bmECCF2 0x01
300
301 /* Bit masks in CCAPM3 (0xdd) */
302
303 #define bmECOM3 0x40
304 #define bmCAPP3 0x20
305 #define bmCAPN3 0x10
306 #define bmMAT3  0x08
307 #define bmTOG3  0x04
308 #define bmPWM3  0x02
309 #define bmECCF3 0x01
310
311 /* Bit masks in CCAPM4 (0xde) */
312
313 #define bmECOM4 0x40
314 #define bmCAPP4 0x20
315 #define bmCAPN4 0x10
316 #define bmMAT4  0x08
317 #define bmTOG4  0x04
318 #define bmPWM4  0x02
319 #define bmECCF4 0x01
320
321 #define bmECOM  0x40
322 #define bmCAPP  0x20
323 #define bmCAPN  0x10
324 #define bmMAT   0x08
325 #define bmTOG   0x04
326 #define bmPWM   0x02
327 #define bmEDDF  0x01
328
329
330 #endif
331
332 /* End of s51.src/regs51.h */