Register Definitions Update V1.0.6
[fw/sdcc] / device / include / mcs51reg.h
1 /*-------------------------------------------------------------------------
2    Register Declarations for the mcs51 compatible microcontrollers
3
4    Written By -  Bela Torok / bela.torok@kssg.ch (November 2000)
5
6    This program is free software; you can redistribute it and/or modify it
7    under the terms of the GNU General Public License as published by the
8    Free Software Foundation; either version 2, or (at your option) any
9    later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20    In other words, you are welcome to use, share and improve this program.
21    You are forbidden to forbid anyone else to use, share and improve
22    what you give them.   Help stamp out software-hoarding!
23
24
25    History:
26    --------
27    Version 1.0 Nov 2, 2000 - B. Torok  / bela.torok@kssg.ch
28    Initial release, supported microcontrollers:
29    8051, 8052, Atmel AT89C1051, AT89C2051, AT89C4051,
30    Infineon / Siemens SAB80515, SAB80535, SAB80515A
31
32    Version 1.0.1 (Nov 3, 2000)
33    SAB80515A definitions revised by Michael Schmitt / michael.schmitt@t-online.de
34
35    Version 1.0.2 (Nov 6, 2000)
36    T2CON bug corrected 8052 and SABX microcontrollers have different T2CONs
37    Support for for the Atmel AT89C52, AT80LV52, AT89C55, AT80LV55
38    Support for the Dallas DS80C320 and DS80C323 microcontrollers
39    microcontrollers - B. Torok / bela.torok@kssg.ch
40
41    Version 1.0.3 (Nov 7, 2000)
42    SAB80517 definitions added by Michael Schmitt / michael.schmitt@t-online.de
43    Dallas AT89S53 definitions added by B. Torok / bela.torok@kssg.ch
44    Dallas DS87C520 and DS83C520 definitions added by B. Torok / bela.torok@kssg.ch
45
46    Version 1.0.4 (Nov 9, 2000)
47    To simplify the identication of registers, a large number of definitios
48    were renamed. Long register names now (hopefully) clearly define the
49    function of the registers.
50    Dallas DS89C420 definitions added by B. Torok / bela.torok@kssg.ch
51
52    Version 1.0.5 (Dec 15, 2000)
53    Definitions added: #ifdef MCS51REG_EXTERNAL_ROM
54                       #ifdef MCS51REG_EXTERNAL_RAM
55                       #ifdef MCS51REG_DISABLE_WARNINGS
56
57    Version 1.0.6 (Dec 15, 2000)
58    Correction, if External Memory (RAM or ROM) ist used P2 is used for the
59    upper 8 Adressbits instead of P3
60
61    Adding support for additional microcontrollers:
62    -----------------------------------------------
63
64    1. Don't modify this file!!!
65
66    2. Insert your code in a separate file e.g.: mcs51reg_update.h and include
67       this after the #define HEADER_MCS51REG statement in this file
68
69    3. The mcs51reg_update.h file should contain following definitions:
70
71           a. An entry with the inventory of the register set of the
72              microcontroller in the  "Describe microcontrollers" section.
73
74           b. If necessary add entry(s) in for registers not defined in this file
75
76           c. Define interrupt vectors
77
78    4. Send me the file mcs51reg_update.h ( bela.torok@kssg.ch ).
79       I'm going to verify/merge new definitions to this file.
80
81
82    Microcontroller support:
83
84    Use one of the following options:
85
86    1. use #include <mcs51reg.h> in your program & define MICROCONTROLLER_XXXX in your makefile.
87
88    2. use following definitions prior the
89       #include <mcs51reg.h> line in your program:
90       e.g.:
91       #define MICROCONTROLLER_8052       -> 8052 type microcontroller
92       or
93       #define MICROCONTROLLER_AT89CX051  -> Atmel AT89C1051, AT89C2051 and AT89C4051 microcontrollers
94
95
96    Use only one of the following definitions!!!
97
98    Supported Microcontrollers:
99
100    No definition                8051
101    MICROCONTROLLER_8051         8051
102    MICROCONTROLLER_8052         8052
103    MICROCONTROLLER_AT89CX051    Atmel AT89C1051, AT89C2051 and AT89C4051
104    MICROCONTROLLER_AT89S53      Atmel AT89S53 microcontroller
105    MICROCONTROLLER_AT89X52      Atmel AT89C52 and AT80LV52 microcontrollers
106    MICROCONTROLLER_AT89X55      Atmel AT89C55 and AT80LV55 microcontrollers
107    MICROCONTROLLER_DS80C32X     Dallas DS80C320 and DS80C323 microcontrollers
108    MICROCONTROLLER_DS89C420     Dallas DS89C420 microcontroller
109    MICROCONTROLLER_DS8XC520     Dallas DS87C520 and DS83C520 microcontrollers
110    MICROCONTROLLER_SAB80515     Infineon / Siemens SAB80515 & SAB80535
111    MICROCONTROLLER_SAB80515A    Infineon / Siemens SAB80515A
112    MICROCONTROLLER_SAB80517     Infineon / Siemens SAB80517
113
114    Additional definitions (use them prior the #include mcs51reg.h statement):
115
116    Ports P0 & P2 are not available for the programmer if external ROM used.
117    Use statement "#define MCS51REG_EXTERNAL_RAM" to undefine P0 & P2.
118
119    Ports P0, P2, P3_6, WR, P3_7 & RD are not available for the programmer if
120    external RAM is used.
121    Use statement "#define MCS51REG_EXTERNAL_RAM" to undefine P0, P2,
122    P3_6, WR, P3_7 & RD.
123
124    #define MCS51REG_DISABLE_WARNINGS -> disables warnings
125
126 -----------------------------------------------------------------------*/
127
128
129 #ifndef HEADER_MCS51REG
130 #define HEADER_MCS51REG
131
132 ///////////////////////////////////////////////////////
133 ///  Insert header here (for developers only)       ///
134 ///  remove "//" from the begining of the next line ///
135 //#include "mcs51reg_update.h"                      ///
136 ///////////////////////////////////////////////////////
137
138 //////////////////////////////////
139 ///  Describe microcontrollers ///
140 ///  (inventory of registers)  ///
141 //////////////////////////////////
142
143 // definitions for the 8051
144 #ifdef MICROCONTROLLER_8051
145 #ifdef MICROCONTROLLER_DEFINED
146 #define MCS51REG_ERROR
147 #endif
148 #ifndef MICROCONTROLLER_DEFINED
149 #define MICROCONTROLLER_DEFINED
150 #endif
151 #ifndef MCS51REG_DISABLE_WARNINGS
152 #warning Selected HW: 8051
153 #endif
154 #define P0
155 #define SP
156 #define DPL
157 #define DPH
158 #define PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
159 #define TCON
160 #define TMOD
161 #define TL0
162 #define TL1
163 #define TH0
164 #define TH1
165 #define P1
166 #define SCON
167 #define SBUF
168 #define P2
169 #define IE__EA__x__x__ES__ET1__EX1__ET0__EX0
170 #define P3
171 #define IP___x__x__x__PS__PT1__PX1__PT0__PX0
172 #define PSW
173 #define ACC
174 #define B
175 #endif
176 // end of definitions for the 8051
177
178
179 // definitions for the 8052 microcontroller
180 #ifdef MICROCONTROLLER_8052
181 #ifdef MICROCONTROLLER_DEFINED
182 #define MCS51REG_ERROR
183 #endif
184 #ifndef MICROCONTROLLER_DEFINED
185 #define MICROCONTROLLER_DEFINED
186 #endif
187 #ifndef MCS51REG_DISABLE_WARNINGS
188 #warning Selected HW: 8052
189 #endif
190 // 8051 register set
191 #define P0
192 #define SP
193 #define DPL
194 #define DPH
195 #define PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
196 #define TCON
197 #define TMOD
198 #define TL0
199 #define TL1
200 #define TH0
201 #define TH1
202 #define P1
203 #define SCON
204 #define SBUF
205 #define P2
206 #define IE__EA__x__ET2__ES__ET1__EX1__ET0__EX0
207 #define P3
208 #define IP___x__x__PT2__PS__PT1__PX1__PT0__PX0
209 #define PSW
210 #define ACC
211 #define B
212 // 8052 specific registers
213 #define T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
214 #define RCAP2L
215 #define RCAP2H
216 #define TL2
217 #define TH2
218 #endif
219 // end of definitions for the 8052 microcontroller
220
221
222 // definitionsons for the Atmel
223 // AT89C1051, AT89C2051 and AT89C4051 microcontrollers
224 #ifdef MICROCONTROLLER_AT89CX051
225 #ifdef MICROCONTROLLER_DEFINED
226 #define MCS51REG_ERROR
227 #endif
228 #ifndef MICROCONTROLLER_DEFINED
229 #define MICROCONTROLLER_DEFINED
230 #endif
231 #ifndef MCS51REG_DISABLE_WARNINGS
232 #warning Selected HW: Atmel AT89Cx051
233 #endif
234 // 8051 register set without P0 & P2
235 #define SP
236 #define DPL
237 #define DPH
238 #define PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
239 #define TCON
240 #define TMOD
241 #define TL0
242 #define TL1
243 #define TH0
244 #define TH1
245 #define P1
246 #define SCON
247 #define SBUF
248 #define IE__EA__x__x__ES__ET1__EX1__ET0__EX0
249 #define P3
250 #define IP___x__x__x__PS__PT1__PX1__PT0__PX0
251 #define PSW
252 #define ACC
253 #define B
254 #endif
255 // end of definitionsons for the Atmel
256 // AT89C1051, AT89C2051 and AT89C4051 microcontrollers
257
258
259 // definitions for the Atmel AT89S53
260 #ifdef MICROCONTROLLER_AT89S53
261 #ifdef MICROCONTROLLER_DEFINED
262 #define MCS51REG_ERROR
263 #endif
264 #ifndef MICROCONTROLLER_DEFINED
265 #define MICROCONTROLLER_DEFINED
266 #endif
267 #ifndef MCS51REG_DISABLE_WARNINGS
268 #warning Selected HW: AT89S53
269 #endif
270 // 8051 register set
271 #define P0
272 #define SP
273 #define DPL
274 #define DPH
275 #define PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
276 #define TCON
277 #define TMOD
278 #define TL0
279 #define TL1
280 #define TH0
281 #define TH1
282 #define P1
283 #define SCON
284 #define SBUF
285 #define P2
286 #define IE__EA__x__ET2__ES__ET1__EX1__ET0__EX0
287 #define P3
288 #define IP___x__x__PT2__PS__PT1__PX1__PT0__PX0
289 #define PSW
290 #define ACC
291 #define B
292 // 8052 specific registers
293 #define T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
294 #define RCAP2L
295 #define RCAP2H
296 #define TL2
297 #define TH2
298 // AT89S53 specific register
299 #define T2MOD
300 #define P1_EXT__x__x__x__x__x__x__T2EX__T2
301 #define SPCR
302 #define SPDR
303 #define SPSR
304 #define WCOM
305 #define DPL1
306 #define DPH1
307 #endif
308 // end of definitions for the Atmel AT89S53 microcontroller
309
310
311 // definitions for the Atmel AT89C52 and AT89LV52 microcontrollers
312 #ifdef MICROCONTROLLER_AT89X52
313 #ifdef MICROCONTROLLER_DEFINED
314 #define MCS51REG_ERROR
315 #endif
316 #ifndef MICROCONTROLLER_DEFINED
317 #define MICROCONTROLLER_DEFINED
318 #endif
319 #ifndef MCS51REG_DISABLE_WARNINGS
320 #warning Selected HW: AT89C52 or AT89LV52
321 #endif
322 // 8051 register set
323 #define P0
324 #define SP
325 #define DPL
326 #define DPH
327 #define PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
328 #define TCON
329 #define TMOD
330 #define TL0
331 #define TL1
332 #define TH0
333 #define TH1
334 #define P1
335 #define SCON
336 #define SBUF
337 #define P2
338 #define IE__EA__x__ET2__ES__ET1__EX1__ET0__EX0
339 #define P3
340 #define IP___x__x__PT2__PS__PT1__PX1__PT0__PX0
341 #define PSW
342 #define ACC
343 #define B
344 // 8052 specific registers
345 #define T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
346 #define RCAP2L
347 #define RCAP2H
348 #define TL2
349 #define TH2
350 // AT89X55 specific register
351 #define T2MOD
352 #define P1_EXT__x__x__x__x__x__x__T2EX__T2
353 #endif
354 // end of definitions for the Atmel AT89C52 and AT89LV52 microcontrollers
355
356
357 // definitions for the Atmel AT89C55 and AT89LV55 microcontrollers
358 #ifdef MICROCONTROLLER_AT89X55
359 #ifdef MICROCONTROLLER_DEFINED
360 #define MCS51REG_ERROR
361 #endif
362 #ifndef MICROCONTROLLER_DEFINED
363 #define MICROCONTROLLER_DEFINED
364 #endif
365 #ifndef MCS51REG_DISABLE_WARNINGS
366 #warning Selected HW: AT89C55 or AT89LV55
367 #endif
368 // 8051 register set
369 #define P0
370 #define SP
371 #define DPL
372 #define DPH
373 #define PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
374 #define TCON
375 #define TMOD
376 #define TL0
377 #define TL1
378 #define TH0
379 #define TH1
380 #define P1
381 #define SCON
382 #define SBUF
383 #define P2
384 #define IE__EA__x__ET2__ES__ET1__EX1__ET0__EX0
385 #define P3
386 #define IP___x__x__PT2__PS__PT1__PX1__PT0__PX0
387 #define PSW
388 #define ACC
389 #define B
390 // 8052 specific registers
391 #define T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
392 #define RCAP2L
393 #define RCAP2H
394 #define TL2
395 #define TH2
396 // AT89X55 specific register
397 #define T2MOD
398 #define P1_EXT__x__x__x__x__x__x__T2EX__T2
399 #endif
400 // end of definitions for the Atmel AT89C55 and AT89LV55 microcontrollers
401
402
403 // definitions for the Dallas DS80C320 and DS80C323 microcontrollers
404 #ifdef MICROCONTROLLER_DS80C32X
405 #ifdef MICROCONTROLLER_DEFINED
406 #define MCS51REG_ERROR
407 #endif
408 #ifndef MICROCONTROLLER_DEFINED
409 #define MICROCONTROLLER_DEFINED
410 #endif
411 #ifndef MCS51REG_DISABLE_WARNINGS
412 #warning Selected HW: Dallas DS80C320 or DS80C323
413 #endif
414 // 8051 register set
415 #define P0
416 #define SP
417 #define DPL
418 #define DPH
419 #define PCON__SMOD__SMOD0__x__x__GF1__GF0__STOP__IDLE
420 #define TCON
421 #define TMOD
422 #define TL0
423 #define TL1
424 #define TH0
425 #define TH1
426 #define P1
427 #define SCON
428 #define SBUF
429 #define P2
430 #define IE__EA__ES1__ET2__ES__ET1__EX1__ET0__EX0
431 #define P3
432 #define IP__x__PS1__PT2__PS__PT1_PX1__PT0__PX0
433 #define PSW
434 #define ACC
435 #define B
436 // 8052 specific registers
437 #define T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
438 #define RCAP2L
439 #define RCAP2H
440 #define TL2
441 #define TH2
442 // DS80C320 specific register
443 #define DPL1
444 #define DPH1
445 #define DPS__x__x__x__x__x__x__x__SEL
446 #define CKCON
447 #define EXIF__IE5__IE4__IE3__IE2__x__RGMD__RGSL__BGS
448 #define SADDR0
449 #define SADDR1
450 #define SADEN0
451 #define SADEN1
452 #define SCON1
453 #define SBUF1
454 #define STATUS__PIP__HIP__LIP__x__x__x__x__x
455 #define TA
456 #define T2MOD
457 #define P1_EXT__INT5__INT4__INT3__INT2__TXD1__RXD1__T2EX__T2
458 #define WDCON
459 #define EIE
460 #define EIP
461 #endif
462 // end of definitions for the Dallas DS80C320 and DS80C323 microcontrollers
463
464
465 // definitions for the Dallas DS89C420 microcontroller
466 #ifdef MICROCONTROLLER_DS89C420
467 #ifdef MICROCONTROLLER_DEFINED
468 #define MCS51REG_ERROR
469 #endif
470 #ifndef MICROCONTROLLER_DEFINED
471 #define MICROCONTROLLER_DEFINED
472 #endif
473 #ifndef MCS51REG_DISABLE_WARNINGS
474 #warning Selected HW: Dallas DS89C420
475 #endif
476 // 8051 register set
477 #define P0
478 #define SP
479 #define DPL
480 #define DPH
481 #define PCON__SMOD__SMOD0__OFDF__OFDE__GF1__GF0__STOP__IDLE
482 #define TCON
483 #define TMOD
484 #define TL0
485 #define TL1
486 #define TH0
487 #define TH1
488 #define P1
489 #define SCON
490 #define SBUF
491 #define P2
492 #define IE__EA__ES1__ET2__ES__ET1__EX1__ET0__EX0
493 #define P3
494 #define IP__x__PS1__PT2__PS__PT1_PX1__PT0__PX0
495 #define PSW
496 #define ACC
497 #define B
498 // 8052 specific registers
499 #define T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
500 #define RCAP2L
501 #define RCAP2H
502 #define TL2
503 #define TH2
504 // DS8XC520 specific registers
505 #define ACON
506 #define DPL1
507 #define DPH1
508 #define DPS__ID1__ID0__TSL__AID__x__x__x__SEL
509 #define CKCON
510 #define CKMOD
511 #define IP0__x__LPS1__LPT2__LPS0__LPT1__LPX1__LPT0__LPX0
512 #define IP1__x__MPS1__MPT2__MPS0__MPT1__MPX1__MPT0__MPX0
513 #define EXIF__IE5__IE4__IE3__IE2__CKRY__RGMD__RGSL__BGS
514 #define PMR
515 #define SADDR0
516 #define SADDR1
517 #define SADEN0
518 #define SADEN1
519 #define SCON1
520 #define SBUF1
521 #define STATUS__PIP__HIP__LIP__XTUP__SPTA2__SPTA1__SPTA0__SPRA0
522 #define TA
523 #define T2MOD
524 #define P1_EXT__INT5__INT4__INT3__INT2__TXD1__RXD1__T2EX__T2
525 #define WDCON
526 #define ROMSIZE__HBPF__BPF__TE__MOVCX__PRAME__RMS2__RMS1__RMS0
527 #define WDCON
528 #define EIE
529 #define EIP
530 #endif
531 // end of definitions for the Dallas DS89C420 microcontroller
532
533
534 // definitions for the Dallas DS87C520 and DS83C520 microcontrollers
535 #ifdef MICROCONTROLLER_DS8XC520
536 #ifdef MICROCONTROLLER_DEFINED
537 #define MCS51REG_ERROR
538 #endif
539 #ifndef MICROCONTROLLER_DEFINED
540 #define MICROCONTROLLER_DEFINED
541 #endif
542 #ifndef MCS51REG_DISABLE_WARNINGS
543 #warning Selected HW: Dallas DS87C520 or DS85C520
544 #endif
545 // 8051 register set
546 #define P0
547 #define SP
548 #define DPL
549 #define DPH
550 #define PCON__SMOD__SMOD0__x__x__GF1__GF0__STOP__IDLE
551 #define TCON
552 #define TMOD
553 #define TL0
554 #define TL1
555 #define TH0
556 #define TH1
557 #define P1
558 #define SCON
559 #define SBUF
560 #define P2
561 #define IE__EA__ES1__ET2__ES__ET1__EX1__ET0__EX0
562 #define P3
563 #define IP__x__PS1__PT2__PS__PT1_PX1__PT0__PX0
564 #define PSW
565 #define ACC
566 #define B
567 // 8052 specific registers
568 #define T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
569 #define RCAP2L
570 #define RCAP2H
571 #define TL2
572 #define TH2
573 // DS8XC520 specific registers
574 #define DPL1
575 #define DPH1
576 #define DPS__x__x__x__x__x__x__x__SEL
577 #define CKCON
578 #define EXIF__IE5__IE4__IE3__IE2__XT_RG__RGMD__RGSL__BGS
579 #define PMR
580 #define SADDR0
581 #define SADDR1
582 #define SADEN0
583 #define SADEN1
584 #define SCON1
585 #define SBUF1
586 #define STATUS__PIP__HIP__LIP__XTUP__SPTA2__SPTA1__SPTA0__SPRA0
587 #define TA
588 #define T2MOD
589 #define P1_EXT__INT5__INT4__INT3__INT2__TXD1__RXD1__T2EX__T2
590 #define WDCON
591 #define ROMSIZE__x__x__x__x__x__RMS2__RMS1__RMS0
592 #define BP2
593 #define WDCON
594 #define EIE
595 #define EIP
596 #endif
597 // end of definitions for the Dallas DS87C520 and DS83C520 microcontrollers
598
599
600 // definitions for the Infineon / Siemens SAB80515 & SAB80535
601 #ifdef MICROCONTROLLER_SAB80515
602 #ifdef MICROCONTROLLER_DEFINED
603 #define MCS51REG_ERROR
604 #endif
605 #ifndef MICROCONTROLLER_DEFINED
606 #define MICROCONTROLLER_DEFINED
607 #endif
608 #ifndef MCS51REG_DISABLE_WARNINGS
609 #warning Selected HW: Infineon / Siemens SAB80515 & SAB80535
610 #endif
611 // 8051 register set without IP
612 #define P0
613 #define SP
614 #define DPL
615 #define DPH
616 #define PCON__SMOD__x__x__x__x__x__x__x
617 #define TCON
618 #define TMOD
619 #define TL0
620 #define TL1
621 #define TH0
622 #define TH1
623 #define P1
624 #define SCON
625 #define SBUF
626 #define P2
627 #define IE__EA_WDT_ET2_ES_ET1_EX1_ET0_EX0
628 #define P3
629 #define PSW
630 #define ACC
631 #define B
632 // SAB80515 specific registers
633 #define P1_EXT__T2__CLKOUT__T2EX__INT2__INT6_CC3__INT5_CC2__INT4_CC1__INT3_CC0
634 #define IP0__x__WDTS__IP0_5__IP0_4__IP0_3__IP0_2__IP0_1__IP0_0
635 #define IEN1
636 #define IRCON
637 #define CCEN
638 #define CCL1
639 #define CCH1
640 #define CCL2
641 #define CCH2
642 #define CCL3
643 #define CCH3
644 #define T2CON__T2PS__I3FR__I2FR__T2R1__T2R0__T2CM__T2I1__T2I0
645 #define CRCL
646 #define CRCH
647 #define TL2
648 #define TH2
649 #define ADCON
650 #define ADDAT
651 #define DAPR__SAB80515
652 #define P4_AT_0XE8
653 #define P5_AT_0XF8
654 #endif
655 // end of definitions for the Infineon / Siemens SAB80515
656
657
658 // definitions for the Infineon / Siemens SAB80515A
659 #ifdef MICROCONTROLLER_SAB80515A
660 #ifdef MICROCONTROLLER_DEFINED
661 #define MCS51REG_ERROR
662 #endif
663 #ifndef MICROCONTROLLER_DEFINED
664 #define MICROCONTROLLER_DEFINED
665 #endif
666 #ifndef MCS51REG_DISABLE_WARNINGS
667 #warning Selected HW: Infineon / Siemens SAB80515A
668 #endif
669 // 8051 register set without IP
670 #define P0
671 #define SP
672 #define DPL
673 #define DPH
674 #define PCON__SMOD__PDS__IDLS__x__x__x__PD__IDL
675 #define TCON
676 #define TMOD
677 #define TL0
678 #define TL1
679 #define TH0
680 #define TH1
681 #define P1
682 #define SCON
683 #define SBUF
684 #define P2
685 #define IE__EA_WDT_ET2_ES_ET1_EX1_ET0_EX0
686 #define P3
687 #define PSW
688 #define ACC
689 #define B
690 // SAB80515A specific registers
691 #define P1_EXT__T2__CLKOUT__T2EX__INT2__INT6_CC3__INT5_CC2__INT4_CC1__INT3_CC0
692 #define IP0__x__WDTS__IP0_5__IP0_4__IP0_3__IP0_2__IP0_1__IP0_0
693 #define IP1__x__x__IP1_5__IP1_4__IP1_3__IP1_2__IP1_1__IP1_0
694 #define IEN1
695 #define IRCON
696 #define CCEN
697 #define CCL1
698 #define CCH1
699 #define CCL2
700 #define CCH2
701 #define CCL3
702 #define CCH3
703 #define T2CON__T2PS__I3FR__I2FR__T2R1__T2R0__T2CM__T2I1__T2I0
704 #define CRCL
705 #define CRCH
706 #define TL2
707 #define TH2
708 #define ADCON0
709 #define ADDATH
710 #define ADDATL
711 #define ADCON1
712 #define SRELL
713 #define SYSCON
714 #define SRELH
715 #define P4_AT_0XE8
716 #define P5_AT_0XF8
717 #define P6_AT_0XDB
718 #define XPAGE
719 #endif
720 // end of definitions for the Infineon / Siemens SAB80515A
721
722
723 // definitions for the Infineon / Siemens SAB80517
724 #ifdef MICROCONTROLLER_SAB80517
725 #ifdef MICROCONTROLLER_DEFINED
726 #define MCS51REG_ERROR
727 #endif
728 #ifndef MICROCONTROLLER_DEFINED
729 #define MICROCONTROLLER_DEFINED
730 #endif
731 #ifndef MCS51REG_DISABLE_WARNINGS
732 #warning Selected HW: Infineon / Siemens SAB80517
733 #endif
734 // 8051 register set without IP, SCON & SBUF
735 #define P0
736 #define SP
737 #define DPL
738 #define DPH
739 #define PCON__SMOD__PDS__IDLS__x__x__x__PD__IDL
740 #define TCON
741 #define TMOD
742 #define TL0
743 #define TL1
744 #define TH0
745 #define TH1
746 #define P1
747 // #define SCON
748 // #define SBUF
749 #define P2
750 #define IE__EA_WDT_ET2_ES_ET1_EX1_ET0_EX0
751 #define P3
752 #define PSW
753 #define ACC
754 #define B
755 // SAB80517 specific registers
756 #define P1_EXT__T2__CLKOUT__T2EX__INT2__INT6_CC3__INT5_CC2__INT4_CC1__INT3_CC0
757 #define IP0__x__WDTS__IP0_5__IP0_4__IP0_3__IP0_2__IP0_1__IP0_0
758 #define IP1__x__x__IP1_5__IP1_4__IP1_3__IP1_2__IP1_1__IP1_0
759 #define IEN1
760 #define IEN2__SAB80517
761 #define IRCON
762 #define CCEN
763 #define CCL1
764 #define CCH1
765 #define CCL2
766 #define CCH2
767 #define CCL3
768 #define CCH3
769 #define CCL4
770 #define CCH4
771 #define CC4EN
772 #define CMEN
773 #define CMH0
774 #define CML0
775 #define CMH1
776 #define CML1
777 #define CMH2
778 #define CML2
779 #define CMH3
780 #define CML3
781 #define CMH4
782 #define CML4
783 #define CMH5
784 #define CML5
785 #define CMH6
786 #define CML6
787 #define CMH7
788 #define CML7
789 #define CMSEL
790 #define T2CON__T2PS__I3FR__I2FR__T2R1__T2R0__T2CM__T2I1__T2I0
791 #define CRCL
792 #define CRCH
793 #define CTCON
794 #define CTRELH
795 #define CTRELL
796 #define TL2
797 #define TH2
798 #define ADCON0
799 #define ADCON1
800 #define ADDAT
801 #define DAPR__SAB80517
802 #define P4_AT_0XE8
803 #define P5_AT_0XF8
804 #define P6_AT_0XFA
805 #define P7_AT_0XDB
806 #define P8_AT_0XDD
807 #define DPSEL
808 #define ARCON
809 #define MD0
810 #define MD1
811 #define MD2
812 #define MD3
813 #define MD4
814 #define MD5
815 #define S0BUF
816 #define S0CON
817 #define S0RELH
818 #define S0RELL
819 #define S1BUF
820 #define S1CON
821 #define S1RELH
822 #define S1RELL
823 #define WDTH
824 #define WDTL
825 #define WDTREL
826 #endif
827 // end of definitions for the Infineon / Siemens SAB80517
828
829
830 /////////////////////////////////////////////////////////
831 ///  don't specify microcontrollers below this line!  ///
832 /////////////////////////////////////////////////////////
833
834
835 // default microcontroller -> 8051
836 // use default if no microcontroller specified
837 #ifndef MICROCONTROLLER_DEFINED
838 #define MICROCONTROLLER_DEFINED
839 #ifndef MCS51REG_DISABLE_WARNINGS
840 #warning //////////////////////////////////
841 #warning // No microcontroller defined!  //
842 #warning //////////////////////////////////
843 #warning Code will be generated for the
844 #warning 8051 (default) microcontroller.
845 #warning If you have another microcontroller
846 #warning define it in the makefile, or in the
847 #warning "C" source prior
848 #warning the #include <mcs51reg.h> statement.
849 #warning If you use a non supported
850 #warning microcontroller, mcs51reg.h can be
851 #warning easily extended to support your HW.
852 #endif
853 // 8051 register set
854 #define P0
855 #define SP
856 #define DPL
857 #define DPH
858 #define PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
859 #define TCON
860 #define TMOD
861 #define TL0
862 #define TL1
863 #define TH0
864 #define TH1
865 #define P1
866 #define SCON
867 #define SBUF
868 #define P2
869 #define IE__EA__x__x__ES__ET1__EX1__ET0__EX0
870 #define P3
871 #define IP___x__x__x__PS__PT1__PX1__PT0__PX0
872 #define PSW
873 #define ACC
874 #define B
875 #endif
876 // end of definitions for the default microcontroller
877
878
879 #ifdef MCS51REG_ERROR
880 #error Two or more microcontrollers defined!
881 #endif
882
883 #ifdef MCS51REG_EXTERNAL_ROM
884 #ifndef MCS51REG_UNDEFINE_P0
885 #define MCS51REG_UNDEFINE_P0
886 #endif
887 #ifndef MCS51REG_UNDEFINE_P2
888 #define MCS51REG_UNDEFINE_P2
889 #endif
890 #endif
891
892 #ifdef MCS51REG_EXTERNAL_RAM
893 #ifndef MCS51REG_UNDEFINE_P0
894 #define MCS51REG_UNDEFINE_P0
895 #endif
896 #ifndef MCS51REG_UNDEFINE_P2
897 #define MCS51REG_UNDEFINE_P2
898 #endif
899 #endif
900
901 #ifdef MCS51REG_UNDEFINE_P0
902 #undef P0
903 #endif
904
905 #ifdef MCS51REG_UNDEFINE_P2
906 #undef P2
907 #endif
908
909 ////////////////////////////////
910 ///  Register definitions    ///
911 ///  (In alphabetical order) ///
912 ////////////////////////////////
913
914 #ifdef ACC
915 #undef ACC
916 sfr at 0xE0 ACC  ;
917 #endif
918
919 #ifdef ACON
920 #undef ACON
921 sfr at 0x9D ACON   ; // DS89C420 specific
922 // Bit registers
923 #define PAGE0   0x20
924 #define PAGES   0x40
925 #define PAGEE   0x80
926 #endif
927
928 #ifdef ADCON
929 #undef ADCON
930 sfr at 0xD8 ADCON   ; // A/D-converter control register SAB80515 specific
931 // Bit registers
932 sbit at 0xD8 MX0        ;
933 sbit at 0xD9 MX1        ;
934 sbit at 0xDA MX2        ;
935 sbit at 0xDB ADM        ;
936 sbit at 0xDC BSY        ;
937 sbit at 0xDE CLK        ;
938 sbit at 0xDF BD         ;
939 #endif
940
941 // ADCON0 ... Infineon / Siemens also called this register ADCON in the User Manual
942 #ifdef ADCON0
943 #undef ADCON0
944 sfr at 0xD8 ADCON0      ; // A/D-converter control register 0 SAB80515A &
945 // Bit registers          // SAB80517 specific
946 sbit at 0xD8 MX0        ;
947 sbit at 0xD9 MX1        ;
948 sbit at 0xDA MX2        ;
949 sbit at 0xDB ADM        ;
950 sbit at 0xDC BSY        ;
951 sbit at 0xDD ADEX       ;
952 sbit at 0xDE CLK        ;
953 sbit at 0xDF BD         ;
954 // Not directly accessible ADCON0
955 #define ADCON0_MX0              0x01
956 #define ADCON0_MX1              0x02
957 #define ADCON0_MX2              0x04
958 #define ADCON0_ADM              0x08
959 #define ADCON0_BSY              0x10
960 #define ADCON0_ADEX             0x20
961 #define ADCON0_CLK              0x40
962 #define ADCON0_BD               0x80
963 #endif
964
965 #ifdef ADCON1
966 #undef ADCON1
967 sfr at 0xDC ADCON1      ; // A/D-converter control register 1 SAB80515A & SAB80517 specific
968 // Not directly accessible ADCON1
969 #define ADCON1_MX0              0x01
970 #define ADCON1_MX1              0x02
971 #define ADCON1_MX2              0x04
972 #define ADCON1_ADCL             0x80
973 #endif
974
975 #ifdef ADDAT
976 #undef ADDAT
977 sfr at 0xD9 ADDAT   ; // A/D-converter data register SAB80515 specific
978 #endif
979
980 #ifdef ADDATH
981 #undef ADDATH
982 sfr at 0xD9 ADDATH      ; // A/D data high byte SAB80515A specific
983 #endif
984
985 #ifdef ADDATL
986 #undef ADDATL
987 sfr at 0xDA ADDATL      ; // A/D data low byte SAB80515A specific
988 #endif
989
990 #ifdef ARCON
991 #undef ARCON
992 sfr at 0xEF ARCON       ; // arithmetic control register SAB80517
993 #endif
994
995 #ifdef B
996 #undef B
997 sfr at 0xF0 B    ;
998 // Bit registers
999 sbit at 0xF0 BREG_F0        ;
1000 sbit at 0xF1 BREG_F1        ;
1001 sbit at 0xF2 BREG_F2        ;
1002 sbit at 0xF3 BREG_F3        ;
1003 sbit at 0xF4 BREG_F4        ;
1004 sbit at 0xF5 BREG_F5        ;
1005 sbit at 0xF6 BREG_F6        ;
1006 sbit at 0xF7 BREG_F7        ;
1007 #endif
1008
1009 #ifdef BP2
1010 #undef BP2
1011 sfr at 0xC3 BP2    ;
1012 // Not directly accessible bits
1013 #define MS0   0x01
1014 #define MS1   0x02
1015 #define MS2   0x04
1016 #define LB1   0x08
1017 #define LB2   0x10
1018 #define LB3   0x20
1019 #endif
1020
1021 #ifdef CC4EN
1022 #undef CC4EN
1023 sfr at 0xC9 CC4EN       ; // compare/capture 4 enable register SAB80517 specific
1024 #endif
1025
1026 #ifdef CCEN
1027 #undef CCEN
1028 sfr at 0xC1 CCEN        ; // compare/capture enable register SAB80515 specific
1029 #endif
1030
1031 #ifdef CCH1
1032 #undef CCH1
1033 sfr at 0xC3 CCH1        ; // compare/capture register 1, high byte SAB80515 specific
1034 #endif
1035
1036 #ifdef CCH2
1037 #undef CCH2
1038 sfr at 0xC5 CCH2        ; // compare/capture register 2, high byte SAB80515 specific
1039 #endif
1040
1041 #ifdef CCH3
1042 #undef CCH3
1043 sfr at 0xC7 CCH3        ; // compare/capture register 3, high byte SAB80515 specific
1044 #endif
1045
1046 #ifdef CCH4
1047 #undef CCH4
1048 sfr at 0xCF CCH4        ; // compare/capture register 4, high byte SAB80515 specific
1049 #endif
1050
1051 #ifdef CCL1
1052 #undef CCL1
1053 sfr at 0xC2 CCL1        ; // compare/capture register 1, low byte SAB80515 specific
1054 #endif
1055
1056 #ifdef CCL2
1057 #undef CCL2
1058 sfr at 0xC4 CCL2        ; // compare/capture register 2, low byte SAB80515 specific
1059 #endif
1060
1061 #ifdef CCL3
1062 #undef CCL3
1063 sfr at 0xC6 CCL3        ; // compare/capture register 3, low byte SAB80515 specific
1064 #endif
1065
1066 #ifdef CCL4
1067 #undef CCL4
1068 sfr at 0xCE CCL4        ; // compare/capture register 4, low byte SAB80515 specific
1069 #endif
1070
1071 #ifdef CKCON
1072 #undef CKCON
1073 sfr at 0x8E CKCON       ; // DS80C320 specific
1074 // Not directly accessible Bits. DS80C320 specific
1075 #define MD0    0x01
1076 #define MD1    0x02
1077 #define MD2    0x04
1078 #define T0M    0x08
1079 #define T1M    0x10
1080 #define T2M    0x20
1081 #define WD0    0x40
1082 #define WD1    0x80
1083 #endif
1084
1085 #ifdef CKMOD
1086 #undef CKMOD
1087 sfr at 0x96 CKMOD       ; // DS89C420 specific
1088 // Not directly accessible Bits.
1089 #define T0MH   0x08
1090 #define T1MH   0x10
1091 #define T2MH   0x20
1092 #endif
1093
1094 #ifdef CMEN
1095 #undef CMEN
1096 sfr at 0xF6 CMEN    ; // compare enable register SAB80517 specific
1097 #endif
1098
1099 #ifdef CMH0
1100 #undef CMH0
1101 sfr at 0xD3 CMH0    ; // compare register 0 high byte SAB80517 specific
1102 #endif
1103
1104 #ifdef CMH1
1105 #undef CMH1
1106 sfr at 0xD5 CMH1    ; // compare register 1 high byte SAB80517 specific
1107 #endif
1108
1109 #ifdef CMH2
1110 #undef CMH2
1111 sfr at 0xD7 CMH2    ; // compare register 2 high byte SAB80517 specific
1112 #endif
1113
1114 #ifdef CMH3
1115 #undef CMH3
1116 sfr at 0xE3 CMH3    ; // compare register 3 high byte SAB80517 specific
1117 #endif
1118
1119 #ifdef CMH4
1120 #undef CMH4
1121 sfr at 0xE5 CMH4    ; // compare register 4 high byte SAB80517 specific
1122 #endif
1123
1124 #ifdef CMH5
1125 #undef CMH5
1126 sfr at 0xE7 CMH5    ; // compare register 5 high byte SAB80517 specific
1127 #endif
1128
1129 #ifdef CMH6
1130 #undef CMH6
1131 sfr at 0xF3 CMH6    ; // compare register 6 high byte SAB80517 specific
1132 #endif
1133
1134 #ifdef CMH7
1135 #undef CMH7
1136 sfr at 0xF5 CMH7    ; // compare register 7 high byte SAB80517 specific
1137 #endif
1138
1139 #ifdef CML0
1140 #undef CML0
1141 sfr at 0xD2 CML0    ; // compare register 0 low byte SAB80517 specific
1142 #endif
1143
1144 #ifdef CML1
1145 #undef CML1
1146 sfr at 0xD4 CML1    ; // compare register 1 low byte SAB80517 specific
1147 #endif
1148
1149 #ifdef CML2
1150 #undef CML2
1151 sfr at 0xD6 CML2    ; // compare register 2 low byte SAB80517 specific
1152 #endif
1153
1154 #ifdef CML3
1155 #undef CML3
1156 sfr at 0xE2 CML3    ; // compare register 3 low byte SAB80517 specific
1157 #endif
1158
1159 #ifdef CML4
1160 #undef CML4
1161 sfr at 0xE4 CML4    ; // compare register 4 low byte SAB80517 specific
1162 #endif
1163
1164 #ifdef CML5
1165 #undef CML5
1166 sfr at 0xE6 CML5    ; // compare register 5 low byte SAB80517 specific
1167 #endif
1168
1169 #ifdef CML6
1170 #undef CML6
1171 sfr at 0xF2 CML6    ; // compare register 6 low byte SAB80517 specific
1172 #endif
1173
1174 #ifdef CML7
1175 #undef CML7
1176 sfr at 0xF4 CML7    ; // compare register 7 low byte SAB80517 specific
1177 #endif
1178
1179 #ifdef CMSEL
1180 #undef CMSEL
1181 sfr at 0xF7 CMSEL   ; // compare input select SAB80517
1182 #endif
1183
1184 #ifdef CRCH
1185 #undef CRCH
1186 sfr at 0xCB CRCH    ; // compare/reload/capture register, high byte SAB80515 specific
1187 #endif
1188
1189 #ifdef CRCL
1190 #undef CRCL
1191 sfr at 0xCA CRCL    ; // compare/reload/capture register, low byte SAB80515 specific
1192 #endif
1193
1194 #ifdef CTCON
1195 #undef CTCON
1196 sfr at 0xE1 CTCON    ; // com.timer control register SAB80517
1197 #endif
1198
1199 #ifdef CTRELH
1200 #undef CTRELH
1201 sfr at 0xDF CTRELH  ; // com.timer rel register high byte SAB80517
1202 #endif
1203
1204 #ifdef CTRELL
1205 #undef CTRELL
1206 sfr at 0xDE CTRELL  ; // com.timer rel register low byte SAB80517
1207 #endif
1208
1209 #ifdef DAPR__SAB80515
1210 #undef DAPR__SAB80515
1211 sfr at 0xD8 DAPR    ; // D/A-converter program register SAB80515 specific
1212 #endif
1213
1214 #ifdef DAPR__SAB80517
1215 #undef DAPR__SAB80517
1216 sfr at 0xDA DAPR    ; // D/A-converter program register SAB80517 specific
1217 #endif
1218
1219 #ifdef DPH
1220 #undef DPH
1221 sfr at 0x83 DPH  ;
1222 sfr at 0x83 DP0H ;  // Alternate name for AT89S53
1223 #endif
1224
1225 #ifdef DPH1
1226 #undef DPH1
1227 sfr at 0x85 DPH1  ; // DS80C320 specific
1228 sfr at 0x85 DP1H  ; // Alternate name for AT89S53
1229 #endif
1230
1231 #ifdef DPL
1232 #undef DPL
1233 sfr at 0x82 DPL  ;  // Alternate name for AT89S53
1234 sfr at 0x82 DP0L ;
1235 #endif
1236
1237 #ifdef DPL1
1238 #undef DPL1
1239 sfr at 0x84 DPL1  ; // DS80C320 specific
1240 sfr at 0x84 DP1L  ; // Alternate name for AT89S53
1241 #endif
1242
1243 #ifdef DPS__x__x__x__x__x__x__x__SEL
1244 #undef DPS__x__x__x__x__x__x__x__SEL
1245 sfr at 0x86 DPS  ;
1246 // Not directly accessible DPS Bit. DS80C320 & DPS8XC520 specific
1247 #define SEL    0x01
1248 #endif
1249
1250 #ifdef DPS__ID1__ID0__TSL__AID__x__x__x__SEL
1251 #undef DPS__ID1__ID0__TSL__AID__x__x__x__SEL
1252 sfr at 0x86 DPS  ;
1253 // Not directly accessible DPS Bit. DS89C420 specific
1254 #define SEL    0x01
1255 #define AID    0x10
1256 #define TSL    0x20
1257 #define ID0    0x40
1258 #define ID1    0x80
1259 #endif
1260
1261 #ifdef DPSEL
1262 #undef DPSEL
1263 sfr at 0x92 DPSEL   ; // data pointer select register SAB80517
1264 #endif
1265
1266 #ifdef EIE
1267 #undef EIE
1268 sfr at 0xE8 EIE  ;
1269 // Bit registers DS80C320 specific
1270 sbit at 0xE8 EX2    ;
1271 sbit at 0xE9 EX3    ;
1272 sbit at 0xEA EX4    ;
1273 sbit at 0xEB EX5    ;
1274 sbit at 0xEC EWDI   ;
1275 #endif
1276
1277 #ifdef EIP
1278 #undef EIP
1279 sfr at 0xE8 EIP  ;
1280 // Bit registers DS80C320 specific
1281 sbit at 0xF8 PX2    ;
1282 sbit at 0xF9 PX3    ;
1283 sbit at 0xFA PX4    ;
1284 sbit at 0xFB PX5    ;
1285 sbit at 0xFC PWDI   ;
1286 #endif
1287
1288 #ifdef EXIF__IE5__IE4__IE3__IE2__x__RGMD__RGSL__BGS
1289 #undef EXIF__IE5__IE4__IE3__IE2__x__RGMD__RGSL__BGS
1290 sfr at 0x91 EXIF  ;
1291 // Not directly accessible EXIF Bits DS80C320 specific
1292 #define BGS    0x01
1293 #define RGSL   0x02
1294 #define RGMD   0x04
1295 #define IE2    0x10
1296 #define IE3    0x20
1297 #define IE4    0x40
1298 #define IE5    0x80
1299 #endif
1300
1301 #ifdef EXIF__IE5__IE4__IE3__IE2__XT_RG__RGMD__RGSL__BGS
1302 #undef EXIF__IE5__IE4__IE3__IE2__XT_RG__RGMD__RGSL__BGS
1303 sfr at 0x91 EXIF  ;
1304 // Not directly accessible EXIF Bits DS87C520 specific
1305 #define BGS    0x01
1306 #define RGSL   0x02
1307 #define RGMD   0x04
1308 #define XT_RG  0x08
1309 #define IE2    0x10
1310 #define IE3    0x20
1311 #define IE4    0x40
1312 #define IE5    0x80
1313 #endif
1314
1315 #ifdef EXIF__IE5__IE4__IE3__IE2__CKRY__RGMD__RGSL__BGS
1316 #undef EXIF__IE5__IE4__IE3__IE2__CKRY__RGMD__RGSL__BGS
1317 sfr at 0x91 EXIF  ;
1318 // Not directly accessible EXIF Bits DS89C420 specific
1319 #define BGS    0x01
1320 #define RGSL   0x02
1321 #define RGMD   0x04
1322 #define CKRY   0x08
1323 #define IE2    0x10
1324 #define IE3    0x20
1325 #define IE4    0x40
1326 #define IE5    0x80
1327 #endif
1328
1329 #ifdef IE__EA__x__x__ES__ET1__EX1__ET0__EX0
1330 #undef IE__EA__x__x__ES__ET1__EX1__ET0__EX0
1331 sfr at 0xA8 IE   ;
1332 // Bit registers
1333 sbit at 0xA8 EX0  ;
1334 sbit at 0xA9 ET0  ;
1335 sbit at 0xAA EX1  ;
1336 sbit at 0xAB ET1  ;
1337 sbit at 0xAC ES   ;
1338 sbit at 0xAF EA   ;
1339 #endif
1340
1341 #ifdef IE__EA__x__ET2__ES__ET1__EX1__ET0__EX0
1342 #undef IE__EA__x__ET2__ES__ET1__EX1__ET0__EX0
1343 sfr at 0xA8 IE   ;
1344 // Bit registers
1345 sbit at 0xA8 EX0  ;
1346 sbit at 0xA9 ET0  ;
1347 sbit at 0xAA EX1  ;
1348 sbit at 0xAB ET1  ;
1349 sbit at 0xAC ES   ;
1350 sbit at 0xAD ET2  ; // Enable timer2 interrupt
1351 sbit at 0xAF EA   ;
1352 #endif // IE
1353
1354 #ifdef IE__EA__ES1__ET2__ES__ET1__EX1__ET0__EX0
1355 #undef IE__EA__ES1__ET2__ES__ET1__EX1__ET0__EX0
1356 sfr at 0xA8 IE   ;
1357 // Bit registers
1358 sbit at 0xA8 EX0  ;
1359 sbit at 0xA9 ET0  ;
1360 sbit at 0xAA EX1  ;
1361 sbit at 0xAB ET1  ;
1362 sbit at 0xAC ES   ;
1363 sbit at 0xAC ES0  ; // Alternate name
1364 sbit at 0xAD ET2  ; // Enable timer2 interrupt
1365 sbit at 0xAE ES1  ;
1366 sbit at 0xAF EA   ;
1367 #endif // IE
1368
1369 #ifdef IE__EA_WDT_ET2_ES_ET1_EX1_ET0_EX0
1370 #undef IE__EA_WDT_ET2_ES_ET1_EX1_ET0_EX0
1371 sfr at 0xA8 IE    ;
1372 sfr at 0xA8 IEN0  ; // Alternate name
1373 // Bit registers for the SAB80515 and compatible IE
1374 sbit at 0xA8 EX0  ;
1375 sbit at 0xA9 ET0  ;
1376 sbit at 0xAA EX1  ;
1377 sbit at 0xAB ET1  ;
1378 sbit at 0xAC ES   ;
1379 sbit at 0xAC ES0  ;
1380 sbit at 0xAD ET2  ; // Enable timer 2 overflow SAB80515 specific
1381 sbit at 0xAE WDT  ; // watchdog timer reset - SAB80515 specific
1382 sbit at 0xAF EA   ;
1383 sbit at 0xAF EAL  ; // EA as called by Infineon / Siemens
1384 #endif
1385
1386 #ifdef IEN1
1387 #undef IEN1
1388 sfr at 0xB8 IEN1        ; // interrupt enable register - SAB80515 specific
1389 // Bit registers
1390 sbit at 0xB8 EADC       ; // A/D converter interrupt enable
1391 sbit at 0xB9 EX2        ;
1392 sbit at 0xBA EX3        ;
1393 sbit at 0xBB EX4        ;
1394 sbit at 0xBC EX5        ;
1395 sbit at 0xBD EX6        ;
1396 sbit at 0xBE SWDT       ; // watchdog timer start/reset
1397 sbit at 0xBF EXEN2      ; // timer2 external reload interrupt enable
1398 #endif
1399
1400 #ifdef IEN2__SAB80517
1401 #undef IEN2__SAB80517
1402 sfr at 0x9A IEN2        ; // interrupt enable register 2 SAB80517
1403 #endif
1404
1405 #ifdef IP___x__x__x__PS__PT1__PX1__PT0__PX0
1406 #undef IP___x__x__x__PS__PT1__PX1__PT0__PX0
1407 sfr at 0xB8 IP   ;
1408 // Bit registers
1409 sbit at 0xB8 PX0  ;
1410 sbit at 0xB9 PT0  ;
1411 sbit at 0xBA PX1  ;
1412 sbit at 0xBB PT1  ;
1413 sbit at 0xBC PS   ;
1414 #endif
1415
1416 #ifdef IP___x__x__PT2__PS__PT1__PX1__PT0__PX0
1417 #undef IP___x__x__PT2__PS__PT1__PX1__PT0__PX0
1418 sfr at 0xB8 IP    ;
1419 // Bit registers
1420 sbit at 0xB8 PX0  ;
1421 sbit at 0xB9 PT0  ;
1422 sbit at 0xBA PX1  ;
1423 sbit at 0xBB PT1  ;
1424 sbit at 0xBC PS   ;
1425 sbit at 0xBD PT2  ;
1426 #endif
1427
1428 #ifdef IP__x__PS1__PT2__PS__PT1_PX1__PT0__PX0
1429 #undef IP__x__PS1__PT2__PS__PT1_PX1__PT0__PX0
1430 sfr at 0xB8 IP   ;
1431 // Bit registers
1432 sbit at 0xB8 PX0  ;
1433 sbit at 0xB9 PT0  ;
1434 sbit at 0xBA PX1  ;
1435 sbit at 0xBB PT1  ;
1436 sbit at 0xBC PS   ;
1437 sbit at 0xBD PT2  ;
1438 sbit at 0xBE PS1  ;
1439 #endif
1440
1441 #ifdef IP0__x__WDTS__IP0_5__IP0_4__IP0_3__IP0_2__IP0_1__IP0_0
1442 #undef IP0__x__WDTS__IP0_5__IP0_4__IP0_3__IP0_2__IP0_1__IP0_0
1443 sfr at 0xA9 IP0   ; // interrupt priority register SAB80515 specific
1444 // Not directly accessible IP0 bits
1445 #define IP0_0    0x01
1446 #define IP0_1    0x02
1447 #define IP0_2    0x04
1448 #define IP0_3    0x08
1449 #define IP0_4    0x10
1450 #define IP0_5    0x20
1451 #define WDTS     0x40
1452 #endif
1453
1454 #ifdef IP0__x__LPS1__LPT2__LPS0__LPT1__LPX1__LPT0__LPX0
1455 #undef IP0__x__LPS1__LPT2__LPS0__LPT1__LPX1__LPT0__LPX0
1456 sfr at 0xB8 IP0   ; // interrupt priority register DS89C420 specific
1457 // Not directly accessible IP0 bits
1458 #define LPX0    0x01
1459 #define LPT0    0x02
1460 #define LPX1    0x04
1461 #define LPT1    0x08
1462 #define LPS0    0x10
1463 #define LPT2    0x20
1464 #define LPS1    0x40
1465 #endif
1466
1467 #ifdef IP1__x__x__IP1_5__IP1_4__IP1_3__IP1_2__IP1_1__IP1_0
1468 #undef IP1__x__x__IP1_5__IP1_4__IP1_3__IP1_2__IP1_1__IP1_0
1469 sfr at 0xB9 IP1   ; // interrupt priority register SAB80515 specific
1470 // Not directly accessible IP1 bits
1471 #define IP1_0    0x01
1472 #define IP1_1    0x02
1473 #define IP1_2    0x04
1474 #define IP1_3    0x08
1475 #define IP1_4    0x10
1476 #define IP1_5    0x20
1477 #endif
1478
1479 #ifdef IP1__x__MPS1__MPT2__MPS0__MPT1__MPX1__MPT0__MPX0
1480 #undef IP1__x__MPS1__MPT2__MPS0__MPT1__MPX1__MPT0__MPX0
1481 sfr at 0xB1 IP1   ; // interrupt priority register DS89C420 specific
1482 // Not directly accessible IP0 bits
1483 #define LPX0    0x01
1484 #define LPT0    0x02
1485 #define LPX1    0x04
1486 #define LPT1    0x08
1487 #define LPS0    0x10
1488 #define LPT2    0x20
1489 #define LPS1    0x40
1490 #endif
1491
1492 #ifdef IRCON
1493 #undef IRCON
1494 sfr at 0xC0 IRCON       ; // interrupt control register - SAB80515 specific
1495 // Bit registers
1496 sbit at 0xC0 IADC       ; // A/D converter irq flag
1497 sbit at 0xC1 IEX2       ; // external interrupt edge detect flag
1498 sbit at 0xC2 IEX3       ;
1499 sbit at 0xC3 IEX4       ;
1500 sbit at 0xC4 IEX5       ;
1501 sbit at 0xC5 IEX6       ;
1502 sbit at 0xC6 TF2        ; // timer 2 owerflow flag
1503 sbit at 0xC7 EXF2       ; // timer2 reload flag
1504 #endif
1505
1506 #ifdef IRCON0
1507 #undef IRCON0
1508 sfr at 0xC0 IRCON0       ; // interrupt control register - SAB80515 specific
1509 // Bit registers
1510 sbit at 0xC0 IADC       ; // A/D converter irq flag
1511 sbit at 0xC1 IEX2       ; // external interrupt edge detect flag
1512 sbit at 0xC2 IEX3       ;
1513 sbit at 0xC3 IEX4       ;
1514 sbit at 0xC4 IEX5       ;
1515 sbit at 0xC5 IEX6       ;
1516 sbit at 0xC6 TF2        ; // timer 2 owerflow flag
1517 sbit at 0xC7 EXF2       ; // timer2 reload flag
1518 #endif
1519
1520 #ifdef IRCON1
1521 #undef IRCON1
1522 sfr at 0xD1 IRCON1      ; // interrupt control register - SAB80515 specific
1523 #endif
1524
1525 #ifdef MD0
1526 #undef MD0
1527 sfr at 0xE9 MD0         ; // MUL / DIV register 0 SAB80517
1528 #endif
1529
1530 #ifdef MD1
1531 #undef MD1
1532 sfr at 0xEA MD1         ; // MUL / DIV register 1 SAB80517
1533 #endif
1534
1535 #ifdef MD2
1536 #undef MD2
1537 sfr at 0xEB MD2         ; // MUL / DIV register 2 SAB80517
1538 #endif
1539
1540 #ifdef MD3
1541 #undef MD3
1542 sfr at 0xEC MD3         ; // MUL / DIV register 3 SAB80517
1543 #endif
1544
1545 #ifdef MD4
1546 #undef MD4
1547 sfr at 0xED MD4         ; // MUL / DIV register 4 SAB80517
1548 #endif
1549
1550 #ifdef MD5
1551 #undef MD5
1552 sfr at 0xEE MD5         ; // MUL / DIV register 5 SAB80517
1553 #endif
1554
1555 #ifdef P0
1556 #undef P0
1557 sfr at 0x80 P0   ;
1558 //  Bit Registers
1559 sbit at 0x80 P0_0 ;
1560 sbit at 0x81 P0_1 ;
1561 sbit at 0x82 P0_2 ;
1562 sbit at 0x83 P0_3 ;
1563 sbit at 0x84 P0_4 ;
1564 sbit at 0x85 P0_5 ;
1565 sbit at 0x86 P0_6 ;
1566 sbit at 0x87 P0_7 ;
1567 #endif
1568
1569 #ifdef P1
1570 #undef P1
1571 sfr at 0x90 P1   ;
1572 // Bit registers
1573 sbit at 0x90 P1_0 ;
1574 sbit at 0x91 P1_1 ;
1575 sbit at 0x92 P1_2 ;
1576 sbit at 0x93 P1_3 ;
1577 sbit at 0x94 P1_4 ;
1578 sbit at 0x95 P1_5 ;
1579 sbit at 0x96 P1_6 ;
1580 sbit at 0x97 P1_7 ;
1581 #endif
1582
1583 #ifdef P1_EXT__INT5__INT4__INT3__INT2__TXD1__RXD1__T2EX__T2
1584 #undef P1_EXT__INT5__INT4__INT3__INT2__TXD1__RXD1__T2EX__T2
1585 // P1 alternate functions
1586 sbit at 0x90 T2   ;
1587 sbit at 0x91 T2EX ;
1588 sbit at 0x92 RXD1 ;
1589 sbit at 0x93 TXD1 ;
1590 sbit at 0x94 INT2 ;
1591 sbit at 0x95 INT3 ;
1592 sbit at 0x96 INT4 ;
1593 sbit at 0x97 INT5 ;
1594 #endif
1595
1596 #ifdef P1_EXT__T2__CLKOUT__T2EX__INT2__INT6_CC3__INT5_CC2__INT4_CC1__INT3_CC0
1597 sbit at 0x90 INT3_CC0   ; // P1 alternate functions - SAB80515 specific
1598 sbit at 0x91 INT4_CC1   ;
1599 sbit at 0x92 INT5_CC2   ;
1600 sbit at 0x93 INT6_CC3   ;
1601 sbit at 0x94 INT2       ;
1602 sbit at 0x95 T2EX       ;
1603 sbit at 0x96 CLKOUT     ;
1604 sbit at 0x97 T2         ;
1605 #endif
1606
1607 #ifdef P1_EXT__x__x__x__x__x__x__T2EX__T2
1608 #undef P1_EXT__x__x__x__x__x__x__T2EX__T2
1609 // P1 alternate functions
1610 sbit at 0x90 T2         ;
1611 sbit at 0x91 T2EX       ;
1612 #endif
1613
1614 #ifdef P2
1615 #undef P2
1616 sfr at 0xA0 P2   ;
1617 // Bit registers
1618 sbit at 0xA0 P2_0 ;
1619 sbit at 0xA1 P2_1 ;
1620 sbit at 0xA2 P2_2 ;
1621 sbit at 0xA3 P2_3 ;
1622 sbit at 0xA4 P2_4 ;
1623 sbit at 0xA5 P2_5 ;
1624 sbit at 0xA6 P2_6 ;
1625 sbit at 0xA7 P2_7 ;
1626 #endif
1627
1628 #ifdef P3
1629 #undef P3
1630 sfr at 0xB0 P3   ;
1631 // Bit registers
1632 sbit at 0xB0 P3_0 ;
1633 sbit at 0xB1 P3_1 ;
1634 sbit at 0xB2 P3_2 ;
1635 sbit at 0xB3 P3_3 ;
1636 sbit at 0xB4 P3_4 ;
1637 sbit at 0xB5 P3_5 ;
1638 #ifndef MCS51REG_EXTERNAL_RAM
1639 sbit at 0xB6 P3_6 ;
1640 sbit at 0xB7 P3_7 ;
1641 #endif
1642 // alternate names
1643 sbit at 0xB0 RXD  ;
1644 sbit at 0xB1 TXD  ;
1645 sbit at 0xB2 INT0 ;
1646 sbit at 0xB3 INT1 ;
1647 sbit at 0xB4 T0   ;
1648 sbit at 0xB5 T1   ;
1649 #ifndef MCS51REG_EXTERNAL_RAM
1650 sbit at 0xB6 WR   ;
1651 sbit at 0xB7 RD   ;
1652 #endif
1653 #endif
1654
1655 #ifdef P4_AT_0XE8
1656 #undef P4_AT_0XE8
1657 sfr at 0xE8 P4          ; // Port 4 - SAB80515 & compatible microcontrollers
1658 // Bit registers
1659 sbit at 0xE8 P4_0       ;
1660 sbit at 0xE9 P4_1       ;
1661 sbit at 0xEA P4_2       ;
1662 sbit at 0xEB P4_3       ;
1663 sbit at 0xEC P4_4       ;
1664 sbit at 0xED P4_5       ;
1665 sbit at 0xEE P4_6       ;
1666 sbit at 0xEF P4_7       ;
1667 #endif
1668
1669 #ifdef P5_AT_0XF8
1670 #undef P5_AT_0XF8
1671 sfr at 0xF8 P5          ; // Port 5 - SAB80515 & compatible microcontrollers
1672 // Bit registers
1673 sbit at 0xF8 P5_0       ;
1674 sbit at 0xF9 P5_1       ;
1675 sbit at 0xFA P5_2       ;
1676 sbit at 0xFB P5_3       ;
1677 sbit at 0xFC P5_4       ;
1678 sbit at 0xFD P5_5       ;
1679 sbit at 0xFE P5_6       ;
1680 sbit at 0xFF P5_7       ;
1681 #endif
1682
1683 #ifdef P6_AT_0XDB
1684 #undef P6_AT_0XDB
1685 sfr at 0xDB P6          ; // Port 6 - SAB80515 & compatible microcontrollers
1686 #endif
1687
1688 #ifdef P6_AT_0XFA
1689 #undef P6_AT_0XFA
1690 sfr at 0xFA P6          ; // Port 6 - SAB80517 specific
1691 #endif
1692
1693 #ifdef P7_AT_0XDB
1694 #undef P7_AT_0XDB
1695 sfr at 0xDB P7          ; // Port 7 - SAB80517 specific
1696 #endif
1697
1698 #ifdef P8_AT_0XDD
1699 #undef P8_AT_0XDD
1700 sfr at 0xDD P8          ; // Port 6 - SAB80517 specific
1701 #endif
1702
1703 #ifdef PCON__SMOD__x__x__x__x__x__x__x
1704 #undef PCON__SMOD__x__x__x__x__x__x__x
1705 sfr at 0x87 PCON ;
1706 // Not directly accessible PCON bits
1707 #define SMOD    0x80
1708 #endif
1709
1710 #ifdef PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
1711 #undef PCON__SMOD__x__x__x__GF1__GF0__PD__IDL
1712 sfr at 0x87 PCON ;
1713 // Not directly accessible PCON bits
1714 #define IDL             0x01
1715 #define PD              0x02
1716 #define GF0             0x04
1717 #define GF1             0x08
1718 #define SMOD            0x80
1719 #endif
1720
1721 #ifdef PCON__SMOD__PDS__IDLS__x__x__x__PD__IDL
1722 #undef PCON__SMOD__PDS__IDLS__x__x__x__PD__IDL
1723 sfr at 0x87 PCON ;
1724 // Not directly accessible PCON bits
1725 #define IDL             0x01
1726 #define IDLE            0x01  ; same as IDL
1727 #define PD              0x02  ;
1728 #define PDE             0x02  ; same as PD
1729 #define IDLS            0x20
1730 #define PDS             0x40
1731 #define SMOD            0x80
1732 // alternate names
1733 #define PCON_IDLE       0x01
1734 #define PCON_PDE        0x02
1735 #define PCON_GF0        0x04
1736 #define PCON_GF1        0x08
1737 #define PCON_IDLS       0x20
1738 #define PCON_PDS        0x40
1739 #define PCON_SMOD       0x80
1740 #endif
1741
1742 #ifdef PCON__SMOD__SMOD0__x__x__GF1__GF0__STOP__IDLE
1743 #undef PCON__SMOD__SMOD0__x__x__GF1__GF0__STOP__IDLE
1744 sfr at 0x87 PCON ;
1745 // Not directly accessible PCON bits
1746 #define IDL             0x01
1747 #define IDLE            0x01  ; same as IDL
1748 #define STOP            0x02  ;
1749 #define GF0             0x04
1750 #define GF1             0x08
1751 #define SMOD0           0x40
1752 #define SMOD            0x80
1753 #endif
1754
1755 #ifdef PCON__SMOD__SMOD0__OFDF__OFDE__GF1__GF0__STOP__IDLE
1756 #undef PCON__SMOD__SMOD0__OFDF__OFDE__GF1__GF0__STOP__IDLE
1757 sfr at 0x87 PCON ;
1758 // Not directly accessible PCON bits
1759 #define IDL             0x01
1760 #define IDLE            0x01  ; same as IDL
1761 #define STOP            0x02  ;
1762 #define GF0             0x04
1763 #define GF1             0x08
1764 #define OFDE            0x10
1765 #define OFDF            0x20
1766 #define SMOD0           0x40
1767 #define SMOD            0x80
1768 #endif
1769
1770 #ifdef PMR
1771 #undef PMR
1772 sfr at 0xC4 PMR  ;   // DS87C520, DS83C520
1773 // Not directly accessible bits
1774 #define DME0    0x01
1775 #define DME1    0x02
1776 #define ALEOFF  0x04
1777 #define XTOFF   0x08
1778 #define SWB     0x20
1779 #define CD0     0x40
1780 #define CD1     0x80
1781 #endif
1782
1783 #ifdef PSW
1784 #undef PSW
1785 sfr at 0xD0 PSW  ;
1786 // Bit registers
1787 sbit at 0xD0 P    ;
1788 sbit at 0xD1 F1   ;
1789 sbit at 0xD2 OV   ;
1790 sbit at 0xD3 RS0  ;
1791 sbit at 0xD4 RS1  ;
1792 sbit at 0xD5 F0   ;
1793 sbit at 0xD6 AC   ;
1794 sbit at 0xD7 CY   ;
1795 #endif
1796
1797 #ifdef RCAP2H
1798 #undef RCAP2H
1799 sfr at 0xCB RCAP2H  ;
1800 #endif
1801
1802 #ifdef RCAP2L
1803 #undef RCAP2L
1804 sfr at 0xCA RCAP2L  ;
1805 #endif
1806
1807 #ifdef ROMSIZE__x__x__x__x__x__RMS2__RMS1__RMS0
1808 #undef ROMSIZE__x__x__x__x__x__RMS2__RMS1__RMS0
1809 sfr at 0xC2 ROMSIZE  ;   // DS87C520, DS83C520
1810 // Not directly accessible bits
1811 #define RSM0    0x01
1812 #define RSM1    0x02
1813 #define RSM2    0x04
1814 #endif
1815
1816 #ifdef ROMSIZE__HBPF__BPF__TE__MOVCX__PRAME__RMS2__RMS1__RMS0
1817 #undef ROMSIZE__HBPF__BPF__TE__MOVCX__PRAME__RMS2__RMS1__RMS0
1818 sfr at 0xC2 ROMSIZE  ;   // DS87C520, DS83C520
1819 // Not directly accessible bits
1820 #define RSM0    0x01
1821 #define RSM1    0x02
1822 #define RSM2    0x04
1823 #define PRAME   0x08
1824 #define MOVCX   0x10
1825 #define TE      0x20
1826 #define BPF     0x40
1827 #define HBPF    0x80
1828 #endif
1829
1830 #ifdef S0BUF
1831 #undef S0BUF
1832 sfr at 0x99 S0BUF ; // serial channel 0 buffer register SAB80517 specific
1833 #endif
1834
1835 #ifdef S0CON
1836 #undef S0CON
1837 sfr at 0x98 S0CON ; // serial channel 0 control register SAB80517 specific
1838 // Bit registers
1839 sbit at 0x98 RI0  ; // S0CON.0: receiver0 interrupt flag
1840 sbit at 0x99 TI0  ; // S0CON.1: transmitter0 interrupt flag
1841 sbit at 0x9A RB80 ; // S0CON.2: receiver0 bit8
1842 sbit at 0x9B TB80 ; // S0CON.3: transmitter0 bit 8
1843 sbit at 0x9C REN0 ; // S0CON.4: receiver0 enable
1844 sbit at 0x9D SM20 ; // S0CON.5: multiprocessor feature
1845 sbit at 0x9E SM1  ; // S0CON.6: | select serial mode
1846 sbit at 0x9F SM0  ; // S0CON.7: |
1847 #endif
1848
1849 #ifdef S0RELL
1850 #undef S0RELL
1851 sfr at 0xAA S0RELL ; // serial channel 0 reload register low byte SAB80517 specific
1852 #endif
1853
1854 #ifdef S0RELH
1855 #undef S0RELH
1856 sfr at 0xBA S0RELH ; // serial channel 0 reload register high byte SAB80517 specific
1857 #endif
1858
1859 #ifdef S1BUF
1860 #undef S1BUF
1861 sfr at 0x9C S1BUF ; // serial channel 1 buffer register SAB80517 specific
1862 #endif
1863
1864 #ifdef S1CON
1865 #undef S1CON
1866 sfr at 0x9B S1CON ; // serial channel 1 control register SAB80517 specific
1867 #endif
1868
1869 #ifdef S1RELL
1870 #undef S1RELL
1871 sfr at 0x9D S1RELL ; // serial channel 1 reload register low byte SAB80517 specific
1872 #endif
1873
1874 #ifdef S1RELH
1875 #undef S1RELH
1876 sfr at 0xBB S1RELH ; // serial channel 1 reload register high byte SAB80517 specific
1877 #endif
1878
1879 #ifdef SADDR0
1880 #undef SADDR0
1881 // DS80C320 specific
1882 sfr at 0xA9 SADDR0  ;
1883 #endif
1884
1885 #ifdef SADDR1
1886 #undef SADDR1
1887 // DS80C320 specific
1888 sfr at 0xAA SADDR1  ;
1889 #endif
1890
1891 #ifdef SADEN0
1892 #undef SADEN0
1893 // DS80C320 specific
1894 sfr at 0xB9 SADEN0  ;
1895 #endif
1896
1897 #ifdef SADEN1
1898 #undef SADEN1
1899 // DS80C320 specific
1900 sfr at 0xBA SADEN1  ;
1901 #endif
1902
1903 #ifdef SBUF
1904 #undef SBUF
1905 sfr at 0x99 SBUF ;
1906 #endif
1907
1908 #ifdef SBUF1
1909 #undef SBUF1
1910 // DS80C320 specific
1911 sfr at 0xC1 SBUF1 ;
1912 #endif
1913
1914 #ifdef SCON
1915 #undef SCON
1916 sfr at 0x98 SCON ;
1917 // Bit registers
1918 sbit at 0x98 RI   ;
1919 sbit at 0x99 TI   ;
1920 sbit at 0x9A RB8  ;
1921 sbit at 0x9B TB8  ;
1922 sbit at 0x9C REN  ;
1923 sbit at 0x9D SM2  ;
1924 sbit at 0x9E SM1  ;
1925 sbit at 0x9F SM0  ;
1926 #endif
1927
1928 #ifdef SCON1
1929 #undef SCON1
1930 // DS80C320 specific
1931 sfr at 0xC0 SCON1  ;
1932 // Bit registers
1933 sbit at 0xC8 RI_1         ;
1934 sbit at 0xC9 TI_1         ;
1935 sbit at 0xCA RB8_1        ;
1936 sbit at 0xCB TB8_1        ;
1937 sbit at 0xCC REN_1        ;
1938 sbit at 0xCD SM2_1        ;
1939 sbit at 0xCE SM1_1        ;
1940 sbit at 0xCF SM0_1        ;
1941 sbit at 0xCF FE_1         ;
1942 sbit at 0xCF SM0_FE_1     ;
1943 #endif
1944
1945 #ifdef SP
1946 #undef SP
1947 sfr at 0x81 SP   ;
1948 #endif
1949
1950 #ifdef SPCR
1951 #undef SPCR
1952 sfr at 0xD5 SPCR   ;   // AT89S53 specific
1953 // Not directly accesible bits
1954 #define SPR0 0x01
1955 #define SPR1 0x02
1956 #define CPHA 0x04
1957 #define CPOL 0x08
1958 #define MSTR 0x10
1959 #define DORD 0x20
1960 #define SPE  0x40
1961 #define SPIE 0x80
1962 #endif
1963
1964 #ifdef SPDR
1965 #undef SPDR
1966 sfr at 0x86 SPDR   ;   // AT89S53 specific
1967 // Not directly accesible bits
1968 #define SPD_0 0x01
1969 #define SPD_1 0x02
1970 #define SPD_2 0x04
1971 #define SPD_3 0x08
1972 #define SPD_4 0x10
1973 #define SPD_5 0x20
1974 #define SPD_6 0x40
1975 #define SPD_7 0x80
1976 #endif
1977
1978 #ifdef SPSR
1979 #undef SPSR
1980 sfr at 0xAA SPSR   ;   // AT89S53 specific
1981 // Not directly accesible bits
1982 #define SPIF 0x40
1983 #define WCOL 0x80
1984 #endif
1985
1986 #ifdef SRELH
1987 #undef SRELH
1988 sfr at 0xBA SRELH       ; // Baudrate generator reload high
1989 #endif
1990
1991 #ifdef SRELL
1992 #undef SRELL
1993 sfr at 0xAA SRELL       ; // Baudrate generator reload low
1994 #endif
1995
1996 #ifdef STATUS__PIP__HIP__LIP__x__x__x__x__x
1997 #undef STATUS__PIP__HIP__LIP__x__x__x__x__x
1998 // DS80C320 specific
1999 sfr at 0xC5 STATUS ;
2000 // Not directly accessible Bits. DS80C320 specific
2001 #define LIP  0x20
2002 #define HIP  0x40
2003 #define PIP  0x80
2004 #endif
2005
2006 #ifdef STATUS__PIP__HIP__LIP__XTUP__SPTA2__SPTA1__SPTA0__SPRA0
2007 #undef STATUS__PIP__HIP__LIP__XTUP__SPTA2__SPTA1__SPTA0__SPRA0
2008 sfr at 0xC5 STATUS ; // DS87C520 & DS83520specific
2009 // Not directly accessible Bits.
2010 #define SPRA0  0x01
2011 #define SPTA0  0x02
2012 #define SPTA1  0x04
2013 #define SPTA2  0x08
2014 #define XTUP   0x10
2015 #define LIP    0x20
2016 #define HIP    0x40
2017 #define PIP    0x80
2018 #endif
2019
2020 #ifdef SYSCON
2021 #undef SYSCON
2022 sfr at 0xB1 SYSCON      ; // XRAM Controller Access Control
2023 // SYSCON bits
2024 #define SYSCON_XMAP0    0x01
2025 #define SYSCON_XMAP1    0x02
2026 #define SYSCON_RMAP             0x10
2027 #define SYSCON_EALE             0x20
2028 #endif
2029
2030 #ifdef T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
2031 #undef T2CON__TF2__EXF2__RCLK__TCLK__EXEN2__TR2__C_T2__CP_RL2
2032 sfr at 0xC8 T2CON ;
2033 // Definitions for the 8052 compatible microcontrollers.
2034 // Bit registers
2035 sbit at 0xC8 CP_RL2  ;
2036 sbit at 0xC9 C_T2    ;
2037 sbit at 0xCA TR2     ;
2038 sbit at 0xCB EXEN2   ;
2039 sbit at 0xCC TCLK    ;
2040 sbit at 0xCD RCLK    ;
2041 sbit at 0xCE EXF2    ;
2042 sbit at 0xCF TF2     ;
2043 // alternate names
2044 sbit at 0xC8 T2CON_0 ;
2045 sbit at 0xC9 T2CON_1 ;
2046 sbit at 0xCA T2CON_2 ;
2047 sbit at 0xCB T2CON_3 ;
2048 sbit at 0xCC T2CON_4 ;
2049 sbit at 0xCD T2CON_5 ;
2050 sbit at 0xCE T2CON_6 ;
2051 sbit at 0xCF T2CON_7 ;
2052 #endif
2053
2054 #ifdef T2CON__T2PS__I3FR__I2FR__T2R1__T2R0__T2CM__T2I1__T2I0
2055 #undef T2CON__T2PS__I3FR__I2FR__T2R1__T2R0__T2CM__T2I1__T2I0
2056 sfr at 0xC8 T2CON ;
2057 // Definitions for the Infineon / Siemens SAB80515, SAB80515A, SAB80517
2058 // Bit registers
2059 sbit at 0xC8 T2I0 ;
2060 sbit at 0xC9 T2I1 ;
2061 sbit at 0xCA T2CM ;
2062 sbit at 0xCB T2R0 ;
2063 sbit at 0xCC T2R1 ;
2064 sbit at 0xCD I2FR ;
2065 sbit at 0xCE I3FR ;
2066 sbit at 0xCF T2PS ;
2067 // alternate names
2068 sbit at 0xC8 T2CON_0 ;
2069 sbit at 0xC9 T2CON_1 ;
2070 sbit at 0xCA T2CON_2 ;
2071 sbit at 0xCB T2CON_3 ;
2072 sbit at 0xCC T2CON_4 ;
2073 sbit at 0xCD T2CON_5 ;
2074 sbit at 0xCE T2CON_6 ;
2075 sbit at 0xCF T2CON_7 ;
2076 #endif
2077
2078 #ifdef T2MOD
2079 #undef T2MOD
2080 // Definitions for the timer/counter 2 of the Atmel 89x52 microcontroller
2081 sfr at 0xC9 T2MOD  ;
2082 // Not not directly accessible T2MOD bits
2083 #define DCEN            0x01
2084 #define T2OE            0x02
2085 // Alternate names
2086 #define DCEN_           0x01
2087 #define T2OE_           0x02
2088 #endif
2089
2090 #ifdef TA
2091 #undef TA
2092 // DS80C320 specific
2093 sfr at 0xC7 TA ;
2094 #endif
2095
2096 #ifdef TCON
2097 #undef TCON
2098 sfr at 0x88 TCON ;
2099 //  Bit registers
2100 sbit at 0x88 IT0  ;
2101 sbit at 0x89 IE0  ;
2102 sbit at 0x8A IT1  ;
2103 sbit at 0x8B IE1  ;
2104 sbit at 0x8C TR0  ;
2105 sbit at 0x8D TF0  ;
2106 sbit at 0x8E TR1  ;
2107 sbit at 0x8F TF1  ;
2108 #endif
2109
2110 #ifdef TH0
2111 #undef TH0
2112 sfr at 0x8C TH0  ;
2113 #endif
2114
2115 #ifdef TH1
2116 #undef TH1
2117 sfr at 0x8D TH1  ;
2118 #endif
2119
2120 #ifdef TH2
2121 #undef TH2
2122 sfr at 0xCD TH2     ;
2123 #endif
2124
2125 #ifdef TL0
2126 #undef TL0
2127 sfr at 0x8A TL0  ;
2128 #endif
2129
2130 #ifdef TL1
2131 #undef TL1
2132 sfr at 0x8B TL1  ;
2133 #endif
2134
2135 #ifdef TL2
2136 #undef TL2
2137 sfr at 0xCC TL2     ;
2138 #endif
2139
2140 #ifdef TMOD
2141 #undef TMOD
2142 sfr at 0x89 TMOD ;
2143 // Not directly accessible TMOD bits
2144 #define T0_M0           0x01
2145 #define T0_M1           0x02
2146 #define T0_CT           0x04
2147 #define T0_GATE         0x08
2148 #define T1_M0           0x10
2149 #define T1_M1           0x20
2150 #define T1_CT           0x40
2151 #define T1_GATE         0x80
2152
2153 #define T0_MASK         0x0F
2154 #define T1_MASK         0xF0
2155 #endif
2156
2157 #ifdef WCON
2158 #undef WCON
2159 sfr at 0x96 WCON   ;   // AT89S53 specific
2160 // Not directly accesible bits
2161 #define WDTEN  0x01
2162 #define WDTRST 0x02
2163 #define DPS    0x04
2164 #define PS0    0x20
2165 #define PS1    0x40
2166 #define PS2    0x80
2167 #endif
2168
2169 #ifdef WDCON
2170 #undef WDCON
2171 // DS80C320 specific
2172 sfr at 0xD8 WDCON ;
2173 // Not directly accessible bits
2174 #define RWT    0x01    /* Timed-Access protected */
2175 #define EWT    0x02    /* Timed-Access protected */
2176 #define WTRF   0x04
2177 #define WDIF   0x08    /* Timed-Access protected */
2178 #define PFI    0x10
2179 #define EPFI   0x20
2180 #define POR    0x40    /* Timed-Access protected */
2181 #define SMOD_1 0x80
2182 #endif
2183
2184 #ifdef WDTREL
2185 #undef WDTREL
2186 sfr at 0x86 WDTREL    ; // Watchdof Timer reload register
2187 #endif
2188
2189 #ifdef XPAGE
2190 #undef XPAGE
2191 sfr at 0x91 XPAGE     ; // Page Address Register for Extended On-Chip Ram - Infineon / Siemens SAB80515A specific
2192 #endif
2193
2194
2195 /////////////////////////
2196 /// Interrupt vectors ///
2197 /////////////////////////
2198
2199 // Interrupt numbers: address = (number * 8) + 3
2200 #define IE0_VECTOR      0       // 0x03 external interrupt 0
2201 #define TF0_VECTOR      1       // 0x0b timer 0
2202 #define IE1_VECTOR      2       // 0x13 external interrupt 1
2203 #define TF1_VECTOR      3       // 0x1b timer 1
2204 #define SI0_VECTOR      4       // 0x23 serial port 0
2205
2206 #ifdef MICROCONTROLLER_AT89S53
2207 #define TF2_VECTOR      5       /* 0x2B timer 2 */
2208 #define EX2_VECTOR      5       /* 0x2B external interrupt 2 */
2209 #endif
2210
2211 #ifdef MICROCONTROLLER_AT89X52
2212 #define TF2_VECTOR      5       /* 0x2B timer 2 */
2213 #define EX2_VECTOR      5       /* 0x2B external interrupt 2 */
2214 #endif
2215
2216 #ifdef MICROCONTROLLER_AT89X55
2217 #define TF2_VECTOR      5       /* 0x2B timer 2 */
2218 #define EX2_VECTOR      5       /* 0x2B external interrupt 2 */
2219 #endif
2220
2221 #ifdef MICROCONTROLLER_DS80C32X
2222 #define TF2_VECTOR      5  /* 0x2B */
2223 #define PFI_VECTOR      6  /* 0x33 */
2224 #define SIO1_VECTOR     7  /* 0x3B */
2225 #define IE2_VECTOR      8  /* 0x43 */
2226 #define IE3_VECTOR      9  /* 0x4B */
2227 #define IE4_VECTOR      10 /* 0x53 */
2228 #define IE5_VECTOR      11 /* 0x5B */
2229 #define WDI_VECTOR      12 /* 0x63 */
2230 #endif
2231
2232 #ifdef MICROCONTROLLER_DS8XC520
2233 #define TF2_VECTOR      5  /* 0x2B */
2234 #define PFI_VECTOR      6  /* 0x33 */
2235 #define SIO1_VECTOR     7  /* 0x3B */
2236 #define IE2_VECTOR      8  /* 0x43 */
2237 #define IE3_VECTOR      9  /* 0x4B */
2238 #define IE4_VECTOR      10 /* 0x53 */
2239 #define IE5_VECTOR      11 /* 0x5B */
2240 #define WDI_VECTOR      12 /* 0x63 */
2241 #endif
2242
2243 #ifdef MICROCONTROLLER_SAB80515
2244 #define TF2_VECTOR      5       // 0x2B timer 2
2245 #define EX2_VECTOR      5       // 0x2B external interrupt 2
2246 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
2247 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
2248 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
2249 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
2250 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
2251 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
2252 #endif
2253
2254 #ifdef MICROCONTROLLER_SAB80515A
2255 #define TF2_VECTOR      5       // 0x2B timer 2
2256 #define EX2_VECTOR      5       // 0x2B external interrupt 2
2257 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
2258 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
2259 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
2260 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
2261 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
2262 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
2263 #endif
2264
2265 #ifdef MICROCONTROLLER_SAB80517
2266 #define TF2_VECTOR      5       // 0x2B timer 2
2267 #define EX2_VECTOR      5       // 0x2B external interrupt 2
2268 #define IADC_VECTOR     8       // 0x43 A/D converter interrupt
2269 #define IEX2_VECTOR     9       // 0x4B external interrupt 2
2270 #define IEX3_VECTOR    10       // 0x53 external interrupt 3
2271 #define IEX4_VECTOR    11       // 0x5B external interrupt 4
2272 #define IEX5_VECTOR    12       // 0x63 external interrupt 5
2273 #define IEX6_VECTOR    13       // 0x6B external interrupt 6
2274                                 // 0x73 not used
2275                                 // 0x7B not used
2276 #define SI1_VECTOR     16       // 0x83 serial port 1
2277                                 // 0x8B not used
2278                                 // 0x93 not used
2279 #define COMPARE_VECTOR 19       // 0x9B compare
2280 #endif
2281
2282 #endif  // End of the header -> #ifndef MCS51REG_H