4 * Copyright (C) 1995-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/>.
26 * With Contributions from
32 * Internet: Marko dot Makela at Helsinki dot Fi
33 * EARN/BitNet: msmakela at finuh
46 /* fix order of '<', '>', and '#' */
48 if (((c
= getnb()) == '<') || (c
== '>')) {
57 if ((c
= getnb()) == '#') {
59 esp
->e_mode
= S_IMMED
;
63 esp
->e_mode
= S_DIR
; /* ___ *arg */
68 esp
->e_mode
= S_DINDX
; /* ___ *arg,X */
71 esp
->e_mode
= S_DINDY
; /* ___ *arg,Y */
78 } else if (c
== '[') {
79 if ((c
= getnb()) != '*') {
83 if ((c
= getnb()) == ']') {
86 if (admode(axy
) != S_Y
)
88 esp
->e_mode
= S_IPSTY
;
95 if (admode(axy
) != S_X
)
97 esp
->e_mode
= S_IPREX
;
103 switch(admode(axy
)) {
105 esp
->e_mode
= S_ACC
; /* ___ A */
107 case S_X
: /* ___ X Is Illegal */
108 case S_Y
: /* ___ Y Is Illegal */
113 esp
->e_mode
= S_ACC
; /* ___ BLANK -> ___ A */
118 switch(admode(axy
)) {
119 case S_X
: /* ___ arg,X */
121 && (esp
->e_base
.e_ap
==NULL
)
122 && !(esp
->e_addr
& ~0xFF)) {
123 esp
->e_mode
= S_DINDX
;
127 && (esp
->e_base
.e_ap
==zpg
)) {
128 esp
->e_mode
= S_DINDX
;
130 esp
->e_mode
= S_INDX
;
134 case S_Y
: /* ___ arg,Y */
136 && (esp
->e_base
.e_ap
==NULL
)
137 && !(esp
->e_addr
& ~0xFF)) {
138 esp
->e_mode
= S_DINDY
;
142 && (esp
->e_base
.e_ap
==zpg
)) {
143 esp
->e_mode
= S_DINDY
;
145 esp
->e_mode
= S_INDY
;
155 && (esp
->e_base
.e_ap
==NULL
)
156 && !(esp
->e_addr
& ~0xFF)) {
161 && (esp
->e_base
.e_ap
==zpg
)) {
171 return (esp
->e_mode
);
175 * When building a table that has variations of a common
176 * symbol always start with the most complex symbol first.
177 * for example if x, x+, and x++ are in the same table
178 * the order should be x++, x+, and then x. The search
179 * order is then most to least complex.
183 * When searching symbol tables that contain characters
184 * not of type LTR16, eg with '-' or '+', always search
185 * the more complex symbol tables first. For example:
186 * searching for x+ will match the first part of x++,
187 * a false match if the table with x+ is searched
188 * before the table with x++.
192 * Enter admode() to search a specific addressing mode table
193 * for a match. Return the addressing value on a match or
208 while ( *(ptr
= &sp
[i
].a_str
[0]) ) {
219 * srch --- does string match ?
228 while (*ptr
&& *str
) {
229 if(ccase
[*ptr
& 0x007F] != ccase
[*str
& 0x007F])
234 if (ccase
[*ptr
& 0x007F] == ccase
[*str
& 0x007F]) {
240 if (!(ctype
[*ptr
& 0x007F] & LTR16
)) {
247 struct adsym axy
[] = { /* a, x, or y registers */