4 * Copyright (C) 1989-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/>.
26 * xerr messages and order fix Copyright (C) 1989-2021 Alan R. Baldwin
31 * Extensions: P. Felber
38 * Read an address specifier. Pack the
39 * address information into the supplied
40 * `expr' structure. Return the mode of
43 * This addr(esp) routine performs the following addressing decoding:
45 * address mode flag addr base
47 * label s_type ---- s_addr s_area
48 * [REG] S_IND+icode 0 0 NULL
49 * [label] S_INDM ---- s_addr s_area
50 * offset[REG] S_IND+icode ---- offset ----
59 /* fix order of '<', '>', and '#' */
61 if (((c
= getnb()) == '<') || (c
== '>')) {
70 if ((c
= getnb()) == '#') {
72 esp
->e_mode
= S_IMMED
;
75 if ((indx
= admode(R8
)) != 0) {
78 if ((indx
= admode(R16
)) != 0) {
81 if ((indx
= admode(R8X
)) != 0) {
83 xerr('a', "No I or R.");
85 if ((indx
= admode(R16X
)) != 0) {
87 xerr('a', "Registers AF and AF' are invalid.");
94 esp
->e_mode
= (mode
+ indx
)&0xFF;
95 esp
->e_base
.e_ap
= NULL
;
97 if ((c
= getnb()) != RTIND
) {
98 xerr('a', "Missing ')'.");
102 if ((indx
= admode(R8
)) != 0) {
105 if ((indx
= admode(R16
)) != 0) {
108 if ((indx
= admode(R8X
)) != 0) {
111 if ((indx
= admode(R8U1
)) != 0) {
114 if ((indx
= admode(R8U2
)) != 0) {
117 if ((indx
= admode(R16X
)) != 0) {
120 if ((indx
= admode(R8MB
)) != 0) {
128 esp
->e_addr
= indx
&0xFF;
130 esp
->e_base
.e_ap
= NULL
;
132 if ((c
= getnb()) == LFIND
) {
133 if ((indx
=admode(R16
))!=0
134 && ((indx
&0xFF)==IX
|| (indx
&0xFF)==IY
)) {
135 esp
->e_mode
= S_INDR
+ (indx
&0xFF);
137 xerr('a', "Register IX or IY required.");
139 if ((c
= getnb()) != RTIND
)
140 xerr('a', "Missing ')'.");
145 return (esp
->e_mode
);
149 * When building a table that has variations of a common
150 * symbol always start with the most complex symbol first.
151 * for example if x, x+, and x++ are in the same table
152 * the order should be x++, x+, and then x. The search
153 * order is then most to least complex.
157 * When searching symbol tables that contain characters
158 * not of type LTR16, eg with '-' or '+', always search
159 * the more complex symbol tables first. For example:
160 * searching for x+ will match the first part of x++,
161 * a false match if the table with x+ is searched
162 * before the table with x++.
166 * Enter admode() to search a specific addressing mode table
167 * for a match. Return the addressing value on a match or
182 while ( *(ptr
= &sp
[i
].a_str
[0]) ) {
193 * srch --- does string match ?
202 while (*ptr
&& *str
) {
203 if (ccase
[*ptr
& 0x007F] != ccase
[*str
& 0x007F])
208 if (ccase
[*ptr
& 0x007F] == ccase
[*str
& 0x007F]) {
214 if (!(ctype
[*ptr
& 0x007F] & LTR16
)) {
225 struct adsym R8
[] = {
236 struct adsym R8X
[] = {
242 /* Undocumented instructions for 0xDD prefix H->IX high, L->IX low */
243 struct adsym R8U1
[] = {
249 /* Undocumented instructions for 0xFD prefix H->IY high, L->IY low */
250 struct adsym R8U2
[] = {
256 struct adsym R16
[] = {
266 struct adsym R16X
[] = {
267 { "af'", AF
|0400 }, /* af' must be first !!! */
272 struct adsym R8MB
[] = {
277 struct adsym RX
[] = {
278 { "x", X
|0400 }, /* for ZXN pop x */
283 * Conditional definitions
286 struct adsym CND
[] = {