4 * Copyright (C) 1998-2009 Alan R. Baldwin
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
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.
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/>.
24 * This Assember Ported by
25 * John L. Hartman (JLH)
26 * jhartman at compuserve dot com
27 * noice at noicedebugger dot com
57 #define S_INH 50 /* One byte inherent */
58 #define S_JMP11 51 /* Jump and call 11 bit. */
59 #define S_JMP16 52 /* Jump and call 16 bit */
60 #define S_ACC 53 /* Accumulator */
61 #define S_TYP1 54 /* Type 1 (inc and dec) */
62 #define S_TYP2 55 /* Type 2 (arith ops) */
63 #define S_TYP3 56 /* Type 3 (logic ops) */
64 #define S_TYP4 57 /* Type 4 (XCH) */
65 #define S_MOV 58 /* MOV */
66 #define S_BITBR 59 /* bit branch */
67 #define S_BR 60 /* branch */
68 #define S_ACBIT 61 /* CLR, CPL */
69 #define S_CJNE 62 /* CJNE */
70 #define S_DJNZ 63 /* DJNZ */
71 #define S_JMP 64 /* JMP */
72 #define S_MOVC 65 /* MOVC */
73 #define S_MOVX 66 /* MOVX */
74 #define S_AB 67 /* AB (div and mul) */
75 #define S_CPL 68 /* CPL */
76 #define S_SETB 69 /* SETB */
77 #define S_DIRECT 70 /* DIRECT (pusha and pop) */
78 #define S_XCHD 71 /* XCHD */
80 /* Addressing modes */
81 #define S_A 30 /* A */
82 /* #define S_B 31 */ /* B */
83 #define S_C 32 /* C (carry) */
84 #define S_RAB 33 /* AB */
85 #define S_DPTR 34 /* DPTR */
86 #define S_REG 35 /* Register R0-R7 */
87 #define S_IMMED 36 /* immediate */
88 #define S_DIR 37 /* direct */
89 #define S_EXT 38 /* extended */
90 #define S_PC 39 /* PC (for addressing mode) */
92 #define S_AT_R 40 /* @R0 or @R1 */
93 #define S_AT_DP 41 /* @DPTR */
94 #define S_AT_APC 42 /* @A+PC */
95 #define S_AT_ADP 43 /* @A+DPTR */
96 #define S_NOT_BIT 44 /* /BIT (/DIR) */
99 * Registers. Value == address in RAM, except for PC
111 #define PC 0xFF /* dummy number for register ID only */
112 #define AB 0xFE /* dummy number for register ID only */
113 #define C 0xFD /* dummy number for register ID only */
117 char a_str
[5]; /* addressing string (length for DPTR+null)*/
118 int a_val
; /* addressing mode value */
121 /* pre-defined symbol structure: name and value */
127 extern struct PreDef preDef
[];
129 /* machine dependent functions */
134 extern struct adsym reg51
[];
135 extern int addr(struct expr
*esp
);
136 extern int admode(struct adsym
*sp
);
137 extern int any(int c
, char *str
);
138 extern int srch(char *str
);
139 extern int reg(void);
142 extern VOID
machine(struct mne
*mp
);
143 extern int mchpcr(struct expr
*esp
);
144 extern VOID
minit(void);
149 extern struct adsym reg51
[];
157 extern VOID
machine();