* asranlib/asranlib.c, link/lkar.h, link/lkar.c:
[fw/sdcc] / as / mcs51 / i8051.h
1 /* i8051.h
2
3    Copyright (C) 1989-1995 Alan R. Baldwin
4    721 Berkeley St., Kent, Ohio 44240
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 3, 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, see <http://www.gnu.org/licenses/>. */
18
19 /*
20  * Ported from 8085 to 8051 by John Hartman 30-Apr-1995
21  * Continued, 2-Jun-95
22  */
23
24 /*)BUILD
25         $(PROGRAM) =    AS8051
26         $(INCLUDE) = {
27                 ASM.H
28                 I8051.H
29         }
30         $(FILES) = {
31                 I51EXT.C
32                 I51MCH.C
33                 I51PST.C
34                 ASMAIN.C
35                 ASLEX.C
36                 ASSYM.C
37                 ASSUBR.C
38                 ASEXPR.C
39                 ASDATA.C
40                 ASLIST.C
41                 ASOUT.C
42         }
43         $(STACK) = 2000
44 */
45
46 /*
47  * Symbol types.
48  */
49 #define S_INH   50              /* One byte inherent */
50 #define S_JMP11 51              /* Jump and call 11 bit. */
51 #define S_JMP16 52              /* Jump and call 16 bit */
52 #define S_ACC   53              /* Accumulator */
53 #define S_TYP1  54              /* Type 1 (inc and dec) */
54 #define S_TYP2  55              /* Type 2 (arith ops) */
55 #define S_TYP3  56              /* Type 3 (logic ops) */
56 #define S_TYP4  57              /* Type 4 (XCH) */
57 #define S_MOV   58              /* MOV */
58 #define S_BITBR 59              /* bit branch */
59 #define S_BR    60              /* branch */
60 #define S_ACBIT 61              /* CLR, CPL */
61 #define S_CJNE  62              /* CJNE */
62 #define S_DJNZ  63              /* DJNZ */
63 #define S_JMP   64              /* JMP */
64 #define S_MOVC  65              /* MOVC */
65 #define S_MOVX  66              /* MOVX */
66 #define S_AB    67              /* AB (div and mul) */
67 #define S_CPL   68              /* CPL */
68 #define S_SETB  69              /* SETB */
69 #define S_DIRECT 70             /* DIRECT (pusha and pop) */
70 #define S_XCHD  71              /* XCHD */
71
72 /* Addressing modes */
73 #define S_A      30             /* A */
74 /* #define S_B   31 */          /* B */
75 #define S_C      32             /* C (carry) */
76 #define S_RAB    33             /* AB */
77 #define S_DPTR   34             /* DPTR */
78 #define S_REG    35             /* Register R0-R7 */
79 #define S_IMMED  36             /* immediate */
80 #define S_DIR    37             /* direct */
81 #define S_EXT    38             /* extended */
82 #define S_PC     39             /* PC (for addressing mode) */
83
84 #define S_AT_R   40             /* @R0 or @R1 */
85 #define S_AT_DP  41             /* @DPTR */
86 #define S_AT_APC 42             /* @A+PC */
87 #define S_AT_ADP 43             /* @A+DPTR */
88 #define S_NOT_BIT 44             /* /BIT (/DIR) */
89
90 /*
91  * Registers.  Value  == address in RAM, except for PC
92  */
93 #define R0      0
94 #define R1      1
95 #define R2      2
96 #define R3      3
97 #define R4      4
98 #define R5      5
99 #define R6      6
100 #define R7      7
101 #define A       0xE0
102 #define DPTR    0x82
103 #define PC      0xFF            /* dummy number for register ID only */
104 #define AB      0xFE            /* dummy number for register ID only */
105 #define C       0xFD            /* dummy number for register ID only */
106
107 struct adsym
108 {
109         char    a_str[5];       /* addressing string (length for DPTR+null)*/
110         int     a_val;          /* addressing mode value */
111 };
112
113 /* pre-defined symbol structure: name and value */
114 struct PreDef
115 {
116    char id[NCPS];
117    int  value;
118 };
119 extern struct PreDef preDef[];
120
121         /* machine dependent functions */
122
123         /* i51mch.c */
124 extern  int             comma();
125 extern  VOID            minit();
126 extern  int             reg();