| 1 |
/* |
| 2 |
the DASM macro assembler (aka small systems cross assembler) |
| 3 |
|
| 4 |
Copyright (c) 1988-2002 by Matthew Dillon. |
| 5 |
Copyright (c) 1995 by Olaf "Rhialto" Seibert. |
| 6 |
Copyright (c) 2003-2008 by Andrew Davie. |
| 7 |
Copyright (c) 2008 by Peter H. Froehlich. |
| 8 |
|
| 9 |
This program is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation; either version 2 of the License, or |
| 12 |
(at your option) any later version. |
| 13 |
|
| 14 |
This program is distributed in the hope that it will be useful, |
| 15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
GNU General Public License for more details. |
| 18 |
|
| 19 |
You should have received a copy of the GNU General Public License along |
| 20 |
with this program; if not, write to the Free Software Foundation, Inc., |
| 21 |
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 22 |
*/ |
| 23 |
|
| 24 |
/* |
| 25 |
* EXP.C |
| 26 |
* |
| 27 |
* Handle expression evaluation and addressing mode decode. |
| 28 |
* |
| 29 |
* NOTE! If you use the string field in an expression you must clear |
| 30 |
* the SYM_MACRO and SYM_STRING bits in the flags before calling |
| 31 |
* FreeSymbolList()! |
| 32 |
*/ |
| 33 |
|
| 34 |
#include "asm.h"cxx . . $ `<file>/src/asm.h`/ |
| 35 |
|
| 36 |
#define UNIONcxx . . $ `src/exp.c:36:9`! 0 |
| 37 |
|
| 38 |
#if UNIONcxx . . $ `src/exp.c:36:9`! /* warning: ANSI disallows cast to union type */ |
| 39 |
typedef void (unop)(long v1, int f1); |
| 40 |
typedef void (binop)(long v1, long v2, int f1, int f2); |
| 41 |
|
| 42 |
union unibin { |
| 43 |
unop *unary; |
| 44 |
binop *binary; |
| 45 |
}; |
| 46 |
|
| 47 |
typedef union unibin opfunc_t; |
| 48 |
#define _unary .unary |
| 49 |
#define _binary .binary |
| 50 |
#else /* warning: Calling functions without prototype */ |
| 51 |
|
| •52 |
typedef void (*opfunc_tcxx . . $ opfunc_t#)(...); |
| 53 |
#define _unarycxx . . $ `src/exp.c:53:9`! |
| 54 |
#define _binarycxx . . $ `src/exp.c:54:9`! |
| 55 |
|
| 56 |
#endif |
| 57 |
|
| 58 |
static void stackargcxx . . $ stackarg(d53def507beff8e3).(long val, int flags, const char *ptr1); |
| 59 |
|
| 60 |
void doopcxx . . $ doop(1761cb952289507d).(opfunc_tcxx . . $ opfunc_t#, int pri); |
| 61 |
void evaltopcxx . . $ evaltop(49f6e7a06ebc5aa8).(void); |
| 62 |
void op_multcxx . . $ op_mult(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 63 |
op_divcxx . . $ op_div(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 64 |
op_modcxx . . $ op_mod(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 65 |
op_addcxx . . $ op_add(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 66 |
op_subcxx . . $ op_sub(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 67 |
op_shiftleftcxx . . $ op_shiftleft(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 68 |
op_shiftrightcxx . . $ op_shiftright(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 69 |
op_greatercxx . . $ op_greater(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 70 |
op_greatereqcxx . . $ op_greatereq(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 71 |
op_smallercxx . . $ op_smaller(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 72 |
op_smallereqcxx . . $ op_smallereq(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 73 |
op_eqeqcxx . . $ op_eqeq(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 74 |
op_noteqcxx . . $ op_noteq(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 75 |
op_andandcxx . . $ op_andand(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 76 |
op_ororcxx . . $ op_oror(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 77 |
op_xorcxx . . $ op_xor(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 78 |
op_andcxx . . $ op_and(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 79 |
op_orcxx . . $ op_or(a983888e2c35cfad).(long v1, long v2, int f1, int f2), |
| 80 |
op_questioncxx . . $ op_question(a983888e2c35cfad).(long v1, long v2, int f1, int f2); |
| 81 |
|
| 82 |
void op_takelsbcxx . . $ op_takelsb(3b75d2d14f60ac6a).(long v1, int f1), |
| 83 |
op_takemsbcxx . . $ op_takemsb(3b75d2d14f60ac6a).(long v1, int f1), |
| 84 |
op_negatecxx . . $ op_negate(3b75d2d14f60ac6a).(long v1, int f1), |
| 85 |
op_invertcxx . . $ op_invert(3b75d2d14f60ac6a).(long v1, int f1), |
| 86 |
op_notcxx . . $ op_not(3b75d2d14f60ac6a).(long v1, int f1); |
| 87 |
|
| 88 |
|
| 89 |
const char *pushsymbolcxx . . $ pushsymbol(fb58d2e09a2a1ce6).(const char *str); |
| 90 |
const char *pushstrcxx . . $ pushstr(fb58d2e09a2a1ce6).(const char *str); |
| 91 |
const char *pushbincxx . . $ pushbin(fb58d2e09a2a1ce6).(const char *str); |
| 92 |
const char *pushoctcxx . . $ pushoct(fb58d2e09a2a1ce6).(const char *str); |
| 93 |
const char *pushdeccxx . . $ pushdec(fb58d2e09a2a1ce6).(const char *str); |
| 94 |
const char *pushhexcxx . . $ pushhex(fb58d2e09a2a1ce6).(const char *str); |
| 95 |
const char *pushcharcxx . . $ pushchar(fb58d2e09a2a1ce6).(const char *str); |
| 96 |
|
| 97 |
int IsAlphaNumcxx . . $ IsAlphaNum(7864480464b09eea).( int c ); |
| 98 |
|
| 99 |
/* |
| 100 |
* evaluate an expression. Figure out the addressing mode: |
| 101 |
* |
| 102 |
* implied |
| 103 |
* #val immediate |
| 104 |
* val zero page or absolute |
| 105 |
* val,x zero,x or absolute,x |
| 106 |
* val,y zero,y or absolute,y |
| 107 |
* val,sp stack pointer indexed + offset |
| 108 |
* (val) indirect |
| 109 |
* (val,x) zero indirect x |
| 110 |
* (val),y zero indirect y |
| 111 |
* |
| 112 |
* exp, exp,.. LIST of expressions |
| 113 |
* |
| 114 |
* an absolute may be returned as zero page |
| 115 |
* a relative may be returned as zero page or absolute |
| 116 |
* |
| 117 |
* unary: - ~ ! < > |
| 118 |
* binary: (^)(* / %)(+ -)(>> <<)(& |)(`)(&& ||)(== != < > <= >=) |
| 119 |
* |
| 120 |
* values: symbol, octal, decimal, $hex, %binary, 'c "str" |
| 121 |
* |
| 122 |
*/ |
| 123 |
|
| 124 |
#define MAXOPScxx . . $ `src/exp.c:124:9`! 32 |
| 125 |
#define MAXARGScxx . . $ `src/exp.c:125:9`! 64 |
| 126 |
|
| 127 |
unsigned char Argflagscxx . . $ Argflags.[MAXARGScxx . . $ `src/exp.c:125:9`!]; |
| 128 |
long Argstackcxx . . $ Argstack.[MAXARGScxx . . $ `src/exp.c:125:9`!]; |
| 129 |
char *Argstringcxx . . $ Argstring.[MAXARGScxx . . $ `src/exp.c:125:9`!]; |
| 130 |
int Oppricxx . . $ Oppri.[MAXOPScxx . . $ `src/exp.c:124:9`!]; |
| 131 |
opfunc_tcxx . . $ opfunc_t# Opdiscxx . . $ Opdis.[MAXOPScxx . . $ `src/exp.c:124:9`!]; |
| 132 |
|
| 133 |
int Argicxx . . $ Argi., Opicxx . . $ Opi., Lastwasopcxx . . $ Lastwasop.; |
| 134 |
int Argibasecxx . . $ Argibase., Opibasecxx . . $ Opibase.; |
| 135 |
|
| 136 |
char ucasm_indexed_notationcxx . . $ ucasm_indexed_notation. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 137 |
|
| 138 |
SYMBOLcxx . . $ `src/asm.h:160:9`! *evalcxx . . $ eval(83a8820e5b78665b).(const char *str, int wantmode) |
| 139 |
{ |
| 140 |
SYMBOLcxx . . $ `src/asm.h:160:9`! *base, *cur; |
| 141 |
int oldargibase = Argibasecxx . . $ Argibase.; |
| 142 |
int oldopibase = Opibasecxx . . $ Opibase.; |
| 143 |
int scr; |
| 144 |
|
| 145 |
const char *pLine = str; |
| 146 |
|
| 147 |
Argibasecxx . . $ Argibase. = Argicxx . . $ Argi.; |
| 148 |
Opibasecxx . . $ Opibase. = Opicxx . . $ Opi.; |
| 149 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 150 |
base = cur = allocsymbolcxx . . $ allocsymbol(cdf7111cce0c7830).(); |
| 151 |
|
| 152 |
|
| 153 |
while (*str) |
| 154 |
{ |
| 155 |
if (Xdebugcxx . . $ Xdebug.) |
| 156 |
printfcxx . . $ printf(581fddd72a8db8fc).("char '%c'\n", *str); |
| 157 |
|
| 158 |
switch(*str) |
| 159 |
{ |
| 160 |
case ' ': |
| 161 |
case '\n': |
| 162 |
++str; |
| 163 |
break; |
| 164 |
|
| 165 |
case '~': |
| 166 |
if (Lastwasopcxx . . $ Lastwasop.) |
| 167 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_invertcxx . . $ op_invert(3b75d2d14f60ac6a)., 128); |
| 168 |
else |
| 169 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_SYNTAX_ERRORcxx . . $ ERROR_SYNTAX_ERROR., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, pLine ); |
| 170 |
++str; |
| 171 |
break; |
| 172 |
|
| 173 |
case '*': |
| 174 |
if (Lastwasopcxx . . $ Lastwasop.) { |
| 175 |
pushsymbolcxx . . $ pushsymbol(fb58d2e09a2a1ce6).("."); |
| 176 |
} else |
| 177 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_multcxx . . $ op_mult(a983888e2c35cfad)., 20); |
| 178 |
++str; |
| 179 |
break; |
| 180 |
|
| 181 |
case '/': |
| 182 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_divcxx . . $ op_div(a983888e2c35cfad)., 20); |
| 183 |
++str; |
| 184 |
break; |
| 185 |
|
| 186 |
case '%': |
| 187 |
if (Lastwasopcxx . . $ Lastwasop.) { |
| 188 |
str = pushbincxx . . $ pushbin(fb58d2e09a2a1ce6).(str+1); |
| 189 |
} else { |
| 190 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_modcxx . . $ op_mod(a983888e2c35cfad)., 20); |
| 191 |
++str; |
| 192 |
} |
| 193 |
break; |
| 194 |
|
| 195 |
case '?': /* 10 */ |
| 196 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_questioncxx . . $ op_question(a983888e2c35cfad)., 10); |
| 197 |
++str; |
| 198 |
break; |
| 199 |
|
| 200 |
case '+': /* 19 */ |
| 201 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_addcxx . . $ op_add(a983888e2c35cfad)., 19); |
| 202 |
++str; |
| 203 |
break; |
| 204 |
|
| 205 |
case '-': /* 19: - (or - unary) */ |
| 206 |
if (Lastwasopcxx . . $ Lastwasop.) { |
| 207 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_negatecxx . . $ op_negate(3b75d2d14f60ac6a)., 128); |
| 208 |
} else { |
| 209 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_subcxx . . $ op_sub(a983888e2c35cfad)., 19); |
| 210 |
} |
| 211 |
++str; |
| 212 |
break; |
| 213 |
|
| 214 |
case '>': /* 18: >> << 17: > >= <= < */ |
| 215 |
|
| 216 |
if (Lastwasopcxx . . $ Lastwasop.) |
| 217 |
{ |
| 218 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_takemsbcxx . . $ op_takemsb(3b75d2d14f60ac6a)., 128); |
| 219 |
++str; |
| 220 |
break; |
| 221 |
} |
| 222 |
|
| 223 |
if (str[1] == '>') |
| 224 |
{ |
| 225 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_shiftrightcxx . . $ op_shiftright(a983888e2c35cfad)., 18); |
| 226 |
++str; |
| 227 |
} |
| 228 |
|
| 229 |
else if (str[1] == '=') |
| 230 |
{ |
| 231 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_greatereqcxx . . $ op_greatereq(a983888e2c35cfad)., 17); |
| 232 |
++str; |
| 233 |
} |
| 234 |
else |
| 235 |
{ |
| 236 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_greatercxx . . $ op_greater(a983888e2c35cfad)., 17); |
| 237 |
} |
| 238 |
++str; |
| 239 |
break; |
| 240 |
|
| 241 |
case '<': |
| 242 |
|
| 243 |
if (Lastwasopcxx . . $ Lastwasop.) |
| 244 |
{ |
| 245 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_takelsbcxx . . $ op_takelsb(3b75d2d14f60ac6a)., 128); |
| 246 |
++str; |
| 247 |
break; |
| 248 |
} |
| 249 |
|
| 250 |
if (str[1] == '<') |
| 251 |
{ |
| 252 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_shiftleftcxx . . $ op_shiftleft(a983888e2c35cfad)., 18); |
| 253 |
++str; |
| 254 |
} |
| 255 |
else if (str[1] == '=') |
| 256 |
{ |
| 257 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_smallereqcxx . . $ op_smallereq(a983888e2c35cfad)., 17); |
| 258 |
++str; |
| 259 |
} |
| 260 |
else |
| 261 |
{ |
| 262 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_smallercxx . . $ op_smaller(a983888e2c35cfad)., 17); |
| 263 |
} |
| 264 |
++str; |
| 265 |
break; |
| 266 |
|
| 267 |
case '=': /* 16: == (= same as ==) */ |
| 268 |
|
| 269 |
if (str[1] == '=') |
| 270 |
++str; |
| 271 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_eqeqcxx . . $ op_eqeq(a983888e2c35cfad)., 16); |
| 272 |
++str; |
| 273 |
break; |
| 274 |
|
| 275 |
case '!': /* 16: != */ |
| 276 |
|
| 277 |
if (Lastwasopcxx . . $ Lastwasop.) |
| 278 |
{ |
| 279 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_notcxx . . $ op_not(3b75d2d14f60ac6a)., 128); |
| 280 |
} |
| 281 |
else |
| 282 |
{ |
| 283 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_noteqcxx . . $ op_noteq(a983888e2c35cfad)., 16); |
| 284 |
++str; |
| 285 |
} |
| 286 |
++str; |
| 287 |
break; |
| 288 |
|
| 289 |
case '&': /* 15: & 12: && */ |
| 290 |
|
| 291 |
if (str[1] == '&') |
| 292 |
{ |
| 293 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_andandcxx . . $ op_andand(a983888e2c35cfad)., 12); |
| 294 |
++str; |
| 295 |
} |
| 296 |
else |
| 297 |
{ |
| 298 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_andcxx . . $ op_and(a983888e2c35cfad)., 15); |
| 299 |
} |
| 300 |
++str; |
| 301 |
break; |
| 302 |
|
| 303 |
case '^': /* 14: ^ */ |
| 304 |
|
| 305 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_xorcxx . . $ op_xor(a983888e2c35cfad)., 14); |
| 306 |
++str; |
| 307 |
break; |
| 308 |
|
| 309 |
case '|': /* 13: | 11: || */ |
| 310 |
|
| 311 |
if (str[1] == '|') |
| 312 |
{ |
| 313 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_ororcxx . . $ op_oror(a983888e2c35cfad)., 11); |
| 314 |
++str; |
| 315 |
} |
| 316 |
else |
| 317 |
{ |
| 318 |
doopcxx . . $ doop(1761cb952289507d).((opfunc_tcxx . . $ opfunc_t#)op_orcxx . . $ op_or(a983888e2c35cfad)., 13); |
| 319 |
} |
| 320 |
++str; |
| 321 |
break; |
| 322 |
|
| 323 |
|
| 324 |
case '(': |
| 325 |
|
| 326 |
if (wantmode) |
| 327 |
{ |
| 328 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_INDWORDcxx . . $ AM_INDWORD.; |
| 329 |
++str; |
| 330 |
break; |
| 331 |
} |
| 332 |
|
| 333 |
/* fall thru OK */ |
| 334 |
|
| 335 |
case '[': /* eventually an argument */ |
| 336 |
ucasm_indexed_notationcxx . . $ ucasm_indexed_notation. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 337 |
|
| 338 |
if ((((((str[1]|0x20) == 'x') || ((str[1]|0x20) == 'y')) && (str[2] == '+')) || // X- or Y-indexed address mode |
| 339 |
(((str[1]|0x20) == 's') && ((str[2]|0x20) == 'p') && (str[3] == '+'))) && // SP-indexed address mode |
| 340 |
((Processorcxx . . $ Processor. == 68705) || (Processorcxx . . $ Processor. == 6811) || (Processorcxx . . $ Processor. == 68908))) |
| 341 |
{ |
| 342 |
ucasm_indexed_notationcxx . . $ ucasm_indexed_notation. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!; |
| 343 |
// UCASM compatibility, allow notations [X+255], [Y+3], [SP+5] |
| 344 |
switch(str[1]|0x20) { |
| 345 |
case 'x': |
| 346 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_BYTEADRXcxx . . $ AM_BYTEADRX.; |
| 347 |
//FIX: OPCODE.FORCE / Mnext adaption moved to ops.c |
| 348 |
break; |
| 349 |
|
| 350 |
case 'y': cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_BYTEADRYcxx . . $ AM_BYTEADRY.; break; |
| 351 |
|
| 352 |
case 's': |
| 353 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_BYTEADR_SPcxx . . $ AM_BYTEADR_SP.; |
| 354 |
//FIX: OPCODE.FORCE / Mnext adaption moved to ops.c |
| 355 |
break; |
| 356 |
} |
| 357 |
str += 3; /* skip '[',{x,y,s},'+' */ |
| 358 |
if ((cur->addrmodecxx . . $ _SYMBOL#addrmode. == AM_BYTEADR_SPcxx . . $ AM_BYTEADR_SP.) || (cur->addrmodecxx . . $ _SYMBOL#addrmode. == AM_WORDADR_SPcxx . . $ AM_WORDADR_SP.)) { |
| 359 |
++str; /* skip also 'p' */ |
| 360 |
} |
| 361 |
} else { |
| 362 |
ucasm_indexed_notationcxx . . $ ucasm_indexed_notation. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 363 |
if (Opicxx . . $ Opi. == MAXOPScxx . . $ `src/exp.c:124:9`!) |
| 364 |
putscxx . . $ puts(5c4306d8553b3696).("too many ops"); |
| 365 |
else |
| 366 |
Oppricxx . . $ Oppri.[Opicxx . . $ Opi.++] = 0; |
| 367 |
++str; |
| 368 |
} |
| 369 |
break; |
| 370 |
|
| 371 |
case ')': |
| 372 |
|
| 373 |
if (wantmode) |
| 374 |
{ |
| 375 |
if (cur->addrmodecxx . . $ _SYMBOL#addrmode. == AM_INDWORDcxx . . $ AM_INDWORD. && |
| 376 |
str[1] == ',' && (str[2]|0x20) == 'y') |
| 377 |
{ |
| 378 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_INDBYTEYcxx . . $ AM_INDBYTEY.; |
| 379 |
str += 2; |
| 380 |
} |
| 381 |
//FIX: detect illegal opc (zp),x syntax... |
| 382 |
if (cur->addrmodecxx . . $ _SYMBOL#addrmode. == AM_INDWORDcxx . . $ AM_INDWORD. && str[1] == ',' && (str[2]|0x20) == 'x') |
| 383 |
{ |
| 384 |
char sBuffer[128]; |
| 385 |
sprintfcxx . . $ sprintf(26c8642d26409d6d).( sBuffer, "%s", str ); |
| 386 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_ILLEGAL_ADDRESSING_MODEcxx . . $ ERROR_ILLEGAL_ADDRESSING_MODE.,falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, pLine ); |
| 387 |
++Redocxx . . $ Redo.; |
| 388 |
Redo_whycxx . . $ Redo_why. |= REASON_MNEMONIC_NOT_RESOLVEDcxx . . $ REASON_MNEMONIC_NOT_RESOLVED.; |
| 389 |
|
| 390 |
//we treat the opcode as valid to allow passes to continue, which should |
| 391 |
//allow other errors (like phase errros) to resolve before our "++Redo" |
| 392 |
//ultimately forces a failure. |
| 393 |
} |
| 394 |
++str; |
| 395 |
break; |
| 396 |
} |
| 397 |
|
| 398 |
/* fall thru OK */ |
| 399 |
|
| 400 |
case ']': |
| 401 |
|
| 402 |
while(Opicxx . . $ Opi. != Opibasecxx . . $ Opibase. && Oppricxx . . $ Oppri.[Opicxx . . $ Opi.-1]) |
| 403 |
evaltopcxx . . $ evaltop(49f6e7a06ebc5aa8).(); |
| 404 |
if (Opicxx . . $ Opi. != Opibasecxx . . $ Opibase.) |
| 405 |
--Opicxx . . $ Opi.; |
| 406 |
++str; |
| 407 |
|
| 408 |
if (ucasm_indexed_notationcxx . . $ ucasm_indexed_notation.) { |
| 409 |
ucasm_indexed_notationcxx . . $ ucasm_indexed_notation. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!; |
| 410 |
} else { |
| 411 |
if (Argicxx . . $ Argi. == Argibasecxx . . $ Argibase.) |
| 412 |
{ |
| 413 |
putscxx . . $ puts(5c4306d8553b3696).("']' error, no arg on stack"); |
| 414 |
break; |
| 415 |
} |
| 416 |
} |
| 417 |
|
| 418 |
if (*str == 'd') |
| 419 |
{ /* STRING CONVERSION */ |
| 420 |
char buf[32]; |
| 421 |
++str; |
| 422 |
if (Argflagscxx . . $ Argflags.[Argicxx . . $ Argi.-1] == 0) |
| 423 |
{ |
| 424 |
sprintfcxx . . $ sprintf(26c8642d26409d6d).(buf,"%ld",Argstackcxx . . $ Argstack.[Argicxx . . $ Argi.-1]); |
| 425 |
Argstringcxx . . $ Argstring.[Argicxx . . $ Argi.-1] = strcpycxx . . $ strcpy(b7b3a83273496486).(ckmalloccxx . . $ ckmalloc(ff224f080444ee45).(strlencxx . . $ strlen(751346f8406fd082).(buf)+1),buf); |
| 426 |
} |
| 427 |
} |
| 428 |
Lastwasopcxx . . $ Lastwasop. = 0; |
| 429 |
break; |
| 430 |
|
| 431 |
case '#': |
| 432 |
|
| 433 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_IMM8cxx . . $ AM_IMM8.; |
| 434 |
++str; |
| 435 |
/* |
| 436 |
* No other addressing mode is possible from now on |
| 437 |
* so we might as well allow () instead of []. |
| 438 |
*/ |
| 439 |
wantmode = 0; |
| 440 |
break; |
| 441 |
|
| 442 |
case ',': |
| 443 |
|
| 444 |
while(Opicxx . . $ Opi. != Opibasecxx . . $ Opibase.) |
| 445 |
evaltopcxx . . $ evaltop(49f6e7a06ebc5aa8).(); |
| 446 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 447 |
scr = str[1]|0x20; /* to lower case */ |
| 448 |
|
| 449 |
if (cur->addrmodecxx . . $ _SYMBOL#addrmode. == AM_INDWORDcxx . . $ AM_INDWORD. && scr == 'x' && !IsAlphaNumcxx . . $ IsAlphaNum(7864480464b09eea).( str[2] )) |
| 450 |
{ |
| 451 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_INDBYTEXcxx . . $ AM_INDBYTEX.; |
| 452 |
++str; |
| 453 |
} |
| 454 |
//FIX: detect illegal opc (zp,y) syntax... |
| 455 |
else if ((cur->addrmodecxx . . $ _SYMBOL#addrmode. == AM_INDWORDcxx . . $ AM_INDWORD. && scr == 'y' && str[2]==')')&&(wantmode)) |
| 456 |
{ |
| 457 |
char sBuffer[128]; |
| 458 |
sprintfcxx . . $ sprintf(26c8642d26409d6d).( sBuffer, "%s", str ); |
| 459 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_ILLEGAL_ADDRESSING_MODEcxx . . $ ERROR_ILLEGAL_ADDRESSING_MODE.,falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, pLine ); |
| 460 |
++Redocxx . . $ Redo.; |
| 461 |
Redo_whycxx . . $ Redo_why. |= REASON_MNEMONIC_NOT_RESOLVEDcxx . . $ REASON_MNEMONIC_NOT_RESOLVED.; |
| 462 |
|
| 463 |
//we treat the opcode as valid to allow passes to continue, which should |
| 464 |
//allow other errors (like phase errros) to resolve before our "++Redo" |
| 465 |
//ultimately forces a failure. |
| 466 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_0Ycxx . . $ AM_0Y.; |
| 467 |
++str; |
| 468 |
|
| 469 |
} |
| 470 |
else if (scr == 'x' && !IsAlphaNumcxx . . $ IsAlphaNum(7864480464b09eea).(str[2])) |
| 471 |
{ |
| 472 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_0Xcxx . . $ AM_0X.; |
| 473 |
++str; |
| 474 |
//FIX: OPCODE.FORCE / Mnext adaption moved to ops.c |
| 475 |
} |
| 476 |
else if (scr == 'y' && !IsAlphaNumcxx . . $ IsAlphaNum(7864480464b09eea).(str[2])) |
| 477 |
{ |
| 478 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_0Ycxx . . $ AM_0Y.; |
| 479 |
++str; |
| 480 |
//FIX: OPCODE.FORCE / Mnext adaption moved to ops.c |
| 481 |
} |
| 482 |
else if ((scr == 's') && ((str[2]|0x20) == 'p') && !IsAlphaNumcxx . . $ IsAlphaNum(7864480464b09eea).(str[3])) // stack pointer indexed address mode |
| 483 |
{ |
| 484 |
cur->addrmodecxx . . $ _SYMBOL#addrmode. = AM_BYTEADR_SPcxx . . $ AM_BYTEADR_SP.; |
| 485 |
++str; |
| 486 |
++str; |
| 487 |
//FIX: OPCODE.FORCE / Mnext adaption moved to ops.c |
| 488 |
} |
| 489 |
else |
| 490 |
{ |
| 491 |
SYMBOLcxx . . $ `src/asm.h:160:9`! *pNewSymbol = allocsymbolcxx . . $ allocsymbol(cdf7111cce0c7830).(); |
| 492 |
cur->nextcxx . . $ _SYMBOL#next. = pNewSymbol; |
| 493 |
--Argicxx . . $ Argi.; |
| 494 |
if (Argicxx . . $ Argi. < Argibasecxx . . $ Argibase.) |
| 495 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_SYNTAX_ERRORcxx . . $ ERROR_SYNTAX_ERROR., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, pLine ); |
| 496 |
if (Argicxx . . $ Argi. > Argibasecxx . . $ Argibase.) |
| 497 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_SYNTAX_ERRORcxx . . $ ERROR_SYNTAX_ERROR., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, pLine ); |
| 498 |
cur->valuecxx . . $ _SYMBOL#value. = Argstackcxx . . $ Argstack.[Argicxx . . $ Argi.]; |
| 499 |
cur->flagscxx . . $ _SYMBOL#flags. = Argflagscxx . . $ Argflags.[Argicxx . . $ Argi.]; |
| 500 |
|
| 501 |
if ((cur->stringcxx . . $ _SYMBOL#string. = (void *)Argstringcxx . . $ Argstring.[Argicxx . . $ Argi.]) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 502 |
{ |
| 503 |
cur->flagscxx . . $ _SYMBOL#flags. |= SYM_STRINGcxx . . $ `src/asm.h:328:9`!; |
| 504 |
if (Xdebugcxx . . $ Xdebug.) |
| 505 |
printfcxx . . $ printf(581fddd72a8db8fc).("STRING: %s\n", cur->stringcxx . . $ _SYMBOL#string.); |
| 506 |
} |
| 507 |
cur = pNewSymbol; |
| 508 |
} |
| 509 |
++str; |
| 510 |
break; |
| 511 |
|
| 512 |
case '$': |
| 513 |
str = pushhexcxx . . $ pushhex(fb58d2e09a2a1ce6).(str+1); |
| 514 |
break; |
| 515 |
|
| 516 |
case '\'': |
| 517 |
str = pushcharcxx . . $ pushchar(fb58d2e09a2a1ce6).(str+1); |
| 518 |
break; |
| 519 |
|
| 520 |
case '\"': |
| 521 |
str = pushstrcxx . . $ pushstr(fb58d2e09a2a1ce6).(str+1); |
| 522 |
break; |
| 523 |
|
| 524 |
default: |
| 525 |
{ |
| 526 |
const char *dol = str; |
| 527 |
while (*dol >= '0' && *dol <= '9') |
| 528 |
dol++; |
| 529 |
if (*dol == '$') |
| 530 |
{ |
| 531 |
str = pushsymbolcxx . . $ pushsymbol(fb58d2e09a2a1ce6).(str); |
| 532 |
break; |
| 533 |
} |
| 534 |
} |
| 535 |
|
| 536 |
if (*str == '0') |
| 537 |
{ |
| 538 |
if (str[1] == 'x') { // allow also '0xAA' notation for '$AA' |
| 539 |
++str; |
| 540 |
str = (char *)pushhexcxx . . $ pushhex(fb58d2e09a2a1ce6).(str+1); |
| 541 |
} else { |
| 542 |
str = pushoctcxx . . $ pushoct(fb58d2e09a2a1ce6).(str); |
| 543 |
} |
| 544 |
} |
| 545 |
else |
| 546 |
{ |
| 547 |
if (*str > '0' && *str <= '9') |
| 548 |
str = pushdeccxx . . $ pushdec(fb58d2e09a2a1ce6).(str); |
| 549 |
else |
| 550 |
str = pushsymbolcxx . . $ pushsymbol(fb58d2e09a2a1ce6).(str); |
| 551 |
} |
| 552 |
break; |
| 553 |
} |
| 554 |
} |
| 555 |
|
| 556 |
while(Opicxx . . $ Opi. != Opibasecxx . . $ Opibase.) |
| 557 |
evaltopcxx . . $ evaltop(49f6e7a06ebc5aa8).(); |
| 558 |
|
| 559 |
if (Argicxx . . $ Argi. != Argibasecxx . . $ Argibase.) |
| 560 |
{ |
| 561 |
--Argicxx . . $ Argi.; |
| 562 |
cur->valuecxx . . $ _SYMBOL#value. = Argstackcxx . . $ Argstack.[Argicxx . . $ Argi.]; |
| 563 |
cur->flagscxx . . $ _SYMBOL#flags. = Argflagscxx . . $ Argflags.[Argicxx . . $ Argi.]; |
| 564 |
if ((cur->stringcxx . . $ _SYMBOL#string. = (void *)Argstringcxx . . $ Argstring.[Argicxx . . $ Argi.]) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 565 |
{ |
| 566 |
cur->flagscxx . . $ _SYMBOL#flags. |= SYM_STRINGcxx . . $ `src/asm.h:328:9`!; |
| 567 |
if (Xdebugcxx . . $ Xdebug.) |
| 568 |
printfcxx . . $ printf(581fddd72a8db8fc).("STRING: %s\n", cur->stringcxx . . $ _SYMBOL#string.); |
| 569 |
} |
| 570 |
if (base->addrmodecxx . . $ _SYMBOL#addrmode. == 0) |
| 571 |
base->addrmodecxx . . $ _SYMBOL#addrmode. = AM_BYTEADRcxx . . $ AM_BYTEADR.; |
| 572 |
} |
| 573 |
|
| 574 |
if (Argicxx . . $ Argi. != Argibasecxx . . $ Argibase. || Opicxx . . $ Opi. != Opibasecxx . . $ Opibase.) |
| 575 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_SYNTAX_ERRORcxx . . $ ERROR_SYNTAX_ERROR., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, pLine ); |
| 576 |
|
| 577 |
|
| 578 |
Argicxx . . $ Argi. = Argibasecxx . . $ Argibase.; |
| 579 |
Opicxx . . $ Opi. = Opibasecxx . . $ Opibase.; |
| 580 |
Argibasecxx . . $ Argibase. = oldargibase; |
| 581 |
Opibasecxx . . $ Opibase. = oldopibase; |
| 582 |
return base; |
| 583 |
} |
| 584 |
|
| 585 |
|
| 586 |
int IsAlphaNumcxx . . $ IsAlphaNum(7864480464b09eea).( int c ) |
| 587 |
{ |
| 588 |
return ((c >= 'a' && c <= 'z') |
| 589 |
|| (c >= 'A' && c <= 'Z') |
| 590 |
|| (c >= '0' && c <= '9')); |
| 591 |
} |
| 592 |
|
| 593 |
void evaltopcxx . . $ evaltop(49f6e7a06ebc5aa8).(void) |
| 594 |
{ |
| 595 |
if (Xdebugcxx . . $ Xdebug.) |
| 596 |
printfcxx . . $ printf(581fddd72a8db8fc).("evaltop @(A,O) %d %d\n", Argicxx . . $ Argi., Opicxx . . $ Opi.); |
| 597 |
|
| 598 |
if (Opicxx . . $ Opi. <= Opibasecxx . . $ Opibase.) { |
| 599 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_SYNTAX_ERRORcxx . . $ ERROR_SYNTAX_ERROR., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ); |
| 600 |
Opicxx . . $ Opi. = Opibasecxx . . $ Opibase.; |
| 601 |
return; |
| 602 |
} |
| 603 |
--Opicxx . . $ Opi.; |
| 604 |
|
| 605 |
if (Opdiscxx . . $ Opdis.[Opicxx . . $ Opi.] == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 606 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_AVOID_SEGFAULTcxx . . $ ERROR_AVOID_SEGFAULT., truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "operator function table" ); |
| 607 |
return; |
| 608 |
} |
| 609 |
|
| 610 |
if (Oppricxx . . $ Oppri.[Opicxx . . $ Opi.] == 128) { |
| 611 |
if (Argicxx . . $ Argi. < Argibasecxx . . $ Argibase. + 1) { |
| 612 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_SYNTAX_ERRORcxx . . $ ERROR_SYNTAX_ERROR., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ); |
| 613 |
Argicxx . . $ Argi. = Argibasecxx . . $ Argibase.; |
| 614 |
return; |
| 615 |
} |
| 616 |
--Argicxx . . $ Argi.; |
| 617 |
(*Opdiscxx . . $ Opdis.[Opicxx . . $ Opi.]_unarycxx . . $ `src/exp.c:53:9`!)(Argstackcxx . . $ Argstack.[Argicxx . . $ Argi.], Argflagscxx . . $ Argflags.[Argicxx . . $ Argi.]); |
| 618 |
} |
| 619 |
else |
| 620 |
{ |
| 621 |
if (Argicxx . . $ Argi. < Argibasecxx . . $ Argibase. + 2) |
| 622 |
{ |
| 623 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_SYNTAX_ERRORcxx . . $ ERROR_SYNTAX_ERROR., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ); |
| 624 |
Argicxx . . $ Argi. = Argibasecxx . . $ Argibase.; |
| 625 |
return; |
| 626 |
} |
| 627 |
|
| 628 |
Argicxx . . $ Argi. -= 2; |
| 629 |
(*Opdiscxx . . $ Opdis.[Opicxx . . $ Opi.]_binarycxx . . $ `src/exp.c:54:9`!)(Argstackcxx . . $ Argstack.[Argicxx . . $ Argi.], Argstackcxx . . $ Argstack.[Argicxx . . $ Argi.+1], |
| 630 |
Argflagscxx . . $ Argflags.[Argicxx . . $ Argi.], Argflagscxx . . $ Argflags.[Argicxx . . $ Argi.+1]); |
| 631 |
} |
| 632 |
} |
| 633 |
|
| 634 |
static void stackargcxx . . $ stackarg(d53def507beff8e3).(long val, int flags, const char *ptr1) |
| 635 |
{ |
| 636 |
char *str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 637 |
|
| 638 |
if (Xdebugcxx . . $ Xdebug.) |
| 639 |
printfcxx . . $ printf(581fddd72a8db8fc).("stackarg %ld (@%d)\n", val, Argicxx . . $ Argi.); |
| 640 |
|
| 641 |
Lastwasopcxx . . $ Lastwasop. = 0; |
| 642 |
if (flags & SYM_STRINGcxx . . $ `src/asm.h:328:9`!) |
| 643 |
{ |
| 644 |
/* |
| 645 |
Why unsigned char? Looks like we're converting to |
| 646 |
long in a very strange way... [phf] |
| 647 |
*/ |
| 648 |
const unsigned char *ptr = (const unsigned char *)ptr1; |
| 649 |
char *new; |
| 650 |
int len; |
| 651 |
val = len = 0; |
| 652 |
while (*ptr && *ptr != '\"') |
| 653 |
{ |
| 654 |
val = (val << 8) | *ptr; |
| 655 |
++ptr; |
| 656 |
++len; |
| 657 |
} |
| 658 |
new = ckmalloccxx . . $ ckmalloc(ff224f080444ee45).(len + 1); |
| 659 |
memcpycxx . . $ memcpy(cc817cb175f282d).(new, ptr1, len); |
| 660 |
new[len] = 0; |
| 661 |
flags &= ~SYM_STRINGcxx . . $ `src/asm.h:328:9`!; |
| 662 |
str = new; |
| 663 |
} |
| 664 |
Argstackcxx . . $ Argstack.[Argicxx . . $ Argi.] = val; |
| 665 |
Argstringcxx . . $ Argstring.[Argicxx . . $ Argi.] = str; |
| 666 |
Argflagscxx . . $ Argflags.[Argicxx . . $ Argi.] = flags; |
| 667 |
if (++Argicxx . . $ Argi. == MAXARGScxx . . $ `src/exp.c:125:9`!) { |
| 668 |
putscxx . . $ puts(5c4306d8553b3696).("stackarg: maxargs stacked"); |
| 669 |
Argicxx . . $ Argi. = Argibasecxx . . $ Argibase.; |
| 670 |
} |
| 671 |
while (Opicxx . . $ Opi. != Opibasecxx . . $ Opibase. && Oppricxx . . $ Oppri.[Opicxx . . $ Opi.-1] == 128) |
| 672 |
evaltopcxx . . $ evaltop(49f6e7a06ebc5aa8).(); |
| 673 |
} |
| 674 |
|
| 675 |
void doopcxx . . $ doop(1761cb952289507d).(opfunc_tcxx . . $ opfunc_t# func, int pri) |
| 676 |
{ |
| 677 |
if (Xdebugcxx . . $ Xdebug.) |
| 678 |
putscxx . . $ puts(5c4306d8553b3696).("doop"); |
| 679 |
|
| 680 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 681 |
|
| 682 |
if (Opicxx . . $ Opi. == Opibasecxx . . $ Opibase. || pri == 128) |
| 683 |
{ |
| 684 |
if (Xdebugcxx . . $ Xdebug.) |
| 685 |
printfcxx . . $ printf(581fddd72a8db8fc).("doop @ %d unary\n", Opicxx . . $ Opi.); |
| 686 |
|
| 687 |
if (Opicxx . . $ Opi. >= MAXOPScxx . . $ `src/exp.c:124:9`!) { |
| 688 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"doop: error: operator index(%d) > MAXOPS(%d), probably too deep recursion", Opicxx . . $ Opi., MAXOPScxx . . $ `src/exp.c:124:9`!); |
| 689 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).(ERROR_RECURSION_TOO_DEEPcxx . . $ ERROR_RECURSION_TOO_DEEP., truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "doop()"); |
| 690 |
return; |
| 691 |
} |
| 692 |
Opdiscxx . . $ Opdis.[Opicxx . . $ Opi.] = func; |
| 693 |
Oppricxx . . $ Oppri.[Opicxx . . $ Opi.] = pri; |
| 694 |
++Opicxx . . $ Opi.; |
| 695 |
return; |
| 696 |
} |
| 697 |
|
| 698 |
while (Opicxx . . $ Opi. != Opibasecxx . . $ Opibase. && Oppricxx . . $ Oppri.[Opicxx . . $ Opi.-1] && pri <= Oppricxx . . $ Oppri.[Opicxx . . $ Opi.-1]) |
| 699 |
evaltopcxx . . $ evaltop(49f6e7a06ebc5aa8).(); |
| 700 |
|
| 701 |
if (Xdebugcxx . . $ Xdebug.) |
| 702 |
printfcxx . . $ printf(581fddd72a8db8fc).("doop @ %d\n", Opicxx . . $ Opi.); |
| 703 |
|
| 704 |
Opdiscxx . . $ Opdis.[Opicxx . . $ Opi.] = func; |
| 705 |
Oppricxx . . $ Oppri.[Opicxx . . $ Opi.] = pri; |
| 706 |
++Opicxx . . $ Opi.; |
| 707 |
|
| 708 |
if (Opicxx . . $ Opi. == MAXOPScxx . . $ `src/exp.c:124:9`!) |
| 709 |
{ |
| 710 |
putscxx . . $ puts(5c4306d8553b3696).("doop: too many operators"); |
| 711 |
Opicxx . . $ Opi. = Opibasecxx . . $ Opibase.; |
| 712 |
} |
| 713 |
return; |
| 714 |
} |
| 715 |
|
| 716 |
void op_takelsbcxx . . $ op_takelsb(3b75d2d14f60ac6a).(long v1, int f1) |
| 717 |
{ |
| 718 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1 & 0xFFL, f1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 719 |
} |
| 720 |
|
| 721 |
void op_takemsbcxx . . $ op_takemsb(3b75d2d14f60ac6a).(long v1, int f1) |
| 722 |
{ |
| 723 |
stackargcxx . . $ stackarg(d53def507beff8e3).((v1 >> 8) & 0xFF, f1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 724 |
} |
| 725 |
|
| 726 |
void op_negatecxx . . $ op_negate(3b75d2d14f60ac6a).(long v1, int f1) |
| 727 |
{ |
| 728 |
stackargcxx . . $ stackarg(d53def507beff8e3).(-v1, f1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 729 |
} |
| 730 |
|
| 731 |
void op_invertcxx . . $ op_invert(3b75d2d14f60ac6a).(long v1, int f1) |
| 732 |
{ |
| 733 |
stackargcxx . . $ stackarg(d53def507beff8e3).(~v1, f1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 734 |
} |
| 735 |
|
| 736 |
void op_notcxx . . $ op_not(3b75d2d14f60ac6a).(long v1, int f1) |
| 737 |
{ |
| 738 |
stackargcxx . . $ stackarg(d53def507beff8e3).(!v1, f1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 739 |
} |
| 740 |
|
| 741 |
void op_multcxx . . $ op_mult(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 742 |
{ |
| 743 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1 * v2, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 744 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 745 |
} |
| 746 |
|
| 747 |
void op_divcxx . . $ op_div(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 748 |
{ |
| 749 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 750 |
if (f1|f2) { |
| 751 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 752 |
return; |
| 753 |
} |
| 754 |
if (v2 == 0) |
| 755 |
{ |
| 756 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_DIVISION_BY_0cxx . . $ ERROR_DIVISION_BY_0., truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ); |
| 757 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 758 |
} |
| 759 |
else |
| 760 |
{ |
| 761 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1 / v2, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 762 |
} |
| 763 |
} |
| 764 |
|
| 765 |
void op_modcxx . . $ op_mod(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 766 |
{ |
| 767 |
if (f1|f2) { |
| 768 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 769 |
return; |
| 770 |
} |
| 771 |
if (v2 == 0) |
| 772 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 773 |
else |
| 774 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1 % v2, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 775 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 776 |
} |
| 777 |
|
| 778 |
void op_questioncxx . . $ op_question(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 779 |
{ |
| 780 |
if (f1) |
| 781 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, f1, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 782 |
else |
| 783 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)((v1) ? v2 : 0), ((v1) ? f2 : 0), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 784 |
} |
| 785 |
|
| 786 |
void op_addcxx . . $ op_add(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 787 |
{ |
| 788 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1 + v2, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 789 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 790 |
} |
| 791 |
|
| 792 |
void op_subcxx . . $ op_sub(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 793 |
{ |
| 794 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1 - v2, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 795 |
Lastwasopcxx . . $ Lastwasop. = 1; |
| 796 |
} |
| 797 |
|
| 798 |
void op_shiftrightcxx . . $ op_shiftright(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 799 |
{ |
| 800 |
if (f1|f2) |
| 801 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 802 |
else |
| 803 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 >> v2), 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 804 |
} |
| 805 |
|
| 806 |
void op_shiftleftcxx . . $ op_shiftleft(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 807 |
{ |
| 808 |
if (f1|f2) |
| 809 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 810 |
else |
| 811 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 << v2), 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 812 |
} |
| 813 |
|
| 814 |
void op_greatercxx . . $ op_greater(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 815 |
{ |
| 816 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 > v2), f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 817 |
} |
| 818 |
|
| 819 |
void op_greatereqcxx . . $ op_greatereq(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 820 |
{ |
| 821 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 >= v2), f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 822 |
} |
| 823 |
|
| 824 |
void op_smallercxx . . $ op_smaller(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 825 |
{ |
| 826 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 < v2), f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 827 |
} |
| 828 |
|
| 829 |
void op_smallereqcxx . . $ op_smallereq(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 830 |
{ |
| 831 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 <= v2), f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 832 |
} |
| 833 |
|
| 834 |
void op_eqeqcxx . . $ op_eqeq(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 835 |
{ |
| 836 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 == v2), f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 837 |
} |
| 838 |
|
| 839 |
void op_noteqcxx . . $ op_noteq(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 840 |
{ |
| 841 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)(v1 != v2), f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 842 |
} |
| 843 |
|
| 844 |
void op_andandcxx . . $ op_andand(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 845 |
{ |
| 846 |
if ((!f1 && !v1) || (!f2 && !v2)) { |
| 847 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 848 |
return; |
| 849 |
} |
| 850 |
stackargcxx . . $ stackarg(d53def507beff8e3).(1L, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 851 |
} |
| 852 |
|
| 853 |
void op_ororcxx . . $ op_oror(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 854 |
{ |
| 855 |
if ((!f1 && v1) || (!f2 && v2)) { |
| 856 |
stackargcxx . . $ stackarg(d53def507beff8e3).(1L, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 857 |
return; |
| 858 |
} |
| 859 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 860 |
} |
| 861 |
|
| 862 |
void op_xorcxx . . $ op_xor(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 863 |
{ |
| 864 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1^v2, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 865 |
} |
| 866 |
|
| 867 |
void op_andcxx . . $ op_and(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 868 |
{ |
| 869 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1&v2, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 870 |
} |
| 871 |
|
| 872 |
void op_orcxx . . $ op_or(a983888e2c35cfad).(long v1, long v2, int f1, int f2) |
| 873 |
{ |
| 874 |
stackargcxx . . $ stackarg(d53def507beff8e3).(v1|v2, f1|f2, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 875 |
} |
| 876 |
|
| 877 |
const char *pushcharcxx . . $ pushchar(fb58d2e09a2a1ce6).(const char *str) |
| 878 |
{ |
| 879 |
if (*str) { |
| 880 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)*str, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 881 |
++str; |
| 882 |
} else { |
| 883 |
stackargcxx . . $ stackarg(d53def507beff8e3).((long)' ', 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 884 |
} |
| 885 |
return str; |
| 886 |
} |
| 887 |
|
| 888 |
const char *pushhexcxx . . $ pushhex(fb58d2e09a2a1ce6).(const char *str) |
| 889 |
{ |
| 890 |
long val = 0; |
| 891 |
for (;; ++str) { |
| 892 |
if (*str >= '0' && *str <= '9') { |
| 893 |
val = (val << 4) + (*str - '0'); |
| 894 |
continue; |
| 895 |
} |
| 896 |
if ((*str >= 'a' && *str <= 'f') || (*str >= 'A' && *str <= 'F')) { |
| 897 |
val = (val << 4) + ((*str&0x1F) + 9); |
| 898 |
continue; |
| 899 |
} |
| 900 |
break; |
| 901 |
} |
| 902 |
stackargcxx . . $ stackarg(d53def507beff8e3).(val, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 903 |
return str; |
| 904 |
} |
| 905 |
|
| 906 |
const char *pushoctcxx . . $ pushoct(fb58d2e09a2a1ce6).(const char *str) |
| 907 |
{ |
| 908 |
long val = 0; |
| 909 |
while (*str >= '0' && *str <= '7') { |
| 910 |
val = (val << 3) + (*str - '0'); |
| 911 |
++str; |
| 912 |
} |
| 913 |
stackargcxx . . $ stackarg(d53def507beff8e3).(val, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 914 |
return str; |
| 915 |
} |
| 916 |
|
| 917 |
const char *pushdeccxx . . $ pushdec(fb58d2e09a2a1ce6).(const char *str) |
| 918 |
{ |
| 919 |
long val = 0; |
| 920 |
while (*str >= '0' && *str <= '9') { |
| 921 |
val = (val * 10) + (*str - '0'); |
| 922 |
++str; |
| 923 |
} |
| 924 |
stackargcxx . . $ stackarg(d53def507beff8e3).(val, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 925 |
return str; |
| 926 |
} |
| 927 |
|
| 928 |
const char *pushbincxx . . $ pushbin(fb58d2e09a2a1ce6).(const char *str) |
| 929 |
{ |
| 930 |
long val = 0; |
| 931 |
while (*str == '0' || *str == '1') { |
| 932 |
val = (val << 1) | (*str - '0'); |
| 933 |
++str; |
| 934 |
} |
| 935 |
stackargcxx . . $ stackarg(d53def507beff8e3).(val, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 936 |
return str; |
| 937 |
} |
| 938 |
|
| 939 |
const char *pushstrcxx . . $ pushstr(fb58d2e09a2a1ce6).(const char *str) |
| 940 |
{ |
| 941 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0, SYM_STRINGcxx . . $ `src/asm.h:328:9`!, str); |
| 942 |
while (*str && *str != '\"') |
| 943 |
++str; |
| 944 |
if (*str == '\"') |
| 945 |
++str; |
| 946 |
return str; |
| 947 |
} |
| 948 |
|
| 949 |
static int symbolRecursionCountcxx . . $ symbolRecursionCount. = 0; |
| 950 |
|
| 951 |
const char *pushsymbolcxx . . $ pushsymbol(fb58d2e09a2a1ce6).(const char *str) |
| 952 |
{ |
| 953 |
SYMBOLcxx . . $ `src/asm.h:160:9`! *sym; |
| 954 |
const char *ptr; |
| 955 |
unsigned char macro = 0; |
| 956 |
|
| 957 |
symbolRecursionCountcxx . . $ symbolRecursionCount.++; |
| 958 |
|
| 959 |
if (symbolRecursionCountcxx . . $ symbolRecursionCount. > 1000) { |
| 960 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "error: %s:%d: recursion > 1000, too deep, aborting\n",__FILE__,__LINE__); |
| 961 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).(ERROR_RECURSION_TOO_DEEPcxx . . $ ERROR_RECURSION_TOO_DEEP., truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!, "pushsymbol()"); |
| 962 |
} |
| 963 |
|
| 964 |
for (ptr = str; |
| 965 |
*ptr == '_' || |
| 966 |
*ptr == '.' || |
| 967 |
(*ptr >= 'a' && *ptr <= 'z') || |
| 968 |
(*ptr == '@') || // UCASM compatibility, allow at-sign to apear in label names |
| 969 |
(*ptr >= 'A' && *ptr <= 'Z') || |
| 970 |
(*ptr >= '0' && *ptr <= '9'); |
| 971 |
++ptr |
| 972 |
); |
| 973 |
if (ptr == str) { |
| 974 |
asmerrcxx . . $ asmerr(1daa6892c969c96d).( ERROR_ILLEGAL_CHARACTERcxx . . $ ERROR_ILLEGAL_CHARACTER., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!, str ); |
| 975 |
printfcxx . . $ printf(581fddd72a8db8fc).("char = '%c' %d (-1: %d)\n", *str, *str, *(str-1)); |
| 976 |
if (F_listfilecxx . . $ F_listfile.) |
| 977 |
fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(FI_listfilecxx . . $ FI_listfile., "char = '%c' code %d\n", *str, *str); |
| 978 |
return str+1; |
| 979 |
} |
| 980 |
|
| 981 |
if (*ptr == '$') |
| 982 |
ptr++; |
| 983 |
|
| 984 |
if ((sym = findsymbolcxx . . $ findsymbol(83a8820e5b78665b).(str, ptr - str)) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 985 |
{ |
| 986 |
if (sym->flagscxx . . $ _SYMBOL#flags. & SYM_UNKNOWNcxx . . $ `src/asm.h:326:9`!) |
| 987 |
++Redo_evalcxx . . $ Redo_eval.; |
| 988 |
|
| 989 |
if (sym->flagscxx . . $ _SYMBOL#flags. & SYM_MACROcxx . . $ `src/asm.h:330:9`!) |
| 990 |
{ |
| 991 |
macro = 1; |
| 992 |
sym = evalcxx . . $ eval(83a8820e5b78665b).(sym->stringcxx . . $ _SYMBOL#string., 0); |
| 993 |
} |
| 994 |
|
| 995 |
if (sym->flagscxx . . $ _SYMBOL#flags. & SYM_STRINGcxx . . $ `src/asm.h:328:9`!) |
| 996 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0, SYM_STRINGcxx . . $ `src/asm.h:328:9`!, sym->stringcxx . . $ _SYMBOL#string.); |
| 997 |
|
| 998 |
else |
| 999 |
stackargcxx . . $ stackarg(d53def507beff8e3).(sym->valuecxx . . $ _SYMBOL#value., sym->flagscxx . . $ _SYMBOL#flags. & SYM_UNKNOWNcxx . . $ `src/asm.h:326:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1000 |
|
| 1001 |
sym->flagscxx . . $ _SYMBOL#flags. |= SYM_REFcxx . . $ `src/asm.h:327:9`!|SYM_MASREFcxx . . $ `src/asm.h:331:9`!; |
| 1002 |
|
| 1003 |
if (macro) |
| 1004 |
FreeSymbolListcxx . . $ FreeSymbolList(54782e8e250fbf33).(sym); |
| 1005 |
} |
| 1006 |
else |
| 1007 |
{ |
| 1008 |
stackargcxx . . $ stackarg(d53def507beff8e3).(0L, SYM_UNKNOWNcxx . . $ `src/asm.h:326:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 1009 |
sym = CreateSymbolcxx . . $ CreateSymbol(83a8820e5b78665b).( str, ptr - str ); |
| 1010 |
sym->flagscxx . . $ _SYMBOL#flags. = SYM_REFcxx . . $ `src/asm.h:327:9`!|SYM_MASREFcxx . . $ `src/asm.h:331:9`!|SYM_UNKNOWNcxx . . $ `src/asm.h:326:9`!; |
| 1011 |
++Redo_evalcxx . . $ Redo_eval.; |
| 1012 |
} |
| 1013 |
symbolRecursionCountcxx . . $ symbolRecursionCount.--; |
| 1014 |
return ptr; |
| 1015 |
} |
| 1016 |
|
| 1017 |
|