3 Copyright (C) 1989-1995 Alan R. Baldwin
4 721 Berkeley St., Kent, Ohio 44240
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
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/>. */
20 * Ported from 8085 to 8051 by John Hartman 30-Apr-1995
21 * Continued, 29-May-95
29 extern int admode (struct adsym *);
31 struct adsym reg51[] = { /* R0 thru R7 registers */
61 /* Classify argument as to address mode */
64 register struct expr *esp;
69 if ((c = getnb()) == '#') {
72 esp->e_mode = S_IMMED;
75 /* choices are @R0, @R1, @DPTR, @A+PC, @A+DPTR */
86 esp->e_mode = S_AT_DP;
93 esp->e_mode = S_AT_APC;
95 } else if (rd == DPTR) {
96 esp->e_mode = S_AT_ADP;
107 esp->e_base.e_ap = NULL;
110 /* Force direct page */
113 if (esp->e_addr & ~0xFF)
117 /* Force inverted bit */
119 esp->e_mode = S_NOT_BIT;
120 if (esp->e_addr & ~0xFF)
126 /* try for register: A, AB, R0-R7, DPTR, PC, Cy */
127 if ((esp->e_addr = admode(reg51)) != -1) {
128 switch (esp->e_addr) {
136 esp->e_mode = S_DPTR;
149 /* Must be an expression */
152 && (esp->e_base.e_ap==NULL)
153 && !(esp->e_addr & ~0xFF)) {
160 return (esp->e_mode);
165 * any --- does str contain c?
181 register const char *ptr;
185 while (*ptr && *str) {
196 while (*ptr && *str) {
197 if(ccase[*ptr] != ccase[*str])
202 if (ccase[*ptr] == ccase[*str]) {
209 if (any(*ptr," \t\n,];")) {
217 * Enter admode() to search a specific addressing mode table
218 * for a match. Return the addressing value on a match or
223 register struct adsym *sp;
229 while ( *(ptr = (char *) &sp[i]) ) {
239 * srch --- does string match ?
243 * Read a register name. Return register value, -1 if no register found
248 register struct mne *mp;
252 if ((mp = mlookup(id))==NULL) {
256 switch (mp->m_type) {