4 * Copyright (C) 1989-2021 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/>.
25 /* TODO: check if differences/extension still needed*/
28 * Extensions: P. Felber
40 * Read an address specifier. Pack the
41 * address information into the supplied
42 * `expr' structure. Return the mode of
45 * This addr(esp) routine performs the following addressing decoding:
47 * address mode flag addr base
49 * label s_type ---- s_addr s_area
50 * [REG] S_IND+icode 0 0 NULL
51 * [label] S_INDM ---- s_addr s_area
52 * offset[REG] S_IND+icode ---- offset ----
61 /* fix order of '<', '>', and '#' */
63 if (((c
= getnb()) == '<') || (c
== '>')) {
72 if ((c
= getnb()) == '#') {
74 esp
->e_mode
= S_IMMED
;
77 if ((indx
= admode(R8
)) != 0) {
80 if ((indx
= admode(R16
)) != 0) {
83 if ((indx
= admode(R16X
)) != 0) {
92 esp
->e_mode
= (mode
+ indx
)&0xFF;
93 esp
->e_base
.e_ap
= NULL
;
95 if ((c
= getnb()) != RTIND
)
96 xerr('q', "Missing ')'.");
99 if ((indx
= admode(R8
)) != 0) {
102 if ((indx
= admode(R16
)) != 0) {
105 if ((indx
= admode(R16X
)) != 0) {
113 esp
->e_addr
= indx
&0xFF;
115 esp
->e_base
.e_ap
= NULL
;
117 if ((c
= getnb()) == LFIND
) {
118 if ((indx
=admode(R16
))!=0) {
119 esp
->e_mode
= S_INDR
+ (indx
&0xFF);
123 if ((c
= getnb()) != RTIND
)
129 return (esp
->e_mode
);
133 * When building a table that has variations of a common
134 * symbol always start with the most complex symbol first.
135 * for example if x, x+, and x++ are in the same table
136 * the order should be x++, x+, and then x. The search
137 * order is then most to least complex.
141 * When searching symbol tables that contain characters
142 * not of type LTR16, eg with '-' or '+', always search
143 * the more complex symbol tables first. For example:
144 * searching for x+ will match the first part of x++,
145 * a false match if the table with x+ is searched
146 * before the table with x++.
150 * Enter admode() to search a specific addressing mode table
151 * for a match. Return the addressing value on a match or
166 while ( *(ptr
= &sp
[i
].a_str
[0]) ) {
177 * srch --- does string match ?
186 while (*ptr
&& *str
) {
187 if (ccase
[*ptr
& 0x007F] != ccase
[*str
& 0x007F])
192 if (ccase
[*ptr
& 0x007F] == ccase
[*str
& 0x007F]) {
198 if (!(ctype
[*ptr
& 0x007F] & LTR16
) && (*ptr
& 0x007F) != '-' && (*ptr
& 0x007F) != '+') {
209 struct adsym R8
[] = {
220 struct adsym R16
[] = {
232 struct adsym R16X
[] = {
238 * Conditional definitions
241 struct adsym CND
[] = {