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 * Extensions: P. Felber
29 * Read an address specifier. Pack the
30 * address information into the supplied
31 * `expr' structure. Return the mode of
34 * This addr(esp) routine performs the following addressing decoding:
36 * address mode flag addr base
38 * label s_type ---- s_addr s_area
39 * [REG] S_IND+icode 0 0 NULL
40 * [label] S_INDM ---- s_addr s_area
41 * offset[REG] S_IND+icode ---- offset ----
45 register struct expr *esp;
47 register int c, mode = 0, indx;
49 if ((c = getnb()) == '#') {
51 esp->e_mode = S_IMMED;
54 if ((indx = admode(R8)) != 0) {
57 if ((indx = admode(R16)) != 0) {
60 if ((indx = admode(R8X)) != 0) {
64 if ((indx = admode(R16X)) != 0) {
72 esp->e_mode = (mode + indx)&0xFF;
73 esp->e_base.e_ap = NULL;
75 if ((c = getnb()) != RTIND)
79 if ((indx = admode(R8)) != 0) {
82 if ((indx = admode(R16)) != 0) {
85 if ((indx = admode(R8X)) != 0) {
88 if ((indx = admode(R16X)) != 0) {
95 esp->e_addr = indx&0xFF;
97 esp->e_base.e_ap = NULL;
99 if ((c = getnb()) == LFIND) {
101 if ((indx=admode(R16))!=0
102 && ((indx&0xFF)==IX || (indx&0xFF)==IY)) {
104 if ((indx=admode(R16))!=0) {
106 esp->e_mode = S_INDR + (indx&0xFF);
110 if ((c = getnb()) != RTIND)
116 return (esp->e_mode);
120 * Enter admode() to search a specific addressing mode table
121 * for a match. Return the addressing value on a match or
126 register struct adsym *sp;
130 register const char *ips;
136 while ( *(ptr = (char *) &sp[i]) ) {
147 * srch --- does string match ?
153 register const char *ptr;
157 while (*ptr && *str) {
168 while (*ptr && *str) {
169 if (ccase[(unsigned char)(*ptr)] != ccase[(unsigned char)(*str)])
174 if (ccase[(unsigned char)(*ptr)] == ccase[(unsigned char)(*str)]) {
181 if (any(*ptr," \t\n,);")) {
189 * any --- does str contain c?
205 struct adsym R8[] = {
223 struct adsym R8X[] = {
231 struct adsym R16[] = {
258 struct adsym R16X[] = {
269 * Conditional definitions
272 struct adsym CND[] = {