ExpressionEvaluator.java
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62: package xeij;
63:
64: import java.lang.*;
65: import java.util.*;
66:
67: public class ExpressionEvaluator extends EFPBox {
68:
69:
70:
71: protected HashMap<String,ExpressionElement> evxVariableMap;
72:
73:
74:
75:
76: public ExpressionEvaluator () {
77: evxVariableMap = new HashMap<String,ExpressionElement> ();
78: }
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97: protected static final int EVM_EXPRESSION = 1;
98: protected static final int EVM_COMMAND = 2;
99: protected static final int EVM_ASSEMBLER = 3;
100:
101:
102:
103:
104:
105: protected HashMap<Integer,Integer> evxLocalLabelCount;
106: protected HashMap<Integer,Integer> evxLocalLabelMap;
107:
108:
109:
110:
111:
112:
113: protected static final int EPY_PRIORITY_PRIMITIVE = 21;
114: protected static final int EPY_PRIORITY_FUNCTION = 20;
115: protected static final int EPY_PRIORITY_AT = 19;
116: protected static final int EPY_PRIORITY_POSTFIX = 18;
117: protected static final int EPY_PRIORITY_PREFIX = 17;
118: protected static final int EPY_PRIORITY_EXPONENTIATION = 16;
119: protected static final int EPY_PRIORITY_MULTIPLICATION = 15;
120: protected static final int EPY_PRIORITY_ADDITION = 14;
121: protected static final int EPY_PRIORITY_SHIFT = 13;
122: protected static final int EPY_PRIORITY_COMPARISON = 12;
123: protected static final int EPY_PRIORITY_EQUALITY = 11;
124: protected static final int EPY_PRIORITY_BITWISE_AND = 10;
125: protected static final int EPY_PRIORITY_BITWISE_XOR = 9;
126: protected static final int EPY_PRIORITY_BITWISE_OR = 8;
127: protected static final int EPY_PRIORITY_LOGICAL_AND = 7;
128: protected static final int EPY_PRIORITY_LOGICAL_OR = 6;
129: protected static final int EPY_PRIORITY_CONDITIONAL = 5;
130: protected static final int EPY_PRIORITY_ASSIGNMENT = 4;
131: protected static final int EPY_PRIORITY_COLON = 3;
132: protected static final int EPY_PRIORITY_COMMA = 2;
133: protected static final int EPY_PRIORITY_COMMAND = 1;
134: protected static final int EPY_PRIORITY_SEPARATOR = 0;
135:
136:
137:
138:
139: public static final String[] EVX_FLOAT_CONTROL_NAME_ARRAY = (
140: "fpiar," +
141: "fpsr," +
142: "fpcr," +
143: "").split (",");
144:
145:
146:
147:
148: public static final String[] EVX_CACHE_NAME_ARRAY = (
149: "nc," +
150: "dc," +
151: "ic," +
152: "bc," +
153: "").split (",");
154:
155:
156:
157:
158: public static final String[] EVX_CONTROL_CODE_MPU_NAME_ARRAY = (
159: "0000 -12346 SFC," +
160: "0001 -12346 DFC," +
161: "0002 --2346 CACR," +
162: "0003 ----46 TC," +
163: "0004 ----46 ITT0," +
164: "0004 ----4- IACR0," +
165: "0005 ----46 ITT1," +
166: "0005 ----4- IACR1," +
167: "0006 ----46 DTT0," +
168: "0006 ----4- DACR0," +
169: "0007 ----46 DTT1," +
170: "0007 ----4- DACR1," +
171: "0008 -----6 BUSCR," +
172: "0800 -12346 USP," +
173: "0801 -12346 VBR," +
174: "0802 --23-- CAAR," +
175: "0803 --234- MSP," +
176: "0804 --2346 ISP," +
177: "0805 ----4- MMUSR," +
178: "0806 ----46 URP," +
179: "0807 ----46 SRP," +
180: "0808 -----6 PCR," +
181: "").split (",");
182: protected static final HashMap<String,Integer> EVX_CONTROL_NAME_TO_MPU_CODE = new HashMap<String,Integer> ();
183: protected static final HashMap<Integer,String> EVX_CONTROL_MPU_CODE_TO_NAME = new HashMap<Integer,String> ();
184: static {
185: for (String codeMPUName : EVX_CONTROL_CODE_MPU_NAME_ARRAY) {
186: int mpuCode = Integer.parseInt (codeMPUName.substring (0, 4), 16);
187: for (int i = 5; i <= 10; i++) {
188: int c = codeMPUName.charAt (i);
189: if (c != '-') {
190: mpuCode |= 1 << 16 << (c & 15);
191: }
192: }
193: String name = codeMPUName.substring (12).toLowerCase ();
194: EVX_CONTROL_NAME_TO_MPU_CODE.put (name, mpuCode);
195: EVX_CONTROL_MPU_CODE_TO_NAME.put (mpuCode, name);
196: }
197: }
198:
199:
200:
201:
202:
203: protected enum ElementType {
204:
205:
206:
207:
208:
209:
210: ETY_UNDEF {
211: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
212: return sb.append ("undefined");
213: }
214: },
215:
216:
217:
218:
219: ETY_VOID {
220: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
221: return sb;
222: }
223: },
224:
225:
226:
227:
228:
229:
230:
231: ETY_VARIABLE_FLOAT {
232: @Override protected void etyEval (ExpressionElement elem, int mode) {
233: elem.exlFloatValue.sete (elem.exlParamX.exlFloatValue);
234: }
235: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
236: return sb.append (elem.exlStringValue);
237: }
238: },
239:
240:
241:
242:
243:
244:
245:
246: ETY_VARIABLE_STRING {
247: @Override protected void etyEval (ExpressionElement elem, int mode) {
248: elem.exlStringValue = elem.exlParamX.exlStringValue;
249: }
250: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
251: return sb.append (elem.exlStringValue);
252: }
253: },
254:
255:
256:
257:
258:
259: ETY_FLOAT {
260: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
261: return sb.append (elem.exlFloatValue.toString ());
262: }
263: },
264:
265:
266:
267:
268: ETY_STRING {
269: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
270: String str = elem.exlStringValue;
271: sb.append ('"');
272: for (int i = 0, l = str.length (); i < l; i++) {
273: char c = str.charAt (i);
274: if (c == '\b') {
275: sb.append ("\\b");
276: } else if (c == '\f') {
277: sb.append ("\\f");
278: } else if (c == '\t') {
279: sb.append ("\\t");
280: } else if (c == '\n') {
281: sb.append ("\\n");
282: } else if (c == '\r') {
283: sb.append ("\\r");
284: } else if (0x00 <= c && c <= 0x1f) {
285: String.format ("\\x%02x", c);
286: } else if (c == '"') {
287: sb.append ("\\\"");
288: } else if (c == '\\') {
289: sb.append ("\\\\");
290: } else {
291: sb.append (c);
292: }
293: }
294: return sb.append ('"');
295: }
296: },
297:
298:
299:
300:
301:
302: ETY_MATH_APERY {
303: @Override protected void etyEval (ExpressionElement elem, int mode) {
304: elem.exlFloatValue.setapery ();
305: }
306: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
307: return sb.append ("Apery");
308: }
309: },
310:
311: ETY_MATH_CATALAN {
312: @Override protected void etyEval (ExpressionElement elem, int mode) {
313: elem.exlFloatValue.setcatalan ();
314: }
315: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
316: return sb.append ("Catalan");
317: }
318: },
319:
320: ETY_MATH_NAPIER {
321: @Override protected void etyEval (ExpressionElement elem, int mode) {
322: elem.exlFloatValue.setnapier ();
323: }
324: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
325: return sb.append ("E");
326: }
327: },
328:
329: ETY_MATH_EULER {
330: @Override protected void etyEval (ExpressionElement elem, int mode) {
331: elem.exlFloatValue.seteuler ();
332: }
333: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
334: return sb.append ("Euler");
335: }
336: },
337:
338: ETY_MATH_PI {
339: @Override protected void etyEval (ExpressionElement elem, int mode) {
340: elem.exlFloatValue.setpi ();
341: }
342: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
343: return sb.append ("Pi");
344: }
345: },
346:
347:
348:
349:
350: ETY_INTEGER_REGISTER {
351: @Override protected void etyEval (ExpressionElement elem, int mode) {
352: elem.exlFloatValue.seti (XEiJ.regRn[elem.exlSubscript]);
353: }
354: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
355: if (elem.exlSubscript <= 7) {
356: return sb.append ('d').append (elem.exlSubscript);
357: } else if (elem.exlSubscript <= 14) {
358: return sb.append ('a').append (elem.exlSubscript - 8);
359: } else {
360: return sb.append ("sp");
361: }
362: }
363: },
364:
365:
366:
367:
368: ETY_FLOATING_POINT_REGISTER {
369: @Override protected void etyEval (ExpressionElement elem, int mode) {
370: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlSubscript));
371: }
372: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
373: return sb.append ("fp").append (elem.exlSubscript);
374: }
375: },
376:
377:
378:
379: ETY_PC {
380: @Override protected void etyEval (ExpressionElement elem, int mode) {
381: elem.exlFloatValue.seti (elem.exlReadPC ());
382: }
383: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
384: return sb.append (elem.exlStringValue);
385: }
386: },
387: ETY_CCR {
388: @Override protected void etyEval (ExpressionElement elem, int mode) {
389: elem.exlFloatValue.seti (elem.exlReadCCR ());
390: }
391: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
392: return sb.append (elem.exlStringValue);
393: }
394: },
395: ETY_SR {
396: @Override protected void etyEval (ExpressionElement elem, int mode) {
397: elem.exlFloatValue.seti (elem.exlReadSR ());
398: }
399: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
400: return sb.append (elem.exlStringValue);
401: }
402: },
403: ETY_FLOAT_CONTROL_REGISTER {
404: @Override protected void etyEval (ExpressionElement elem, int mode) {
405: elem.exlFloatValue.seti (elem.exlReadFloatControlRegister (elem.exlSubscript));
406: }
407: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
408: return sb.append (elem.exlStringValue);
409: }
410: },
411: ETY_CONTROL_REGISTER {
412: @Override protected void etyEval (ExpressionElement elem, int mode) {
413: elem.exlFloatValue.seti (elem.exlReadControlRegister (elem.exlSubscript));
414: }
415: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
416: return sb.append (elem.exlStringValue);
417: }
418: },
419:
420:
421:
422:
423:
424:
425: ETY_ZERO_REGISTER {
426: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
427: return sb.append (elem.exlStringValue);
428: }
429: },
430:
431:
432:
433: ETY_ZERO_PC {
434: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
435: return sb.append (elem.exlStringValue);
436: }
437: },
438:
439:
440:
441: ETY_OPTIONAL_PC {
442: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
443: return sb.append (elem.exlStringValue);
444: }
445: },
446:
447:
448:
449:
450: ETY_CACHE_SELECTION {
451: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
452: return sb.append (elem.exlStringValue);
453: }
454: },
455:
456:
457:
458:
459:
460:
461:
462:
463:
464: ETY_FUNCTION_ABS {
465: @Override protected int etyPriority () {
466: return EPY_PRIORITY_FUNCTION;
467: }
468: @Override protected void etyEval (ExpressionElement elem, int mode) {
469: elem.exlFloatValue.abs (elem.exlParamX.exlEval (mode).exlFloatValue);
470: }
471: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
472: return elem.exlAppendFunctionTo (sb, "abs");
473: }
474: },
475:
476: ETY_FUNCTION_ACOS {
477: @Override protected int etyPriority () {
478: return EPY_PRIORITY_FUNCTION;
479: }
480: @Override protected void etyEval (ExpressionElement elem, int mode) {
481: elem.exlFloatValue.acos (elem.exlParamX.exlEval (mode).exlFloatValue);
482: }
483: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
484: return elem.exlAppendFunctionTo (sb, "acos");
485: }
486: },
487:
488: ETY_FUNCTION_ACOSH {
489: @Override protected int etyPriority () {
490: return EPY_PRIORITY_FUNCTION;
491: }
492: @Override protected void etyEval (ExpressionElement elem, int mode) {
493: elem.exlFloatValue.acosh (elem.exlParamX.exlEval (mode).exlFloatValue);
494: }
495: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
496: return elem.exlAppendFunctionTo (sb, "acosh");
497: }
498: },
499:
500: ETY_FUNCTION_ACOT {
501: @Override protected int etyPriority () {
502: return EPY_PRIORITY_FUNCTION;
503: }
504: @Override protected void etyEval (ExpressionElement elem, int mode) {
505: elem.exlFloatValue.acot (elem.exlParamX.exlEval (mode).exlFloatValue);
506: }
507: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
508: return elem.exlAppendFunctionTo (sb, "acot");
509: }
510: },
511:
512: ETY_FUNCTION_ACOTH {
513: @Override protected int etyPriority () {
514: return EPY_PRIORITY_FUNCTION;
515: }
516: @Override protected void etyEval (ExpressionElement elem, int mode) {
517: elem.exlFloatValue.acoth (elem.exlParamX.exlEval (mode).exlFloatValue);
518: }
519: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
520: return elem.exlAppendFunctionTo (sb, "acoth");
521: }
522: },
523:
524: ETY_FUNCTION_ACSC {
525: @Override protected int etyPriority () {
526: return EPY_PRIORITY_FUNCTION;
527: }
528: @Override protected void etyEval (ExpressionElement elem, int mode) {
529: elem.exlFloatValue.acsc (elem.exlParamX.exlEval (mode).exlFloatValue);
530: }
531: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
532: return elem.exlAppendFunctionTo (sb, "acsc");
533: }
534: },
535:
536: ETY_FUNCTION_ACSCH {
537: @Override protected int etyPriority () {
538: return EPY_PRIORITY_FUNCTION;
539: }
540: @Override protected void etyEval (ExpressionElement elem, int mode) {
541: elem.exlFloatValue.acsch (elem.exlParamX.exlEval (mode).exlFloatValue);
542: }
543: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
544: return elem.exlAppendFunctionTo (sb, "acsch");
545: }
546: },
547:
548: ETY_FUNCTION_AGI {
549: @Override protected int etyPriority () {
550: return EPY_PRIORITY_FUNCTION;
551: }
552: @Override protected void etyEval (ExpressionElement elem, int mode) {
553: elem.exlFloatValue.agi (elem.exlParamX.exlEval (mode).exlFloatValue,
554: elem.exlParamY.exlEval (mode).exlFloatValue);
555: }
556: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
557: return elem.exlAppendFunctionTo (sb, "agi");
558: }
559: },
560:
561: ETY_FUNCTION_AGM {
562: @Override protected int etyPriority () {
563: return EPY_PRIORITY_FUNCTION;
564: }
565: @Override protected void etyEval (ExpressionElement elem, int mode) {
566: elem.exlFloatValue.agi (elem.exlParamX.exlEval (mode).exlFloatValue,
567: elem.exlParamY.exlEval (mode).exlFloatValue);
568: }
569: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
570: return elem.exlAppendFunctionTo (sb, "agm");
571: }
572: },
573:
574: ETY_FUNCTION_ASC {
575: @Override protected int etyPriority () {
576: return EPY_PRIORITY_FUNCTION;
577: }
578: @Override protected void etyEval (ExpressionElement elem, int mode) {
579: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlStringValue.charAt (0));
580: }
581: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
582: return elem.exlAppendFunctionTo (sb, "asc");
583: }
584: },
585:
586: ETY_FUNCTION_ASEC {
587: @Override protected int etyPriority () {
588: return EPY_PRIORITY_FUNCTION;
589: }
590: @Override protected void etyEval (ExpressionElement elem, int mode) {
591: elem.exlFloatValue.asec (elem.exlParamX.exlEval (mode).exlFloatValue);
592: }
593: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
594: return elem.exlAppendFunctionTo (sb, "asec");
595: }
596: },
597:
598: ETY_FUNCTION_ASECH {
599: @Override protected int etyPriority () {
600: return EPY_PRIORITY_FUNCTION;
601: }
602: @Override protected void etyEval (ExpressionElement elem, int mode) {
603: elem.exlFloatValue.asech (elem.exlParamX.exlEval (mode).exlFloatValue);
604: }
605: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
606: return elem.exlAppendFunctionTo (sb, "asech");
607: }
608: },
609:
610: ETY_FUNCTION_ASIN {
611: @Override protected int etyPriority () {
612: return EPY_PRIORITY_FUNCTION;
613: }
614: @Override protected void etyEval (ExpressionElement elem, int mode) {
615: elem.exlFloatValue.asin (elem.exlParamX.exlEval (mode).exlFloatValue);
616: }
617: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
618: return elem.exlAppendFunctionTo (sb, "asin");
619: }
620: },
621:
622: ETY_FUNCTION_ASINH {
623: @Override protected int etyPriority () {
624: return EPY_PRIORITY_FUNCTION;
625: }
626: @Override protected void etyEval (ExpressionElement elem, int mode) {
627: elem.exlFloatValue.asinh (elem.exlParamX.exlEval (mode).exlFloatValue);
628: }
629: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
630: return elem.exlAppendFunctionTo (sb, "asinh");
631: }
632: },
633:
634: ETY_FUNCTION_ATAN {
635: @Override protected int etyPriority () {
636: return EPY_PRIORITY_FUNCTION;
637: }
638: @Override protected void etyEval (ExpressionElement elem, int mode) {
639: elem.exlFloatValue.atan (elem.exlParamX.exlEval (mode).exlFloatValue);
640: }
641: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
642: return elem.exlAppendFunctionTo (sb, "atan");
643: }
644: },
645:
646: ETY_FUNCTION_ATAN2 {
647: @Override protected int etyPriority () {
648: return EPY_PRIORITY_FUNCTION;
649: }
650: @Override protected void etyEval (ExpressionElement elem, int mode) {
651: elem.exlFloatValue.atan2 (elem.exlParamX.exlEval (mode).exlFloatValue,
652: elem.exlParamY.exlEval (mode).exlFloatValue);
653: }
654: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
655: return elem.exlAppendFunctionTo (sb, "atan2");
656: }
657: },
658:
659: ETY_FUNCTION_ATANH {
660: @Override protected int etyPriority () {
661: return EPY_PRIORITY_FUNCTION;
662: }
663: @Override protected void etyEval (ExpressionElement elem, int mode) {
664: elem.exlFloatValue.atanh (elem.exlParamX.exlEval (mode).exlFloatValue);
665: }
666: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
667: return elem.exlAppendFunctionTo (sb, "atanh");
668: }
669: },
670:
671: ETY_FUNCTION_BIN_DOLLAR {
672: @Override protected int etyPriority () {
673: return EPY_PRIORITY_FUNCTION;
674: }
675: @Override protected void etyEval (ExpressionElement elem, int mode) {
676: long x = elem.exlParamX.exlEval (mode).exlFloatValue.getl ();
677: int m = Math.max (0, 63 - Long.numberOfLeadingZeros (x));
678: char[] w = new char[64];
679: for (int k = m; 0 <= k; k--) {
680: int t = (int) (x >>> k) & 1;
681: w[m - k] = (char) (48 + t);
682: }
683: elem.exlStringValue = String.valueOf (w, 0, m + 1);
684: }
685: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
686: return elem.exlAppendFunctionTo (sb, "bin$");
687: }
688: },
689:
690: ETY_FUNCTION_CBRT {
691: @Override protected int etyPriority () {
692: return EPY_PRIORITY_FUNCTION;
693: }
694: @Override protected void etyEval (ExpressionElement elem, int mode) {
695: elem.exlFloatValue.cbrt (elem.exlParamX.exlEval (mode).exlFloatValue);
696: }
697: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
698: return elem.exlAppendFunctionTo (sb, "cbrt");
699: }
700: },
701:
702: ETY_FUNCTION_CEIL {
703: @Override protected int etyPriority () {
704: return EPY_PRIORITY_FUNCTION;
705: }
706: @Override protected void etyEval (ExpressionElement elem, int mode) {
707: elem.exlFloatValue.ceil (elem.exlParamX.exlEval (mode).exlFloatValue);
708: }
709: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
710: return elem.exlAppendFunctionTo (sb, "ceil");
711: }
712: },
713:
714: ETY_FUNCTION_CHR_DOLLAR {
715: @Override protected int etyPriority () {
716: return EPY_PRIORITY_FUNCTION;
717: }
718: @Override protected void etyEval (ExpressionElement elem, int mode) {
719: elem.exlStringValue = String.valueOf ((char) elem.exlParamX.exlEval (mode).exlFloatValue.getl ());
720: }
721: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
722: return elem.exlAppendFunctionTo (sb, "chr$");
723: }
724: },
725:
726: ETY_FUNCTION_CMP {
727: @Override protected int etyPriority () {
728: return EPY_PRIORITY_FUNCTION;
729: }
730: @Override protected void etyEval (ExpressionElement elem, int mode) {
731: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.cmp (elem.exlParamY.exlEval (mode).exlFloatValue));
732: }
733: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
734: return elem.exlAppendFunctionTo (sb, "cmp");
735: }
736: },
737:
738: ETY_FUNCTION_CMP0 {
739: @Override protected int etyPriority () {
740: return EPY_PRIORITY_FUNCTION;
741: }
742: @Override protected void etyEval (ExpressionElement elem, int mode) {
743: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.cmp0 ());
744: }
745: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
746: return elem.exlAppendFunctionTo (sb, "cmp0");
747: }
748: },
749:
750: ETY_FUNCTION_CMP1 {
751: @Override protected int etyPriority () {
752: return EPY_PRIORITY_FUNCTION;
753: }
754: @Override protected void etyEval (ExpressionElement elem, int mode) {
755: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.cmp1 ());
756: }
757: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
758: return elem.exlAppendFunctionTo (sb, "cmp1");
759: }
760: },
761:
762: ETY_FUNCTION_CMP1ABS {
763: @Override protected int etyPriority () {
764: return EPY_PRIORITY_FUNCTION;
765: }
766: @Override protected void etyEval (ExpressionElement elem, int mode) {
767: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.cmp1abs ());
768: }
769: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
770: return elem.exlAppendFunctionTo (sb, "cmp1abs");
771: }
772: },
773:
774: ETY_FUNCTION_CMPABS {
775: @Override protected int etyPriority () {
776: return EPY_PRIORITY_FUNCTION;
777: }
778: @Override protected void etyEval (ExpressionElement elem, int mode) {
779: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.cmpabs (elem.exlParamY.exlEval (mode).exlFloatValue));
780: }
781: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
782: return elem.exlAppendFunctionTo (sb, "cmpabs");
783: }
784: },
785:
786: ETY_FUNCTION_COS {
787: @Override protected int etyPriority () {
788: return EPY_PRIORITY_FUNCTION;
789: }
790: @Override protected void etyEval (ExpressionElement elem, int mode) {
791: elem.exlFloatValue.cos (elem.exlParamX.exlEval (mode).exlFloatValue);
792: }
793: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
794: return elem.exlAppendFunctionTo (sb, "cos");
795: }
796: },
797:
798: ETY_FUNCTION_COSH {
799: @Override protected int etyPriority () {
800: return EPY_PRIORITY_FUNCTION;
801: }
802: @Override protected void etyEval (ExpressionElement elem, int mode) {
803: elem.exlFloatValue.cosh (elem.exlParamX.exlEval (mode).exlFloatValue);
804: }
805: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
806: return elem.exlAppendFunctionTo (sb, "cosh");
807: }
808: },
809:
810: ETY_FUNCTION_COT {
811: @Override protected int etyPriority () {
812: return EPY_PRIORITY_FUNCTION;
813: }
814: @Override protected void etyEval (ExpressionElement elem, int mode) {
815: elem.exlFloatValue.cot (elem.exlParamX.exlEval (mode).exlFloatValue);
816: }
817: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
818: return elem.exlAppendFunctionTo (sb, "cot");
819: }
820: },
821:
822: ETY_FUNCTION_COTH {
823: @Override protected int etyPriority () {
824: return EPY_PRIORITY_FUNCTION;
825: }
826: @Override protected void etyEval (ExpressionElement elem, int mode) {
827: elem.exlFloatValue.coth (elem.exlParamX.exlEval (mode).exlFloatValue);
828: }
829: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
830: return elem.exlAppendFunctionTo (sb, "coth");
831: }
832: },
833:
834: ETY_FUNCTION_CSC {
835: @Override protected int etyPriority () {
836: return EPY_PRIORITY_FUNCTION;
837: }
838: @Override protected void etyEval (ExpressionElement elem, int mode) {
839: elem.exlFloatValue.csc (elem.exlParamX.exlEval (mode).exlFloatValue);
840: }
841: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
842: return elem.exlAppendFunctionTo (sb, "csc");
843: }
844: },
845:
846: ETY_FUNCTION_CSCH {
847: @Override protected int etyPriority () {
848: return EPY_PRIORITY_FUNCTION;
849: }
850: @Override protected void etyEval (ExpressionElement elem, int mode) {
851: elem.exlFloatValue.csch (elem.exlParamX.exlEval (mode).exlFloatValue);
852: }
853: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
854: return elem.exlAppendFunctionTo (sb, "csch");
855: }
856: },
857:
858: ETY_FUNCTION_CUB {
859: @Override protected int etyPriority () {
860: return EPY_PRIORITY_FUNCTION;
861: }
862: @Override protected void etyEval (ExpressionElement elem, int mode) {
863: elem.exlFloatValue.cub (elem.exlParamX.exlEval (mode).exlFloatValue);
864: }
865: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
866: return elem.exlAppendFunctionTo (sb, "cub");
867: }
868: },
869:
870: ETY_FUNCTION_DEC {
871: @Override protected int etyPriority () {
872: return EPY_PRIORITY_FUNCTION;
873: }
874: @Override protected void etyEval (ExpressionElement elem, int mode) {
875: elem.exlFloatValue.dec (elem.exlParamX.exlEval (mode).exlFloatValue);
876: }
877: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
878: return elem.exlAppendFunctionTo (sb, "dec");
879: }
880: },
881:
882: ETY_FUNCTION_DEG {
883: @Override protected int etyPriority () {
884: return EPY_PRIORITY_FUNCTION;
885: }
886: @Override protected void etyEval (ExpressionElement elem, int mode) {
887: elem.exlFloatValue.deg (elem.exlParamX.exlEval (mode).exlFloatValue);
888: }
889: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
890: return elem.exlAppendFunctionTo (sb, "deg");
891: }
892: },
893:
894: ETY_FUNCTION_DIV2 {
895: @Override protected int etyPriority () {
896: return EPY_PRIORITY_FUNCTION;
897: }
898: @Override protected void etyEval (ExpressionElement elem, int mode) {
899: elem.exlFloatValue.div2 (elem.exlParamX.exlEval (mode).exlFloatValue);
900: }
901: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
902: return elem.exlAppendFunctionTo (sb, "div2");
903: }
904: },
905:
906: ETY_FUNCTION_DIV3 {
907: @Override protected int etyPriority () {
908: return EPY_PRIORITY_FUNCTION;
909: }
910: @Override protected void etyEval (ExpressionElement elem, int mode) {
911: elem.exlFloatValue.div3 (elem.exlParamX.exlEval (mode).exlFloatValue);
912: }
913: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
914: return elem.exlAppendFunctionTo (sb, "div3");
915: }
916: },
917:
918: ETY_FUNCTION_DIVPI {
919: @Override protected int etyPriority () {
920: return EPY_PRIORITY_FUNCTION;
921: }
922: @Override protected void etyEval (ExpressionElement elem, int mode) {
923: elem.exlFloatValue.divpi (elem.exlParamX.exlEval (mode).exlFloatValue);
924: }
925: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
926: return elem.exlAppendFunctionTo (sb, "divpi");
927: }
928: },
929:
930: ETY_FUNCTION_DIVRZ {
931: @Override protected int etyPriority () {
932: return EPY_PRIORITY_FUNCTION;
933: }
934: @Override protected void etyEval (ExpressionElement elem, int mode) {
935: elem.exlFloatValue.divrz (elem.exlParamX.exlEval (mode).exlFloatValue,
936: elem.exlParamY.exlEval (mode).exlFloatValue);
937: }
938: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
939: return elem.exlAppendFunctionTo (sb, "divrz");
940: }
941: },
942:
943: ETY_FUNCTION_EXP {
944: @Override protected int etyPriority () {
945: return EPY_PRIORITY_FUNCTION;
946: }
947: @Override protected void etyEval (ExpressionElement elem, int mode) {
948: elem.exlFloatValue.exp (elem.exlParamX.exlEval (mode).exlFloatValue);
949: }
950: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
951: return elem.exlAppendFunctionTo (sb, "exp");
952: }
953: },
954:
955: ETY_FUNCTION_EXP10 {
956: @Override protected int etyPriority () {
957: return EPY_PRIORITY_FUNCTION;
958: }
959: @Override protected void etyEval (ExpressionElement elem, int mode) {
960: elem.exlFloatValue.exp10 (elem.exlParamX.exlEval (mode).exlFloatValue);
961: }
962: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
963: return elem.exlAppendFunctionTo (sb, "exp10");
964: }
965: },
966:
967: ETY_FUNCTION_EXP2 {
968: @Override protected int etyPriority () {
969: return EPY_PRIORITY_FUNCTION;
970: }
971: @Override protected void etyEval (ExpressionElement elem, int mode) {
972: elem.exlFloatValue.exp2 (elem.exlParamX.exlEval (mode).exlFloatValue);
973: }
974: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
975: return elem.exlAppendFunctionTo (sb, "exp2");
976: }
977: },
978:
979: ETY_FUNCTION_EXP2M1 {
980: @Override protected int etyPriority () {
981: return EPY_PRIORITY_FUNCTION;
982: }
983: @Override protected void etyEval (ExpressionElement elem, int mode) {
984: elem.exlFloatValue.exp2m1 (elem.exlParamX.exlEval (mode).exlFloatValue);
985: }
986: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
987: return elem.exlAppendFunctionTo (sb, "exp2m1");
988: }
989: },
990:
991: ETY_FUNCTION_EXPM1 {
992: @Override protected int etyPriority () {
993: return EPY_PRIORITY_FUNCTION;
994: }
995: @Override protected void etyEval (ExpressionElement elem, int mode) {
996: elem.exlFloatValue.expm1 (elem.exlParamX.exlEval (mode).exlFloatValue);
997: }
998: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
999: return elem.exlAppendFunctionTo (sb, "expm1");
1000: }
1001: },
1002:
1003: ETY_FUNCTION_FLOOR {
1004: @Override protected int etyPriority () {
1005: return EPY_PRIORITY_FUNCTION;
1006: }
1007: @Override protected void etyEval (ExpressionElement elem, int mode) {
1008: elem.exlFloatValue.floor (elem.exlParamX.exlEval (mode).exlFloatValue);
1009: }
1010: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1011: return elem.exlAppendFunctionTo (sb, "floor");
1012: }
1013: },
1014:
1015: ETY_FUNCTION_FRAC {
1016: @Override protected int etyPriority () {
1017: return EPY_PRIORITY_FUNCTION;
1018: }
1019: @Override protected void etyEval (ExpressionElement elem, int mode) {
1020: elem.exlFloatValue.frac (elem.exlParamX.exlEval (mode).exlFloatValue);
1021: }
1022: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1023: return elem.exlAppendFunctionTo (sb, "frac");
1024: }
1025: },
1026:
1027: ETY_FUNCTION_GETEXP {
1028: @Override protected int etyPriority () {
1029: return EPY_PRIORITY_FUNCTION;
1030: }
1031: @Override protected void etyEval (ExpressionElement elem, int mode) {
1032: elem.exlFloatValue.getexp (elem.exlParamX.exlEval (mode).exlFloatValue);
1033: }
1034: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1035: return elem.exlAppendFunctionTo (sb, "getexp");
1036: }
1037: },
1038:
1039: ETY_FUNCTION_GETMAN {
1040: @Override protected int etyPriority () {
1041: return EPY_PRIORITY_FUNCTION;
1042: }
1043: @Override protected void etyEval (ExpressionElement elem, int mode) {
1044: elem.exlFloatValue.getman (elem.exlParamX.exlEval (mode).exlFloatValue);
1045: }
1046: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1047: return elem.exlAppendFunctionTo (sb, "getman");
1048: }
1049: },
1050:
1051: ETY_FUNCTION_HEX_DOLLAR {
1052: @Override protected int etyPriority () {
1053: return EPY_PRIORITY_FUNCTION;
1054: }
1055: @Override protected void etyEval (ExpressionElement elem, int mode) {
1056: long x = elem.exlParamX.exlEval (mode).exlFloatValue.getl ();
1057: int m = Math.max (0, 63 - Long.numberOfLeadingZeros (x) >> 2);
1058: char[] w = new char[16];
1059: for (int k = m; 0 <= k; k--) {
1060: int t = (int) (x >>> (k << 2)) & 15;
1061: w[m - k] = (char) ((9 - t >> 4 & 7) + 48 + t);
1062:
1063: }
1064: elem.exlStringValue = String.valueOf (w, 0, m + 1);
1065: }
1066: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1067: return elem.exlAppendFunctionTo (sb, "hex$");
1068: }
1069: },
1070:
1071: ETY_FUNCTION_IEEEREM {
1072: @Override protected int etyPriority () {
1073: return EPY_PRIORITY_FUNCTION;
1074: }
1075: @Override protected void etyEval (ExpressionElement elem, int mode) {
1076: elem.exlFloatValue.ieeerem (elem.exlParamX.exlEval (mode).exlFloatValue,
1077: elem.exlParamY.exlEval (mode).exlFloatValue);
1078: }
1079: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1080: return elem.exlAppendFunctionTo (sb, "ieeerem");
1081: }
1082: },
1083:
1084: ETY_FUNCTION_INC {
1085: @Override protected int etyPriority () {
1086: return EPY_PRIORITY_FUNCTION;
1087: }
1088: @Override protected void etyEval (ExpressionElement elem, int mode) {
1089: elem.exlFloatValue.inc (elem.exlParamX.exlEval (mode).exlFloatValue);
1090: }
1091: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1092: return elem.exlAppendFunctionTo (sb, "inc");
1093: }
1094: },
1095:
1096: ETY_FUNCTION_ISEVEN {
1097: @Override protected int etyPriority () {
1098: return EPY_PRIORITY_FUNCTION;
1099: }
1100: @Override protected void etyEval (ExpressionElement elem, int mode) {
1101: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.iseven () ? 1 : 0);
1102: }
1103: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1104: return elem.exlAppendFunctionTo (sb, "iseven");
1105: }
1106: },
1107:
1108: ETY_FUNCTION_ISINF {
1109: @Override protected int etyPriority () {
1110: return EPY_PRIORITY_FUNCTION;
1111: }
1112: @Override protected void etyEval (ExpressionElement elem, int mode) {
1113: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.isinf () ? 1 : 0);
1114: }
1115: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1116: return elem.exlAppendFunctionTo (sb, "isinf");
1117: }
1118: },
1119:
1120: ETY_FUNCTION_ISINT {
1121: @Override protected int etyPriority () {
1122: return EPY_PRIORITY_FUNCTION;
1123: }
1124: @Override protected void etyEval (ExpressionElement elem, int mode) {
1125: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.isint () ? 1 : 0);
1126: }
1127: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1128: return elem.exlAppendFunctionTo (sb, "isint");
1129: }
1130: },
1131:
1132: ETY_FUNCTION_ISNAN {
1133: @Override protected int etyPriority () {
1134: return EPY_PRIORITY_FUNCTION;
1135: }
1136: @Override protected void etyEval (ExpressionElement elem, int mode) {
1137: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.isnan () ? 1 : 0);
1138: }
1139: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1140: return elem.exlAppendFunctionTo (sb, "isnan");
1141: }
1142: },
1143:
1144: ETY_FUNCTION_ISODD {
1145: @Override protected int etyPriority () {
1146: return EPY_PRIORITY_FUNCTION;
1147: }
1148: @Override protected void etyEval (ExpressionElement elem, int mode) {
1149: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.isodd () ? 1 : 0);
1150: }
1151: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1152: return elem.exlAppendFunctionTo (sb, "isodd");
1153: }
1154: },
1155:
1156: ETY_FUNCTION_ISONE {
1157: @Override protected int etyPriority () {
1158: return EPY_PRIORITY_FUNCTION;
1159: }
1160: @Override protected void etyEval (ExpressionElement elem, int mode) {
1161: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.isone () ? 1 : 0);
1162: }
1163: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1164: return elem.exlAppendFunctionTo (sb, "isone");
1165: }
1166: },
1167:
1168: ETY_FUNCTION_ISZERO {
1169: @Override protected int etyPriority () {
1170: return EPY_PRIORITY_FUNCTION;
1171: }
1172: @Override protected void etyEval (ExpressionElement elem, int mode) {
1173: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.iszero () ? 1 : 0);
1174: }
1175: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1176: return elem.exlAppendFunctionTo (sb, "iszero");
1177: }
1178: },
1179:
1180: ETY_FUNCTION_LGAMMA {
1181: @Override protected int etyPriority () {
1182: return EPY_PRIORITY_FUNCTION;
1183: }
1184: @Override protected void etyEval (ExpressionElement elem, int mode) {
1185: elem.exlFloatValue.lgamma (elem.exlParamX.exlEval (mode).exlFloatValue);
1186: }
1187: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1188: return elem.exlAppendFunctionTo (sb, "lgamma");
1189: }
1190: },
1191:
1192: ETY_FUNCTION_LOG {
1193: @Override protected int etyPriority () {
1194: return EPY_PRIORITY_FUNCTION;
1195: }
1196: @Override protected void etyEval (ExpressionElement elem, int mode) {
1197: elem.exlFloatValue.log (elem.exlParamX.exlEval (mode).exlFloatValue);
1198: }
1199: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1200: return elem.exlAppendFunctionTo (sb, "log");
1201: }
1202: },
1203:
1204: ETY_FUNCTION_LOG10 {
1205: @Override protected int etyPriority () {
1206: return EPY_PRIORITY_FUNCTION;
1207: }
1208: @Override protected void etyEval (ExpressionElement elem, int mode) {
1209: elem.exlFloatValue.log10 (elem.exlParamX.exlEval (mode).exlFloatValue);
1210: }
1211: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1212: return elem.exlAppendFunctionTo (sb, "log10");
1213: }
1214: },
1215:
1216: ETY_FUNCTION_LOG1P {
1217: @Override protected int etyPriority () {
1218: return EPY_PRIORITY_FUNCTION;
1219: }
1220: @Override protected void etyEval (ExpressionElement elem, int mode) {
1221: elem.exlFloatValue.log1p (elem.exlParamX.exlEval (mode).exlFloatValue);
1222: }
1223: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1224: return elem.exlAppendFunctionTo (sb, "log1p");
1225: }
1226: },
1227:
1228: ETY_FUNCTION_LOG2 {
1229: @Override protected int etyPriority () {
1230: return EPY_PRIORITY_FUNCTION;
1231: }
1232: @Override protected void etyEval (ExpressionElement elem, int mode) {
1233: elem.exlFloatValue.log2 (elem.exlParamX.exlEval (mode).exlFloatValue);
1234: }
1235: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1236: return elem.exlAppendFunctionTo (sb, "log2");
1237: }
1238: },
1239:
1240: ETY_FUNCTION_MAX {
1241: @Override protected int etyPriority () {
1242: return EPY_PRIORITY_FUNCTION;
1243: }
1244: @Override protected void etyEval (ExpressionElement elem, int mode) {
1245: elem.exlFloatValue.max (elem.exlParamX.exlEval (mode).exlFloatValue,
1246: elem.exlParamY.exlEval (mode).exlFloatValue);
1247: }
1248: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1249: return elem.exlAppendFunctionTo (sb, "max");
1250: }
1251: },
1252:
1253: ETY_FUNCTION_MIN {
1254: @Override protected int etyPriority () {
1255: return EPY_PRIORITY_FUNCTION;
1256: }
1257: @Override protected void etyEval (ExpressionElement elem, int mode) {
1258: elem.exlFloatValue.min (elem.exlParamX.exlEval (mode).exlFloatValue,
1259: elem.exlParamY.exlEval (mode).exlFloatValue);
1260: }
1261: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1262: return elem.exlAppendFunctionTo (sb, "min");
1263: }
1264: },
1265:
1266: ETY_FUNCTION_MUL2 {
1267: @Override protected int etyPriority () {
1268: return EPY_PRIORITY_FUNCTION;
1269: }
1270: @Override protected void etyEval (ExpressionElement elem, int mode) {
1271: elem.exlFloatValue.mul2 (elem.exlParamX.exlEval (mode).exlFloatValue);
1272: }
1273: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1274: return elem.exlAppendFunctionTo (sb, "mul2");
1275: }
1276: },
1277:
1278: ETY_FUNCTION_MUL3 {
1279: @Override protected int etyPriority () {
1280: return EPY_PRIORITY_FUNCTION;
1281: }
1282: @Override protected void etyEval (ExpressionElement elem, int mode) {
1283: elem.exlFloatValue.mul3 (elem.exlParamX.exlEval (mode).exlFloatValue);
1284: }
1285: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1286: return elem.exlAppendFunctionTo (sb, "mul3");
1287: }
1288: },
1289:
1290: ETY_FUNCTION_MULPI {
1291: @Override protected int etyPriority () {
1292: return EPY_PRIORITY_FUNCTION;
1293: }
1294: @Override protected void etyEval (ExpressionElement elem, int mode) {
1295: elem.exlFloatValue.mulpi (elem.exlParamX.exlEval (mode).exlFloatValue);
1296: }
1297: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1298: return elem.exlAppendFunctionTo (sb, "mulpi");
1299: }
1300: },
1301:
1302: ETY_FUNCTION_OCT_DOLLAR {
1303: @Override protected int etyPriority () {
1304: return EPY_PRIORITY_FUNCTION;
1305: }
1306: @Override protected void etyEval (ExpressionElement elem, int mode) {
1307: long x = elem.exlParamX.exlEval (mode).exlFloatValue.getl ();
1308: int m = Math.max (0, (63 - Long.numberOfLeadingZeros (x)) / 3);
1309: char[] w = new char[22];
1310: for (int k = m; 0 <= k; k--) {
1311: int t = (int) (x >>> k * 3) & 7;
1312: w[m - k] = (char) (48 + t);
1313: }
1314: elem.exlStringValue = String.valueOf (w, 0, m + 1);
1315: }
1316: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1317: return elem.exlAppendFunctionTo (sb, "oct$");
1318: }
1319: },
1320:
1321: ETY_FUNCTION_POW {
1322: @Override protected int etyPriority () {
1323: return EPY_PRIORITY_FUNCTION;
1324: }
1325: @Override protected void etyEval (ExpressionElement elem, int mode) {
1326: elem.exlFloatValue.pow (elem.exlParamX.exlEval (mode).exlFloatValue,
1327: elem.exlParamY.exlEval (mode).exlFloatValue);
1328: }
1329: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1330: return elem.exlAppendFunctionTo (sb, "pow");
1331: }
1332: },
1333:
1334: ETY_FUNCTION_QUO {
1335: @Override protected int etyPriority () {
1336: return EPY_PRIORITY_FUNCTION;
1337: }
1338: @Override protected void etyEval (ExpressionElement elem, int mode) {
1339: elem.exlFloatValue.quo (elem.exlParamX.exlEval (mode).exlFloatValue,
1340: elem.exlParamY.exlEval (mode).exlFloatValue);
1341: }
1342: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1343: return elem.exlAppendFunctionTo (sb, "quo");
1344: }
1345: },
1346:
1347: ETY_FUNCTION_RAD {
1348: @Override protected int etyPriority () {
1349: return EPY_PRIORITY_FUNCTION;
1350: }
1351: @Override protected void etyEval (ExpressionElement elem, int mode) {
1352: elem.exlFloatValue.rad (elem.exlParamX.exlEval (mode).exlFloatValue);
1353: }
1354: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1355: return elem.exlAppendFunctionTo (sb, "rad");
1356: }
1357: },
1358:
1359: ETY_FUNCTION_RANDOM {
1360: @Override protected int etyPriority () {
1361: return EPY_PRIORITY_FUNCTION;
1362: }
1363: @Override protected void etyEval (ExpressionElement elem, int mode) {
1364: elem.exlFloatValue.random ();
1365: }
1366: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1367: return elem.exlAppendFunctionTo (sb, "random");
1368: }
1369: },
1370:
1371: ETY_FUNCTION_RCP {
1372: @Override protected int etyPriority () {
1373: return EPY_PRIORITY_FUNCTION;
1374: }
1375: @Override protected void etyEval (ExpressionElement elem, int mode) {
1376: elem.exlFloatValue.rcp (elem.exlParamX.exlEval (mode).exlFloatValue);
1377: }
1378: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1379: return elem.exlAppendFunctionTo (sb, "rcp");
1380: }
1381: },
1382:
1383: ETY_FUNCTION_RINT {
1384: @Override protected int etyPriority () {
1385: return EPY_PRIORITY_FUNCTION;
1386: }
1387: @Override protected void etyEval (ExpressionElement elem, int mode) {
1388: elem.exlFloatValue.rint (elem.exlParamX.exlEval (mode).exlFloatValue);
1389: }
1390: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1391: return elem.exlAppendFunctionTo (sb, "rint");
1392: }
1393: },
1394:
1395: ETY_FUNCTION_RMODE {
1396: @Override protected int etyPriority () {
1397: return EPY_PRIORITY_FUNCTION;
1398: }
1399: @Override protected void etyEval (ExpressionElement elem, int mode) {
1400: elem.exlSetRoundingMode (elem.exlParamX.exlEval (mode).exlFloatValue.geti ());
1401: elem.exlFloatValue.setnan ();
1402: }
1403: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1404: return elem.exlAppendFunctionTo (sb, "rmode");
1405: }
1406: },
1407:
1408: ETY_FUNCTION_ROUND {
1409: @Override protected int etyPriority () {
1410: return EPY_PRIORITY_FUNCTION;
1411: }
1412: @Override protected void etyEval (ExpressionElement elem, int mode) {
1413: elem.exlFloatValue.round (elem.exlParamX.exlEval (mode).exlFloatValue);
1414: }
1415: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1416: return elem.exlAppendFunctionTo (sb, "round");
1417: }
1418: },
1419:
1420: ETY_FUNCTION_RPREC {
1421: @Override protected int etyPriority () {
1422: return EPY_PRIORITY_FUNCTION;
1423: }
1424: @Override protected void etyEval (ExpressionElement elem, int mode) {
1425: elem.exlSetRoundingPrec (elem.exlParamX.exlEval (mode).exlFloatValue.geti ());
1426: elem.exlFloatValue.setnan ();
1427: }
1428: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1429: return elem.exlAppendFunctionTo (sb, "rprec");
1430: }
1431: },
1432:
1433: ETY_FUNCTION_SEC {
1434: @Override protected int etyPriority () {
1435: return EPY_PRIORITY_FUNCTION;
1436: }
1437: @Override protected void etyEval (ExpressionElement elem, int mode) {
1438: elem.exlFloatValue.sec (elem.exlParamX.exlEval (mode).exlFloatValue);
1439: }
1440: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1441: return elem.exlAppendFunctionTo (sb, "sec");
1442: }
1443: },
1444:
1445: ETY_FUNCTION_SECH {
1446: @Override protected int etyPriority () {
1447: return EPY_PRIORITY_FUNCTION;
1448: }
1449: @Override protected void etyEval (ExpressionElement elem, int mode) {
1450: elem.exlFloatValue.sech (elem.exlParamX.exlEval (mode).exlFloatValue);
1451: }
1452: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1453: return elem.exlAppendFunctionTo (sb, "sech");
1454: }
1455: },
1456:
1457: ETY_FUNCTION_SGN {
1458: @Override protected int etyPriority () {
1459: return EPY_PRIORITY_FUNCTION;
1460: }
1461: @Override protected void etyEval (ExpressionElement elem, int mode) {
1462: elem.exlFloatValue.sgn (elem.exlParamX.exlEval (mode).exlFloatValue);
1463: }
1464: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1465: return elem.exlAppendFunctionTo (sb, "sgn");
1466: }
1467: },
1468:
1469: ETY_FUNCTION_SIN {
1470: @Override protected int etyPriority () {
1471: return EPY_PRIORITY_FUNCTION;
1472: }
1473: @Override protected void etyEval (ExpressionElement elem, int mode) {
1474: elem.exlFloatValue.sin (elem.exlParamX.exlEval (mode).exlFloatValue);
1475: }
1476: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1477: return elem.exlAppendFunctionTo (sb, "sin");
1478: }
1479: },
1480:
1481: ETY_FUNCTION_SINH {
1482: @Override protected int etyPriority () {
1483: return EPY_PRIORITY_FUNCTION;
1484: }
1485: @Override protected void etyEval (ExpressionElement elem, int mode) {
1486: elem.exlFloatValue.sinh (elem.exlParamX.exlEval (mode).exlFloatValue);
1487: }
1488: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1489: return elem.exlAppendFunctionTo (sb, "sinh");
1490: }
1491: },
1492:
1493: ETY_FUNCTION_SQRT {
1494: @Override protected int etyPriority () {
1495: return EPY_PRIORITY_FUNCTION;
1496: }
1497: @Override protected void etyEval (ExpressionElement elem, int mode) {
1498: elem.exlFloatValue.sqrt (elem.exlParamX.exlEval (mode).exlFloatValue);
1499: }
1500: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1501: return elem.exlAppendFunctionTo (sb, "sqrt");
1502: }
1503: },
1504:
1505: ETY_FUNCTION_SQU {
1506: @Override protected int etyPriority () {
1507: return EPY_PRIORITY_FUNCTION;
1508: }
1509: @Override protected void etyEval (ExpressionElement elem, int mode) {
1510: elem.exlFloatValue.squ (elem.exlParamX.exlEval (mode).exlFloatValue);
1511: }
1512: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1513: return elem.exlAppendFunctionTo (sb, "squ");
1514: }
1515: },
1516:
1517: ETY_FUNCTION_STR_DOLLAR {
1518: @Override protected int etyPriority () {
1519: return EPY_PRIORITY_FUNCTION;
1520: }
1521: @Override protected void etyEval (ExpressionElement elem, int mode) {
1522: elem.exlStringValue = elem.exlParamX.exlEval (mode).exlFloatValue.toString ();
1523: }
1524: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1525: return elem.exlAppendFunctionTo (sb, "str$");
1526: }
1527: },
1528:
1529: ETY_FUNCTION_TAN {
1530: @Override protected int etyPriority () {
1531: return EPY_PRIORITY_FUNCTION;
1532: }
1533: @Override protected void etyEval (ExpressionElement elem, int mode) {
1534: elem.exlFloatValue.tan (elem.exlParamX.exlEval (mode).exlFloatValue);
1535: }
1536: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1537: return elem.exlAppendFunctionTo (sb, "tan");
1538: }
1539: },
1540:
1541: ETY_FUNCTION_TANH {
1542: @Override protected int etyPriority () {
1543: return EPY_PRIORITY_FUNCTION;
1544: }
1545: @Override protected void etyEval (ExpressionElement elem, int mode) {
1546: elem.exlFloatValue.tanh (elem.exlParamX.exlEval (mode).exlFloatValue);
1547: }
1548: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1549: return elem.exlAppendFunctionTo (sb, "tanh");
1550: }
1551: },
1552:
1553: ETY_FUNCTION_TGAMMA {
1554: @Override protected int etyPriority () {
1555: return EPY_PRIORITY_FUNCTION;
1556: }
1557: @Override protected void etyEval (ExpressionElement elem, int mode) {
1558: elem.exlFloatValue.tgamma (elem.exlParamX.exlEval (mode).exlFloatValue);
1559: }
1560: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1561: return elem.exlAppendFunctionTo (sb, "tgamma");
1562: }
1563: },
1564:
1565: ETY_FUNCTION_TRUNC {
1566: @Override protected int etyPriority () {
1567: return EPY_PRIORITY_FUNCTION;
1568: }
1569: @Override protected void etyEval (ExpressionElement elem, int mode) {
1570: elem.exlFloatValue.trunc (elem.exlParamX.exlEval (mode).exlFloatValue);
1571: }
1572: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1573: return elem.exlAppendFunctionTo (sb, "trunc");
1574: }
1575: },
1576:
1577: ETY_FUNCTION_ULP {
1578: @Override protected int etyPriority () {
1579: return EPY_PRIORITY_FUNCTION;
1580: }
1581: @Override protected void etyEval (ExpressionElement elem, int mode) {
1582: elem.exlFloatValue.ulp (elem.exlParamX.exlEval (mode).exlFloatValue);
1583: }
1584: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1585: return elem.exlAppendFunctionTo (sb, "ulp");
1586: }
1587: },
1588:
1589: ETY_FUNCTION_VAL {
1590: @Override protected int etyPriority () {
1591: return EPY_PRIORITY_FUNCTION;
1592: }
1593: @Override protected void etyEval (ExpressionElement elem, int mode) {
1594: elem.exlFloatValue.parse (elem.exlParamX.exlEval (mode).exlStringValue);
1595: }
1596: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1597: return elem.exlAppendFunctionTo (sb, "val");
1598: }
1599: },
1600:
1601:
1602:
1603: ETY_SQUARE_BRACKET {
1604: @Override protected int etyPriority () {
1605: return EPY_PRIORITY_FUNCTION;
1606: }
1607: @Override protected void etyEval (ExpressionElement elem, int mode) {
1608: int a, f;
1609: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1610: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1611: f = elem.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1612: } else {
1613: a = elem.exlParamX.exlEval (mode).exlFloatValue.geti ();
1614: f = -1;
1615: }
1616: elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f));
1617: }
1618: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1619: return elem.exlParamX.exlAppendTo (sb.append ('[')).append (']');
1620: }
1621: },
1622:
1623:
1624: ETY_OPERATOR_AT {
1625: @Override protected int etyPriority () {
1626: return EPY_PRIORITY_AT;
1627: }
1628: @Override protected void etyEval (ExpressionElement elem, int mode) {
1629:
1630: elem.exlFloatValue.sete (elem.exlParamX.exlEval (mode).exlFloatValue);
1631: elem.exlParamY.exlEval (mode);
1632: }
1633: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1634: return elem.exlAppendBinaryOperatorTo (sb, "@");
1635: }
1636: },
1637:
1638:
1639: ETY_OPERATOR_POSTINCREMENT {
1640: @Override protected int etyPriority () {
1641: return EPY_PRIORITY_POSTFIX;
1642: }
1643: @Override protected void etyEval (ExpressionElement elem, int mode) {
1644: switch (elem.exlParamX.exlType) {
1645: case ETY_VARIABLE_FLOAT:
1646: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue);
1647: elem.exlParamX.exlParamX.exlFloatValue.inc ();
1648: break;
1649: case ETY_INTEGER_REGISTER:
1650: {
1651: int n = elem.exlParamX.exlSubscript;
1652: int x = elem.exlReadRegLong (n);
1653: elem.exlFloatValue.seti (x);
1654: elem.exlWriteRegLong (n, x + 1);
1655: }
1656: break;
1657: case ETY_FLOATING_POINT_REGISTER:
1658: {
1659: int n = elem.exlParamX.exlSubscript;
1660: EFP x = elem.exlGetFPn (n);
1661: elem.exlFloatValue.sete (x);
1662: x.inc ();
1663: }
1664: break;
1665: case ETY_PC:
1666: {
1667: int x = elem.exlReadPC ();
1668: elem.exlFloatValue.seti (x);
1669: elem.exlWritePC (x + 1);
1670: }
1671: break;
1672: case ETY_CCR:
1673: {
1674: int x = elem.exlReadCCR ();
1675: elem.exlFloatValue.seti (x);
1676: elem.exlWriteCCR (x + 1);
1677: }
1678: break;
1679: case ETY_SR:
1680: {
1681: int x = elem.exlReadSR ();
1682: elem.exlFloatValue.seti (x);
1683: elem.exlWriteSR (x + 1);
1684: }
1685: break;
1686: case ETY_FLOAT_CONTROL_REGISTER:
1687: {
1688: int n = elem.exlParamX.exlSubscript;
1689: int x = elem.exlReadFloatControlRegister (n);
1690: elem.exlFloatValue.seti (x);
1691: elem.exlWriteFloatControlRegister (n, x + 1);
1692: }
1693: break;
1694: case ETY_CONTROL_REGISTER:
1695: {
1696: int n = elem.exlParamX.exlSubscript;
1697: int x = elem.exlReadControlRegister (n);
1698: elem.exlFloatValue.seti (x);
1699: elem.exlWriteControlRegister (n, x + 1);
1700: }
1701: break;
1702: case ETY_SQUARE_BRACKET:
1703: {
1704: int a, f;
1705: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1706: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1707: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1708: } else {
1709: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1710: f = -1;
1711: }
1712: int x = MC68060.mmuPeekByteSign (a, f);
1713: elem.exlFloatValue.seti (x);
1714: MC68060.mmuPokeByte (a, x + 1, f);
1715: }
1716: break;
1717: case ETY_OPERATOR_SIZE_BYTE:
1718: switch (elem.exlParamX.exlParamX.exlType) {
1719: case ETY_INTEGER_REGISTER:
1720: {
1721: int n = elem.exlParamX.exlParamX.exlSubscript;
1722: int x = elem.exlReadRegByte (n);
1723: elem.exlFloatValue.seti (x);
1724: elem.exlWriteRegByte (n, x + 1);
1725: }
1726: break;
1727: case ETY_SQUARE_BRACKET:
1728: {
1729: int a, f;
1730: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1731: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1732: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1733: } else {
1734: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1735: f = -1;
1736: }
1737: int x = MC68060.mmuPeekByteSign (a, f);
1738: elem.exlFloatValue.seti (x);
1739: MC68060.mmuPokeByte (a, x + 1, f);
1740: }
1741: break;
1742: default:
1743: elem.exlFloatValue.setnan ();
1744: }
1745: break;
1746: case ETY_OPERATOR_SIZE_WORD:
1747: switch (elem.exlParamX.exlParamX.exlType) {
1748: case ETY_INTEGER_REGISTER:
1749: {
1750: int n = elem.exlParamX.exlParamX.exlSubscript;
1751: int x = elem.exlReadRegWord (n);
1752: elem.exlFloatValue.seti (x);
1753: elem.exlWriteRegWord (n, x + 1);
1754: }
1755: break;
1756: case ETY_SQUARE_BRACKET:
1757: {
1758: int a, f;
1759: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1760: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1761: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1762: } else {
1763: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1764: f = -1;
1765: }
1766: int x = MC68060.mmuPeekWordSign (a, f);
1767: elem.exlFloatValue.seti (x);
1768: MC68060.mmuPokeWord (a, x + 1, f);
1769: }
1770: break;
1771: default:
1772: elem.exlFloatValue.setnan ();
1773: }
1774: break;
1775: case ETY_OPERATOR_SIZE_LONG:
1776: switch (elem.exlParamX.exlParamX.exlType) {
1777: case ETY_INTEGER_REGISTER:
1778: {
1779: int n = elem.exlParamX.exlParamX.exlSubscript;
1780: int x = elem.exlReadRegLong (n);
1781: elem.exlFloatValue.seti (x);
1782: elem.exlWriteRegLong (n, x + 1);
1783: }
1784: break;
1785: case ETY_SQUARE_BRACKET:
1786: {
1787: int a, f;
1788: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1789: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1790: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1791: } else {
1792: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1793: f = -1;
1794: }
1795: int x = MC68060.mmuPeekLong (a, f);
1796: elem.exlFloatValue.seti (x);
1797: MC68060.mmuPokeLong (a, x + 1, f);
1798: }
1799: break;
1800: default:
1801: elem.exlFloatValue.setnan ();
1802: }
1803: break;
1804: case ETY_OPERATOR_SIZE_QUAD:
1805: switch (elem.exlParamX.exlParamX.exlType) {
1806: case ETY_SQUARE_BRACKET:
1807: {
1808: int a, f;
1809: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1810: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1811: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1812: } else {
1813: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1814: f = -1;
1815: }
1816: long x = MC68060.mmuPeekQuad (a, f);
1817: elem.exlFloatValue.setl (x);
1818: MC68060.mmuPokeQuad (a, x + 1L, f);
1819: }
1820: break;
1821: default:
1822: elem.exlFloatValue.setnan ();
1823: }
1824: break;
1825: case ETY_OPERATOR_SIZE_SINGLE:
1826: switch (elem.exlParamX.exlParamX.exlType) {
1827: case ETY_INTEGER_REGISTER:
1828: {
1829: int n = elem.exlParamX.exlParamX.exlSubscript;
1830: float x = Float.intBitsToFloat (elem.exlReadRegLong (n));
1831: elem.exlFloatValue.setf (x);
1832: elem.exlWriteRegLong (n, Float.floatToIntBits (x + 1.0F));
1833: }
1834: break;
1835: case ETY_SQUARE_BRACKET:
1836: {
1837: int a, f;
1838: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1839: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1840: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1841: } else {
1842: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1843: f = -1;
1844: }
1845: float x = Float.intBitsToFloat (MC68060.mmuPeekLong (a, f));
1846: elem.exlFloatValue.setf (x);
1847: MC68060.mmuPokeLong (a, Float.floatToIntBits (x + 1.0F), f);
1848: }
1849: break;
1850: default:
1851: elem.exlFloatValue.setnan ();
1852: }
1853: break;
1854: case ETY_OPERATOR_SIZE_DOUBLE:
1855: switch (elem.exlParamX.exlParamX.exlType) {
1856: case ETY_SQUARE_BRACKET:
1857: {
1858: int a, f;
1859: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1860: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1861: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1862: } else {
1863: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1864: f = -1;
1865: }
1866: double x = Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f));
1867: elem.exlFloatValue.setd (x);
1868: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x + 1.0), f);
1869: }
1870: break;
1871: default:
1872: elem.exlFloatValue.setnan ();
1873: }
1874: break;
1875: case ETY_OPERATOR_SIZE_EXTENDED:
1876: switch (elem.exlParamX.exlParamX.exlType) {
1877: case ETY_SQUARE_BRACKET:
1878: {
1879: int a, f;
1880: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1881: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1882: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1883: } else {
1884: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1885: f = -1;
1886: }
1887: byte[] b = new byte[12];
1888: MC68060.mmuPeekExtended (a, b, f);
1889: EFP x = XEiJ.fpuBox.new EFP ();
1890: elem.exlFloatValue.sete (x.setx012 (b, 0));
1891: x.inc ().getx012 (b, 0);
1892: MC68060.mmuPokeExtended (a, b, f);
1893: }
1894: break;
1895: default:
1896: elem.exlFloatValue.setnan ();
1897: }
1898: break;
1899: case ETY_OPERATOR_SIZE_TRIPLE:
1900: switch (elem.exlParamX.exlParamX.exlType) {
1901: case ETY_SQUARE_BRACKET:
1902: {
1903: int a, f;
1904: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1905: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1906: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1907: } else {
1908: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1909: f = -1;
1910: }
1911: byte[] b = new byte[12];
1912: MC68060.mmuPeekExtended (a, b, f);
1913: EFP x = XEiJ.fpuBox.new EFP ();
1914: elem.exlFloatValue.sete (x.sety012 (b, 0));
1915: x.inc ().gety012 (b, 0);
1916: MC68060.mmuPokeExtended (a, b, f);
1917: }
1918: break;
1919: default:
1920: elem.exlFloatValue.setnan ();
1921: }
1922: break;
1923: case ETY_OPERATOR_SIZE_PACKED:
1924: switch (elem.exlParamX.exlParamX.exlType) {
1925: case ETY_SQUARE_BRACKET:
1926: {
1927: int a, f;
1928: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
1929: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1930: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
1931: } else {
1932: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
1933: f = -1;
1934: }
1935: byte[] b = new byte[12];
1936: MC68060.mmuPeekExtended (a, b, f);
1937: EFP x = XEiJ.fpuBox.new EFP ();
1938: elem.exlFloatValue.sete (x.setp012 (b, 0));
1939: x.inc ().getp012 (b, 0);
1940: MC68060.mmuPokeExtended (a, b, f);
1941: }
1942: break;
1943: default:
1944: elem.exlFloatValue.setnan ();
1945: }
1946: break;
1947: default:
1948: elem.exlFloatValue.setnan ();
1949: }
1950: }
1951: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
1952: return elem.exlAppendPostfixOperatorTo (sb, "++");
1953: }
1954: },
1955:
1956: ETY_OPERATOR_POSTDECREMENT {
1957: @Override protected int etyPriority () {
1958: return EPY_PRIORITY_POSTFIX;
1959: }
1960: @Override protected void etyEval (ExpressionElement elem, int mode) {
1961: switch (elem.exlParamX.exlType) {
1962: case ETY_VARIABLE_FLOAT:
1963: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue);
1964: elem.exlParamX.exlParamX.exlFloatValue.dec ();
1965: break;
1966: case ETY_INTEGER_REGISTER:
1967: {
1968: int n = elem.exlParamX.exlSubscript;
1969: int x = elem.exlReadRegLong (n);
1970: elem.exlFloatValue.seti (x);
1971: elem.exlWriteRegLong (n, x - 1);
1972: }
1973: break;
1974: case ETY_FLOATING_POINT_REGISTER:
1975: {
1976: int n = elem.exlParamX.exlSubscript;
1977: EFP x = elem.exlGetFPn (n);
1978: elem.exlFloatValue.sete (x);
1979: x.dec ();
1980: }
1981: break;
1982: case ETY_PC:
1983: {
1984: int x = elem.exlReadPC ();
1985: elem.exlFloatValue.seti (x);
1986: elem.exlWritePC (x - 1);
1987: }
1988: break;
1989: case ETY_CCR:
1990: {
1991: int x = elem.exlReadCCR ();
1992: elem.exlFloatValue.seti (x);
1993: elem.exlWriteCCR (x - 1);
1994: }
1995: break;
1996: case ETY_SR:
1997: {
1998: int x = elem.exlReadSR ();
1999: elem.exlFloatValue.seti (x);
2000: elem.exlWriteSR (x - 1);
2001: }
2002: break;
2003: case ETY_FLOAT_CONTROL_REGISTER:
2004: {
2005: int n = elem.exlParamX.exlSubscript;
2006: int x = elem.exlReadFloatControlRegister (n);
2007: elem.exlFloatValue.seti (x);
2008: elem.exlWriteFloatControlRegister (n, x - 1);
2009: }
2010: break;
2011: case ETY_CONTROL_REGISTER:
2012: {
2013: int n = elem.exlParamX.exlSubscript;
2014: int x = elem.exlReadControlRegister (n);
2015: elem.exlFloatValue.seti (x);
2016: elem.exlWriteControlRegister (n, x - 1);
2017: }
2018: break;
2019: case ETY_SQUARE_BRACKET:
2020: {
2021: int a, f;
2022: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2023: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2024: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2025: } else {
2026: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2027: f = -1;
2028: }
2029: int x = MC68060.mmuPeekByteSign (a, f);
2030: elem.exlFloatValue.seti (x);
2031: MC68060.mmuPokeByte (a, x - 1, f);
2032: }
2033: break;
2034: case ETY_OPERATOR_SIZE_BYTE:
2035: switch (elem.exlParamX.exlParamX.exlType) {
2036: case ETY_INTEGER_REGISTER:
2037: {
2038: int n = elem.exlParamX.exlParamX.exlSubscript;
2039: int x = elem.exlReadRegByte (n);
2040: elem.exlFloatValue.seti (x);
2041: elem.exlWriteRegByte (n, x - 1);
2042: }
2043: break;
2044: case ETY_SQUARE_BRACKET:
2045: {
2046: int a, f;
2047: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2048: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2049: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2050: } else {
2051: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2052: f = -1;
2053: }
2054: int x = MC68060.mmuPeekByteSign (a, f);
2055: elem.exlFloatValue.seti (x);
2056: MC68060.mmuPokeByte (a, x - 1, f);
2057: }
2058: break;
2059: default:
2060: elem.exlFloatValue.setnan ();
2061: }
2062: break;
2063: case ETY_OPERATOR_SIZE_WORD:
2064: switch (elem.exlParamX.exlParamX.exlType) {
2065: case ETY_INTEGER_REGISTER:
2066: {
2067: int n = elem.exlParamX.exlParamX.exlSubscript;
2068: int x = elem.exlReadRegWord (n);
2069: elem.exlFloatValue.seti (x);
2070: elem.exlWriteRegWord (n, x - 1);
2071: }
2072: break;
2073: case ETY_SQUARE_BRACKET:
2074: {
2075: int a, f;
2076: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2077: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2078: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2079: } else {
2080: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2081: f = -1;
2082: }
2083: int x = MC68060.mmuPeekWordSign (a, f);
2084: elem.exlFloatValue.seti (x);
2085: MC68060.mmuPokeWord (a, x - 1, f);
2086: }
2087: break;
2088: default:
2089: elem.exlFloatValue.setnan ();
2090: }
2091: break;
2092: case ETY_OPERATOR_SIZE_LONG:
2093: switch (elem.exlParamX.exlParamX.exlType) {
2094: case ETY_INTEGER_REGISTER:
2095: {
2096: int n = elem.exlParamX.exlParamX.exlSubscript;
2097: int x = elem.exlReadRegLong (n);
2098: elem.exlFloatValue.seti (x);
2099: elem.exlWriteRegLong (n, x - 1);
2100: }
2101: break;
2102: case ETY_SQUARE_BRACKET:
2103: {
2104: int a, f;
2105: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2106: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2107: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2108: } else {
2109: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2110: f = -1;
2111: }
2112: int x = MC68060.mmuPeekLong (a, f);
2113: elem.exlFloatValue.seti (x);
2114: MC68060.mmuPokeLong (a, x - 1, f);
2115: }
2116: break;
2117: default:
2118: elem.exlFloatValue.setnan ();
2119: }
2120: break;
2121: case ETY_OPERATOR_SIZE_QUAD:
2122: switch (elem.exlParamX.exlParamX.exlType) {
2123: case ETY_SQUARE_BRACKET:
2124: {
2125: int a, f;
2126: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2127: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2128: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2129: } else {
2130: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2131: f = -1;
2132: }
2133: long x = MC68060.mmuPeekQuad (a, f);
2134: elem.exlFloatValue.setl (x);
2135: MC68060.mmuPokeQuad (a, x - 1L, f);
2136: }
2137: break;
2138: default:
2139: elem.exlFloatValue.setnan ();
2140: }
2141: break;
2142: case ETY_OPERATOR_SIZE_SINGLE:
2143: switch (elem.exlParamX.exlParamX.exlType) {
2144: case ETY_INTEGER_REGISTER:
2145: {
2146: int n = elem.exlParamX.exlParamX.exlSubscript;
2147: float x = Float.intBitsToFloat (elem.exlReadRegLong (n));
2148: elem.exlFloatValue.setf (x);
2149: elem.exlWriteRegLong (n, Float.floatToIntBits (x - 1.0F));
2150: }
2151: break;
2152: case ETY_SQUARE_BRACKET:
2153: {
2154: int a, f;
2155: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2156: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2157: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2158: } else {
2159: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2160: f = -1;
2161: }
2162: float x = Float.intBitsToFloat (MC68060.mmuPeekLong (a, f));
2163: elem.exlFloatValue.setf (x);
2164: MC68060.mmuPokeLong (a, Float.floatToIntBits (x - 1.0F), f);
2165: }
2166: break;
2167: default:
2168: elem.exlFloatValue.setnan ();
2169: }
2170: break;
2171: case ETY_OPERATOR_SIZE_DOUBLE:
2172: switch (elem.exlParamX.exlParamX.exlType) {
2173: case ETY_SQUARE_BRACKET:
2174: {
2175: int a, f;
2176: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2177: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2178: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2179: } else {
2180: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2181: f = -1;
2182: }
2183: double x = Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f));
2184: elem.exlFloatValue.setd (x);
2185: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x - 1.0), f);
2186: }
2187: break;
2188: default:
2189: elem.exlFloatValue.setnan ();
2190: }
2191: break;
2192: case ETY_OPERATOR_SIZE_EXTENDED:
2193: switch (elem.exlParamX.exlParamX.exlType) {
2194: case ETY_SQUARE_BRACKET:
2195: {
2196: int a, f;
2197: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2198: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2199: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2200: } else {
2201: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2202: f = -1;
2203: }
2204: byte[] b = new byte[12];
2205: MC68060.mmuPeekExtended (a, b, f);
2206: EFP x = XEiJ.fpuBox.new EFP ();
2207: elem.exlFloatValue.sete (x.setx012 (b, 0));
2208: x.dec ().getx012 (b, 0);
2209: MC68060.mmuPokeExtended (a, b, f);
2210: }
2211: break;
2212: default:
2213: elem.exlFloatValue.setnan ();
2214: }
2215: break;
2216: case ETY_OPERATOR_SIZE_TRIPLE:
2217: switch (elem.exlParamX.exlParamX.exlType) {
2218: case ETY_SQUARE_BRACKET:
2219: {
2220: int a, f;
2221: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2222: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2223: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2224: } else {
2225: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2226: f = -1;
2227: }
2228: byte[] b = new byte[12];
2229: MC68060.mmuPeekExtended (a, b, f);
2230: EFP x = XEiJ.fpuBox.new EFP ();
2231: elem.exlFloatValue.sete (x.sety012 (b, 0));
2232: x.dec ().gety012 (b, 0);
2233: MC68060.mmuPokeExtended (a, b, f);
2234: }
2235: break;
2236: default:
2237: elem.exlFloatValue.setnan ();
2238: }
2239: break;
2240: case ETY_OPERATOR_SIZE_PACKED:
2241: switch (elem.exlParamX.exlParamX.exlType) {
2242: case ETY_SQUARE_BRACKET:
2243: {
2244: int a, f;
2245: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2246: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2247: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2248: } else {
2249: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2250: f = -1;
2251: }
2252: byte[] b = new byte[12];
2253: MC68060.mmuPeekExtended (a, b, f);
2254: EFP x = XEiJ.fpuBox.new EFP ();
2255: elem.exlFloatValue.sete (x.setp012 (b, 0));
2256: x.dec ().getp012 (b, 0);
2257: MC68060.mmuPokeExtended (a, b, f);
2258: }
2259: break;
2260: default:
2261: elem.exlFloatValue.setnan ();
2262: }
2263: break;
2264: default:
2265: elem.exlFloatValue.setnan ();
2266: }
2267: }
2268: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2269: return elem.exlAppendPostfixOperatorTo (sb, "--");
2270: }
2271: },
2272:
2273: ETY_OPERATOR_SIZE_BYTE {
2274: @Override protected int etyPriority () {
2275: return EPY_PRIORITY_POSTFIX;
2276: }
2277: @Override protected void etyEval (ExpressionElement elem, int mode) {
2278: switch (elem.exlParamX.exlType) {
2279: case ETY_SQUARE_BRACKET:
2280: {
2281: int a, f;
2282: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2283: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2284: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2285: } else {
2286: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2287: f = -1;
2288: }
2289: elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f));
2290: }
2291: break;
2292: default:
2293: elem.exlFloatValue.seti ((byte) elem.exlParamX.exlEval (mode).exlFloatValue.geti ());
2294: }
2295: }
2296: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2297: return elem.exlAppendPostfixOperatorTo (sb, ".b");
2298: }
2299: },
2300:
2301: ETY_OPERATOR_SIZE_WORD {
2302: @Override protected int etyPriority () {
2303: return EPY_PRIORITY_POSTFIX;
2304: }
2305: @Override protected void etyEval (ExpressionElement elem, int mode) {
2306: switch (elem.exlParamX.exlType) {
2307: case ETY_SQUARE_BRACKET:
2308: {
2309: int a, f;
2310: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2311: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2312: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2313: } else {
2314: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2315: f = -1;
2316: }
2317: elem.exlFloatValue.seti (MC68060.mmuPeekWordSign (a, f));
2318: }
2319: break;
2320: default:
2321: elem.exlFloatValue.seti ((short) elem.exlParamX.exlEval (mode).exlFloatValue.geti ());
2322: }
2323: }
2324: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2325: return elem.exlAppendPostfixOperatorTo (sb, ".w");
2326: }
2327: },
2328:
2329: ETY_OPERATOR_SIZE_LONG {
2330: @Override protected int etyPriority () {
2331: return EPY_PRIORITY_POSTFIX;
2332: }
2333: @Override protected void etyEval (ExpressionElement elem, int mode) {
2334: switch (elem.exlParamX.exlType) {
2335: case ETY_SQUARE_BRACKET:
2336: {
2337: int a, f;
2338: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2339: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2340: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2341: } else {
2342: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2343: f = -1;
2344: }
2345: elem.exlFloatValue.seti (MC68060.mmuPeekLong (a, f));
2346: }
2347: break;
2348: default:
2349: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.geti ());
2350: }
2351: }
2352: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2353: return elem.exlAppendPostfixOperatorTo (sb, ".l");
2354: }
2355: },
2356:
2357: ETY_OPERATOR_SIZE_QUAD {
2358: @Override protected int etyPriority () {
2359: return EPY_PRIORITY_POSTFIX;
2360: }
2361: @Override protected void etyEval (ExpressionElement elem, int mode) {
2362: switch (elem.exlParamX.exlType) {
2363: case ETY_SQUARE_BRACKET:
2364: {
2365: int a, f;
2366: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2367: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2368: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2369: } else {
2370: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2371: f = -1;
2372: }
2373: elem.exlFloatValue.setl (MC68060.mmuPeekQuad (a, f));
2374: }
2375: break;
2376: default:
2377: elem.exlFloatValue.setl (elem.exlParamX.exlEval (mode).exlFloatValue.getl ());
2378: }
2379: }
2380: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2381: return elem.exlAppendPostfixOperatorTo (sb, ".q");
2382: }
2383: },
2384:
2385: ETY_OPERATOR_SIZE_SINGLE {
2386: @Override protected int etyPriority () {
2387: return EPY_PRIORITY_POSTFIX;
2388: }
2389: @Override protected void etyEval (ExpressionElement elem, int mode) {
2390: switch (elem.exlParamX.exlType) {
2391: case ETY_SQUARE_BRACKET:
2392: {
2393: int a, f;
2394: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2395: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2396: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2397: } else {
2398: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2399: f = -1;
2400: }
2401: elem.exlFloatValue.setf0 (MC68060.mmuPeekLong (a, f));
2402: }
2403: break;
2404: default:
2405: elem.exlFloatValue.sete (elem.exlParamX.exlEval (mode).exlFloatValue).roundf ();
2406: }
2407: }
2408: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2409: return elem.exlAppendPostfixOperatorTo (sb, ".s");
2410: }
2411: },
2412:
2413: ETY_OPERATOR_SIZE_DOUBLE {
2414: @Override protected int etyPriority () {
2415: return EPY_PRIORITY_POSTFIX;
2416: }
2417: @Override protected void etyEval (ExpressionElement elem, int mode) {
2418: switch (elem.exlParamX.exlType) {
2419: case ETY_SQUARE_BRACKET:
2420: {
2421: int a, f;
2422: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2423: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2424: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2425: } else {
2426: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2427: f = -1;
2428: }
2429: elem.exlFloatValue.setd01 (MC68060.mmuPeekQuad (a, f));
2430: }
2431: break;
2432: default:
2433: elem.exlFloatValue.sete (elem.exlParamX.exlEval (mode).exlFloatValue).roundd ();
2434: }
2435: }
2436: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2437: return elem.exlAppendPostfixOperatorTo (sb, ".d");
2438: }
2439: },
2440:
2441: ETY_OPERATOR_SIZE_EXTENDED {
2442: @Override protected int etyPriority () {
2443: return EPY_PRIORITY_POSTFIX;
2444: }
2445: @Override protected void etyEval (ExpressionElement elem, int mode) {
2446: switch (elem.exlParamX.exlType) {
2447: case ETY_SQUARE_BRACKET:
2448: {
2449: int a, f;
2450: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2451: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2452: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2453: } else {
2454: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2455: f = -1;
2456: }
2457: byte[] b = new byte[12];
2458: MC68060.mmuPeekExtended (a, b, f);
2459: elem.exlFloatValue.setx012 (b, 0);
2460: }
2461: break;
2462: default:
2463: elem.exlFloatValue.sete (elem.exlParamX.exlEval (mode).exlFloatValue).roundx ();
2464: }
2465: }
2466: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2467: return elem.exlAppendPostfixOperatorTo (sb, ".x");
2468: }
2469: },
2470:
2471: ETY_OPERATOR_SIZE_TRIPLE {
2472: @Override protected int etyPriority () {
2473: return EPY_PRIORITY_POSTFIX;
2474: }
2475: @Override protected void etyEval (ExpressionElement elem, int mode) {
2476: switch (elem.exlParamX.exlType) {
2477: case ETY_SQUARE_BRACKET:
2478: {
2479: int a, f;
2480: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2481: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2482: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2483: } else {
2484: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2485: f = -1;
2486: }
2487: byte[] b = new byte[12];
2488: MC68060.mmuPeekExtended (a, b, f);
2489: elem.exlFloatValue.sety012 (b, 0);
2490: }
2491: break;
2492: default:
2493: elem.exlFloatValue.sete (elem.exlParamX.exlEval (mode).exlFloatValue).roundy ();
2494: }
2495: }
2496: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2497: return elem.exlAppendPostfixOperatorTo (sb, ".t");
2498: }
2499: },
2500:
2501: ETY_OPERATOR_SIZE_PACKED {
2502: @Override protected int etyPriority () {
2503: return EPY_PRIORITY_POSTFIX;
2504: }
2505: @Override protected void etyEval (ExpressionElement elem, int mode) {
2506: switch (elem.exlParamX.exlType) {
2507: case ETY_SQUARE_BRACKET:
2508: {
2509: int a, f;
2510: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2511: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2512: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2513: } else {
2514: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2515: f = -1;
2516: }
2517: byte[] b = new byte[12];
2518: MC68060.mmuPeekExtended (a, b, f);
2519: elem.exlFloatValue.setp012 (b, 0);
2520: }
2521: break;
2522: default:
2523: elem.exlFloatValue.setnan ();
2524: }
2525: }
2526: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2527: return elem.exlAppendPostfixOperatorTo (sb, ".p");
2528: }
2529: },
2530:
2531:
2532: ETY_OPERATOR_PREINCREMENT {
2533: @Override protected int etyPriority () {
2534: return EPY_PRIORITY_PREFIX;
2535: }
2536: @Override protected void etyEval (ExpressionElement elem, int mode) {
2537: switch (elem.exlParamX.exlType) {
2538: case ETY_VARIABLE_FLOAT:
2539: elem.exlParamX.exlParamX.exlFloatValue.inc ();
2540: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue);
2541: break;
2542: case ETY_INTEGER_REGISTER:
2543: {
2544: int n = elem.exlParamX.exlSubscript;
2545: int x = elem.exlReadRegLong (n) + 1;
2546: elem.exlWriteRegLong (n, x);
2547: elem.exlFloatValue.seti (x);
2548: }
2549: break;
2550: case ETY_FLOATING_POINT_REGISTER:
2551: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).inc ());
2552: break;
2553: case ETY_PC:
2554: {
2555: int x = elem.exlReadPC () + 1;
2556: elem.exlFloatValue.seti (x);
2557: elem.exlWritePC (x);
2558: }
2559: break;
2560: case ETY_CCR:
2561: {
2562: int x = elem.exlReadCCR () + 1;
2563: elem.exlFloatValue.seti (x);
2564: elem.exlWriteCCR (x);
2565: }
2566: break;
2567: case ETY_SR:
2568: {
2569: int x = elem.exlReadSR () + 1;
2570: elem.exlFloatValue.seti (x);
2571: elem.exlWriteSR (x);
2572: }
2573: break;
2574: case ETY_FLOAT_CONTROL_REGISTER:
2575: {
2576: int n = elem.exlParamX.exlSubscript;
2577: int x = elem.exlReadFloatControlRegister (n) + 1;
2578: elem.exlFloatValue.seti (x);
2579: elem.exlWriteFloatControlRegister (n, x);
2580: }
2581: break;
2582: case ETY_CONTROL_REGISTER:
2583: {
2584: int n = elem.exlParamX.exlSubscript;
2585: int x = elem.exlReadControlRegister (n) + 1;
2586: elem.exlWriteControlRegister (n, x);
2587: elem.exlFloatValue.seti (x);
2588: }
2589: break;
2590: case ETY_SQUARE_BRACKET:
2591: {
2592: int a, f;
2593: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2594: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2595: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2596: } else {
2597: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2598: f = -1;
2599: }
2600: int x = MC68060.mmuPeekByteSign (a, f) + 1;
2601: MC68060.mmuPokeByte (a, x, f);
2602: elem.exlFloatValue.seti (x);
2603: }
2604: break;
2605: case ETY_OPERATOR_SIZE_BYTE:
2606: switch (elem.exlParamX.exlParamX.exlType) {
2607: case ETY_INTEGER_REGISTER:
2608: {
2609: int n = elem.exlParamX.exlParamX.exlSubscript;
2610: int x = elem.exlReadRegByte (n) + 1;
2611: elem.exlWriteRegByte (n, x);
2612: elem.exlFloatValue.seti (x);
2613: }
2614: break;
2615: case ETY_SQUARE_BRACKET:
2616: {
2617: int a, f;
2618: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2619: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2620: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2621: } else {
2622: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2623: f = -1;
2624: }
2625: int x = MC68060.mmuPeekByteSign (a, f) + 1;
2626: MC68060.mmuPokeByte (a, x, f);
2627: elem.exlFloatValue.seti (x);
2628: }
2629: break;
2630: default:
2631: elem.exlFloatValue.setnan ();
2632: }
2633: break;
2634: case ETY_OPERATOR_SIZE_WORD:
2635: switch (elem.exlParamX.exlParamX.exlType) {
2636: case ETY_INTEGER_REGISTER:
2637: {
2638: int n = elem.exlParamX.exlParamX.exlSubscript;
2639: int x = elem.exlReadRegWord (n) + 1;
2640: elem.exlWriteRegWord (n, x);
2641: elem.exlFloatValue.seti (x);
2642: }
2643: break;
2644: case ETY_SQUARE_BRACKET:
2645: {
2646: int a, f;
2647: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2648: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2649: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2650: } else {
2651: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2652: f = -1;
2653: }
2654: int x = MC68060.mmuPeekWordSign (a, f) + 1;
2655: MC68060.mmuPokeWord (a, x, f);
2656: elem.exlFloatValue.seti (x);
2657: }
2658: break;
2659: default:
2660: elem.exlFloatValue.setnan ();
2661: }
2662: break;
2663: case ETY_OPERATOR_SIZE_LONG:
2664: switch (elem.exlParamX.exlParamX.exlType) {
2665: case ETY_INTEGER_REGISTER:
2666: {
2667: int n = elem.exlParamX.exlParamX.exlSubscript;
2668: int x = elem.exlReadRegLong (n) + 1;
2669: elem.exlWriteRegLong (n, x);
2670: elem.exlFloatValue.seti (x);
2671: }
2672: break;
2673: case ETY_SQUARE_BRACKET:
2674: {
2675: int a, f;
2676: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2677: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2678: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2679: } else {
2680: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2681: f = -1;
2682: }
2683: int x = MC68060.mmuPeekLong (a, f) + 1;
2684: MC68060.mmuPokeLong (a, x, f);
2685: elem.exlFloatValue.seti (x);
2686: }
2687: break;
2688: default:
2689: elem.exlFloatValue.setnan ();
2690: }
2691: break;
2692: case ETY_OPERATOR_SIZE_QUAD:
2693: switch (elem.exlParamX.exlParamX.exlType) {
2694: case ETY_SQUARE_BRACKET:
2695: {
2696: int a, f;
2697: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2698: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2699: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2700: } else {
2701: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2702: f = -1;
2703: }
2704: long x = MC68060.mmuPeekQuad (a, f) + 1L;
2705: MC68060.mmuPokeQuad (a, x, f);
2706: elem.exlFloatValue.setl (x);
2707: }
2708: break;
2709: default:
2710: elem.exlFloatValue.setnan ();
2711: }
2712: break;
2713: case ETY_OPERATOR_SIZE_SINGLE:
2714: switch (elem.exlParamX.exlParamX.exlType) {
2715: case ETY_INTEGER_REGISTER:
2716: {
2717: int n = elem.exlParamX.exlParamX.exlSubscript;
2718: float x = Float.intBitsToFloat (elem.exlReadRegLong (n)) + 1.0F;
2719: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
2720: elem.exlFloatValue.setf (x);
2721: }
2722: break;
2723: case ETY_SQUARE_BRACKET:
2724: {
2725: int a, f;
2726: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2727: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2728: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2729: } else {
2730: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2731: f = -1;
2732: }
2733: float x = Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) + 1.0F;
2734: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
2735: elem.exlFloatValue.setf (x);
2736: }
2737: break;
2738: default:
2739: elem.exlFloatValue.setnan ();
2740: }
2741: break;
2742: case ETY_OPERATOR_SIZE_DOUBLE:
2743: switch (elem.exlParamX.exlParamX.exlType) {
2744: case ETY_SQUARE_BRACKET:
2745: {
2746: int a, f;
2747: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2748: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2749: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2750: } else {
2751: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2752: f = -1;
2753: }
2754: double x = Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) + 1.0;
2755: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
2756: elem.exlFloatValue.setd (x);
2757: }
2758: break;
2759: default:
2760: elem.exlFloatValue.setnan ();
2761: }
2762: break;
2763: case ETY_OPERATOR_SIZE_EXTENDED:
2764: switch (elem.exlParamX.exlParamX.exlType) {
2765: case ETY_SQUARE_BRACKET:
2766: {
2767: int a, f;
2768: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2769: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2770: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2771: } else {
2772: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2773: f = -1;
2774: }
2775: byte[] b = new byte[12];
2776: MC68060.mmuPeekExtended (a, b, f);
2777: elem.exlFloatValue.setx012 (b, 0).inc ().getx012 (b, 0);
2778: MC68060.mmuPokeExtended (a, b, f);
2779: }
2780: break;
2781: default:
2782: elem.exlFloatValue.setnan ();
2783: }
2784: break;
2785: case ETY_OPERATOR_SIZE_TRIPLE:
2786: switch (elem.exlParamX.exlParamX.exlType) {
2787: case ETY_SQUARE_BRACKET:
2788: {
2789: int a, f;
2790: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2791: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2792: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2793: } else {
2794: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2795: f = -1;
2796: }
2797: byte[] b = new byte[12];
2798: MC68060.mmuPeekExtended (a, b, f);
2799: elem.exlFloatValue.sety012 (b, 0).inc ().gety012 (b, 0);
2800: MC68060.mmuPokeExtended (a, b, f);
2801: }
2802: break;
2803: default:
2804: elem.exlFloatValue.setnan ();
2805: }
2806: break;
2807: case ETY_OPERATOR_SIZE_PACKED:
2808: switch (elem.exlParamX.exlParamX.exlType) {
2809: case ETY_SQUARE_BRACKET:
2810: {
2811: int a, f;
2812: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2813: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2814: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2815: } else {
2816: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2817: f = -1;
2818: }
2819: byte[] b = new byte[12];
2820: MC68060.mmuPeekExtended (a, b, f);
2821: elem.exlFloatValue.setp012 (b, 0).inc ().getp012 (b, 0);
2822: MC68060.mmuPokeExtended (a, b, f);
2823: }
2824: break;
2825: default:
2826: elem.exlFloatValue.setnan ();
2827: }
2828: break;
2829: default:
2830: elem.exlFloatValue.setnan ();
2831: }
2832: }
2833: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
2834: return elem.exlAppendPrefixOperatorTo (sb, "++");
2835: }
2836: },
2837:
2838: ETY_OPERATOR_PREDECREMENT {
2839: @Override protected int etyPriority () {
2840: return EPY_PRIORITY_PREFIX;
2841: }
2842: @Override protected void etyEval (ExpressionElement elem, int mode) {
2843: switch (elem.exlParamX.exlType) {
2844: case ETY_VARIABLE_FLOAT:
2845: elem.exlParamX.exlParamX.exlFloatValue.dec ();
2846: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue);
2847: break;
2848: case ETY_INTEGER_REGISTER:
2849: {
2850: int n = elem.exlParamX.exlSubscript;
2851: int x = elem.exlReadRegLong (n) - 1;
2852: elem.exlWriteRegLong (n, x);
2853: elem.exlFloatValue.seti (x);
2854: }
2855: break;
2856: case ETY_FLOATING_POINT_REGISTER:
2857: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).dec ());
2858: break;
2859: case ETY_PC:
2860: {
2861: int x = elem.exlReadPC () - 1;
2862: elem.exlFloatValue.seti (x);
2863: elem.exlWritePC (x);
2864: }
2865: break;
2866: case ETY_CCR:
2867: {
2868: int x = elem.exlReadCCR () - 1;
2869: elem.exlFloatValue.seti (x);
2870: elem.exlWriteCCR (x);
2871: }
2872: break;
2873: case ETY_SR:
2874: {
2875: int x = elem.exlReadSR () - 1;
2876: elem.exlFloatValue.seti (x);
2877: elem.exlWriteSR (x);
2878: }
2879: break;
2880: case ETY_FLOAT_CONTROL_REGISTER:
2881: {
2882: int n = elem.exlParamX.exlSubscript;
2883: int x = elem.exlReadFloatControlRegister (n) - 1;
2884: elem.exlFloatValue.seti (x);
2885: elem.exlWriteFloatControlRegister (n, x);
2886: }
2887: break;
2888: case ETY_CONTROL_REGISTER:
2889: {
2890: int n = elem.exlParamX.exlSubscript;
2891: int x = elem.exlReadControlRegister (n) - 1;
2892: elem.exlWriteControlRegister (n, x);
2893: elem.exlFloatValue.seti (x);
2894: }
2895: break;
2896: case ETY_SQUARE_BRACKET:
2897: {
2898: int a, f;
2899: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2900: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2901: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2902: } else {
2903: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2904: f = -1;
2905: }
2906: int x = MC68060.mmuPeekByteSign (a, f) - 1;
2907: MC68060.mmuPokeByte (a, x, f);
2908: elem.exlFloatValue.seti (x);
2909: }
2910: break;
2911: case ETY_OPERATOR_SIZE_BYTE:
2912: switch (elem.exlParamX.exlParamX.exlType) {
2913: case ETY_INTEGER_REGISTER:
2914: {
2915: int n = elem.exlParamX.exlParamX.exlSubscript;
2916: int x = elem.exlReadRegByte (n) - 1;
2917: elem.exlWriteRegByte (n, x);
2918: elem.exlFloatValue.seti (x);
2919: }
2920: break;
2921: case ETY_SQUARE_BRACKET:
2922: {
2923: int a, f;
2924: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2925: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2926: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2927: } else {
2928: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2929: f = -1;
2930: }
2931: int x = MC68060.mmuPeekByteSign (a, f) - 1;
2932: MC68060.mmuPokeByte (a, x, f);
2933: elem.exlFloatValue.seti (x);
2934: }
2935: break;
2936: default:
2937: elem.exlFloatValue.setnan ();
2938: }
2939: break;
2940: case ETY_OPERATOR_SIZE_WORD:
2941: switch (elem.exlParamX.exlParamX.exlType) {
2942: case ETY_INTEGER_REGISTER:
2943: {
2944: int n = elem.exlParamX.exlParamX.exlSubscript;
2945: int x = elem.exlReadRegWord (n) - 1;
2946: elem.exlWriteRegWord (n, x);
2947: elem.exlFloatValue.seti (x);
2948: }
2949: break;
2950: case ETY_SQUARE_BRACKET:
2951: {
2952: int a, f;
2953: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2954: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2955: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2956: } else {
2957: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2958: f = -1;
2959: }
2960: int x = MC68060.mmuPeekWordSign (a, f) - 1;
2961: MC68060.mmuPokeWord (a, x, f);
2962: elem.exlFloatValue.seti (x);
2963: }
2964: break;
2965: default:
2966: elem.exlFloatValue.setnan ();
2967: }
2968: break;
2969: case ETY_OPERATOR_SIZE_LONG:
2970: switch (elem.exlParamX.exlParamX.exlType) {
2971: case ETY_INTEGER_REGISTER:
2972: {
2973: int n = elem.exlParamX.exlParamX.exlSubscript;
2974: int x = elem.exlReadRegLong (n) - 1;
2975: elem.exlWriteRegLong (n, x);
2976: elem.exlFloatValue.seti (x);
2977: }
2978: break;
2979: case ETY_SQUARE_BRACKET:
2980: {
2981: int a, f;
2982: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
2983: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2984: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
2985: } else {
2986: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
2987: f = -1;
2988: }
2989: int x = MC68060.mmuPeekLong (a, f) - 1;
2990: MC68060.mmuPokeLong (a, x, f);
2991: elem.exlFloatValue.seti (x);
2992: }
2993: break;
2994: default:
2995: elem.exlFloatValue.setnan ();
2996: }
2997: break;
2998: case ETY_OPERATOR_SIZE_QUAD:
2999: switch (elem.exlParamX.exlParamX.exlType) {
3000: case ETY_SQUARE_BRACKET:
3001: {
3002: int a, f;
3003: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3004: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3005: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3006: } else {
3007: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3008: f = -1;
3009: }
3010: long x = MC68060.mmuPeekQuad (a, f) - 1L;
3011: MC68060.mmuPokeQuad (a, x, f);
3012: elem.exlFloatValue.setl (x);
3013: }
3014: break;
3015: default:
3016: elem.exlFloatValue.setnan ();
3017: }
3018: break;
3019: case ETY_OPERATOR_SIZE_SINGLE:
3020: switch (elem.exlParamX.exlParamX.exlType) {
3021: case ETY_INTEGER_REGISTER:
3022: {
3023: int n = elem.exlParamX.exlParamX.exlSubscript;
3024: float x = Float.intBitsToFloat (elem.exlReadRegLong (n)) - 1.0F;
3025: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
3026: elem.exlFloatValue.setf (x);
3027: }
3028: break;
3029: case ETY_SQUARE_BRACKET:
3030: {
3031: int a, f;
3032: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3033: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3034: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3035: } else {
3036: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3037: f = -1;
3038: }
3039: float x = Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) - 1.0F;
3040: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
3041: elem.exlFloatValue.setf (x);
3042: }
3043: break;
3044: default:
3045: elem.exlFloatValue.setnan ();
3046: }
3047: break;
3048: case ETY_OPERATOR_SIZE_DOUBLE:
3049: switch (elem.exlParamX.exlParamX.exlType) {
3050: case ETY_SQUARE_BRACKET:
3051: {
3052: int a, f;
3053: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3054: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3055: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3056: } else {
3057: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3058: f = -1;
3059: }
3060: double x = Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) - 1.0;
3061: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
3062: elem.exlFloatValue.setd (x);
3063: }
3064: break;
3065: default:
3066: elem.exlFloatValue.setnan ();
3067: }
3068: break;
3069: case ETY_OPERATOR_SIZE_EXTENDED:
3070: switch (elem.exlParamX.exlParamX.exlType) {
3071: case ETY_SQUARE_BRACKET:
3072: {
3073: int a, f;
3074: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3075: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3076: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3077: } else {
3078: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3079: f = -1;
3080: }
3081: byte[] b = new byte[12];
3082: MC68060.mmuPeekExtended (a, b, f);
3083: elem.exlFloatValue.setx012 (b, 0).dec ().getx012 (b, 0);
3084: MC68060.mmuPokeExtended (a, b, f);
3085: }
3086: break;
3087: default:
3088: elem.exlFloatValue.setnan ();
3089: }
3090: break;
3091: case ETY_OPERATOR_SIZE_TRIPLE:
3092: switch (elem.exlParamX.exlParamX.exlType) {
3093: case ETY_SQUARE_BRACKET:
3094: {
3095: int a, f;
3096: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3097: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3098: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3099: } else {
3100: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3101: f = -1;
3102: }
3103: byte[] b = new byte[12];
3104: MC68060.mmuPeekExtended (a, b, f);
3105: elem.exlFloatValue.sety012 (b, 0).dec ().gety012 (b, 0);
3106: MC68060.mmuPokeExtended (a, b, f);
3107: }
3108: break;
3109: default:
3110: elem.exlFloatValue.setnan ();
3111: }
3112: break;
3113: case ETY_OPERATOR_SIZE_PACKED:
3114: switch (elem.exlParamX.exlParamX.exlType) {
3115: case ETY_SQUARE_BRACKET:
3116: {
3117: int a, f;
3118: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3119: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3120: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3121: } else {
3122: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3123: f = -1;
3124: }
3125: byte[] b = new byte[12];
3126: MC68060.mmuPeekExtended (a, b, f);
3127: elem.exlFloatValue.setp012 (b, 0).dec ().getp012 (b, 0);
3128: MC68060.mmuPokeExtended (a, b, f);
3129: }
3130: break;
3131: default:
3132: elem.exlFloatValue.setnan ();
3133: }
3134: break;
3135: default:
3136: elem.exlFloatValue.setnan ();
3137: }
3138: }
3139: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3140: return elem.exlAppendPrefixOperatorTo (sb, "--");
3141: }
3142: },
3143:
3144: ETY_OPERATOR_NOTHING {
3145: @Override protected int etyPriority () {
3146: return EPY_PRIORITY_PREFIX;
3147: }
3148: @Override protected void etyEval (ExpressionElement elem, int mode) {
3149: elem.exlFloatValue.sete (elem.exlParamX.exlEval (mode).exlFloatValue);
3150: }
3151: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3152: return elem.exlAppendPrefixOperatorTo (sb, "+");
3153: }
3154: },
3155:
3156: ETY_OPERATOR_NEGATION {
3157: @Override protected int etyPriority () {
3158: return EPY_PRIORITY_PREFIX;
3159: }
3160: @Override protected void etyEval (ExpressionElement elem, int mode) {
3161: elem.exlFloatValue.neg (elem.exlParamX.exlEval (mode).exlFloatValue);
3162: }
3163: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3164: return elem.exlAppendPrefixOperatorTo (sb, "-");
3165: }
3166: },
3167:
3168: ETY_OPERATOR_BITWISE_NOT {
3169: @Override protected int etyPriority () {
3170: return EPY_PRIORITY_PREFIX;
3171: }
3172: @Override protected void etyEval (ExpressionElement elem, int mode) {
3173: elem.exlFloatValue.setl (~elem.exlParamX.exlEval (mode).exlFloatValue.getl ());
3174: }
3175: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3176: return elem.exlAppendPrefixOperatorTo (sb, "~");
3177: }
3178: },
3179:
3180: ETY_OPERATOR_LOGICAL_NOT {
3181: @Override protected int etyPriority () {
3182: return EPY_PRIORITY_PREFIX;
3183: }
3184: @Override protected void etyEval (ExpressionElement elem, int mode) {
3185: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.iszero () ? 1 : 0);
3186: }
3187: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3188: return elem.exlAppendPrefixOperatorTo (sb, "!");
3189: }
3190: },
3191:
3192:
3193: ETY_OPERATOR_POWER {
3194: @Override protected int etyPriority () {
3195: return EPY_PRIORITY_EXPONENTIATION;
3196: }
3197: @Override protected void etyEval (ExpressionElement elem, int mode) {
3198: elem.exlFloatValue.pow (elem.exlParamX.exlEval (mode).exlFloatValue, elem.exlParamY.exlEval (mode).exlFloatValue);
3199: }
3200: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3201: return elem.exlAppendBinaryOperatorTo (sb, "**");
3202: }
3203: },
3204:
3205:
3206: ETY_OPERATOR_MULTIPLICATION {
3207: @Override protected int etyPriority () {
3208: return EPY_PRIORITY_MULTIPLICATION;
3209: }
3210: @Override protected void etyEval (ExpressionElement elem, int mode) {
3211: elem.exlFloatValue.mul (elem.exlParamX.exlEval (mode).exlFloatValue, elem.exlParamY.exlEval (mode).exlFloatValue);
3212: }
3213: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3214: return elem.exlAppendBinaryOperatorTo (sb, "*");
3215: }
3216: },
3217:
3218: ETY_OPERATOR_DIVISION {
3219: @Override protected int etyPriority () {
3220: return EPY_PRIORITY_MULTIPLICATION;
3221: }
3222: @Override protected void etyEval (ExpressionElement elem, int mode) {
3223: elem.exlFloatValue.div (elem.exlParamX.exlEval (mode).exlFloatValue, elem.exlParamY.exlEval (mode).exlFloatValue);
3224: }
3225: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3226: return elem.exlAppendBinaryOperatorTo (sb, "/");
3227: }
3228: },
3229:
3230: ETY_OPERATOR_MODULUS {
3231: @Override protected int etyPriority () {
3232: return EPY_PRIORITY_MULTIPLICATION;
3233: }
3234: @Override protected void etyEval (ExpressionElement elem, int mode) {
3235: elem.exlFloatValue.rem (elem.exlParamX.exlEval (mode).exlFloatValue, elem.exlParamY.exlEval (mode).exlFloatValue);
3236: }
3237: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3238: return elem.exlAppendBinaryOperatorTo (sb, "%");
3239: }
3240: },
3241:
3242:
3243: ETY_OPERATOR_ADDITION_FLOAT_FLOAT {
3244: @Override protected int etyPriority () {
3245: return EPY_PRIORITY_ADDITION;
3246: }
3247: @Override protected void etyEval (ExpressionElement elem, int mode) {
3248: elem.exlFloatValue.add (elem.exlParamX.exlEval (mode).exlFloatValue, elem.exlParamY.exlEval (mode).exlFloatValue);
3249: }
3250: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3251: return elem.exlAppendBinaryOperatorTo (sb, "+");
3252: }
3253: },
3254:
3255: ETY_OPERATOR_ADDITION_FLOAT_STRING {
3256: @Override protected int etyPriority () {
3257: return EPY_PRIORITY_ADDITION;
3258: }
3259: @Override protected void etyEval (ExpressionElement elem, int mode) {
3260: elem.exlStringValue = elem.exlParamX.exlEval (mode).exlFloatValue.toString () + elem.exlParamY.exlEval (mode).exlStringValue;
3261: }
3262: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3263: return elem.exlAppendBinaryOperatorTo (sb, "+");
3264: }
3265: },
3266:
3267: ETY_OPERATOR_ADDITION_STRING_FLOAT {
3268: @Override protected int etyPriority () {
3269: return EPY_PRIORITY_ADDITION;
3270: }
3271: @Override protected void etyEval (ExpressionElement elem, int mode) {
3272: elem.exlStringValue = elem.exlParamX.exlEval (mode).exlStringValue + elem.exlParamY.exlEval (mode).exlFloatValue.toString ();
3273: }
3274: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3275: return elem.exlAppendBinaryOperatorTo (sb, "+");
3276: }
3277: },
3278:
3279: ETY_OPERATOR_ADDITION_STRING_STRING {
3280: @Override protected int etyPriority () {
3281: return EPY_PRIORITY_ADDITION;
3282: }
3283: @Override protected void etyEval (ExpressionElement elem, int mode) {
3284: elem.exlStringValue = elem.exlParamX.exlEval (mode).exlStringValue + elem.exlParamY.exlEval (mode).exlStringValue;
3285: }
3286: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3287: return elem.exlAppendBinaryOperatorTo (sb, "+");
3288: }
3289: },
3290:
3291: ETY_OPERATOR_SUBTRACTION {
3292: @Override protected int etyPriority () {
3293: return EPY_PRIORITY_ADDITION;
3294: }
3295: @Override protected void etyEval (ExpressionElement elem, int mode) {
3296: elem.exlFloatValue.sub (elem.exlParamX.exlEval (mode).exlFloatValue, elem.exlParamY.exlEval (mode).exlFloatValue);
3297: }
3298: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3299: return elem.exlAppendBinaryOperatorTo (sb, "-");
3300: }
3301: },
3302:
3303:
3304: ETY_OPERATOR_LEFT_SHIFT {
3305: @Override protected int etyPriority () {
3306: return EPY_PRIORITY_SHIFT;
3307: }
3308: @Override protected void etyEval (ExpressionElement elem, int mode) {
3309: elem.exlFloatValue.setl (elem.exlParamX.exlEval (mode).exlFloatValue.getl () << elem.exlParamY.exlEval (mode).exlFloatValue.geti ());
3310: }
3311: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3312: return elem.exlAppendBinaryOperatorTo (sb, "<<");
3313: }
3314: },
3315:
3316: ETY_OPERATOR_RIGHT_SHIFT {
3317: @Override protected int etyPriority () {
3318: return EPY_PRIORITY_SHIFT;
3319: }
3320: @Override protected void etyEval (ExpressionElement elem, int mode) {
3321: elem.exlFloatValue.setl (elem.exlParamX.exlEval (mode).exlFloatValue.getl () >> elem.exlParamY.exlEval (mode).exlFloatValue.geti ());
3322: }
3323: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3324: return elem.exlAppendBinaryOperatorTo (sb, ">>");
3325: }
3326: },
3327:
3328: ETY_OPERATOR_UNSIGNED_RIGHT_SHIFT {
3329: @Override protected int etyPriority () {
3330: return EPY_PRIORITY_SHIFT;
3331: }
3332: @Override protected void etyEval (ExpressionElement elem, int mode) {
3333: elem.exlFloatValue.setl (elem.exlParamX.exlEval (mode).exlFloatValue.getl () >>> elem.exlParamY.exlEval (mode).exlFloatValue.geti ());
3334: }
3335: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3336: return elem.exlAppendBinaryOperatorTo (sb, ">>>");
3337: }
3338: },
3339:
3340:
3341: ETY_OPERATOR_LESS_THAN {
3342: @Override protected int etyPriority () {
3343: return EPY_PRIORITY_COMPARISON;
3344: }
3345: @Override protected void etyEval (ExpressionElement elem, int mode) {
3346: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.lt (elem.exlParamY.exlEval (mode).exlFloatValue) ? 1 : 0);
3347: }
3348: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3349: return elem.exlAppendBinaryOperatorTo (sb, "<");
3350: }
3351: },
3352:
3353: ETY_OPERATOR_LESS_OR_EQUAL {
3354: @Override protected int etyPriority () {
3355: return EPY_PRIORITY_COMPARISON;
3356: }
3357: @Override protected void etyEval (ExpressionElement elem, int mode) {
3358: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.le (elem.exlParamY.exlEval (mode).exlFloatValue) ? 1 : 0);
3359: }
3360: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3361: return elem.exlAppendBinaryOperatorTo (sb, "<=");
3362: }
3363: },
3364:
3365: ETY_OPERATOR_GREATER_THAN {
3366: @Override protected int etyPriority () {
3367: return EPY_PRIORITY_COMPARISON;
3368: }
3369: @Override protected void etyEval (ExpressionElement elem, int mode) {
3370: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.gt (elem.exlParamY.exlEval (mode).exlFloatValue) ? 1 : 0);
3371: }
3372: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3373: return elem.exlAppendBinaryOperatorTo (sb, ">");
3374: }
3375: },
3376:
3377: ETY_OPERATOR_GREATER_OR_EQUAL {
3378: @Override protected int etyPriority () {
3379: return EPY_PRIORITY_COMPARISON;
3380: }
3381: @Override protected void etyEval (ExpressionElement elem, int mode) {
3382: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.ge (elem.exlParamY.exlEval (mode).exlFloatValue) ? 1 : 0);
3383: }
3384: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3385: return elem.exlAppendBinaryOperatorTo (sb, ">=");
3386: }
3387: },
3388:
3389:
3390: ETY_OPERATOR_EQUAL {
3391: @Override protected int etyPriority () {
3392: return EPY_PRIORITY_EQUALITY;
3393: }
3394: @Override protected void etyEval (ExpressionElement elem, int mode) {
3395: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.eq (elem.exlParamY.exlEval (mode).exlFloatValue) ? 1 : 0);
3396: }
3397: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3398: return elem.exlAppendBinaryOperatorTo (sb, "==");
3399: }
3400: },
3401:
3402: ETY_OPERATOR_NOT_EQUAL {
3403: @Override protected int etyPriority () {
3404: return EPY_PRIORITY_EQUALITY;
3405: }
3406: @Override protected void etyEval (ExpressionElement elem, int mode) {
3407: elem.exlFloatValue.seti (elem.exlParamX.exlEval (mode).exlFloatValue.ne (elem.exlParamY.exlEval (mode).exlFloatValue) ? 1 : 0);
3408: }
3409: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3410: return elem.exlAppendBinaryOperatorTo (sb, "!=");
3411: }
3412: },
3413:
3414:
3415: ETY_OPERATOR_BITWISE_AND {
3416: @Override protected int etyPriority () {
3417: return EPY_PRIORITY_BITWISE_AND;
3418: }
3419: @Override protected void etyEval (ExpressionElement elem, int mode) {
3420: elem.exlFloatValue.setl (elem.exlParamX.exlEval (mode).exlFloatValue.getl () &
3421: elem.exlParamY.exlEval (mode).exlFloatValue.getl ());
3422: }
3423: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3424: return elem.exlAppendBinaryOperatorTo (sb, "&");
3425: }
3426: },
3427:
3428:
3429: ETY_OPERATOR_BITWISE_XOR {
3430: @Override protected int etyPriority () {
3431: return EPY_PRIORITY_BITWISE_XOR;
3432: }
3433: @Override protected void etyEval (ExpressionElement elem, int mode) {
3434: elem.exlFloatValue.setl (elem.exlParamX.exlEval (mode).exlFloatValue.getl () ^
3435: elem.exlParamY.exlEval (mode).exlFloatValue.getl ());
3436: }
3437: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3438: return elem.exlAppendBinaryOperatorTo (sb, "^");
3439: }
3440: },
3441:
3442:
3443: ETY_OPERATOR_BITWISE_OR {
3444: @Override protected int etyPriority () {
3445: return EPY_PRIORITY_BITWISE_OR;
3446: }
3447: @Override protected void etyEval (ExpressionElement elem, int mode) {
3448: elem.exlFloatValue.setl (elem.exlParamX.exlEval (mode).exlFloatValue.getl () |
3449: elem.exlParamY.exlEval (mode).exlFloatValue.getl ());
3450: }
3451: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3452: return elem.exlAppendBinaryOperatorTo (sb, "|");
3453: }
3454: },
3455:
3456:
3457: ETY_OPERATOR_LOGICAL_AND {
3458: @Override protected int etyPriority () {
3459: return EPY_PRIORITY_LOGICAL_AND;
3460: }
3461: @Override protected void etyEval (ExpressionElement elem, int mode) {
3462: elem.exlFloatValue.seti (!elem.exlParamX.exlEval (mode).exlFloatValue.iszero () &&
3463: !elem.exlParamY.exlEval (mode).exlFloatValue.iszero () ? 1 : 0);
3464: }
3465: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3466: return elem.exlAppendBinaryOperatorTo (sb, "&&");
3467: }
3468: },
3469:
3470:
3471: ETY_OPERATOR_LOGICAL_OR {
3472: @Override protected int etyPriority () {
3473: return EPY_PRIORITY_LOGICAL_OR;
3474: }
3475: @Override protected void etyEval (ExpressionElement elem, int mode) {
3476: elem.exlFloatValue.seti (!elem.exlParamX.exlEval (mode).exlFloatValue.iszero () ||
3477: !elem.exlParamY.exlEval (mode).exlFloatValue.iszero () ? 1 : 0);
3478: }
3479: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3480: return elem.exlAppendBinaryOperatorTo (sb, "||");
3481: }
3482: },
3483:
3484:
3485: ETY_OPERATOR_CONDITIONAL_FLOAT {
3486: @Override protected int etyPriority () {
3487: return EPY_PRIORITY_CONDITIONAL;
3488: }
3489: @Override protected void etyEval (ExpressionElement elem, int mode) {
3490: elem.exlFloatValue.sete (!elem.exlParamX.exlEval (mode).exlFloatValue.iszero () ?
3491: elem.exlParamY.exlEval (mode).exlFloatValue :
3492: elem.exlParamZ.exlEval (mode).exlFloatValue);
3493: }
3494: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3495: return elem.exlAppendConditionalOperatorTo (sb, "?", ":");
3496: }
3497: },
3498:
3499: ETY_OPERATOR_CONDITIONAL_STRING {
3500: @Override protected int etyPriority () {
3501: return EPY_PRIORITY_CONDITIONAL;
3502: }
3503: @Override protected void etyEval (ExpressionElement elem, int mode) {
3504: elem.exlStringValue = (!elem.exlParamX.exlEval (mode).exlFloatValue.iszero () ?
3505: elem.exlParamY.exlEval (mode).exlStringValue :
3506: elem.exlParamZ.exlEval (mode).exlStringValue);
3507: }
3508: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3509: return elem.exlAppendConditionalOperatorTo (sb, "?", ":");
3510: }
3511: },
3512:
3513:
3514: ETY_OPERATOR_ASSIGNMENT {
3515: @Override protected int etyPriority () {
3516: return EPY_PRIORITY_ASSIGNMENT;
3517: }
3518: @Override protected void etyEval (ExpressionElement elem, int mode) {
3519: switch (elem.exlParamX.exlType) {
3520: case ETY_VARIABLE_FLOAT:
3521: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.sete (elem.exlParamY.exlEval (mode).exlFloatValue));
3522: break;
3523: case ETY_INTEGER_REGISTER:
3524: {
3525: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3526: elem.exlFloatValue.seti (y);
3527: elem.exlWriteRegLong (elem.exlParamX.exlSubscript, y);
3528: }
3529: break;
3530: case ETY_FLOATING_POINT_REGISTER:
3531: {
3532: EFP y = elem.exlParamY.exlEval (mode).exlFloatValue;
3533: elem.exlFloatValue.sete (y);
3534: elem.exlGetFPn (elem.exlParamX.exlSubscript).sete (y);
3535: }
3536: break;
3537: case ETY_PC:
3538: {
3539: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3540: elem.exlFloatValue.seti (y);
3541: elem.exlWritePC (y);
3542: }
3543: break;
3544: case ETY_CCR:
3545: {
3546: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3547: elem.exlFloatValue.seti (y);
3548: elem.exlWriteCCR (y);
3549: }
3550: break;
3551: case ETY_SR:
3552: {
3553: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3554: elem.exlFloatValue.seti (y);
3555: elem.exlWriteSR (y);
3556: }
3557: break;
3558: case ETY_FLOAT_CONTROL_REGISTER:
3559: {
3560: int n = elem.exlParamX.exlSubscript;
3561: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3562: elem.exlFloatValue.seti (y);
3563: elem.exlWriteFloatControlRegister (n, y);
3564: }
3565: break;
3566: case ETY_CONTROL_REGISTER:
3567: {
3568: int n = elem.exlParamX.exlSubscript;
3569: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3570: elem.exlFloatValue.seti (y);
3571: elem.exlWriteControlRegister (n, y);
3572: }
3573: break;
3574: case ETY_SQUARE_BRACKET:
3575: {
3576: int a, f;
3577: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3578: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3579: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3580: } else {
3581: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3582: f = -1;
3583: }
3584: if (elem.exlParamY.exlValueType == ElementType.ETY_FLOAT) {
3585: int y = (byte) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3586: elem.exlFloatValue.seti (y);
3587: MC68060.mmuPokeByte (a, y, f);
3588: } else {
3589: MC68060.mmuPokeStringZ (a, elem.exlStringValue = elem.exlParamY.exlEval (mode).exlStringValue, f);
3590: }
3591: }
3592: break;
3593: case ETY_OPERATOR_SIZE_BYTE:
3594: switch (elem.exlParamX.exlParamX.exlType) {
3595: case ETY_INTEGER_REGISTER:
3596: {
3597: int y = (byte) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3598: elem.exlWriteRegByte (elem.exlParamX.exlParamX.exlSubscript, y);
3599: elem.exlFloatValue.seti (y);
3600: }
3601: break;
3602: case ETY_SQUARE_BRACKET:
3603: {
3604: int a, f;
3605: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3606: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3607: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3608: } else {
3609: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3610: f = -1;
3611: }
3612: int y = (byte) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3613: MC68060.mmuPokeByte (a, y, f);
3614: elem.exlFloatValue.seti (y);
3615: }
3616: break;
3617: default:
3618: elem.exlFloatValue.setnan ();
3619: }
3620: break;
3621: case ETY_OPERATOR_SIZE_WORD:
3622: switch (elem.exlParamX.exlParamX.exlType) {
3623: case ETY_INTEGER_REGISTER:
3624: {
3625: int y = (short) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3626: elem.exlWriteRegWord (elem.exlParamX.exlParamX.exlSubscript, y);
3627: elem.exlFloatValue.seti (y);
3628: }
3629: break;
3630: case ETY_SQUARE_BRACKET:
3631: {
3632: int a, f;
3633: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3634: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3635: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3636: } else {
3637: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3638: f = -1;
3639: }
3640: int y = (short) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3641: MC68060.mmuPokeWord (a, y, f);
3642: elem.exlFloatValue.seti (y);
3643: }
3644: break;
3645: default:
3646: elem.exlFloatValue.setnan ();
3647: }
3648: break;
3649: case ETY_OPERATOR_SIZE_LONG:
3650: switch (elem.exlParamX.exlParamX.exlType) {
3651: case ETY_INTEGER_REGISTER:
3652: {
3653: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3654: elem.exlWriteRegLong (elem.exlParamX.exlParamX.exlSubscript, y);
3655: elem.exlFloatValue.seti (y);
3656: }
3657: break;
3658: case ETY_SQUARE_BRACKET:
3659: {
3660: int a, f;
3661: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3662: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3663: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3664: } else {
3665: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3666: f = -1;
3667: }
3668: int y = (int) elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3669: MC68060.mmuPokeLong (a, y, f);
3670: elem.exlFloatValue.seti (y);
3671: }
3672: break;
3673: default:
3674: elem.exlFloatValue.setnan ();
3675: }
3676: break;
3677: case ETY_OPERATOR_SIZE_QUAD:
3678: switch (elem.exlParamX.exlParamX.exlType) {
3679: case ETY_SQUARE_BRACKET:
3680: {
3681: int a, f;
3682: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3683: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3684: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3685: } else {
3686: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3687: f = -1;
3688: }
3689: long y = elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
3690: MC68060.mmuPokeQuad (a, y, f);
3691: elem.exlFloatValue.setl (y);
3692: }
3693: break;
3694: default:
3695: elem.exlFloatValue.setnan ();
3696: }
3697: break;
3698: case ETY_OPERATOR_SIZE_SINGLE:
3699: switch (elem.exlParamX.exlParamX.exlType) {
3700: case ETY_INTEGER_REGISTER:
3701: {
3702: int y = elem.exlParamY.exlEval (mode).exlFloatValue.getf0 ();
3703: elem.exlWriteRegLong (elem.exlParamX.exlParamX.exlSubscript, y);
3704: elem.exlFloatValue.setf0 (y);
3705: }
3706: break;
3707: case ETY_SQUARE_BRACKET:
3708: {
3709: int a, f;
3710: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3711: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3712: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3713: } else {
3714: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3715: f = -1;
3716: }
3717: int y = elem.exlParamY.exlEval (mode).exlFloatValue.getf0 ();
3718: MC68060.mmuPokeLong (a, y, f);
3719: elem.exlFloatValue.setf0 (y);
3720: }
3721: break;
3722: default:
3723: elem.exlFloatValue.setnan ();
3724: }
3725: break;
3726: case ETY_OPERATOR_SIZE_DOUBLE:
3727: switch (elem.exlParamX.exlParamX.exlType) {
3728: case ETY_SQUARE_BRACKET:
3729: {
3730: int a, f;
3731: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3732: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3733: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3734: } else {
3735: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3736: f = -1;
3737: }
3738: long y = elem.exlParamY.exlEval (mode).exlFloatValue.getd01 ();
3739: MC68060.mmuPokeQuad (a, y, f);
3740: elem.exlFloatValue.setd01 (y);
3741: }
3742: break;
3743: default:
3744: elem.exlFloatValue.setnan ();
3745: }
3746: break;
3747: case ETY_OPERATOR_SIZE_EXTENDED:
3748: switch (elem.exlParamX.exlParamX.exlType) {
3749: case ETY_SQUARE_BRACKET:
3750: {
3751: int a, f;
3752: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3753: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3754: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3755: } else {
3756: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3757: f = -1;
3758: }
3759: byte[] b = new byte[12];
3760: elem.exlParamY.exlEval (mode).exlFloatValue.getx012 (b, 0);
3761: MC68060.mmuPokeExtended (a, b, f);
3762: elem.exlFloatValue.setx012 (b, 0);
3763: }
3764: break;
3765: default:
3766: elem.exlFloatValue.setnan ();
3767: }
3768: break;
3769: case ETY_OPERATOR_SIZE_TRIPLE:
3770: switch (elem.exlParamX.exlParamX.exlType) {
3771: case ETY_SQUARE_BRACKET:
3772: {
3773: int a, f;
3774: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3775: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3776: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3777: } else {
3778: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3779: f = -1;
3780: }
3781: byte[] b = new byte[12];
3782: elem.exlParamY.exlEval (mode).exlFloatValue.gety012 (b, 0);
3783: MC68060.mmuPokeExtended (a, b, f);
3784: elem.exlFloatValue.sety012 (b, 0);
3785: }
3786: break;
3787: default:
3788: elem.exlFloatValue.setnan ();
3789: }
3790: break;
3791: case ETY_OPERATOR_SIZE_PACKED:
3792: switch (elem.exlParamX.exlParamX.exlType) {
3793: case ETY_SQUARE_BRACKET:
3794: {
3795: int a, f;
3796: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3797: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3798: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3799: } else {
3800: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3801: f = -1;
3802: }
3803: byte[] b = new byte[12];
3804: elem.exlParamY.exlEval (mode).exlFloatValue.getp012 (b, 0);
3805: MC68060.mmuPokeExtended (a, b, f);
3806: elem.exlFloatValue.setp012 (b, 0);
3807: }
3808: break;
3809: default:
3810: elem.exlFloatValue.setnan ();
3811: }
3812: break;
3813: default:
3814: elem.exlFloatValue.setnan ();
3815: }
3816: }
3817: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3818: return elem.exlAppendAssignmentOperatorTo (sb, "=");
3819: }
3820: },
3821:
3822: ETY_OPERATOR_SELF_POWER {
3823: @Override protected int etyPriority () {
3824: return EPY_PRIORITY_ASSIGNMENT;
3825: }
3826: @Override protected void etyEval (ExpressionElement elem, int mode) {
3827: int n, a, f;
3828: EFPBox.EFP y = elem.exlParamY.exlEval (mode).exlFloatValue;
3829: switch (elem.exlParamX.exlType) {
3830: case ETY_VARIABLE_FLOAT:
3831: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.pow (y));
3832: break;
3833: case ETY_INTEGER_REGISTER:
3834: n = elem.exlParamX.exlSubscript;
3835: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).pow (y).geti ());
3836: break;
3837: case ETY_FLOATING_POINT_REGISTER:
3838: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).pow (y));
3839: break;
3840: case ETY_PC:
3841: elem.exlWritePC (elem.exlFloatValue.seti (elem.exlReadPC ()).pow (y).geti ());
3842: break;
3843: case ETY_CCR:
3844: elem.exlWriteCCR (elem.exlFloatValue.seti (elem.exlReadCCR ()).pow (y).geti ());
3845: break;
3846: case ETY_SR:
3847: elem.exlWriteSR (elem.exlFloatValue.seti (elem.exlReadSR ()).pow (y).geti ());
3848: break;
3849: case ETY_FLOAT_CONTROL_REGISTER:
3850: n = elem.exlParamX.exlSubscript;
3851: elem.exlWriteFloatControlRegister (n, elem.exlFloatValue.seti (elem.exlReadFloatControlRegister (n)).pow (y).geti ());
3852: break;
3853: case ETY_CONTROL_REGISTER:
3854: n = elem.exlParamX.exlSubscript;
3855: elem.exlWriteControlRegister (n, elem.exlFloatValue.seti (elem.exlReadControlRegister (n)).pow (y).geti ());
3856: break;
3857: case ETY_SQUARE_BRACKET:
3858: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3859: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3860: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3861: } else {
3862: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3863: f = -1;
3864: }
3865: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).pow (y).geti (), f);
3866: break;
3867: case ETY_OPERATOR_SIZE_BYTE:
3868: case ETY_OPERATOR_SIZE_WORD:
3869: case ETY_OPERATOR_SIZE_LONG:
3870: case ETY_OPERATOR_SIZE_QUAD:
3871: case ETY_OPERATOR_SIZE_SINGLE:
3872: case ETY_OPERATOR_SIZE_DOUBLE:
3873: case ETY_OPERATOR_SIZE_EXTENDED:
3874: case ETY_OPERATOR_SIZE_TRIPLE:
3875: case ETY_OPERATOR_SIZE_PACKED:
3876: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
3877: n = elem.exlParamX.exlParamX.exlSubscript;
3878: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
3879: elem.exlWriteRegByte (n, elem.exlFloatValue.seti (elem.exlReadRegByte (n)).pow (y).geti ());
3880: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
3881: elem.exlWriteRegWord (n, elem.exlFloatValue.seti (elem.exlReadRegWord (n)).pow (y).geti ());
3882: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
3883: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).pow (y).geti ());
3884: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
3885: elem.exlWriteRegLong (n, elem.exlFloatValue.setf0 (elem.exlReadRegLong (n)).pow (y).getf0 ());
3886: } else {
3887: elem.exlFloatValue.setnan ();
3888: }
3889: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
3890: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3891: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3892: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3893: } else {
3894: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3895: f = -1;
3896: }
3897: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
3898: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).pow (y).geti (), f);
3899: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
3900: MC68060.mmuPokeWord (a, elem.exlFloatValue.seti (MC68060.mmuPeekWordSign (a, f)).pow (y).geti (), f);
3901: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
3902: MC68060.mmuPokeLong (a, elem.exlFloatValue.seti (MC68060.mmuPeekLong (a, f)).pow (y).geti (), f);
3903: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
3904: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setl (MC68060.mmuPeekQuad (a, f)).pow (y).getl (), f);
3905: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
3906: MC68060.mmuPokeLong (a, elem.exlFloatValue.setf0 (MC68060.mmuPeekLong (a, f)).pow (y).getf0 (), f);
3907: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
3908: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setd01 (MC68060.mmuPeekQuad (a, f)).pow (y).getd01 (), f);
3909: } else {
3910: byte[] b = new byte[12];
3911: MC68060.mmuPeekExtended (a, b, f);
3912: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
3913: elem.exlFloatValue.setx012 (b, 0).pow (y).getx012 (b, 0);
3914: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
3915: elem.exlFloatValue.sety012 (b, 0).pow (y).gety012 (b, 0);
3916: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
3917: elem.exlFloatValue.setp012 (b, 0).pow (y).getp012 (b, 0);
3918: } else {
3919: elem.exlFloatValue.setnan ();
3920: }
3921: MC68060.mmuPokeExtended (a, b, f);
3922: }
3923: } else {
3924: elem.exlFloatValue.setnan ();
3925: }
3926: break;
3927: default:
3928: elem.exlFloatValue.setnan ();
3929: }
3930: }
3931: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
3932: return elem.exlAppendAssignmentOperatorTo (sb, "**=");
3933: }
3934: },
3935:
3936: ETY_OPERATOR_SELF_MULTIPLICATION {
3937: @Override protected int etyPriority () {
3938: return EPY_PRIORITY_ASSIGNMENT;
3939: }
3940: @Override protected void etyEval (ExpressionElement elem, int mode) {
3941: int n, a, f;
3942: EFPBox.EFP y = elem.exlParamY.exlEval (mode).exlFloatValue;
3943: switch (elem.exlParamX.exlType) {
3944: case ETY_VARIABLE_FLOAT:
3945: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.mul (y));
3946: break;
3947: case ETY_INTEGER_REGISTER:
3948: n = elem.exlParamX.exlSubscript;
3949: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).mul (y).geti ());
3950: break;
3951: case ETY_FLOATING_POINT_REGISTER:
3952: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).mul (y));
3953: break;
3954: case ETY_PC:
3955: elem.exlWritePC (elem.exlFloatValue.seti (elem.exlReadPC ()).mul (y).geti ());
3956: break;
3957: case ETY_CCR:
3958: elem.exlWriteCCR (elem.exlFloatValue.seti (elem.exlReadCCR ()).mul (y).geti ());
3959: break;
3960: case ETY_SR:
3961: elem.exlWriteSR (elem.exlFloatValue.seti (elem.exlReadSR ()).mul (y).geti ());
3962: break;
3963: case ETY_FLOAT_CONTROL_REGISTER:
3964: n = elem.exlParamX.exlSubscript;
3965: elem.exlWriteFloatControlRegister (n, elem.exlFloatValue.seti (elem.exlReadFloatControlRegister (n)).mul (y).geti ());
3966: break;
3967: case ETY_CONTROL_REGISTER:
3968: n = elem.exlParamX.exlSubscript;
3969: elem.exlWriteControlRegister (n, elem.exlFloatValue.seti (elem.exlReadControlRegister (n)).mul (y).geti ());
3970: break;
3971: case ETY_SQUARE_BRACKET:
3972: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
3973: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3974: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
3975: } else {
3976: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
3977: f = -1;
3978: }
3979: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).mul (y).geti (), f);
3980: break;
3981: case ETY_OPERATOR_SIZE_BYTE:
3982: case ETY_OPERATOR_SIZE_WORD:
3983: case ETY_OPERATOR_SIZE_LONG:
3984: case ETY_OPERATOR_SIZE_QUAD:
3985: case ETY_OPERATOR_SIZE_SINGLE:
3986: case ETY_OPERATOR_SIZE_DOUBLE:
3987: case ETY_OPERATOR_SIZE_EXTENDED:
3988: case ETY_OPERATOR_SIZE_TRIPLE:
3989: case ETY_OPERATOR_SIZE_PACKED:
3990: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
3991: n = elem.exlParamX.exlParamX.exlSubscript;
3992: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
3993: elem.exlWriteRegByte (n, elem.exlFloatValue.seti (elem.exlReadRegByte (n)).mul (y).geti ());
3994: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
3995: elem.exlWriteRegWord (n, elem.exlFloatValue.seti (elem.exlReadRegWord (n)).mul (y).geti ());
3996: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
3997: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).mul (y).geti ());
3998: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
3999: elem.exlWriteRegLong (n, elem.exlFloatValue.setf0 (elem.exlReadRegLong (n)).mul (y).getf0 ());
4000: } else {
4001: elem.exlFloatValue.setnan ();
4002: }
4003: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4004: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4005: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4006: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4007: } else {
4008: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4009: f = -1;
4010: }
4011: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4012: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).mul (y).geti (), f);
4013: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4014: MC68060.mmuPokeWord (a, elem.exlFloatValue.seti (MC68060.mmuPeekWordSign (a, f)).mul (y).geti (), f);
4015: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4016: MC68060.mmuPokeLong (a, elem.exlFloatValue.seti (MC68060.mmuPeekLong (a, f)).mul (y).geti (), f);
4017: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4018: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setl (MC68060.mmuPeekQuad (a, f)).mul (y).getl (), f);
4019: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4020: MC68060.mmuPokeLong (a, elem.exlFloatValue.setf0 (MC68060.mmuPeekLong (a, f)).mul (y).getf0 (), f);
4021: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4022: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setd01 (MC68060.mmuPeekQuad (a, f)).mul (y).getd01 (), f);
4023: } else {
4024: byte[] b = new byte[12];
4025: MC68060.mmuPeekExtended (a, b, f);
4026: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4027: elem.exlFloatValue.setx012 (b, 0).mul (y).getx012 (b, 0);
4028: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4029: elem.exlFloatValue.sety012 (b, 0).mul (y).gety012 (b, 0);
4030: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4031: elem.exlFloatValue.setp012 (b, 0).mul (y).getp012 (b, 0);
4032: } else {
4033: elem.exlFloatValue.setnan ();
4034: }
4035: MC68060.mmuPokeExtended (a, b, f);
4036: }
4037: } else {
4038: elem.exlFloatValue.setnan ();
4039: }
4040: break;
4041: default:
4042: elem.exlFloatValue.setnan ();
4043: }
4044: }
4045: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4046: return elem.exlAppendAssignmentOperatorTo (sb, "*=");
4047: }
4048: },
4049:
4050: ETY_OPERATOR_SELF_DIVISION {
4051: @Override protected int etyPriority () {
4052: return EPY_PRIORITY_ASSIGNMENT;
4053: }
4054: @Override protected void etyEval (ExpressionElement elem, int mode) {
4055: int n, a, f;
4056: EFPBox.EFP y = elem.exlParamY.exlEval (mode).exlFloatValue;
4057: switch (elem.exlParamX.exlType) {
4058: case ETY_VARIABLE_FLOAT:
4059: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.div (y));
4060: break;
4061: case ETY_INTEGER_REGISTER:
4062: n = elem.exlParamX.exlSubscript;
4063: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).div (y).geti ());
4064: break;
4065: case ETY_FLOATING_POINT_REGISTER:
4066: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).div (y));
4067: break;
4068: case ETY_PC:
4069: elem.exlWritePC (elem.exlFloatValue.seti (elem.exlReadPC ()).div (y).geti ());
4070: break;
4071: case ETY_CCR:
4072: elem.exlWriteCCR (elem.exlFloatValue.seti (elem.exlReadCCR ()).div (y).geti ());
4073: break;
4074: case ETY_SR:
4075: elem.exlWriteSR (elem.exlFloatValue.seti (elem.exlReadSR ()).div (y).geti ());
4076: break;
4077: case ETY_FLOAT_CONTROL_REGISTER:
4078: n = elem.exlParamX.exlSubscript;
4079: elem.exlWriteFloatControlRegister (n, elem.exlFloatValue.seti (elem.exlReadFloatControlRegister (n)).div (y).geti ());
4080: break;
4081: case ETY_CONTROL_REGISTER:
4082: n = elem.exlParamX.exlSubscript;
4083: elem.exlWriteControlRegister (n, elem.exlFloatValue.seti (elem.exlReadControlRegister (n)).div (y).geti ());
4084: break;
4085: case ETY_SQUARE_BRACKET:
4086: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4087: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4088: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4089: } else {
4090: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4091: f = -1;
4092: }
4093: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).div (y).geti (), f);
4094: break;
4095: case ETY_OPERATOR_SIZE_BYTE:
4096: case ETY_OPERATOR_SIZE_WORD:
4097: case ETY_OPERATOR_SIZE_LONG:
4098: case ETY_OPERATOR_SIZE_QUAD:
4099: case ETY_OPERATOR_SIZE_SINGLE:
4100: case ETY_OPERATOR_SIZE_DOUBLE:
4101: case ETY_OPERATOR_SIZE_EXTENDED:
4102: case ETY_OPERATOR_SIZE_TRIPLE:
4103: case ETY_OPERATOR_SIZE_PACKED:
4104: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
4105: n = elem.exlParamX.exlParamX.exlSubscript;
4106: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4107: elem.exlWriteRegByte (n, elem.exlFloatValue.seti (elem.exlReadRegByte (n)).div (y).geti ());
4108: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4109: elem.exlWriteRegWord (n, elem.exlFloatValue.seti (elem.exlReadRegWord (n)).div (y).geti ());
4110: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4111: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).div (y).geti ());
4112: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4113: elem.exlWriteRegLong (n, elem.exlFloatValue.setf0 (elem.exlReadRegLong (n)).div (y).getf0 ());
4114: } else {
4115: elem.exlFloatValue.setnan ();
4116: }
4117: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4118: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4119: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4120: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4121: } else {
4122: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4123: f = -1;
4124: }
4125: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4126: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).div (y).geti (), f);
4127: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4128: MC68060.mmuPokeWord (a, elem.exlFloatValue.seti (MC68060.mmuPeekWordSign (a, f)).div (y).geti (), f);
4129: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4130: MC68060.mmuPokeLong (a, elem.exlFloatValue.seti (MC68060.mmuPeekLong (a, f)).div (y).geti (), f);
4131: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4132: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setl (MC68060.mmuPeekQuad (a, f)).div (y).getl (), f);
4133: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4134: MC68060.mmuPokeLong (a, elem.exlFloatValue.setf0 (MC68060.mmuPeekLong (a, f)).div (y).getf0 (), f);
4135: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4136: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setd01 (MC68060.mmuPeekQuad (a, f)).div (y).getd01 (), f);
4137: } else {
4138: byte[] b = new byte[12];
4139: MC68060.mmuPeekExtended (a, b, f);
4140: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4141: elem.exlFloatValue.setx012 (b, 0).div (y).getx012 (b, 0);
4142: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4143: elem.exlFloatValue.sety012 (b, 0).div (y).gety012 (b, 0);
4144: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4145: elem.exlFloatValue.setp012 (b, 0).div (y).getp012 (b, 0);
4146: } else {
4147: elem.exlFloatValue.setnan ();
4148: }
4149: MC68060.mmuPokeExtended (a, b, f);
4150: }
4151: } else {
4152: elem.exlFloatValue.setnan ();
4153: }
4154: break;
4155: default:
4156: elem.exlFloatValue.setnan ();
4157: }
4158: }
4159: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4160: return elem.exlAppendAssignmentOperatorTo (sb, "/=");
4161: }
4162: },
4163:
4164: ETY_OPERATOR_SELF_MODULUS {
4165: @Override protected int etyPriority () {
4166: return EPY_PRIORITY_ASSIGNMENT;
4167: }
4168: @Override protected void etyEval (ExpressionElement elem, int mode) {
4169: int n, a, f;
4170: EFPBox.EFP y = elem.exlParamY.exlEval (mode).exlFloatValue;
4171: switch (elem.exlParamX.exlType) {
4172: case ETY_VARIABLE_FLOAT:
4173: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.rem (y));
4174: break;
4175: case ETY_INTEGER_REGISTER:
4176: n = elem.exlParamX.exlSubscript;
4177: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).rem (y).geti ());
4178: break;
4179: case ETY_FLOATING_POINT_REGISTER:
4180: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).rem (y));
4181: break;
4182: case ETY_PC:
4183: elem.exlWritePC (elem.exlFloatValue.seti (elem.exlReadPC ()).rem (y).geti ());
4184: break;
4185: case ETY_CCR:
4186: elem.exlWriteCCR (elem.exlFloatValue.seti (elem.exlReadCCR ()).rem (y).geti ());
4187: break;
4188: case ETY_SR:
4189: elem.exlWriteSR (elem.exlFloatValue.seti (elem.exlReadSR ()).rem (y).geti ());
4190: break;
4191: case ETY_FLOAT_CONTROL_REGISTER:
4192: n = elem.exlParamX.exlSubscript;
4193: elem.exlWriteFloatControlRegister (n, elem.exlFloatValue.seti (elem.exlReadFloatControlRegister (n)).rem (y).geti ());
4194: break;
4195: case ETY_CONTROL_REGISTER:
4196: n = elem.exlParamX.exlSubscript;
4197: elem.exlWriteControlRegister (n, elem.exlFloatValue.seti (elem.exlReadControlRegister (n)).rem (y).geti ());
4198: break;
4199: case ETY_SQUARE_BRACKET:
4200: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4201: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4202: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4203: } else {
4204: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4205: f = -1;
4206: }
4207: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).rem (y).geti (), f);
4208: break;
4209: case ETY_OPERATOR_SIZE_BYTE:
4210: case ETY_OPERATOR_SIZE_WORD:
4211: case ETY_OPERATOR_SIZE_LONG:
4212: case ETY_OPERATOR_SIZE_QUAD:
4213: case ETY_OPERATOR_SIZE_SINGLE:
4214: case ETY_OPERATOR_SIZE_DOUBLE:
4215: case ETY_OPERATOR_SIZE_EXTENDED:
4216: case ETY_OPERATOR_SIZE_TRIPLE:
4217: case ETY_OPERATOR_SIZE_PACKED:
4218: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
4219: n = elem.exlParamX.exlParamX.exlSubscript;
4220: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4221: elem.exlWriteRegByte (n, elem.exlFloatValue.seti (elem.exlReadRegByte (n)).rem (y).geti ());
4222: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4223: elem.exlWriteRegWord (n, elem.exlFloatValue.seti (elem.exlReadRegWord (n)).rem (y).geti ());
4224: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4225: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).rem (y).geti ());
4226: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4227: elem.exlWriteRegLong (n, elem.exlFloatValue.setf0 (elem.exlReadRegLong (n)).rem (y).getf0 ());
4228: } else {
4229: elem.exlFloatValue.setnan ();
4230: }
4231: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4232: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4233: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4234: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4235: } else {
4236: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4237: f = -1;
4238: }
4239: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4240: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).rem (y).geti (), f);
4241: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4242: MC68060.mmuPokeWord (a, elem.exlFloatValue.seti (MC68060.mmuPeekWordSign (a, f)).rem (y).geti (), f);
4243: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4244: MC68060.mmuPokeLong (a, elem.exlFloatValue.seti (MC68060.mmuPeekLong (a, f)).rem (y).geti (), f);
4245: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4246: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setl (MC68060.mmuPeekQuad (a, f)).rem (y).getl (), f);
4247: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4248: MC68060.mmuPokeLong (a, elem.exlFloatValue.setf0 (MC68060.mmuPeekLong (a, f)).rem (y).getf0 (), f);
4249: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4250: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setd01 (MC68060.mmuPeekQuad (a, f)).rem (y).getd01 (), f);
4251: } else {
4252: byte[] b = new byte[12];
4253: MC68060.mmuPeekExtended (a, b, f);
4254: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4255: elem.exlFloatValue.setx012 (b, 0).rem (y).getx012 (b, 0);
4256: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4257: elem.exlFloatValue.sety012 (b, 0).rem (y).gety012 (b, 0);
4258: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4259: elem.exlFloatValue.setp012 (b, 0).rem (y).getp012 (b, 0);
4260: } else {
4261: elem.exlFloatValue.setnan ();
4262: }
4263: MC68060.mmuPokeExtended (a, b, f);
4264: }
4265: } else {
4266: elem.exlFloatValue.setnan ();
4267: }
4268: break;
4269: default:
4270: elem.exlFloatValue.setnan ();
4271: }
4272: }
4273: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4274: return elem.exlAppendAssignmentOperatorTo (sb, "%=");
4275: }
4276: },
4277:
4278: ETY_OPERATOR_SELF_ADDITION {
4279: @Override protected int etyPriority () {
4280: return EPY_PRIORITY_ASSIGNMENT;
4281: }
4282: @Override protected void etyEval (ExpressionElement elem, int mode) {
4283: int n, a, f;
4284: EFPBox.EFP y = elem.exlParamY.exlEval (mode).exlFloatValue;
4285: switch (elem.exlParamX.exlType) {
4286: case ETY_VARIABLE_FLOAT:
4287: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.add (y));
4288: break;
4289: case ETY_INTEGER_REGISTER:
4290: n = elem.exlParamX.exlSubscript;
4291: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).add (y).geti ());
4292: break;
4293: case ETY_FLOATING_POINT_REGISTER:
4294: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).add (y));
4295: break;
4296: case ETY_PC:
4297: elem.exlWritePC (elem.exlFloatValue.seti (elem.exlReadPC ()).add (y).geti ());
4298: break;
4299: case ETY_CCR:
4300: elem.exlWriteCCR (elem.exlFloatValue.seti (elem.exlReadCCR ()).add (y).geti ());
4301: break;
4302: case ETY_SR:
4303: elem.exlWriteSR (elem.exlFloatValue.seti (elem.exlReadSR ()).add (y).geti ());
4304: break;
4305: case ETY_FLOAT_CONTROL_REGISTER:
4306: n = elem.exlParamX.exlSubscript;
4307: elem.exlWriteFloatControlRegister (n, elem.exlFloatValue.seti (elem.exlReadFloatControlRegister (n)).add (y).geti ());
4308: break;
4309: case ETY_CONTROL_REGISTER:
4310: n = elem.exlParamX.exlSubscript;
4311: elem.exlWriteControlRegister (n, elem.exlFloatValue.seti (elem.exlReadControlRegister (n)).add (y).geti ());
4312: break;
4313: case ETY_SQUARE_BRACKET:
4314: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4315: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4316: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4317: } else {
4318: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4319: f = -1;
4320: }
4321: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).add (y).geti (), f);
4322: break;
4323: case ETY_OPERATOR_SIZE_BYTE:
4324: case ETY_OPERATOR_SIZE_WORD:
4325: case ETY_OPERATOR_SIZE_LONG:
4326: case ETY_OPERATOR_SIZE_QUAD:
4327: case ETY_OPERATOR_SIZE_SINGLE:
4328: case ETY_OPERATOR_SIZE_DOUBLE:
4329: case ETY_OPERATOR_SIZE_EXTENDED:
4330: case ETY_OPERATOR_SIZE_TRIPLE:
4331: case ETY_OPERATOR_SIZE_PACKED:
4332: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
4333: n = elem.exlParamX.exlParamX.exlSubscript;
4334: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4335: elem.exlWriteRegByte (n, elem.exlFloatValue.seti (elem.exlReadRegByte (n)).add (y).geti ());
4336: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4337: elem.exlWriteRegWord (n, elem.exlFloatValue.seti (elem.exlReadRegWord (n)).add (y).geti ());
4338: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4339: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).add (y).geti ());
4340: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4341: elem.exlWriteRegLong (n, elem.exlFloatValue.setf0 (elem.exlReadRegLong (n)).add (y).getf0 ());
4342: } else {
4343: elem.exlFloatValue.setnan ();
4344: }
4345: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4346: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4347: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4348: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4349: } else {
4350: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4351: f = -1;
4352: }
4353: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4354: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).add (y).geti (), f);
4355: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4356: MC68060.mmuPokeWord (a, elem.exlFloatValue.seti (MC68060.mmuPeekWordSign (a, f)).add (y).geti (), f);
4357: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4358: MC68060.mmuPokeLong (a, elem.exlFloatValue.seti (MC68060.mmuPeekLong (a, f)).add (y).geti (), f);
4359: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4360: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setl (MC68060.mmuPeekQuad (a, f)).add (y).getl (), f);
4361: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4362: MC68060.mmuPokeLong (a, elem.exlFloatValue.setf0 (MC68060.mmuPeekLong (a, f)).add (y).getf0 (), f);
4363: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4364: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setd01 (MC68060.mmuPeekQuad (a, f)).add (y).getd01 (), f);
4365: } else {
4366: byte[] b = new byte[12];
4367: MC68060.mmuPeekExtended (a, b, f);
4368: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4369: elem.exlFloatValue.setx012 (b, 0).add (y).getx012 (b, 0);
4370: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4371: elem.exlFloatValue.sety012 (b, 0).add (y).gety012 (b, 0);
4372: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4373: elem.exlFloatValue.setp012 (b, 0).add (y).getp012 (b, 0);
4374: } else {
4375: elem.exlFloatValue.setnan ();
4376: }
4377: MC68060.mmuPokeExtended (a, b, f);
4378: }
4379: } else {
4380: elem.exlFloatValue.setnan ();
4381: }
4382: break;
4383: default:
4384: elem.exlFloatValue.setnan ();
4385: }
4386: }
4387: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4388: return elem.exlAppendAssignmentOperatorTo (sb, "+=");
4389: }
4390: },
4391:
4392: ETY_OPERATOR_SELF_SUBTRACTION {
4393: @Override protected int etyPriority () {
4394: return EPY_PRIORITY_ASSIGNMENT;
4395: }
4396: @Override protected void etyEval (ExpressionElement elem, int mode) {
4397: int n, a, f;
4398: EFPBox.EFP y = elem.exlParamY.exlEval (mode).exlFloatValue;
4399: switch (elem.exlParamX.exlType) {
4400: case ETY_VARIABLE_FLOAT:
4401: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.sub (y));
4402: break;
4403: case ETY_INTEGER_REGISTER:
4404: n = elem.exlParamX.exlSubscript;
4405: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).sub (y).geti ());
4406: break;
4407: case ETY_FLOATING_POINT_REGISTER:
4408: elem.exlFloatValue.sete (elem.exlGetFPn (elem.exlParamX.exlSubscript).sub (y));
4409: break;
4410: case ETY_PC:
4411: elem.exlWritePC (elem.exlFloatValue.seti (elem.exlReadPC ()).sub (y).geti ());
4412: break;
4413: case ETY_CCR:
4414: elem.exlWriteCCR (elem.exlFloatValue.seti (elem.exlReadCCR ()).sub (y).geti ());
4415: break;
4416: case ETY_SR:
4417: elem.exlWriteSR (elem.exlFloatValue.seti (elem.exlReadSR ()).sub (y).geti ());
4418: break;
4419: case ETY_FLOAT_CONTROL_REGISTER:
4420: n = elem.exlParamX.exlSubscript;
4421: elem.exlWriteFloatControlRegister (n, elem.exlFloatValue.seti (elem.exlReadFloatControlRegister (n)).sub (y).geti ());
4422: break;
4423: case ETY_CONTROL_REGISTER:
4424: n = elem.exlParamX.exlSubscript;
4425: elem.exlWriteControlRegister (n, elem.exlFloatValue.seti (elem.exlReadControlRegister (n)).sub (y).geti ());
4426: break;
4427: case ETY_SQUARE_BRACKET:
4428: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4429: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4430: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4431: } else {
4432: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4433: f = -1;
4434: }
4435: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).sub (y).geti (), f);
4436: break;
4437: case ETY_OPERATOR_SIZE_BYTE:
4438: case ETY_OPERATOR_SIZE_WORD:
4439: case ETY_OPERATOR_SIZE_LONG:
4440: case ETY_OPERATOR_SIZE_QUAD:
4441: case ETY_OPERATOR_SIZE_SINGLE:
4442: case ETY_OPERATOR_SIZE_DOUBLE:
4443: case ETY_OPERATOR_SIZE_EXTENDED:
4444: case ETY_OPERATOR_SIZE_TRIPLE:
4445: case ETY_OPERATOR_SIZE_PACKED:
4446: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
4447: n = elem.exlParamX.exlParamX.exlSubscript;
4448: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4449: elem.exlWriteRegByte (n, elem.exlFloatValue.seti (elem.exlReadRegByte (n)).sub (y).geti ());
4450: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4451: elem.exlWriteRegWord (n, elem.exlFloatValue.seti (elem.exlReadRegWord (n)).sub (y).geti ());
4452: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4453: elem.exlWriteRegLong (n, elem.exlFloatValue.seti (elem.exlReadRegLong (n)).sub (y).geti ());
4454: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4455: elem.exlWriteRegLong (n, elem.exlFloatValue.setf0 (elem.exlReadRegLong (n)).sub (y).getf0 ());
4456: } else {
4457: elem.exlFloatValue.setnan ();
4458: }
4459: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4460: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4461: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4462: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4463: } else {
4464: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4465: f = -1;
4466: }
4467: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4468: MC68060.mmuPokeByte (a, elem.exlFloatValue.seti (MC68060.mmuPeekByteSign (a, f)).sub (y).geti (), f);
4469: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4470: MC68060.mmuPokeWord (a, elem.exlFloatValue.seti (MC68060.mmuPeekWordSign (a, f)).sub (y).geti (), f);
4471: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4472: MC68060.mmuPokeLong (a, elem.exlFloatValue.seti (MC68060.mmuPeekLong (a, f)).sub (y).geti (), f);
4473: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4474: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setl (MC68060.mmuPeekQuad (a, f)).sub (y).getl (), f);
4475: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4476: MC68060.mmuPokeLong (a, elem.exlFloatValue.setf0 (MC68060.mmuPeekLong (a, f)).sub (y).getf0 (), f);
4477: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4478: MC68060.mmuPokeQuad (a, elem.exlFloatValue.setd01 (MC68060.mmuPeekQuad (a, f)).sub (y).getd01 (), f);
4479: } else {
4480: byte[] b = new byte[12];
4481: MC68060.mmuPeekExtended (a, b, f);
4482: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4483: elem.exlFloatValue.setx012 (b, 0).sub (y).getx012 (b, 0);
4484: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4485: elem.exlFloatValue.sety012 (b, 0).sub (y).gety012 (b, 0);
4486: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4487: elem.exlFloatValue.setp012 (b, 0).sub (y).getp012 (b, 0);
4488: } else {
4489: elem.exlFloatValue.setnan ();
4490: }
4491: MC68060.mmuPokeExtended (a, b, f);
4492: }
4493: } else {
4494: elem.exlFloatValue.setnan ();
4495: }
4496: break;
4497: default:
4498: elem.exlFloatValue.setnan ();
4499: }
4500: }
4501: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4502: return elem.exlAppendAssignmentOperatorTo (sb, "-=");
4503: }
4504: },
4505:
4506: ETY_OPERATOR_SELF_LEFT_SHIFT {
4507: @Override protected int etyPriority () {
4508: return EPY_PRIORITY_ASSIGNMENT;
4509: }
4510: @Override protected void etyEval (ExpressionElement elem, int mode) {
4511: int n, a, f;
4512: int y = elem.exlParamY.exlEval (mode).exlFloatValue.geti ();
4513: switch (elem.exlParamX.exlType) {
4514: case ETY_VARIABLE_FLOAT:
4515: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.setl (elem.exlParamX.exlParamX.exlFloatValue.getl () << y));
4516: break;
4517: case ETY_INTEGER_REGISTER:
4518: n = elem.exlParamX.exlSubscript;
4519: {
4520: int x = (int) ((long) elem.exlReadRegLong (n) << y);
4521: elem.exlFloatValue.seti (x);
4522: elem.exlWriteRegLong (n, x);
4523: }
4524: break;
4525: case ETY_FLOATING_POINT_REGISTER:
4526: n = elem.exlParamX.exlSubscript;
4527: elem.exlSetFPn (n, elem.exlFloatValue.setl (elem.exlGetFPn (n).getl () << y));
4528: break;
4529: case ETY_PC:
4530: {
4531: int x = (int) ((long) elem.exlReadPC () << y);
4532: elem.exlFloatValue.seti (x);
4533: elem.exlWritePC (x);
4534: }
4535: break;
4536: case ETY_CCR:
4537: {
4538: int x = (int) ((long) elem.exlReadCCR () << y);
4539: elem.exlFloatValue.seti (x);
4540: elem.exlWriteCCR (x);
4541: }
4542: break;
4543: case ETY_SR:
4544: {
4545: int x = (int) ((long) elem.exlReadSR () << y);
4546: elem.exlFloatValue.seti (x);
4547: elem.exlWriteSR (x);
4548: }
4549: break;
4550: case ETY_FLOAT_CONTROL_REGISTER:
4551: n = elem.exlParamX.exlSubscript;
4552: {
4553: int x = (int) ((long) elem.exlReadFloatControlRegister (n) << y);
4554: elem.exlFloatValue.seti (x);
4555: elem.exlWriteFloatControlRegister (n, x);
4556: }
4557: break;
4558: case ETY_CONTROL_REGISTER:
4559: n = elem.exlParamX.exlSubscript;
4560: {
4561: int x = (int) ((long) elem.exlReadControlRegister (n) << y);
4562: elem.exlFloatValue.seti (x);
4563: elem.exlWriteControlRegister (n, x);
4564: }
4565: break;
4566: case ETY_SQUARE_BRACKET:
4567: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4568: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4569: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4570: } else {
4571: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4572: f = -1;
4573: }
4574: {
4575: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) << y);
4576: elem.exlFloatValue.seti (x);
4577: MC68060.mmuPokeByte (a, x, f);
4578: }
4579: break;
4580: case ETY_OPERATOR_SIZE_BYTE:
4581: case ETY_OPERATOR_SIZE_WORD:
4582: case ETY_OPERATOR_SIZE_LONG:
4583: case ETY_OPERATOR_SIZE_QUAD:
4584: case ETY_OPERATOR_SIZE_SINGLE:
4585: case ETY_OPERATOR_SIZE_DOUBLE:
4586: case ETY_OPERATOR_SIZE_EXTENDED:
4587: case ETY_OPERATOR_SIZE_TRIPLE:
4588: case ETY_OPERATOR_SIZE_PACKED:
4589: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
4590: n = elem.exlParamX.exlParamX.exlSubscript;
4591: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4592: int x = (byte) ((long) elem.exlReadRegByte (n) << y);
4593: elem.exlFloatValue.seti (x);
4594: elem.exlWriteRegByte (n, x);
4595: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4596: int x = (short) ((long) elem.exlReadRegWord (n) << y);
4597: elem.exlFloatValue.seti (x);
4598: elem.exlWriteRegWord (n, x);
4599: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4600: int x = (int) ((long) elem.exlReadRegLong (n) << y);
4601: elem.exlFloatValue.seti (x);
4602: elem.exlWriteRegLong (n, x);
4603: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4604: float x = (float) ((long) Float.intBitsToFloat (elem.exlReadRegLong (n)) << y);
4605: elem.exlFloatValue.setf (x);
4606: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
4607: } else {
4608: elem.exlFloatValue.setnan ();
4609: }
4610: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4611: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4612: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4613: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4614: } else {
4615: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4616: f = -1;
4617: }
4618: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4619: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) << y);
4620: elem.exlFloatValue.seti (x);
4621: MC68060.mmuPokeByte (a, x, f);
4622: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4623: int x = (short) ((long) MC68060.mmuPeekWordSign (a, f) << y);
4624: elem.exlFloatValue.seti (x);
4625: MC68060.mmuPokeWord (a, x, f);
4626: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4627: int x = (int) ((long) MC68060.mmuPeekLong (a, f) << y);
4628: elem.exlFloatValue.seti (x);
4629: MC68060.mmuPokeLong (a, x, f);
4630: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4631: long x = MC68060.mmuPeekQuad (a, f) << y;
4632: elem.exlFloatValue.setl (x);
4633: MC68060.mmuPokeQuad (a, x, f);
4634: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4635: float x = (float) ((long) Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) << y);
4636: elem.exlFloatValue.setf (x);
4637: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
4638: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4639: double x = (double) ((long) Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) << y);
4640: elem.exlFloatValue.setd (x);
4641: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
4642: } else {
4643: byte[] b = new byte[12];
4644: MC68060.mmuPeekExtended (a, b, f);
4645: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4646: elem.exlFloatValue.setl (elem.exlFloatValue.setx012 (b, 0).getl () << y).getx012 (b, 0);
4647: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4648: elem.exlFloatValue.setl (elem.exlFloatValue.sety012 (b, 0).getl () << y).gety012 (b, 0);
4649: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4650: elem.exlFloatValue.setl (elem.exlFloatValue.setp012 (b, 0).getl () << y).getp012 (b, 0);
4651: } else {
4652: elem.exlFloatValue.setnan ();
4653: }
4654: MC68060.mmuPokeExtended (a, b, f);
4655: }
4656: } else {
4657: elem.exlFloatValue.setnan ();
4658: }
4659: break;
4660: default:
4661: elem.exlFloatValue.setnan ();
4662: }
4663: }
4664: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4665: return elem.exlAppendAssignmentOperatorTo (sb, "<<=");
4666: }
4667: },
4668:
4669: ETY_OPERATOR_SELF_RIGHT_SHIFT {
4670: @Override protected int etyPriority () {
4671: return EPY_PRIORITY_ASSIGNMENT;
4672: }
4673: @Override protected void etyEval (ExpressionElement elem, int mode) {
4674: int n, a, f;
4675: int y = elem.exlParamY.exlEval (mode).exlFloatValue.geti ();
4676: switch (elem.exlParamX.exlType) {
4677: case ETY_VARIABLE_FLOAT:
4678: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.setl (elem.exlParamX.exlParamX.exlFloatValue.getl () >> y));
4679: break;
4680: case ETY_INTEGER_REGISTER:
4681: n = elem.exlParamX.exlSubscript;
4682: {
4683: int x = (int) ((long) elem.exlReadRegLong (n) >> y);
4684: elem.exlFloatValue.seti (x);
4685: elem.exlWriteRegLong (n, x);
4686: }
4687: break;
4688: case ETY_FLOATING_POINT_REGISTER:
4689: n = elem.exlParamX.exlSubscript;
4690: elem.exlSetFPn (n, elem.exlFloatValue.setl (elem.exlGetFPn (n).getl () >> y));
4691: break;
4692: case ETY_PC:
4693: {
4694: int x = (int) ((long) elem.exlReadPC () >> y);
4695: elem.exlFloatValue.seti (x);
4696: elem.exlWritePC (x);
4697: }
4698: break;
4699: case ETY_CCR:
4700: {
4701: int x = (int) ((long) elem.exlReadCCR () >> y);
4702: elem.exlFloatValue.seti (x);
4703: elem.exlWriteCCR (x);
4704: }
4705: break;
4706: case ETY_SR:
4707: {
4708: int x = (int) ((long) elem.exlReadSR () >> y);
4709: elem.exlFloatValue.seti (x);
4710: elem.exlWriteSR (x);
4711: }
4712: break;
4713: case ETY_FLOAT_CONTROL_REGISTER:
4714: n = elem.exlParamX.exlSubscript;
4715: {
4716: int x = (int) ((long) elem.exlReadFloatControlRegister (n) >> y);
4717: elem.exlFloatValue.seti (x);
4718: elem.exlWriteFloatControlRegister (n, x);
4719: }
4720: break;
4721: case ETY_CONTROL_REGISTER:
4722: n = elem.exlParamX.exlSubscript;
4723: {
4724: int x = (int) ((long) elem.exlReadControlRegister (n) >> y);
4725: elem.exlFloatValue.seti (x);
4726: elem.exlWriteControlRegister (n, x);
4727: }
4728: break;
4729: case ETY_SQUARE_BRACKET:
4730: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4731: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4732: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4733: } else {
4734: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4735: f = -1;
4736: }
4737: {
4738: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) >> y);
4739: elem.exlFloatValue.seti (x);
4740: MC68060.mmuPokeByte (a, x, f);
4741: }
4742: break;
4743: case ETY_OPERATOR_SIZE_BYTE:
4744: case ETY_OPERATOR_SIZE_WORD:
4745: case ETY_OPERATOR_SIZE_LONG:
4746: case ETY_OPERATOR_SIZE_QUAD:
4747: case ETY_OPERATOR_SIZE_SINGLE:
4748: case ETY_OPERATOR_SIZE_DOUBLE:
4749: case ETY_OPERATOR_SIZE_EXTENDED:
4750: case ETY_OPERATOR_SIZE_TRIPLE:
4751: case ETY_OPERATOR_SIZE_PACKED:
4752: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
4753: n = elem.exlParamX.exlParamX.exlSubscript;
4754: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4755: int x = (byte) ((long) elem.exlReadRegByte (n) >> y);
4756: elem.exlFloatValue.seti (x);
4757: elem.exlWriteRegByte (n, x);
4758: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4759: int x = (short) ((long) elem.exlReadRegWord (n) >> y);
4760: elem.exlFloatValue.seti (x);
4761: elem.exlWriteRegWord (n, x);
4762: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4763: int x = (int) ((long) elem.exlReadRegLong (n) >> y);
4764: elem.exlFloatValue.seti (x);
4765: elem.exlWriteRegLong (n, x);
4766: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4767: float x = (float) ((long) Float.intBitsToFloat (elem.exlReadRegLong (n)) >> y);
4768: elem.exlFloatValue.setf (x);
4769: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
4770: } else {
4771: elem.exlFloatValue.setnan ();
4772: }
4773: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4774: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4775: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4776: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4777: } else {
4778: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4779: f = -1;
4780: }
4781: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4782: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) >> y);
4783: elem.exlFloatValue.seti (x);
4784: MC68060.mmuPokeByte (a, x, f);
4785: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4786: int x = (short) ((long) MC68060.mmuPeekWordSign (a, f) >> y);
4787: elem.exlFloatValue.seti (x);
4788: MC68060.mmuPokeWord (a, x, f);
4789: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4790: int x = (int) ((long) MC68060.mmuPeekLong (a, f) >> y);
4791: elem.exlFloatValue.seti (x);
4792: MC68060.mmuPokeLong (a, x, f);
4793: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4794: long x = MC68060.mmuPeekQuad (a, f) >> y;
4795: elem.exlFloatValue.setl (x);
4796: MC68060.mmuPokeQuad (a, x, f);
4797: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4798: float x = (float) ((long) Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) >> y);
4799: elem.exlFloatValue.setf (x);
4800: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
4801: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4802: double x = (double) ((long) Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) >> y);
4803: elem.exlFloatValue.setd (x);
4804: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
4805: } else {
4806: byte[] b = new byte[12];
4807: MC68060.mmuPeekExtended (a, b, f);
4808: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4809: elem.exlFloatValue.setl (elem.exlFloatValue.setx012 (b, 0).getl () >> y).getx012 (b, 0);
4810: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4811: elem.exlFloatValue.setl (elem.exlFloatValue.sety012 (b, 0).getl () >> y).gety012 (b, 0);
4812: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4813: elem.exlFloatValue.setl (elem.exlFloatValue.setp012 (b, 0).getl () >> y).getp012 (b, 0);
4814: } else {
4815: elem.exlFloatValue.setnan ();
4816: }
4817: MC68060.mmuPokeExtended (a, b, f);
4818: }
4819: } else {
4820: elem.exlFloatValue.setnan ();
4821: }
4822: break;
4823: default:
4824: elem.exlFloatValue.setnan ();
4825: }
4826: }
4827: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4828: return elem.exlAppendAssignmentOperatorTo (sb, ">>=");
4829: }
4830: },
4831:
4832: ETY_OPERATOR_SELF_UNSIGNED_RIGHT_SHIFT {
4833: @Override protected int etyPriority () {
4834: return EPY_PRIORITY_ASSIGNMENT;
4835: }
4836: @Override protected void etyEval (ExpressionElement elem, int mode) {
4837: int n, a, f;
4838: int y = elem.exlParamY.exlEval (mode).exlFloatValue.geti ();
4839: switch (elem.exlParamX.exlType) {
4840: case ETY_VARIABLE_FLOAT:
4841: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.setl (elem.exlParamX.exlParamX.exlFloatValue.getl () >>> y));
4842: break;
4843: case ETY_INTEGER_REGISTER:
4844: n = elem.exlParamX.exlSubscript;
4845: {
4846: int x = (int) ((long) elem.exlReadRegLong (n) >>> y);
4847: elem.exlFloatValue.seti (x);
4848: elem.exlWriteRegLong (n, x);
4849: }
4850: break;
4851: case ETY_FLOATING_POINT_REGISTER:
4852: n = elem.exlParamX.exlSubscript;
4853: elem.exlSetFPn (n, elem.exlFloatValue.setl (elem.exlGetFPn (n).getl () >>> y));
4854: break;
4855: case ETY_PC:
4856: {
4857: int x = (int) ((long) elem.exlReadPC () >>> y);
4858: elem.exlFloatValue.seti (x);
4859: elem.exlWritePC (x);
4860: }
4861: break;
4862: case ETY_CCR:
4863: {
4864: int x = (int) ((long) elem.exlReadCCR () >>> y);
4865: elem.exlFloatValue.seti (x);
4866: elem.exlWriteCCR (x);
4867: }
4868: break;
4869: case ETY_SR:
4870: {
4871: int x = (int) ((long) elem.exlReadSR () >>> y);
4872: elem.exlFloatValue.seti (x);
4873: elem.exlWriteSR (x);
4874: }
4875: break;
4876: case ETY_FLOAT_CONTROL_REGISTER:
4877: n = elem.exlParamX.exlSubscript;
4878: {
4879: int x = (int) ((long) elem.exlReadFloatControlRegister (n) >>> y);
4880: elem.exlFloatValue.seti (x);
4881: elem.exlWriteFloatControlRegister (n, x);
4882: }
4883: break;
4884: case ETY_CONTROL_REGISTER:
4885: n = elem.exlParamX.exlSubscript;
4886: {
4887: int x = (int) ((long) elem.exlReadControlRegister (n) >>> y);
4888: elem.exlFloatValue.seti (x);
4889: elem.exlWriteControlRegister (n, x);
4890: }
4891: break;
4892: case ETY_SQUARE_BRACKET:
4893: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4894: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4895: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4896: } else {
4897: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4898: f = -1;
4899: }
4900: {
4901: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) >>> y);
4902: elem.exlFloatValue.seti (x);
4903: MC68060.mmuPokeByte (a, x, f);
4904: }
4905: break;
4906: case ETY_OPERATOR_SIZE_BYTE:
4907: case ETY_OPERATOR_SIZE_WORD:
4908: case ETY_OPERATOR_SIZE_LONG:
4909: case ETY_OPERATOR_SIZE_QUAD:
4910: case ETY_OPERATOR_SIZE_SINGLE:
4911: case ETY_OPERATOR_SIZE_DOUBLE:
4912: case ETY_OPERATOR_SIZE_EXTENDED:
4913: case ETY_OPERATOR_SIZE_TRIPLE:
4914: case ETY_OPERATOR_SIZE_PACKED:
4915: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
4916: n = elem.exlParamX.exlParamX.exlSubscript;
4917: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4918: int x = (byte) ((long) elem.exlReadRegByte (n) >>> y);
4919: elem.exlFloatValue.seti (x);
4920: elem.exlWriteRegByte (n, x);
4921: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4922: int x = (short) ((long) elem.exlReadRegWord (n) >>> y);
4923: elem.exlFloatValue.seti (x);
4924: elem.exlWriteRegWord (n, x);
4925: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4926: int x = (int) ((long) elem.exlReadRegLong (n) >>> y);
4927: elem.exlFloatValue.seti (x);
4928: elem.exlWriteRegLong (n, x);
4929: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4930: float x = (float) ((long) Float.intBitsToFloat (elem.exlReadRegLong (n)) >>> y);
4931: elem.exlFloatValue.setf (x);
4932: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
4933: } else {
4934: elem.exlFloatValue.setnan ();
4935: }
4936: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
4937: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
4938: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4939: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
4940: } else {
4941: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
4942: f = -1;
4943: }
4944: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
4945: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) >>> y);
4946: elem.exlFloatValue.seti (x);
4947: MC68060.mmuPokeByte (a, x, f);
4948: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
4949: int x = (short) ((long) MC68060.mmuPeekWordSign (a, f) >>> y);
4950: elem.exlFloatValue.seti (x);
4951: MC68060.mmuPokeWord (a, x, f);
4952: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
4953: int x = (int) ((long) MC68060.mmuPeekLong (a, f) >>> y);
4954: elem.exlFloatValue.seti (x);
4955: MC68060.mmuPokeLong (a, x, f);
4956: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
4957: long x = MC68060.mmuPeekQuad (a, f) >>> y;
4958: elem.exlFloatValue.setl (x);
4959: MC68060.mmuPokeQuad (a, x, f);
4960: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
4961: float x = (float) ((long) Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) >>> y);
4962: elem.exlFloatValue.setf (x);
4963: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
4964: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
4965: double x = (double) ((long) Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) >>> y);
4966: elem.exlFloatValue.setd (x);
4967: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
4968: } else {
4969: byte[] b = new byte[12];
4970: MC68060.mmuPeekExtended (a, b, f);
4971: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
4972: elem.exlFloatValue.setl (elem.exlFloatValue.setx012 (b, 0).getl () >>> y).getx012 (b, 0);
4973: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
4974: elem.exlFloatValue.setl (elem.exlFloatValue.sety012 (b, 0).getl () >>> y).gety012 (b, 0);
4975: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
4976: elem.exlFloatValue.setl (elem.exlFloatValue.setp012 (b, 0).getl () >>> y).getp012 (b, 0);
4977: } else {
4978: elem.exlFloatValue.setnan ();
4979: }
4980: MC68060.mmuPokeExtended (a, b, f);
4981: }
4982: } else {
4983: elem.exlFloatValue.setnan ();
4984: }
4985: break;
4986: default:
4987: elem.exlFloatValue.setnan ();
4988: }
4989: }
4990: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
4991: return elem.exlAppendAssignmentOperatorTo (sb, ">>>=");
4992: }
4993: },
4994:
4995: ETY_OPERATOR_SELF_BITWISE_AND {
4996: @Override protected int etyPriority () {
4997: return EPY_PRIORITY_ASSIGNMENT;
4998: }
4999: @Override protected void etyEval (ExpressionElement elem, int mode) {
5000: int n, a, f;
5001: long y = elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
5002: switch (elem.exlParamX.exlType) {
5003: case ETY_VARIABLE_FLOAT:
5004: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.setl (elem.exlParamX.exlParamX.exlFloatValue.getl () & y));
5005: break;
5006: case ETY_INTEGER_REGISTER:
5007: n = elem.exlParamX.exlSubscript;
5008: {
5009: int x = (int) ((long) elem.exlReadRegLong (n) & y);
5010: elem.exlFloatValue.seti (x);
5011: elem.exlWriteRegLong (n, x);
5012: }
5013: break;
5014: case ETY_FLOATING_POINT_REGISTER:
5015: n = elem.exlParamX.exlSubscript;
5016: elem.exlSetFPn (n, elem.exlFloatValue.setl (elem.exlGetFPn (n).getl () & y));
5017: break;
5018: case ETY_PC:
5019: {
5020: int x = (int) ((long) elem.exlReadPC () & y);
5021: elem.exlFloatValue.seti (x);
5022: elem.exlWritePC (x);
5023: }
5024: break;
5025: case ETY_CCR:
5026: {
5027: int x = (int) ((long) elem.exlReadCCR () & y);
5028: elem.exlFloatValue.seti (x);
5029: elem.exlWriteCCR (x);
5030: }
5031: break;
5032: case ETY_SR:
5033: {
5034: int x = (int) ((long) elem.exlReadSR () & y);
5035: elem.exlFloatValue.seti (x);
5036: elem.exlWriteSR (x);
5037: }
5038: break;
5039: case ETY_FLOAT_CONTROL_REGISTER:
5040: n = elem.exlParamX.exlSubscript;
5041: {
5042: int x = (int) ((long) elem.exlReadFloatControlRegister (n) & y);
5043: elem.exlFloatValue.seti (x);
5044: elem.exlWriteFloatControlRegister (n, x);
5045: }
5046: break;
5047: case ETY_CONTROL_REGISTER:
5048: n = elem.exlParamX.exlSubscript;
5049: {
5050: int x = (int) ((long) elem.exlReadControlRegister (n) & y);
5051: elem.exlFloatValue.seti (x);
5052: elem.exlWriteControlRegister (n, x);
5053: }
5054: break;
5055: case ETY_SQUARE_BRACKET:
5056: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
5057: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5058: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
5059: } else {
5060: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5061: f = -1;
5062: }
5063: {
5064: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) & y);
5065: elem.exlFloatValue.seti (x);
5066: MC68060.mmuPokeByte (a, x, f);
5067: }
5068: break;
5069: case ETY_OPERATOR_SIZE_BYTE:
5070: case ETY_OPERATOR_SIZE_WORD:
5071: case ETY_OPERATOR_SIZE_LONG:
5072: case ETY_OPERATOR_SIZE_QUAD:
5073: case ETY_OPERATOR_SIZE_SINGLE:
5074: case ETY_OPERATOR_SIZE_DOUBLE:
5075: case ETY_OPERATOR_SIZE_EXTENDED:
5076: case ETY_OPERATOR_SIZE_TRIPLE:
5077: case ETY_OPERATOR_SIZE_PACKED:
5078: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
5079: n = elem.exlParamX.exlParamX.exlSubscript;
5080: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
5081: int x = (byte) ((long) elem.exlReadRegByte (n) & y);
5082: elem.exlFloatValue.seti (x);
5083: elem.exlWriteRegByte (n, x);
5084: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
5085: int x = (short) ((long) elem.exlReadRegWord (n) & y);
5086: elem.exlFloatValue.seti (x);
5087: elem.exlWriteRegWord (n, x);
5088: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
5089: int x = (int) ((long) elem.exlReadRegLong (n) & y);
5090: elem.exlFloatValue.seti (x);
5091: elem.exlWriteRegLong (n, x);
5092: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
5093: float x = (float) ((long) Float.intBitsToFloat (elem.exlReadRegLong (n)) & y);
5094: elem.exlFloatValue.setf (x);
5095: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
5096: } else {
5097: elem.exlFloatValue.setnan ();
5098: }
5099: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
5100: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
5101: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5102: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
5103: } else {
5104: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5105: f = -1;
5106: }
5107: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
5108: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) & y);
5109: elem.exlFloatValue.seti (x);
5110: MC68060.mmuPokeByte (a, x, f);
5111: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
5112: int x = (short) ((long) MC68060.mmuPeekWordSign (a, f) & y);
5113: elem.exlFloatValue.seti (x);
5114: MC68060.mmuPokeWord (a, x, f);
5115: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
5116: int x = (int) ((long) MC68060.mmuPeekLong (a, f) & y);
5117: elem.exlFloatValue.seti (x);
5118: MC68060.mmuPokeLong (a, x, f);
5119: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
5120: long x = MC68060.mmuPeekQuad (a, f) & y;
5121: elem.exlFloatValue.setl (x);
5122: MC68060.mmuPokeQuad (a, x, f);
5123: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
5124: float x = (float) ((long) Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) & y);
5125: elem.exlFloatValue.setf (x);
5126: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
5127: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
5128: double x = (double) ((long) Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) & y);
5129: elem.exlFloatValue.setd (x);
5130: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
5131: } else {
5132: byte[] b = new byte[12];
5133: MC68060.mmuPeekExtended (a, b, f);
5134: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
5135: elem.exlFloatValue.setl (elem.exlFloatValue.setx012 (b, 0).getl () & y).getx012 (b, 0);
5136: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
5137: elem.exlFloatValue.setl (elem.exlFloatValue.sety012 (b, 0).getl () & y).gety012 (b, 0);
5138: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
5139: elem.exlFloatValue.setl (elem.exlFloatValue.setp012 (b, 0).getl () & y).getp012 (b, 0);
5140: } else {
5141: elem.exlFloatValue.setnan ();
5142: }
5143: MC68060.mmuPokeExtended (a, b, f);
5144: }
5145: } else {
5146: elem.exlFloatValue.setnan ();
5147: }
5148: break;
5149: default:
5150: elem.exlFloatValue.setnan ();
5151: }
5152: }
5153: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5154: return elem.exlAppendAssignmentOperatorTo (sb, "&=");
5155: }
5156: },
5157:
5158: ETY_OPERATOR_SELF_BITWISE_XOR {
5159: @Override protected int etyPriority () {
5160: return EPY_PRIORITY_ASSIGNMENT;
5161: }
5162: @Override protected void etyEval (ExpressionElement elem, int mode) {
5163: int n, a, f;
5164: long y = elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
5165: switch (elem.exlParamX.exlType) {
5166: case ETY_VARIABLE_FLOAT:
5167: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.setl (elem.exlParamX.exlParamX.exlFloatValue.getl () ^ y));
5168: break;
5169: case ETY_INTEGER_REGISTER:
5170: n = elem.exlParamX.exlSubscript;
5171: {
5172: int x = (int) ((long) elem.exlReadRegLong (n) ^ y);
5173: elem.exlFloatValue.seti (x);
5174: elem.exlWriteRegLong (n, x);
5175: }
5176: break;
5177: case ETY_FLOATING_POINT_REGISTER:
5178: n = elem.exlParamX.exlSubscript;
5179: elem.exlSetFPn (n, elem.exlFloatValue.setl (elem.exlGetFPn (n).getl () ^ y));
5180: break;
5181: case ETY_PC:
5182: {
5183: int x = (int) ((long) elem.exlReadPC () ^ y);
5184: elem.exlFloatValue.seti (x);
5185: elem.exlWritePC (x);
5186: }
5187: break;
5188: case ETY_CCR:
5189: {
5190: int x = (int) ((long) elem.exlReadCCR () ^ y);
5191: elem.exlFloatValue.seti (x);
5192: elem.exlWriteCCR (x);
5193: }
5194: break;
5195: case ETY_SR:
5196: {
5197: int x = (int) ((long) elem.exlReadSR () ^ y);
5198: elem.exlFloatValue.seti (x);
5199: elem.exlWriteSR (x);
5200: }
5201: break;
5202: case ETY_FLOAT_CONTROL_REGISTER:
5203: n = elem.exlParamX.exlSubscript;
5204: {
5205: int x = (int) ((long) elem.exlReadFloatControlRegister (n) ^ y);
5206: elem.exlFloatValue.seti (x);
5207: elem.exlWriteFloatControlRegister (n, x);
5208: }
5209: break;
5210: case ETY_CONTROL_REGISTER:
5211: n = elem.exlParamX.exlSubscript;
5212: {
5213: int x = (int) ((long) elem.exlReadControlRegister (n) ^ y);
5214: elem.exlFloatValue.seti (x);
5215: elem.exlWriteControlRegister (n, x);
5216: }
5217: break;
5218: case ETY_SQUARE_BRACKET:
5219: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
5220: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5221: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
5222: } else {
5223: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5224: f = -1;
5225: }
5226: {
5227: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) ^ y);
5228: elem.exlFloatValue.seti (x);
5229: MC68060.mmuPokeByte (a, x, f);
5230: }
5231: break;
5232: case ETY_OPERATOR_SIZE_BYTE:
5233: case ETY_OPERATOR_SIZE_WORD:
5234: case ETY_OPERATOR_SIZE_LONG:
5235: case ETY_OPERATOR_SIZE_QUAD:
5236: case ETY_OPERATOR_SIZE_SINGLE:
5237: case ETY_OPERATOR_SIZE_DOUBLE:
5238: case ETY_OPERATOR_SIZE_EXTENDED:
5239: case ETY_OPERATOR_SIZE_TRIPLE:
5240: case ETY_OPERATOR_SIZE_PACKED:
5241: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
5242: n = elem.exlParamX.exlParamX.exlSubscript;
5243: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
5244: int x = (byte) ((long) elem.exlReadRegByte (n) ^ y);
5245: elem.exlFloatValue.seti (x);
5246: elem.exlWriteRegByte (n, x);
5247: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
5248: int x = (short) ((long) elem.exlReadRegWord (n) ^ y);
5249: elem.exlFloatValue.seti (x);
5250: elem.exlWriteRegWord (n, x);
5251: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
5252: int x = (int) ((long) elem.exlReadRegLong (n) ^ y);
5253: elem.exlFloatValue.seti (x);
5254: elem.exlWriteRegLong (n, x);
5255: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
5256: float x = (float) ((long) Float.intBitsToFloat (elem.exlReadRegLong (n)) ^ y);
5257: elem.exlFloatValue.setf (x);
5258: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
5259: } else {
5260: elem.exlFloatValue.setnan ();
5261: }
5262: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
5263: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
5264: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5265: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
5266: } else {
5267: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5268: f = -1;
5269: }
5270: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
5271: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) ^ y);
5272: elem.exlFloatValue.seti (x);
5273: MC68060.mmuPokeByte (a, x, f);
5274: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
5275: int x = (short) ((long) MC68060.mmuPeekWordSign (a, f) ^ y);
5276: elem.exlFloatValue.seti (x);
5277: MC68060.mmuPokeWord (a, x, f);
5278: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
5279: int x = (int) ((long) MC68060.mmuPeekLong (a, f) ^ y);
5280: elem.exlFloatValue.seti (x);
5281: MC68060.mmuPokeLong (a, x, f);
5282: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
5283: long x = MC68060.mmuPeekQuad (a, f) ^ y;
5284: elem.exlFloatValue.setl (x);
5285: MC68060.mmuPokeQuad (a, x, f);
5286: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
5287: float x = (float) ((long) Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) ^ y);
5288: elem.exlFloatValue.setf (x);
5289: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
5290: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
5291: double x = (double) ((long) Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) ^ y);
5292: elem.exlFloatValue.setd (x);
5293: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
5294: } else {
5295: byte[] b = new byte[12];
5296: MC68060.mmuPeekExtended (a, b, f);
5297: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
5298: elem.exlFloatValue.setl (elem.exlFloatValue.setx012 (b, 0).getl () ^ y).getx012 (b, 0);
5299: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
5300: elem.exlFloatValue.setl (elem.exlFloatValue.sety012 (b, 0).getl () ^ y).gety012 (b, 0);
5301: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
5302: elem.exlFloatValue.setl (elem.exlFloatValue.setp012 (b, 0).getl () ^ y).getp012 (b, 0);
5303: } else {
5304: elem.exlFloatValue.setnan ();
5305: }
5306: MC68060.mmuPokeExtended (a, b, f);
5307: }
5308: } else {
5309: elem.exlFloatValue.setnan ();
5310: }
5311: break;
5312: default:
5313: elem.exlFloatValue.setnan ();
5314: }
5315: }
5316: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5317: return elem.exlAppendAssignmentOperatorTo (sb, "^=");
5318: }
5319: },
5320:
5321: ETY_OPERATOR_SELF_BITWISE_OR {
5322: @Override protected int etyPriority () {
5323: return EPY_PRIORITY_ASSIGNMENT;
5324: }
5325: @Override protected void etyEval (ExpressionElement elem, int mode) {
5326: int n, a, f;
5327: long y = elem.exlParamY.exlEval (mode).exlFloatValue.getl ();
5328: switch (elem.exlParamX.exlType) {
5329: case ETY_VARIABLE_FLOAT:
5330: elem.exlFloatValue.sete (elem.exlParamX.exlParamX.exlFloatValue.setl (elem.exlParamX.exlParamX.exlFloatValue.getl () | y));
5331: break;
5332: case ETY_INTEGER_REGISTER:
5333: n = elem.exlParamX.exlSubscript;
5334: {
5335: int x = (int) ((long) elem.exlReadRegLong (n) | y);
5336: elem.exlFloatValue.seti (x);
5337: elem.exlWriteRegLong (n, x);
5338: }
5339: break;
5340: case ETY_FLOATING_POINT_REGISTER:
5341: n = elem.exlParamX.exlSubscript;
5342: elem.exlSetFPn (n, elem.exlFloatValue.setl (elem.exlGetFPn (n).getl () | y));
5343: break;
5344: case ETY_PC:
5345: {
5346: int x = (int) ((long) elem.exlReadPC () | y);
5347: elem.exlFloatValue.seti (x);
5348: elem.exlWritePC (x);
5349: }
5350: break;
5351: case ETY_CCR:
5352: {
5353: int x = (int) ((long) elem.exlReadCCR () | y);
5354: elem.exlFloatValue.seti (x);
5355: elem.exlWriteCCR (x);
5356: }
5357: break;
5358: case ETY_SR:
5359: {
5360: int x = (int) ((long) elem.exlReadSR () | y);
5361: elem.exlFloatValue.seti (x);
5362: elem.exlWriteSR (x);
5363: }
5364: break;
5365: case ETY_FLOAT_CONTROL_REGISTER:
5366: n = elem.exlParamX.exlSubscript;
5367: {
5368: int x = (int) ((long) elem.exlReadFloatControlRegister (n) | y);
5369: elem.exlFloatValue.seti (x);
5370: elem.exlWriteFloatControlRegister (n, x);
5371: }
5372: break;
5373: case ETY_CONTROL_REGISTER:
5374: n = elem.exlParamX.exlSubscript;
5375: {
5376: int x = (int) ((long) elem.exlReadControlRegister (n) | y);
5377: elem.exlFloatValue.seti (x);
5378: elem.exlWriteControlRegister (n, x);
5379: }
5380: break;
5381: case ETY_SQUARE_BRACKET:
5382: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
5383: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5384: f = elem.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
5385: } else {
5386: a = elem.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5387: f = -1;
5388: }
5389: {
5390: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) | y);
5391: elem.exlFloatValue.seti (x);
5392: MC68060.mmuPokeByte (a, x, f);
5393: }
5394: break;
5395: case ETY_OPERATOR_SIZE_BYTE:
5396: case ETY_OPERATOR_SIZE_WORD:
5397: case ETY_OPERATOR_SIZE_LONG:
5398: case ETY_OPERATOR_SIZE_QUAD:
5399: case ETY_OPERATOR_SIZE_SINGLE:
5400: case ETY_OPERATOR_SIZE_DOUBLE:
5401: case ETY_OPERATOR_SIZE_EXTENDED:
5402: case ETY_OPERATOR_SIZE_TRIPLE:
5403: case ETY_OPERATOR_SIZE_PACKED:
5404: if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) {
5405: n = elem.exlParamX.exlParamX.exlSubscript;
5406: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
5407: int x = (byte) ((long) elem.exlReadRegByte (n) | y);
5408: elem.exlFloatValue.seti (x);
5409: elem.exlWriteRegByte (n, x);
5410: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
5411: int x = (short) ((long) elem.exlReadRegWord (n) | y);
5412: elem.exlFloatValue.seti (x);
5413: elem.exlWriteRegWord (n, x);
5414: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
5415: int x = (int) ((long) elem.exlReadRegLong (n) | y);
5416: elem.exlFloatValue.seti (x);
5417: elem.exlWriteRegLong (n, x);
5418: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
5419: float x = (float) ((long) Float.intBitsToFloat (elem.exlReadRegLong (n)) | y);
5420: elem.exlFloatValue.setf (x);
5421: elem.exlWriteRegLong (n, Float.floatToIntBits (x));
5422: } else {
5423: elem.exlFloatValue.setnan ();
5424: }
5425: } else if (elem.exlParamX.exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET) {
5426: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_AT) {
5427: a = elem.exlParamX.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5428: f = elem.exlParamX.exlParamX.exlParamX.exlParamY.exlEval (mode).exlFloatValue.geti ();
5429: } else {
5430: a = elem.exlParamX.exlParamX.exlParamX.exlEval (mode).exlFloatValue.geti ();
5431: f = -1;
5432: }
5433: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE) {
5434: int x = (byte) ((long) MC68060.mmuPeekByteSign (a, f) | y);
5435: elem.exlFloatValue.seti (x);
5436: MC68060.mmuPokeByte (a, x, f);
5437: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_WORD) {
5438: int x = (short) ((long) MC68060.mmuPeekWordSign (a, f) | y);
5439: elem.exlFloatValue.seti (x);
5440: MC68060.mmuPokeWord (a, x, f);
5441: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) {
5442: int x = (int) ((long) MC68060.mmuPeekLong (a, f) | y);
5443: elem.exlFloatValue.seti (x);
5444: MC68060.mmuPokeLong (a, x, f);
5445: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD) {
5446: long x = MC68060.mmuPeekQuad (a, f) | y;
5447: elem.exlFloatValue.setl (x);
5448: MC68060.mmuPokeQuad (a, x, f);
5449: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) {
5450: float x = (float) ((long) Float.intBitsToFloat (MC68060.mmuPeekLong (a, f)) | y);
5451: elem.exlFloatValue.setf (x);
5452: MC68060.mmuPokeLong (a, Float.floatToIntBits (x), f);
5453: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE) {
5454: double x = (double) ((long) Double.longBitsToDouble (MC68060.mmuPeekQuad (a, f)) | y);
5455: elem.exlFloatValue.setd (x);
5456: MC68060.mmuPokeQuad (a, Double.doubleToLongBits (x), f);
5457: } else {
5458: byte[] b = new byte[12];
5459: MC68060.mmuPeekExtended (a, b, f);
5460: if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED) {
5461: elem.exlFloatValue.setl (elem.exlFloatValue.setx012 (b, 0).getl () | y).getx012 (b, 0);
5462: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE) {
5463: elem.exlFloatValue.setl (elem.exlFloatValue.sety012 (b, 0).getl () | y).gety012 (b, 0);
5464: } else if (elem.exlParamX.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) {
5465: elem.exlFloatValue.setl (elem.exlFloatValue.setp012 (b, 0).getl () | y).getp012 (b, 0);
5466: } else {
5467: elem.exlFloatValue.setnan ();
5468: }
5469: MC68060.mmuPokeExtended (a, b, f);
5470: }
5471: } else {
5472: elem.exlFloatValue.setnan ();
5473: }
5474: break;
5475: default:
5476: elem.exlFloatValue.setnan ();
5477: }
5478: }
5479: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5480: return elem.exlAppendAssignmentOperatorTo (sb, "|=");
5481: }
5482: },
5483:
5484:
5485: ETY_OPERATOR_ASSIGN_STRING_TO_VARIABLE {
5486: @Override protected int etyPriority () {
5487: return EPY_PRIORITY_ASSIGNMENT;
5488: }
5489: @Override protected void etyEval (ExpressionElement elem, int mode) {
5490: elem.exlStringValue = elem.exlParamX.exlParamX.exlStringValue = elem.exlParamY.exlEval (mode).exlStringValue;
5491: }
5492: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5493: return elem.exlAppendAssignmentOperatorTo (sb, "=");
5494: }
5495: },
5496:
5497: ETY_OPERATOR_CONCAT_STRING_TO_VARIABLE {
5498: @Override protected int etyPriority () {
5499: return EPY_PRIORITY_ASSIGNMENT;
5500: }
5501: @Override protected void etyEval (ExpressionElement elem, int mode) {
5502: elem.exlStringValue = elem.exlParamX.exlParamX.exlStringValue += elem.exlParamY.exlEval (mode).exlStringValue;
5503: }
5504: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5505: return elem.exlAppendAssignmentOperatorTo (sb, "+=");
5506: }
5507: },
5508:
5509: ETY_OPERATOR_ASSIGN_STRING_TO_MEMORY {
5510: @Override protected int etyPriority () {
5511: return EPY_PRIORITY_ASSIGNMENT;
5512: }
5513: @Override protected void etyEval (ExpressionElement elem, int mode) {
5514: ExpressionElement valueA = elem.exlParamX.exlParamX.exlEval (mode);
5515: ExpressionElement valueY = elem.exlParamY.exlEval (mode);
5516: int a = valueA.exlFloatValue.geti ();
5517: int f = valueA.exlType == ElementType.ETY_OPERATOR_AT ? valueA.exlParamY.exlFloatValue.geti () : -1;
5518: elem.exlStringValue = MC68060.mmuPokeStringZ (a, valueY.exlStringValue, f);
5519: }
5520: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5521: return elem.exlAppendAssignmentOperatorTo (sb, "=");
5522: }
5523: },
5524:
5525: ETY_OPERATOR_CONCAT_STRING_TO_MEMORY {
5526: @Override protected int etyPriority () {
5527: return EPY_PRIORITY_ASSIGNMENT;
5528: }
5529: @Override protected void etyEval (ExpressionElement elem, int mode) {
5530: ExpressionElement valueA = elem.exlParamX.exlParamX.exlEval (mode);
5531: ExpressionElement valueY = elem.exlParamY.exlEval (mode);
5532: int a = valueA.exlFloatValue.geti ();
5533: int f = valueA.exlType == ElementType.ETY_OPERATOR_AT ? valueA.exlParamY.exlFloatValue.geti () : -1;
5534: elem.exlStringValue = MC68060.mmuPokeStringZ (a, MC68060.mmuPeekStringZ (a, f) + valueY.exlStringValue, f);
5535: }
5536: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5537: return elem.exlAppendAssignmentOperatorTo (sb, "+=");
5538: }
5539: },
5540:
5541:
5542: ETY_OPERATOR_COLON {
5543: @Override protected int etyPriority () {
5544: return EPY_PRIORITY_COLON;
5545: }
5546: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5547: return elem.exlAppendBinaryOperatorTo (sb, ":");
5548: }
5549: },
5550:
5551:
5552: ETY_OPERATOR_COMMA {
5553: @Override protected int etyPriority () {
5554: return EPY_PRIORITY_COMMA;
5555: }
5556: @Override protected void etyEval (ExpressionElement elem, int mode) {
5557: elem.exlParamX.exlEval (mode);
5558: elem.exlParamY.exlEval (mode);
5559: if (elem.exlParamY.exlType == ElementType.ETY_FLOAT) {
5560:
5561: elem.exlFloatValue.sete (elem.exlParamY.exlFloatValue);
5562: } else if (elem.exlParamY.exlType == ElementType.ETY_STRING) {
5563:
5564: elem.exlStringValue = elem.exlParamY.exlStringValue;
5565: }
5566: }
5567: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5568: return elem.exlAppendBinaryOperatorTo (sb, ",");
5569: }
5570: },
5571:
5572:
5573:
5574:
5575:
5576: ETY_COMMAND_ASSEMBLE {
5577: @Override protected int etyPriority () {
5578: return EPY_PRIORITY_COMMAND;
5579: }
5580: @Override protected void etyEval (ExpressionElement elem, int mode) {
5581: if (DebugConsole.dgtAssemblePC == 0) {
5582: DebugConsole.dgtAssemblePC = XEiJ.regPC;
5583: }
5584: if (elem.exlParamX != null) {
5585: ExpressionElement[] paramList = elem.exlParamX.exlEvalCommaList (mode);
5586: if (0 < paramList.length) {
5587: ExpressionElement param = paramList[0];
5588: if (param.exlType == ElementType.ETY_OPERATOR_AT) {
5589: DebugConsole.dgtAssemblePC = param.exlParamX.exlFloatValue.geti ();
5590: DebugConsole.dgtAssembleFC = param.exlParamY.exlFloatValue.geti ();
5591: } else if (param.exlValueType == ElementType.ETY_FLOAT) {
5592: DebugConsole.dgtAssemblePC = param.exlFloatValue.geti ();
5593: DebugConsole.dgtAssembleFC = XEiJ.regSRS == 0 ? 2 : 6;
5594: }
5595: }
5596: }
5597:
5598: DebugConsole.dgtMakeAssemblerPrompt ();
5599:
5600: DebugConsole.dgtPrint (Multilingual.mlnJapanese ?
5601: "[ . で終了]\n" :
5602: "[enter . to exit]\n");
5603: DebugConsole.dgtInputMode = DebugConsole.DGT_INPUT_MODE_ASSEMBLER;
5604: DebugConsole.dgtPrintPrompt ();
5605: }
5606: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5607: sb.append ("a");
5608: if (elem.exlParamX != null) {
5609: elem.exlParamX.exlAppendTo (sb.append (' '));
5610: }
5611: return sb;
5612: }
5613: },
5614:
5615:
5616:
5617:
5618: ETY_COMMAND_DUMP {
5619: @Override protected int etyPriority () {
5620: return EPY_PRIORITY_COMMAND;
5621: }
5622: @Override protected void etyEval (ExpressionElement elem, int mode) {
5623: int size = elem.exlSubscript;
5624:
5625: int lineSize = 16;
5626: EFPBox.EFP tmpF = null;
5627: switch (size) {
5628:
5629:
5630:
5631:
5632: case 's':
5633: lineSize = 4;
5634: tmpF = XEiJ.fpuBox.new EFP ();
5635: break;
5636: case 'd':
5637: lineSize = 8;
5638: tmpF = XEiJ.fpuBox.new EFP ();
5639: break;
5640: case 'x':
5641: case 't':
5642: case 'p':
5643: lineSize = 12;
5644: tmpF = XEiJ.fpuBox.new EFP ();
5645: break;
5646: }
5647:
5648: int pageAddress = DebugConsole.dgtDumpAddress;
5649: int pageSize = lineSize * 16;
5650: if (elem.exlParamX != null) {
5651: ExpressionElement[] list = elem.exlParamX.exlEvalCommaList (mode);
5652: if (0 < list.length) {
5653: ExpressionElement param = list[0];
5654: if (param.exlType == ElementType.ETY_OPERATOR_AT) {
5655: pageAddress = param.exlParamX.exlFloatValue.geti ();
5656: DebugConsole.dgtDumpFunctionCode = param.exlParamY.exlFloatValue.geti ();
5657: } else if (param.exlValueType == ElementType.ETY_FLOAT) {
5658: pageAddress = param.exlFloatValue.geti ();
5659: DebugConsole.dgtDumpFunctionCode = XEiJ.regSRS == 0 ? 1 : 5;
5660: }
5661: if (1 < list.length) {
5662: param = list[1];
5663: if (param.exlType == ElementType.ETY_OPERATOR_AT) {
5664: pageSize = param.exlParamX.exlFloatValue.geti () - pageAddress;
5665: } else if (param.exlValueType == ElementType.ETY_FLOAT) {
5666: pageSize = param.exlFloatValue.geti () - pageAddress;
5667: }
5668: }
5669: }
5670: }
5671: if ((pageSize & -65536) != 0) {
5672: pageSize = lineSize * 16;
5673: }
5674: pageSize = Math.max (1, (pageSize + lineSize - 1) / lineSize) * lineSize;
5675: DebugConsole.dgtDumpAddress = pageAddress + pageSize;
5676: int supervisor = DebugConsole.dgtDumpFunctionCode & 4;
5677:
5678: StringBuilder sb = new StringBuilder ();
5679: for (int lineOffset = 0; lineOffset < pageSize; lineOffset += lineSize) {
5680: int lineAddress = pageAddress + lineOffset;
5681:
5682: XEiJ.fmtHex8 (sb, lineAddress);
5683:
5684: switch (size) {
5685: case 'b':
5686: for (int o = 0; o < lineSize; o++) {
5687: XEiJ.fmtHex2 (sb.append ((o & 3) == 0 ? " " : " "), MC68060.mmuPeekByteZeroData (lineAddress + o, supervisor));
5688: }
5689: break;
5690: case 'w':
5691: for (int o = 0; o < lineSize; o += 2) {
5692: XEiJ.fmtHex4 (sb.append ((o & 7) == 0 ? " " : " "), MC68060.mmuPeekWordZeroData (lineAddress + o, supervisor));
5693: }
5694: break;
5695: case 'l':
5696: for (int o = 0; o < lineSize; o += 4) {
5697: XEiJ.fmtHex8 (sb.append (o == 0 ? " " : " "), MC68060.mmuPeekLongData (lineAddress + o, supervisor));
5698: }
5699: break;
5700: case 'q':
5701: for (int o = 0; o < lineSize; o += 8) {
5702: XEiJ.fmtHex16 (sb.append (o == 0 ? " " : " "), MC68060.mmuPeekQuadData (lineAddress + o, supervisor));
5703: }
5704: break;
5705: case 's':
5706: {
5707: String s = tmpF.setf0 (MC68060.mmuPeekLongData (lineAddress, supervisor)).toString ();
5708: sb.append (" ").append (s).append (XEiJ.DBG_SPACES, 0, Math.max (0, 35 - s.length ()));
5709: }
5710: break;
5711: case 'd':
5712: {
5713: String s = tmpF.setd01 (MC68060.mmuPeekQuadData (lineAddress, supervisor)).toString ();
5714: sb.append (" ").append (s).append (XEiJ.DBG_SPACES, 0, Math.max (0, 35 - s.length ()));
5715: }
5716: break;
5717: case 'x':
5718: {
5719: String s = tmpF.setx012 (MC68060.mmuPeekLongData (lineAddress, supervisor),
5720: MC68060.mmuPeekQuadData (lineAddress + 4, supervisor)).toString ();
5721: sb.append (" ").append (s).append (XEiJ.DBG_SPACES, 0, Math.max (0, 35 - s.length ()));
5722: }
5723: break;
5724: case 't':
5725: {
5726: String s = tmpF.sety012 (MC68060.mmuPeekLongData (lineAddress, supervisor),
5727: MC68060.mmuPeekQuadData (lineAddress + 4, supervisor)).toString ();
5728: sb.append (" ").append (s).append (XEiJ.DBG_SPACES, 0, Math.max (0, 35 - s.length ()));
5729: }
5730: break;
5731: case 'p':
5732: {
5733: String s = tmpF.setp012 (MC68060.mmuPeekLongData (lineAddress, supervisor),
5734: MC68060.mmuPeekQuadData (lineAddress + 4, supervisor)).toString ();
5735: sb.append (" ").append (s).append (XEiJ.DBG_SPACES, 0, Math.max (0, 35 - s.length ()));
5736: }
5737: break;
5738: }
5739:
5740: sb.append (" ");
5741: for (int o = 0; o < lineSize; o++) {
5742: int a = lineAddress + o;
5743: int h = MC68060.mmuPeekByteZeroData (a, supervisor);
5744: int c;
5745: if (0x81 <= h && h <= 0x9f || 0xe0 <= h && h <= 0xef) {
5746: int l = MC68060.mmuPeekByteZeroData (a + 1, supervisor);
5747: if (0x40 <= l && l != 0x7f && l <= 0xfc) {
5748: c = CharacterCode.chrSJISToChar[h << 8 | l];
5749: if (c == 0) {
5750: c = '※';
5751: }
5752: o++;
5753: } else {
5754: c = '.';
5755: }
5756: } else {
5757: c = CharacterCode.chrSJISToChar[h];
5758: if (c < 0x20 || c == 0x7f) {
5759: c = '.';
5760: }
5761: }
5762: sb.append ((char) c);
5763: }
5764: sb.append ('\n');
5765: }
5766: DebugConsole.dgtPrint (sb.toString ());
5767: }
5768: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5769: return sb.append ("d").append ((char) elem.exlSubscript);
5770: }
5771: },
5772:
5773:
5774:
5775:
5776: ETY_COMMAND_FILL {
5777: @Override protected int etyPriority () {
5778: return EPY_PRIORITY_COMMAND;
5779: }
5780: @Override protected void etyEval (ExpressionElement elem, int mode) {
5781: int size = elem.exlSubscript;
5782:
5783:
5784: ExpressionElement[] list = elem.exlParamX.exlEvalCommaList (mode);
5785:
5786: ExpressionElement param = list[0];
5787: if (param.exlValueType != ElementType.ETY_FLOAT) {
5788: DebugConsole.dgtPrintln ("引数の型が違います\n");
5789: return;
5790: }
5791: int startAddress;
5792: int functionCode;
5793: if (param.exlType == ElementType.ETY_OPERATOR_AT) {
5794: startAddress = param.exlParamX.exlFloatValue.geti ();
5795: functionCode = param.exlParamY.exlFloatValue.geti () & 7;
5796: } else {
5797: startAddress = param.exlFloatValue.geti ();
5798: functionCode = XEiJ.regSRS == 0 ? 1 : 5;
5799: }
5800:
5801: param = list[1];
5802: if (param.exlValueType != ElementType.ETY_FLOAT) {
5803: DebugConsole.dgtPrintln ("引数の型が違います\n");
5804: return;
5805: }
5806: int endAddress;
5807: if (param.exlType == ElementType.ETY_OPERATOR_AT) {
5808: endAddress = param.exlParamX.exlFloatValue.geti ();
5809: } else {
5810: endAddress = param.exlFloatValue.geti ();
5811: }
5812:
5813: int dataSize;
5814: switch (size) {
5815: case 'b':
5816: dataSize = 1;
5817: break;
5818: case 'w':
5819: dataSize = 2;
5820: break;
5821: case 'l':
5822: case 's':
5823: dataSize = 4;
5824: break;
5825: case 'q':
5826: case 'd':
5827: dataSize = 8;
5828: break;
5829: default:
5830: dataSize = 12;
5831: }
5832: int dataCount = list.length - 2;
5833: EFPBox.EFP[] dataArray = new EFPBox.EFP[dataCount];
5834: for (int i = 0; i < dataCount; i++) {
5835: param = list[2 + i];
5836: if (param.exlValueType != ElementType.ETY_FLOAT) {
5837: DebugConsole.dgtPrintln (Multilingual.mlnJapanese ?
5838: "引数の型が違います" :
5839: "wrong type of parameter");
5840: return;
5841: }
5842: dataArray[i] = param.exlFloatValue;
5843: }
5844: int repeatCount = (endAddress + 1 - startAddress) / (dataSize * dataCount);
5845:
5846: int a = startAddress;
5847: switch (size) {
5848: case 'b':
5849: {
5850: int[] x = new int[dataCount];
5851: for (int i = 0; i < dataCount; i++) {
5852: x[i] = dataArray[i].getb ();
5853: }
5854: for (int n = 0; n < repeatCount; n++) {
5855: for (int i = 0; i < dataCount; i++) {
5856: MC68060.mmuPokeByte (a++, x[i], functionCode);
5857: }
5858: }
5859: }
5860: break;
5861: case 'w':
5862: {
5863: int[] x = new int[dataCount];
5864: for (int i = 0; i < dataCount; i++) {
5865: x[i] = dataArray[i].gets ();
5866: }
5867: for (int n = 0; n < repeatCount; n++) {
5868: for (int i = 0; i < dataCount; i++) {
5869: MC68060.mmuPokeWord (a, x[i], functionCode);
5870: a += 2;
5871: }
5872: }
5873: }
5874: break;
5875: case 'l':
5876: case 's':
5877: {
5878: int[] x = new int[dataCount];
5879: for (int i = 0; i < dataCount; i++) {
5880: if (size == 'l') {
5881: x[i] = dataArray[i].geti ();
5882: } else {
5883: x[i] = dataArray[i].getf0 ();
5884: }
5885: }
5886: for (int n = 0; n < repeatCount; n++) {
5887: for (int i = 0; i < dataCount; i++) {
5888: MC68060.mmuPokeLong (a, x[i], functionCode);
5889: a += 4;
5890: }
5891: }
5892: }
5893: break;
5894: case 'q':
5895: case 'd':
5896: {
5897: long[] x = new long[dataCount];
5898: for (int i = 0; i < dataCount; i++) {
5899: if (size == 'q') {
5900: x[i] = dataArray[i].getl ();
5901: } else {
5902: x[i] = dataArray[i].getd01 ();
5903: }
5904: }
5905: for (int n = 0; n < repeatCount; n++) {
5906: for (int i = 0; i < dataCount; i++) {
5907: MC68060.mmuPokeQuad (a, x[i], functionCode);
5908: a += 8;
5909: }
5910: }
5911: }
5912: break;
5913: case 'x':
5914: case 't':
5915: case 'p':
5916: {
5917: int[] xi = new int[dataCount];
5918: long[] xl = new long[dataCount];
5919: byte[] b = new byte[12];
5920: for (int i = 0; i < dataCount; i++) {
5921: if (size == 'x') {
5922: dataArray[i].getx012 (b, 0);
5923: } else if (size == 't') {
5924: dataArray[i].gety012 (b, 0);
5925: } else {
5926: dataArray[i].getp012 (b, 0);
5927: }
5928: xi[i] = b[0] << 24 | (b[1] & 255) << 16 | (char) (b[2] << 8 | b[3] & 255);
5929: xl[i] = ((long) (b[4] << 24 | (b[5] & 255) << 16 | (char) (b[ 6] << 8 | b[ 7] & 255)) << 32 |
5930: (long) (b[8] << 24 | (b[9] & 255) << 16 | (char) (b[10] << 8 | b[11] & 255)) & 0xffffffffL);
5931: }
5932: for (int n = 0; n < repeatCount; n++) {
5933: for (int i = 0; i < dataCount; i++) {
5934: MC68060.mmuPokeLong (a , xi[i], functionCode);
5935: MC68060.mmuPokeQuad (a + 4, xl[i], functionCode);
5936: a += 12;
5937: }
5938: }
5939: }
5940: break;
5941: }
5942:
5943: while (a != endAddress + 1) {
5944: MC68060.mmuPokeByte (a++, 0, functionCode);
5945: }
5946: }
5947: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5948: return sb.append ("f").append ((char) elem.exlSubscript);
5949: }
5950: },
5951:
5952:
5953:
5954: ETY_COMMAND_RUN {
5955: @Override protected int etyPriority () {
5956: return EPY_PRIORITY_COMMAND;
5957: }
5958: @Override protected void etyEval (ExpressionElement elem, int mode) {
5959: if (XEiJ.mpuTask != null) {
5960: DebugConsole.dgtPrintln (Multilingual.mlnJapanese ?
5961: "MPU は動作しています" :
5962: "MPU is running");
5963: return;
5964: }
5965: if (elem.exlParamX != null) {
5966: ExpressionElement[] list = elem.exlParamX.exlEvalCommaList (mode);
5967: if (0 < list.length) {
5968: ExpressionElement param = list[0];
5969: if (param.exlValueType == ElementType.ETY_FLOAT) {
5970:
5971: XEiJ.regPC = param.exlFloatValue.geti ();
5972: }
5973: }
5974: }
5975: XEiJ.mpuStart ();
5976: }
5977: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
5978: sb.append ("g");
5979: if (elem.exlParamX != null) {
5980: elem.exlParamX.exlAppendTo (sb.append (' '));
5981: }
5982: return sb;
5983: }
5984: },
5985:
5986:
5987:
5988: ETY_COMMAND_HELP {
5989: @Override protected int etyPriority () {
5990: return EPY_PRIORITY_COMMAND;
5991: }
5992: @Override protected void etyEval (ExpressionElement elem, int mode) {
5993: DebugConsole.dgtPageList = new LinkedList<String> ();
5994: DebugConsole.dgtPageList.addLast (
5995: Multilingual.mlnJapanese ?
5996: " コマンド\n" +
5997:
5998:
5999:
6000:
6001:
6002:
6003: " d<サイズ> <開始アドレス>,<終了アドレス¹> ダンプ\n" +
6004: " f<サイズ> <開始アドレス>,<終了アドレス¹>,<データ>,… フィル\n" +
6005: " g <開始アドレス> 実行\n" +
6006: " h ヘルプ\n" +
6007: " i 停止\n" +
6008: " l <開始アドレス>,<終了アドレス¹> 逆アセンブル\n" +
6009:
6010:
6011:
6012:
6013:
6014:
6015: " p <式>,… 計算結果表示\n" +
6016: " r ステップアンティルリターン\n" +
6017: " s <回数> ステップ\n" +
6018: " t <回数> トレース\n" +
6019: " x レジスタ一覧\n" +
6020: " xf 浮動小数点レジスタ一覧\n" +
6021:
6022:
6023: " <式> 計算\n" +
6024: " <コマンド>;… 逐次実行\n" +
6025: " ¹終了アドレスは範囲に含まれる\n" :
6026: " Command\n" +
6027:
6028:
6029:
6030:
6031:
6032:
6033: " d<size> <start-address>,<end-address¹> dump\n" +
6034: " f<size> <start-address>,<end-address¹>,<data>,… fill\n" +
6035: " g <start-address> run\n" +
6036: " h help\n" +
6037: " i stop\n" +
6038: " l <start-address>,<end-address¹> disassemble\n" +
6039:
6040:
6041:
6042:
6043:
6044:
6045: " p <expression>,… calculate and print\n" +
6046: " r step until return\n" +
6047: " s <number-of-times> step\n" +
6048: " t <number-of-times> trace\n" +
6049: " x list registers\n" +
6050: " xf list floating point registers\n" +
6051:
6052:
6053: " <expression> calculate\n" +
6054: " <command>;… sequential execution\n" +
6055: " ¹The end address is within the range.\n");
6056: DebugConsole.dgtPageList.addLast (
6057: Multilingual.mlnJapanese ?
6058: " サイズ\n" +
6059: " b バイト (8bit)\n" +
6060: " w ワード (16bit)\n" +
6061: " l ロング (32bit)\n" +
6062: " q クワッド (64bit)\n" +
6063: " s シングル (32bit)\n" +
6064: " d ダブル (64bit)\n" +
6065: " x エクステンデッド (80bit)\n" +
6066: " t トリプル (96bit)\n" +
6067: " p パックトデシマル (96bit)\n" :
6068: " Size\n" +
6069: " b byte (8bit)\n" +
6070: " w word (16bit)\n" +
6071: " l long (32bit)\n" +
6072: " q quad (64bit)\n" +
6073: " s single (32bit)\n" +
6074: " d double (64bit)\n" +
6075: " x extended (80bit)\n" +
6076: " t triple (96bit)\n" +
6077: " p packed decimal (96bit)\n");
6078: DebugConsole.dgtPageList.addLast (
6079: Multilingual.mlnJapanese ?
6080: " 浮動小数点数\n" +
6081: " 1.0e+2 10進数\n" +
6082: " 0b1.1001p+6 2進数\n" +
6083: " 0o1.44p+6 8進数\n" +
6084: " 0x1.9p+6 $64 16進数\n" +
6085: " Infinity NaN 無限大,非数\n" +
6086: " 数学定数\n" +
6087: " Apery Catalan E Eular Pi\n" +
6088: " 文字コード\n" +
6089: " 'A'\n" +
6090: " 文字列\n" +
6091: " \"ABC\"\n" :
6092: " Floating point number\n" +
6093: " 1.0e+2 decimal number\n" +
6094: " 0b1.1001p+6 binary number\n" +
6095: " 0o1.44p+6 octal number\n" +
6096: " 0x1.9p+6 $64 hexadecimal number\n" +
6097: " Infinity NaN infinity,not a number\n" +
6098: " Mathematical constant\n" +
6099: " Apery Catalan E Eular Pi\n" +
6100: " Character code\n" +
6101: " 'A'\n" +
6102: " String\n" +
6103: " \"ABC\"\n");
6104: DebugConsole.dgtPageList.addLast (
6105: Multilingual.mlnJapanese ?
6106: " レジスタ\n" +
6107: " 汎用レジスタ\n" +
6108: " d0 … d7 r0 … r7 データレジスタ\n" +
6109: " a0 … a7 r8 … r15 sp アドレスレジスタ\n" +
6110: " fp0 … fp7 浮動小数点レジスタ\n" +
6111: " 制御レジスタ\n" +
6112: " pc sr ccr sfc dfc cacr tc itt0 itt1 dtt0 dtt1 buscr\n" +
6113: " usp vbr caar ssp msp isp urp srp pcr fpiar fpsr fpcr\n" +
6114: " 変数\n" +
6115: " foo 浮動小数点変数\n" +
6116: " foo$ 文字列変数" :
6117: " Register\n" +
6118: " General register\n" +
6119: " d0 … d7 r0 … r7 data register\n" +
6120: " a0 … a7 r8 … r15 sp address register\n" +
6121: " fp0 … fp7 floating point register\n" +
6122: " Control register\n" +
6123: " pc sr ccr sfc dfc cacr tc itt0 itt1 dtt0 dtt1 buscr\n" +
6124: " usp vbr caar ssp msp isp urp srp pcr fpiar fpsr fpcr\n" +
6125: " Variable\n" +
6126: " foo floating point variable\n" +
6127: " foo$ string variable");
6128: DebugConsole.dgtPageList.addLast (
6129: Multilingual.mlnJapanese ?
6130: " アドレス\n" +
6131: " <アドレス> 現在のアドレス空間\n" +
6132: " <物理アドレス>@0 物理アドレス空間\n" +
6133: " <論理アドレス>@1 ユーザデータ空間\n" +
6134: " <論理アドレス>@2 ユーザコード空間\n" +
6135: " <論理アドレス>@5 スーパーバイザデータ空間\n" +
6136: " <論理アドレス>@6 スーパーバイザコード空間\n" :
6137: " Address\n" +
6138: " <address> current address space\n" +
6139: " <physical-address>@0 physical address space\n" +
6140: " <logical-address>@1 user data space\n" +
6141: " <logical-address>@2 user code space\n" +
6142: " <logical-address>@5 supervisor data space\n" +
6143: " <logical-address>@6 supervisor code space\n");
6144: DebugConsole.dgtPageList.addLast (
6145: Multilingual.mlnJapanese ?
6146: " 演算子\n" +
6147: " <汎用レジスタ>.<サイズ> 汎用レジスタアクセス\n" +
6148: " <変数>.<サイズ> 変数アクセス\n" +
6149: " [<アドレス>].<サイズ> メモリアクセス\n" +
6150: " x.<サイズ> キャスト\n" +
6151: " x(y) 関数呼び出し\n" +
6152: " x++ ++x x-- --x インクリメント,デクリメント\n" +
6153: " +x -x ~x !x 符号,ビットNOT,論理NOT\n" +
6154: " x**y x*y x/y x%y 累乗,乗除算\n" +
6155: " x+y x-y 加減算,連結\n" +
6156: " x<<y x>>y x>>>y シフト\n" +
6157: " x<y x<=y x>y x>=y 比較\n" +
6158: " x==y x!=y 等価\n" +
6159: " x&y x^y x|y x&&y x||y ビットAND,XOR,OR,論理AND,OR\n" +
6160: " x?y:z 条件\n" +
6161: " x=y x**=y x*=y x/=y x%=y x+=y x-=y\n" +
6162: " x<<=y x>>=y x>>>=y x&=y x^=y x|=y 代入\n" +
6163: " x,y 逐次評価\n" :
6164: " Operator\n" +
6165: " <general-register>.<size> general register access\n" +
6166: " <variable>.<size> variable access\n" +
6167: " [<address>].<size> memory access\n" +
6168: " x.<size> cast\n" +
6169: " x(y) function call\n" +
6170: " x++ ++x x-- --x increment,decrement\n" +
6171: " +x -x ~x !x signum,bitwise NOT,logical NOT\n" +
6172: " x**y x*y x/y x%y exponentiation,multiplication,division\n" +
6173: " x+y x-y addition,subtraction,concatenation\n" +
6174: " x<<y x>>y x>>>y shift\n" +
6175: " x<y x<=y x>y x>=y comparison\n" +
6176: " x==y x!=y equality\n" +
6177: " x&y x^y x|y x&&y x||y bitwise AND,XOR,OR,logical AND,OR\n" +
6178: " x?y:z conditional\n" +
6179: " x=y x**=y x*=y x/=y x%=y x+=y x-=y\n" +
6180: " x<<=y x>>=y x>>>=y x&=y x^=y x|=y assignment\n" +
6181: " x,y sequential evaluation\n");
6182: DebugConsole.dgtPageList.addLast (
6183: Multilingual.mlnJapanese ?
6184: " 関数\n" +
6185: " abs acos acosh acot acoth acsc acsch agi agm\n" +
6186: " asc asec asech asin asinh atan atan2 atanh\n" +
6187: " bin$ cbrt ceil chr$ cmp cmp0 cmp1 cmp1abs cmpabs\n" +
6188: " cos cosh cot coth csc csch cub dec deg div2 div3 divpi divrz\n" +
6189: " exp exp10 exp2 exp2m1 expm1 floor frac getexp getman\n" +
6190: " hex$ ieeerem inc iseven isinf isint isnan isodd isone iszero\n" +
6191: " lgamma log log10 log1p log2 max min mul2 mul3 mulpi\n" +
6192: " oct$ pow quo rad random rcp rint rmode round rprec\n" +
6193: " sec sech sgn sin sinh sqrt squ str$ tan tanh tgamma trunc ulp val\n" :
6194: " Function\n" +
6195: " abs acos acosh acot acoth acsc acsch agi agm\n" +
6196: " asc asec asech asin asinh atan atan2 atanh\n" +
6197: " bin$ cbrt ceil chr$ cmp cmp0 cmp1 cmp1abs cmpabs\n" +
6198: " cos cosh cot coth csc csch cub dec deg div2 div3 divpi divrz\n" +
6199: " exp exp10 exp2 exp2m1 expm1 floor frac getexp getman\n" +
6200: " hex$ ieeerem inc iseven isinf isint isnan isodd isone iszero\n" +
6201: " lgamma log log10 log1p log2 max min mul2 mul3 mulpi\n" +
6202: " oct$ pow quo rad random rcp rint rmode round rprec\n" +
6203: " sec sech sgn sin sinh sqrt squ str$ tan tanh tgamma trunc ulp val\n");
6204: DebugConsole.dgtPrintPage ();
6205: }
6206: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6207: return sb.append ("h");
6208: }
6209: },
6210:
6211:
6212:
6213: ETY_COMMAND_STOP {
6214: @Override protected int etyPriority () {
6215: return EPY_PRIORITY_COMMAND;
6216: }
6217: @Override protected void etyEval (ExpressionElement elem, int mode) {
6218: if (XEiJ.mpuTask == null) {
6219: DebugConsole.dgtPrintln (Multilingual.mlnJapanese ?
6220: "MPU は停止しています" :
6221: "MPU is not running");
6222: return;
6223: }
6224: if (RootPointerList.RTL_ON) {
6225: if (RootPointerList.rtlCurrentSupervisorTaskIsStoppable ||
6226: RootPointerList.rtlCurrentUserTaskIsStoppable) {
6227: DebugConsole.dgtRequestRegs = true;
6228: XEiJ.mpuStop (null);
6229: }
6230: } else {
6231: DebugConsole.dgtRequestRegs = true;
6232: XEiJ.mpuStop (null);
6233: }
6234: }
6235: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6236: return sb.append ("i");
6237: }
6238: },
6239:
6240:
6241:
6242: ETY_COMMAND_LIST {
6243: @Override protected int etyPriority () {
6244: return EPY_PRIORITY_COMMAND;
6245: }
6246: @Override protected void etyEval (ExpressionElement elem, int mode) {
6247: if (DebugConsole.dgtDisassemblePC == 0) {
6248: DebugConsole.dgtDisassemblePC = XEiJ.regPC;
6249: DebugConsole.dgtDisassembleLastTail = XEiJ.regPC + 31 & -32;
6250: }
6251: int headAddress = DebugConsole.dgtDisassemblePC;
6252: int tailAddress = DebugConsole.dgtDisassembleLastTail + 32;
6253: if (elem.exlParamX != null) {
6254: ExpressionElement[] list = elem.exlParamX.exlEvalCommaList (mode);
6255: if (0 < list.length) {
6256: ExpressionElement param = list[0];
6257: if (param.exlType == ElementType.ETY_OPERATOR_AT) {
6258: headAddress = DebugConsole.dgtDisassemblePC = param.exlParamX.exlFloatValue.geti ();
6259: tailAddress = headAddress + 63 & -32;
6260: DebugConsole.dgtDisassembleFC = param.exlParamY.exlFloatValue.geti ();
6261: } else if (param.exlValueType == ElementType.ETY_FLOAT) {
6262: headAddress = DebugConsole.dgtDisassemblePC = param.exlFloatValue.geti ();
6263: tailAddress = headAddress + 63 & -32;
6264: DebugConsole.dgtDisassembleFC = XEiJ.regSRS == 0 ? 2 : 6;
6265: }
6266: if (1 < list.length) {
6267: param = list[1];
6268: if (param.exlType == ElementType.ETY_OPERATOR_AT) {
6269: tailAddress = param.exlParamX.exlFloatValue.geti ();
6270: } else if (param.exlValueType == ElementType.ETY_FLOAT) {
6271: tailAddress = param.exlFloatValue.geti ();
6272: }
6273: if (Integer.compareUnsigned (tailAddress, headAddress) < 0) {
6274: tailAddress = headAddress;
6275: }
6276: tailAddress = tailAddress + 2 & -2;
6277: }
6278: }
6279: }
6280: int supervisor = DebugConsole.dgtDisassembleFC & 4;
6281:
6282:
6283: boolean prevBranchFlag = false;
6284:
6285: StringBuilder sb = new StringBuilder ();
6286: int itemAddress = headAddress;
6287: int itemEndAddress;
6288: do {
6289:
6290: if (prevBranchFlag) {
6291: sb.append ('\n');
6292:
6293: int l = sb.length ();
6294: LabeledAddress.lblSearch (sb, itemAddress);
6295: if (l < sb.length ()) {
6296: sb.append ('\n');
6297: }
6298: }
6299:
6300: String code = Disassembler.disDisassemble (new StringBuilder (), itemAddress, supervisor).toString ();
6301: itemEndAddress = Disassembler.disPC;
6302:
6303: int lineAddress = itemAddress;
6304: int lineEndAddress = Math.min (lineAddress + 10, itemEndAddress);
6305:
6306: XEiJ.fmtHex8 (sb, lineAddress).append (" ");
6307:
6308: for (int a = lineAddress; a < lineEndAddress; a += 2) {
6309: XEiJ.fmtHex4 (sb, MC68060.mmuPeekWordZeroCode (a, supervisor));
6310: }
6311: sb.append (XEiJ.DBG_SPACES, 0, 2 * Math.max (0, lineAddress + 10 - lineEndAddress) + 2);
6312:
6313: sb.append (code).append (XEiJ.DBG_SPACES, 0, Math.max (1, 68 - 32 - code.length ()));
6314:
6315: for (int a = lineAddress; a < lineEndAddress; a++) {
6316: int h = MC68060.mmuPeekByteZeroCode (a, supervisor);
6317: int c;
6318: if (0x81 <= h && h <= 0x9f || 0xe0 <= h && h <= 0xef) {
6319: int l = MC68060.mmuPeekByteZeroCode (a + 1, supervisor);
6320: if (0x40 <= l && l != 0x7f && l <= 0xfc) {
6321: c = CharacterCode.chrSJISToChar[h << 8 | l];
6322: if (c == 0) {
6323: c = '※';
6324: }
6325: a++;
6326: } else {
6327: c = '.';
6328: }
6329: } else {
6330: c = CharacterCode.chrSJISToChar[h];
6331: if (c < 0x20 || c == 0x7f) {
6332: c = '.';
6333: }
6334: }
6335: sb.append ((char) c);
6336: }
6337: sb.append ('\n');
6338:
6339: while (lineEndAddress < itemEndAddress) {
6340: lineAddress = lineEndAddress;
6341: lineEndAddress = Math.min (lineAddress + 10, itemEndAddress);
6342:
6343: XEiJ.fmtHex8 (sb, lineAddress).append (" ");
6344:
6345: for (int a = lineAddress; a < lineEndAddress; a += 2) {
6346: XEiJ.fmtHex4 (sb, MC68060.mmuPeekWordZeroCode (a, supervisor));
6347: }
6348: sb.append (XEiJ.DBG_SPACES, 0, 2 * Math.max (0, lineAddress + 10 - lineEndAddress) + (2 + 68 - 32));
6349:
6350: for (int a = lineAddress; a < lineEndAddress; a++) {
6351: int h = MC68060.mmuPeekByteZeroCode (a, supervisor);
6352: int c;
6353: if (0x81 <= h && h <= 0x9f || 0xe0 <= h && h <= 0xef) {
6354: int l = MC68060.mmuPeekByteZeroCode (a + 1, supervisor);
6355: if (0x40 <= l && l != 0x7f && l <= 0xfc) {
6356: c = CharacterCode.chrSJISToChar[h << 8 | l];
6357: if (c == 0) {
6358: c = '※';
6359: }
6360: a++;
6361: } else {
6362: c = '.';
6363: }
6364: } else {
6365: c = CharacterCode.chrSJISToChar[h];
6366: if (c < 0x20 || c == 0x7f) {
6367: c = '.';
6368: }
6369: }
6370: sb.append ((char) c);
6371: }
6372: sb.append ('\n');
6373: }
6374:
6375: prevBranchFlag = (Disassembler.disStatus & Disassembler.DIS_ALWAYS_BRANCH) != 0;
6376: itemAddress = itemEndAddress;
6377: } while (itemAddress - headAddress < tailAddress - headAddress);
6378: DebugConsole.dgtPrint (sb.toString ());
6379: DebugConsole.dgtDisassemblePC = itemEndAddress;
6380: DebugConsole.dgtDisassembleLastTail = tailAddress;
6381: }
6382: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6383: sb.append ("l");
6384: if (elem.exlParamX != null) {
6385: elem.exlParamX.exlAppendTo (sb.append (' '));
6386: }
6387: return sb;
6388: }
6389: },
6390:
6391:
6392:
6393: ETY_COMMAND_PRINT {
6394: @Override protected int etyPriority () {
6395: return EPY_PRIORITY_COMMAND;
6396: }
6397: @Override protected void etyEval (ExpressionElement elem, int mode) {
6398: if (elem.exlParamX != null) {
6399: for (ExpressionElement param : elem.exlParamX.exlEvalCommaList (mode)) {
6400: param.exlPrint ();
6401: }
6402: }
6403: DebugConsole.dgtPrintChar ('\n');
6404: }
6405: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6406: sb.append ("p");
6407: if (elem.exlParamX != null) {
6408: elem.exlParamX.exlAppendTo (sb.append (' '));
6409: }
6410: return sb;
6411: }
6412: },
6413:
6414:
6415:
6416: ETY_COMMAND_RETURN {
6417: @Override protected int etyPriority () {
6418: return EPY_PRIORITY_COMMAND;
6419: }
6420: @Override protected void etyEval (ExpressionElement elem, int mode) {
6421: if (XEiJ.mpuTask == null) {
6422: DebugConsole.dgtRequestRegs = true;
6423: XEiJ.mpuStepUntilReturn ();
6424: }
6425: }
6426: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6427: return sb.append ("r");
6428: }
6429: },
6430:
6431:
6432:
6433: ETY_COMMAND_STEP {
6434: @Override protected int etyPriority () {
6435: return EPY_PRIORITY_COMMAND;
6436: }
6437: @Override protected void etyEval (ExpressionElement elem, int mode) {
6438: int n = 1;
6439: if (elem.exlParamX != null) {
6440: ExpressionElement[] list = elem.exlParamX.exlEvalCommaList (mode);
6441: if (0 < list.length) {
6442: ExpressionElement param = list[0];
6443: if (param.exlValueType == ElementType.ETY_FLOAT) {
6444: n = Math.max (1, Math.min (1000, param.exlFloatValue.geti ()));
6445: }
6446: }
6447: }
6448: if (XEiJ.mpuTask == null) {
6449: DebugConsole.dgtRequestRegs = true;
6450: XEiJ.mpuStep (n);
6451: }
6452: }
6453: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6454: return sb.append ("s");
6455: }
6456: },
6457:
6458:
6459:
6460: ETY_COMMAND_TRACE {
6461: @Override protected int etyPriority () {
6462: return EPY_PRIORITY_COMMAND;
6463: }
6464: @Override protected void etyEval (ExpressionElement elem, int mode) {
6465: int n = 1;
6466: if (elem.exlParamX != null) {
6467: ExpressionElement[] list = elem.exlParamX.exlEvalCommaList (mode);
6468: if (0 < list.length) {
6469: ExpressionElement param = list[0];
6470: if (param.exlValueType == ElementType.ETY_FLOAT) {
6471: n = Math.max (1, Math.min (1000, param.exlFloatValue.geti ()));
6472: }
6473: }
6474: }
6475: if (XEiJ.mpuTask == null) {
6476: DebugConsole.dgtRequestRegs = true;
6477: XEiJ.mpuAdvance (n);
6478: }
6479: }
6480: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6481: return sb.append ("t");
6482: }
6483: },
6484:
6485:
6486:
6487: ETY_COMMAND_REGS {
6488: @Override protected int etyPriority () {
6489: return EPY_PRIORITY_COMMAND;
6490: }
6491: @Override protected void etyEval (ExpressionElement elem, int mode) {
6492: StringBuilder sb = new StringBuilder ();
6493:
6494: int pc = XEiJ.regPC;
6495: int srs = XEiJ.regSRS;
6496:
6497:
6498:
6499:
6500:
6501:
6502: XEiJ.fmtHex8 (sb.append ("PC:"), pc);
6503: XEiJ.fmtHex8 (sb.append (" USP:"), srs != 0 ? XEiJ.mpuUSP : XEiJ.regRn[15]);
6504: if (XEiJ.currentMPU < Model.MPU_MC68020) {
6505: XEiJ.fmtHex8 (sb.append (" SSP:"), srs != 0 ? XEiJ.regRn[15] : XEiJ.mpuISP);
6506: XEiJ.fmtHex4 (sb.append (" SR:"), XEiJ.regSRT1 | srs | XEiJ.regSRI | XEiJ.regCCR);
6507: } else if (XEiJ.currentMPU < Model.MPU_MC68LC040) {
6508: XEiJ.fmtHex8 (sb.append (" ISP:"), srs == 0 || XEiJ.regSRM != 0 ? XEiJ.mpuISP : XEiJ.regRn[15]);
6509: XEiJ.fmtHex8 (sb.append (" MSP:"), srs == 0 || XEiJ.regSRM == 0 ? XEiJ.mpuMSP : XEiJ.regRn[15]);
6510: XEiJ.fmtHex4 (sb.append (" SR:"), XEiJ.regSRT1 | XEiJ.regSRT0 | srs | XEiJ.regSRM | XEiJ.regSRI | XEiJ.regCCR);
6511: } else {
6512: XEiJ.fmtHex8 (sb.append (" SSP:"), srs != 0 ? XEiJ.regRn[15] : XEiJ.mpuISP);
6513: XEiJ.fmtHex4 (sb.append (" SR:"), XEiJ.regSRT1 | srs | XEiJ.regSRM | XEiJ.regSRI | XEiJ.regCCR);
6514: }
6515: sb.append (" X:").append (XEiJ.REG_CCRXMAP[XEiJ.regCCR]);
6516: sb.append (" N:").append (XEiJ.REG_CCRNMAP[XEiJ.regCCR]);
6517: sb.append (" Z:").append (XEiJ.REG_CCRZMAP[XEiJ.regCCR]);
6518: sb.append (" V:").append (XEiJ.REG_CCRVMAP[XEiJ.regCCR]);
6519: sb.append (" C:").append (XEiJ.REG_CCRCMAP[XEiJ.regCCR]);
6520: sb.append ('\n');
6521:
6522:
6523:
6524:
6525: sb.append ("HI:").append (XEiJ.MPU_CCCMAP[ 2 << 5 | XEiJ.regCCR]);
6526: sb.append (" LS:").append (XEiJ.MPU_CCCMAP[ 3 << 5 | XEiJ.regCCR]);
6527: sb.append (" CC(HS):").append (XEiJ.MPU_CCCMAP[ 4 << 5 | XEiJ.regCCR]);
6528: sb.append (" CS(LO):").append (XEiJ.MPU_CCCMAP[ 5 << 5 | XEiJ.regCCR]);
6529: sb.append (" NE:").append (XEiJ.MPU_CCCMAP[ 6 << 5 | XEiJ.regCCR]);
6530: sb.append (" EQ:").append (XEiJ.MPU_CCCMAP[ 7 << 5 | XEiJ.regCCR]);
6531: sb.append (" VC:").append (XEiJ.MPU_CCCMAP[ 8 << 5 | XEiJ.regCCR]);
6532: sb.append (" VS:").append (XEiJ.MPU_CCCMAP[ 9 << 5 | XEiJ.regCCR]);
6533: sb.append (" PL:").append (XEiJ.MPU_CCCMAP[10 << 5 | XEiJ.regCCR]);
6534: sb.append (" MI:").append (XEiJ.MPU_CCCMAP[11 << 5 | XEiJ.regCCR]);
6535: sb.append (" GE:").append (XEiJ.MPU_CCCMAP[12 << 5 | XEiJ.regCCR]);
6536: sb.append (" LT:").append (XEiJ.MPU_CCCMAP[13 << 5 | XEiJ.regCCR]);
6537: sb.append (" GT:").append (XEiJ.MPU_CCCMAP[14 << 5 | XEiJ.regCCR]);
6538: sb.append (" LE:").append (XEiJ.MPU_CCCMAP[15 << 5 | XEiJ.regCCR]);
6539: sb.append ('\n');
6540:
6541:
6542:
6543:
6544:
6545: XEiJ.fmtHex8 (sb.append ("D0:") , XEiJ.regRn[ 0]);
6546: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[ 1]);
6547: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[ 2]);
6548: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[ 3]);
6549: XEiJ.fmtHex8 (sb.append (" D4:"), XEiJ.regRn[ 4]);
6550: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[ 5]);
6551: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[ 6]);
6552: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[ 7]);
6553: sb.append ('\n');
6554: XEiJ.fmtHex8 (sb.append ("A0:") , XEiJ.regRn[ 8]);
6555: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[ 9]);
6556: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[10]);
6557: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[11]);
6558: XEiJ.fmtHex8 (sb.append (" A4:"), XEiJ.regRn[12]);
6559: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[13]);
6560: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[14]);
6561: XEiJ.fmtHex8 (sb.append (' ') , XEiJ.regRn[15]);
6562: sb.append ('\n');
6563: if (Model.MPU_MC68020 <= XEiJ.currentMPU) {
6564:
6565:
6566:
6567:
6568: sb.append ("SFC:").append ((char) ('0' + XEiJ.mpuSFC));
6569: sb.append (" DFC:").append ((char) ('0' + XEiJ.mpuDFC));
6570: XEiJ.fmtHex8 (sb.append (" VBR:"), XEiJ.mpuVBR);
6571: XEiJ.fmtHex8 (sb.append (" CACR:"), XEiJ.mpuCACR);
6572: if (Model.MPU_MC68LC040 <= XEiJ.currentMPU) {
6573: XEiJ.fmtHex8 (sb.append (" TCR:"), MC68060.mmuTCR);
6574: XEiJ.fmtHex8 (sb.append (" URP:"), MC68060.mmuURP);
6575: XEiJ.fmtHex8 (sb.append (" SRP:"), MC68060.mmuSRP);
6576: }
6577: sb.append ('\n');
6578:
6579:
6580:
6581:
6582: if (Model.MPU_MC68LC040 <= XEiJ.currentMPU) {
6583: XEiJ.fmtHex8 (sb.append ("ITT0:"), MC68060.mmuITT0);
6584: XEiJ.fmtHex8 (sb.append (" ITT1:"), MC68060.mmuITT1);
6585: XEiJ.fmtHex8 (sb.append (" DTT0:"), MC68060.mmuDTT0);
6586: XEiJ.fmtHex8 (sb.append (" DTT1:"), MC68060.mmuDTT1);
6587: XEiJ.fmtHex8 (sb.append (" PCR:"), XEiJ.mpuPCR);
6588: sb.append ('\n');
6589: }
6590: }
6591:
6592:
6593: {
6594: int l = sb.length ();
6595: LabeledAddress.lblSearch (sb, pc);
6596: if (l < sb.length ()) {
6597: sb.append ('\n');
6598: }
6599: }
6600:
6601: String code = Disassembler.disDisassemble (new StringBuilder (), pc, srs).toString ();
6602:
6603: XEiJ.fmtHex8 (sb, pc).append (" ");
6604:
6605: for (int a = pc; a < Disassembler.disPC; a += 2) {
6606: XEiJ.fmtHex4 (sb, MC68060.mmuPeekWordZeroCode (a, srs));
6607: }
6608: for (int a = Disassembler.disPC; a < pc + 10; a += 2) {
6609: sb.append (" ");
6610: }
6611:
6612: sb.append (" ").append (code).append ('\n');
6613: DebugConsole.dgtPrint (sb.toString ());
6614: }
6615: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6616: return sb.append ("x");
6617: }
6618: },
6619:
6620:
6621:
6622: ETY_COMMAND_FLOAT_REGS {
6623: @Override protected int etyPriority () {
6624: return EPY_PRIORITY_COMMAND;
6625: }
6626: @Override protected void etyEval (ExpressionElement elem, int mode) {
6627: if (XEiJ.currentMPU < Model.MPU_MC68020) {
6628: DebugConsole.dgtPrintln (Multilingual.mlnJapanese ?
6629: "浮動小数点レジスタはありません" :
6630: "no floating point register exists");
6631: return;
6632: }
6633: StringBuilder sb = new StringBuilder ();
6634:
6635:
6636:
6637:
6638: XEiJ.fmtHex8 (sb.append ("FPCR:"), XEiJ.fpuBox.epbFpcr);
6639: XEiJ.fmtHex8 (sb.append (" FPSR:"), XEiJ.fpuBox.epbFpsr);
6640: sb.append (" M:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 27 & 1)));
6641: sb.append (" Z:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 26 & 1)));
6642: sb.append (" I:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 25 & 1)));
6643: sb.append (" N:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 24 & 1)));
6644: sb.append (" B:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 15 & 1)));
6645: sb.append (" S:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 14 & 1)));
6646: sb.append (" E:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 13 & 1)));
6647: sb.append (" O:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 12 & 1)));
6648: sb.append (" U:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 11 & 1)));
6649: sb.append (" D:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 10 & 1)));
6650: sb.append (" X:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 9 & 1)));
6651: sb.append (" P:").append ((char) ('0' + (XEiJ.fpuBox.epbFpsr >> 8 & 1)));
6652: sb.append ('\n');
6653:
6654:
6655:
6656:
6657:
6658:
6659:
6660: for (int n = 0; n <= 7; n++) {
6661: String s = XEiJ.fpuFPn[n].toString ();
6662: sb.append ("FP").append (n).append (':').append (s);
6663: if ((n & 1) == 0) {
6664: sb.append (XEiJ.DBG_SPACES, 0, Math.max (0, 36 - s.length ()));
6665: } else {
6666: sb.append ('\n');
6667: }
6668: }
6669: DebugConsole.dgtPrint (sb.toString ());
6670: }
6671: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6672: return sb.append ("xf");
6673: }
6674: },
6675:
6676:
6677:
6678:
6679:
6680:
6681: ETY_LINE {
6682: @Override protected int etyPriority () {
6683: return EPY_PRIORITY_COMMAND;
6684: }
6685: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6686: if (elem.exlParamX != null) {
6687:
6688: elem.exlParamX.exlAppendTo (sb);
6689: }
6690: if (elem.exlParamX != null || elem.exlStringValue != null) {
6691:
6692: sb.append (' ');
6693: }
6694: if (elem.exlStringValue != null) {
6695:
6696: sb.append (elem.exlStringValue);
6697: if (0 <= elem.exlSubscript) {
6698:
6699: sb.append ('.').append ((char) elem.exlSubscript);
6700: }
6701: if (elem.exlParamY != null) {
6702:
6703: sb.append (' ');
6704:
6705: elem.exlParamY.exlAppendTo (sb);
6706: }
6707: }
6708: return sb;
6709: }
6710: },
6711:
6712:
6713:
6714:
6715:
6716:
6717:
6718:
6719:
6720:
6721:
6722:
6723:
6724:
6725:
6726:
6727:
6728:
6729:
6730:
6731:
6732:
6733:
6734: ETY_SEPARATOR {
6735: @Override protected int etyPriority () {
6736: return EPY_PRIORITY_SEPARATOR;
6737: }
6738: @Override protected void etyEval (ExpressionElement elem, int mode) {
6739: elem.exlParamX.exlEval (mode);
6740: elem.exlParamY.exlEval (mode);
6741: if (elem.exlParamY.exlType == ElementType.ETY_FLOAT) {
6742:
6743: elem.exlFloatValue.sete (elem.exlParamY.exlFloatValue);
6744: } else if (elem.exlParamY.exlType == ElementType.ETY_STRING) {
6745:
6746: elem.exlStringValue = elem.exlParamY.exlStringValue;
6747: }
6748: }
6749: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6750: return elem.exlAppendBinaryOperatorTo (sb, ";");
6751: }
6752: },
6753:
6754:
6755:
6756: ETY_TOKEN_EXCLAMATION_MARK,
6757:
6758: ETY_TOKEN_NUMBER_SIGN,
6759:
6760: ETY_TOKEN_PERCENT_SIGN,
6761:
6762:
6763: ETY_TOKEN_LEFT_PARENTHESIS,
6764: ETY_TOKEN_RIGHT_PARENTHESIS,
6765: ETY_TOKEN_ASTERISK,
6766: ETY_TOKEN_PLUS_SIGN,
6767: ETY_TOKEN_PLUS_PLUS,
6768: ETY_TOKEN_COMMA,
6769: ETY_TOKEN_HYPHEN_MINUS,
6770: ETY_TOKEN_MINUS_MINUS,
6771: ETY_TOKEN_FULL_STOP,
6772: ETY_TOKEN_SOLIDUS,
6773:
6774: ETY_TOKEN_COLON,
6775: ETY_TOKEN_SEMICOLON,
6776:
6777:
6778:
6779: ETY_TOKEN_QUESTION_MARK,
6780:
6781:
6782: ETY_TOKEN_LEFT_SQUARE_BRACKET,
6783:
6784: ETY_TOKEN_RIGHT_SQUARE_BRACKET,
6785:
6786:
6787:
6788:
6789: ETY_TOKEN_LEFT_CURLY_BRACKET,
6790:
6791: ETY_TOKEN_RIGHT_CURLY_BRACKET,
6792: ETY_TOKEN_TILDE,
6793:
6794:
6795:
6796:
6797:
6798:
6799:
6800: ETY_SIZE {
6801: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6802: return elem.exlParamX.exlAppendTo (sb).append ('.').append ((char) elem.exlSubscript);
6803: }
6804: },
6805:
6806:
6807:
6808:
6809: ETY_SCALE_FACTOR {
6810: @Override protected int etyPriority () {
6811: return EPY_PRIORITY_MULTIPLICATION;
6812: }
6813: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6814: return elem.exlAppendBinaryOperatorTo (sb, "*");
6815: }
6816: },
6817:
6818:
6819:
6820:
6821:
6822: ETY_K_FACTOR {
6823: @Override protected int etyPriority () {
6824: return EPY_PRIORITY_POSTFIX;
6825: }
6826: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6827: return elem.exlParamY.exlAppendTo (elem.exlParamX.exlAppendTo (sb).append ('{')).append ('}');
6828: }
6829: },
6830:
6831:
6832:
6833:
6834:
6835:
6836: ETY_BIT_FIELD {
6837: @Override protected int etyPriority () {
6838: return EPY_PRIORITY_POSTFIX;
6839: }
6840: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6841: return elem.exlParamZ.exlAppendTo (elem.exlParamY.exlAppendTo (elem.exlParamX.exlAppendTo (sb).append ('{')).append (':')).append ('}');
6842: }
6843: },
6844:
6845:
6846:
6847:
6848: ETY_REGISTER_INDIRECT {
6849: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6850: int r = elem.exlSubscript;
6851: sb.append ('(');
6852: if (r < 8) {
6853: sb.append ('d').append (r);
6854: } else if (r < 15) {
6855: sb.append ('a').append (r - 8);
6856: } else {
6857: sb.append ("sp");
6858: }
6859: return sb.append (')');
6860: }
6861: },
6862:
6863:
6864:
6865:
6866: ETY_POSTINCREMENT {
6867: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6868: int r = elem.exlSubscript;
6869: sb.append ('(');
6870: if (r < 7) {
6871: sb.append ('a').append (r);
6872: } else {
6873: sb.append ("sp");
6874: }
6875: return sb.append (")+");
6876: }
6877: },
6878:
6879:
6880:
6881:
6882: ETY_PREDECREMENT {
6883: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6884: int r = elem.exlSubscript;
6885: sb.append ("-(");
6886: if (r < 7) {
6887: sb.append ('a').append (r);
6888: } else {
6889: sb.append ("sp");
6890: }
6891: return sb.append (')');
6892: }
6893: },
6894:
6895:
6896:
6897:
6898: ETY_IMMEDIATE {
6899: @Override protected int etyPriority () {
6900: return EPY_PRIORITY_PREFIX;
6901: }
6902: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6903: return elem.exlAppendPrefixOperatorTo (sb, "#");
6904: }
6905: },
6906:
6907:
6908:
6909:
6910: ETY_DATA_REGISTER_PAIR {
6911: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6912: int subscript = elem.exlSubscript;
6913: int h = subscript >> 3;
6914: int l = subscript & 7;
6915: return sb.append ('d').append (h).append (":d").append (l);
6916: }
6917: },
6918:
6919:
6920:
6921:
6922: ETY_REGISTER_INDIRECT_PAIR {
6923: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6924: int subscript = elem.exlSubscript;
6925: int r = subscript >> 4;
6926: int s = subscript & 15;
6927: sb.append ('(');
6928: if (r < 8) {
6929: sb.append ('d').append (r);
6930: } else if (r < 15) {
6931: sb.append ('a').append (r - 8);
6932: } else {
6933: sb.append ("sp");
6934: }
6935: sb.append ("):(");
6936: if (s < 8) {
6937: sb.append ('d').append (s);
6938: } else if (s < 15) {
6939: sb.append ('a').append (s - 8);
6940: } else {
6941: sb.append ("sp");
6942: }
6943: return sb.append (')');
6944: }
6945: },
6946:
6947:
6948:
6949:
6950:
6951:
6952:
6953:
6954:
6955:
6956: ETY_INTEGER_REGISTER_LIST {
6957: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
6958: int m = elem.exlSubscript;
6959: m = (m & 0x8000) << 2 | (m & 0x7f00) << 1 | (m & 0x00ff);
6960: boolean s = false;
6961: while (m != 0) {
6962: int i = Integer.numberOfTrailingZeros (m);
6963: m += 1 << i;
6964: int j = Integer.numberOfTrailingZeros (m);
6965: m -= 1 << j;
6966: j--;
6967: if (s) {
6968: sb.append ('/');
6969: }
6970: if (i <= 7) {
6971: sb.append ('d').append (i);
6972: } else if (i <= 16) {
6973: sb.append ('a').append (i - 9);
6974: } else {
6975: sb.append ("sp");
6976: }
6977: if (i < j) {
6978: sb.append ('-');
6979: if (j <= 7) {
6980: sb.append ('d').append (j);
6981: } else if (j <= 16) {
6982: sb.append ('a').append (j - 9);
6983: } else {
6984: sb.append ("sp");
6985: }
6986: }
6987: s = true;
6988: }
6989: return sb;
6990: }
6991: },
6992:
6993:
6994:
6995:
6996:
6997:
6998:
6999: ETY_FLOATING_POINT_REGISTER_LIST {
7000: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7001: int m = elem.exlSubscript;
7002: boolean s = false;
7003: while (m != 0) {
7004: int i = Integer.numberOfTrailingZeros (m);
7005: m += 1 << i;
7006: int j = Integer.numberOfTrailingZeros (m);
7007: m -= 1 << j;
7008: j--;
7009: if (s) {
7010: sb.append ('/');
7011: }
7012: sb.append ("fp").append (i);
7013: if (i < j) {
7014: sb.append ("-fp").append (j);
7015: }
7016: s = true;
7017: }
7018: return sb;
7019: }
7020: },
7021:
7022:
7023:
7024:
7025:
7026:
7027:
7028: ETY_FLOATING_POINT_CONTROL_REGISTER_LIST {
7029: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7030: int subscript = elem.exlSubscript;
7031: return sb.append (subscript == 1 ? "fpiar" :
7032: subscript == 2 ? "fpsr" :
7033: subscript == 3 ? "fpiar/fpsr" :
7034: subscript == 4 ? "fpcr" :
7035: subscript == 5 ? "fpiar/fpcr" :
7036: subscript == 6 ? "fpsr/fpcr" :
7037: subscript == 7 ? "fpiar/fpsr/fpcr" :
7038: "");
7039: }
7040: },
7041:
7042:
7043:
7044:
7045: ETY_LABEL_DEFINITION {
7046: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7047: return sb.append (elem.exlStringValue).append (':');
7048: }
7049: },
7050:
7051:
7052:
7053:
7054:
7055:
7056:
7057: ETY_LOCAL_LABEL_DEFINITION {
7058: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7059: if (elem.exlSubscript == 0) {
7060: sb.append ("@@");
7061: } else {
7062: sb.append (elem.exlSubscript);
7063: }
7064: return sb.append (':');
7065: }
7066: },
7067:
7068:
7069:
7070:
7071:
7072:
7073:
7074:
7075:
7076:
7077:
7078:
7079:
7080:
7081:
7082:
7083: ETY_LOCAL_LABEL_REFERENCE {
7084: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7085: int number = (char) elem.exlSubscript;
7086: int offset = elem.exlSubscript >> 16;
7087: if (number == 0) {
7088: for (int i = offset < 0 ? ~offset : offset; 0 <= i; i--) {
7089: sb.append ('@');
7090: }
7091: } else {
7092: sb.append (number);
7093: }
7094: return sb.append (offset < 0 ? 'B' : 'F');
7095: }
7096: },
7097:
7098:
7099:
7100:
7101: ETY_MNEMONIC {
7102: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7103: return sb.append (elem.exlStringValue);
7104: }
7105: },
7106:
7107:
7108:
7109:
7110:
7111: ETY_PARENTHESIS {
7112: @Override protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7113: return elem.exlParamX.exlAppendTo (sb.append ('(')).append (')');
7114: }
7115: },
7116:
7117:
7118: ETY_DUMMY;
7119:
7120: protected void etyEval (ExpressionElement elem, int mode) {
7121: }
7122:
7123: protected StringBuilder etyAppendTo (StringBuilder sb, ExpressionElement elem) {
7124: sb.append (name ()).append ('(');
7125: if (elem.exlParamX != null) {
7126: sb.append (elem.exlParamX.toString ());
7127: if (elem.exlParamY != null) {
7128: sb.append (',').append (elem.exlParamY.toString ());
7129: if (elem.exlParamZ != null) {
7130: sb.append (',').append (elem.exlParamZ.toString ());
7131: }
7132: }
7133: }
7134: return sb.append (')');
7135: }
7136:
7137: protected int etyPriority () {
7138: return EPY_PRIORITY_PRIMITIVE;
7139: }
7140:
7141: };
7142:
7143:
7144:
7145:
7146:
7147:
7148: protected class ExpressionElement {
7149:
7150:
7151:
7152:
7153: protected ElementType exlType;
7154: protected int exlSubscript;
7155: protected ElementType exlValueType;
7156: protected EFP exlFloatValue;
7157: protected String exlStringValue;
7158: protected String exlSource;
7159: protected int exlOffset;
7160: protected int exlLength;
7161: protected ExpressionElement exlParamX;
7162: protected ExpressionElement exlParamY;
7163: protected ExpressionElement exlParamZ;
7164:
7165:
7166:
7167:
7168: protected ExpressionElement (ElementType type, int subscript,
7169: ElementType valueType, EFP floatValue, String stringValue,
7170: String source, int offset, int length) {
7171: exlType = type;
7172: exlSubscript = subscript;
7173: exlValueType = valueType;
7174: exlFloatValue = floatValue == null ? new EFP () : new EFP (floatValue);
7175: exlStringValue = stringValue == null ? "" : stringValue;
7176: exlSource = source;
7177: exlOffset = offset;
7178: exlLength = length;
7179: exlParamX = null;
7180: exlParamY = null;
7181: exlParamZ = null;
7182: }
7183: protected ExpressionElement (ElementType type, int subscript,
7184: ElementType valueType, EFP floatValue, String stringValue,
7185: String source, int offset, int length,
7186: ExpressionElement paramX, ExpressionElement paramY, ExpressionElement paramZ) {
7187: exlType = type;
7188: exlSubscript = subscript;
7189: exlValueType = valueType;
7190: exlFloatValue = floatValue == null ? new EFP () : new EFP (floatValue);
7191: exlStringValue = stringValue == null ? "" : stringValue;
7192: exlSource = source;
7193: exlOffset = offset;
7194: exlLength = length;
7195: exlParamX = paramX;
7196: exlParamY = paramY;
7197: exlParamZ = paramZ;
7198: }
7199:
7200:
7201:
7202:
7203: protected ExpressionElement exlCopy () {
7204: ExpressionElement elem = new ExpressionElement (exlType, exlSubscript,
7205: exlValueType, new EFP (exlFloatValue), exlStringValue,
7206: exlSource, exlOffset, exlLength);
7207: if (exlParamX != null) {
7208: if (exlType == ElementType.ETY_VARIABLE_FLOAT ||
7209: exlType == ElementType.ETY_VARIABLE_STRING) {
7210: elem.exlParamX = exlParamX;
7211: } else {
7212: elem.exlParamX = exlParamX.exlCopy ();
7213: }
7214: }
7215: if (exlParamY != null) {
7216: elem.exlParamY = exlParamY.exlCopy ();
7217: }
7218: if (exlParamZ != null) {
7219: elem.exlParamZ = exlParamZ.exlCopy ();
7220: }
7221: return elem;
7222: }
7223:
7224:
7225:
7226:
7227: protected void exlSetRoundingPrec (int prec) {
7228: if (0 <= prec && prec <= 4) {
7229: epbRoundingPrec = prec;
7230: }
7231: }
7232:
7233:
7234:
7235:
7236: protected void exlSetRoundingMode (int mode) {
7237: if (0 <= mode && mode <= 3) {
7238: epbRoundingMode = mode;
7239: }
7240: }
7241:
7242:
7243:
7244:
7245: protected int exlReadRegByte (int n) {
7246: if (0 <= n && n <= 15) {
7247: return (byte) XEiJ.regRn[n];
7248: }
7249: return 0;
7250: }
7251:
7252: protected int exlReadRegWord (int n) {
7253: if (0 <= n && n <= 15) {
7254: return (short) XEiJ.regRn[n];
7255: }
7256: return 0;
7257: }
7258:
7259: protected int exlReadRegLong (int n) {
7260: if (0 <= n && n <= 15) {
7261: return XEiJ.regRn[n];
7262: }
7263: return 0;
7264: }
7265:
7266: protected void exlWriteRegByte (int n, int x) {
7267: if (0 <= n && n <= 15) {
7268: XEiJ.regRn[n] = XEiJ.regRn[n] & ~255 | x & 255;
7269: }
7270: }
7271:
7272: protected void exlWriteRegWord (int n, int x) {
7273: if (0 <= n && n <= 15) {
7274: XEiJ.regRn[n] = XEiJ.regRn[n] & ~65535 | x & 65535;
7275: }
7276: }
7277:
7278: protected void exlWriteRegLong (int n, int x) {
7279: if (0 <= n && n <= 15) {
7280: XEiJ.regRn[n] = x;
7281: }
7282: }
7283:
7284:
7285:
7286:
7287: protected EFP exlGetFPn (int n) {
7288: return ExpressionEvaluator.this.epbFPn[n];
7289: }
7290: protected void exlSetFPn (int n, EFPBox.EFP x) {
7291: ExpressionEvaluator.this.epbFPn[n].sete (x);
7292: }
7293:
7294:
7295:
7296:
7297: protected int exlReadPC () {
7298: return XEiJ.regPC;
7299: }
7300:
7301: protected int exlWritePC (int x) {
7302: return XEiJ.regPC = x;
7303: }
7304:
7305: protected int exlReadCCR () {
7306: return XEiJ.regCCR;
7307: }
7308:
7309: protected int exlWriteCCR (int x) {
7310: return XEiJ.regCCR = x &= XEiJ.REG_CCR_MASK;
7311: }
7312:
7313: protected int exlReadSR () {
7314: return XEiJ.regSRT1 | XEiJ.regSRT0 | XEiJ.regSRS | XEiJ.regSRM | XEiJ.regSRI | XEiJ.regCCR;
7315: }
7316:
7317: protected int exlWriteSR (int x) {
7318: XEiJ.regSRT1 = x & XEiJ.REG_SR_T1;
7319: XEiJ.regSRT0 = x & XEiJ.REG_SR_T0;
7320:
7321: XEiJ.regSRM = x & XEiJ.REG_SR_M;
7322: XEiJ.regSRI = x & XEiJ.REG_SR_I;
7323: XEiJ.regCCR = x & XEiJ.REG_CCR_MASK;
7324: return x &= XEiJ.REG_SR_T1 | XEiJ.REG_SR_T0 | XEiJ.REG_SR_M | XEiJ.REG_SR_I | XEiJ.REG_CCR_MASK;
7325: }
7326:
7327: protected int exlReadFloatControlRegister (int n) {
7328: switch (n & 7) {
7329: case 1:
7330: return XEiJ.fpuBox.epbFpiar;
7331: case 2:
7332: return XEiJ.fpuBox.epbFpsr;
7333: case 4:
7334: return XEiJ.fpuBox.epbFpcr;
7335: }
7336: return 0;
7337: }
7338:
7339: protected int exlWriteFloatControlRegister (int n, int x) {
7340: switch (n & 7) {
7341: case 1:
7342: return XEiJ.fpuBox.epbFpiar = x;
7343: case 2:
7344: return XEiJ.fpuBox.epbFpsr = x;
7345: case 4:
7346: return XEiJ.fpuBox.epbFpcr = x;
7347: }
7348: return x;
7349: }
7350:
7351: protected int exlReadControlRegister (int n) {
7352: switch ((char) n) {
7353: case 0x0000:
7354: return XEiJ.mpuSFC;
7355: case 0x0001:
7356: return XEiJ.mpuDFC;
7357: case 0x0002:
7358: return XEiJ.mpuCACR;
7359: case 0x0003:
7360: return MC68060.mmuTCR;
7361: case 0x0004:
7362: return MC68060.mmuITT0;
7363: case 0x0005:
7364: return MC68060.mmuITT1;
7365: case 0x0006:
7366: return MC68060.mmuDTT0;
7367: case 0x0007:
7368: return MC68060.mmuDTT1;
7369: case 0x0008:
7370: return XEiJ.mpuBUSCR;
7371: case 0x0800:
7372: return XEiJ.regSRS != 0 ? XEiJ.mpuUSP : XEiJ.regRn[15];
7373: case 0x0801:
7374: return XEiJ.mpuVBR;
7375: case 0x0802:
7376: return XEiJ.mpuCAAR;
7377: case 0x0803:
7378: return XEiJ.regSRS == 0 || XEiJ.regSRM == 0 ? XEiJ.mpuMSP : XEiJ.regRn[15];
7379: case 0x0804:
7380: return XEiJ.regSRS == 0 || XEiJ.regSRM != 0 ? XEiJ.mpuISP : XEiJ.regRn[15];
7381: case 0x0805:
7382: return 0;
7383: case 0x0806:
7384: return MC68060.mmuURP;
7385: case 0x0807:
7386: return MC68060.mmuSRP;
7387: case 0x0808:
7388: return XEiJ.mpuPCR;
7389: }
7390: return 0;
7391: }
7392:
7393: protected int exlWriteControlRegister (int n, int x) {
7394: switch ((char) n) {
7395: case 0x0000:
7396: return XEiJ.mpuSFC = x & 0x00000007;
7397: case 0x0001:
7398: return XEiJ.mpuDFC = x & 0x00000007;
7399: case 0x0002:
7400: return XEiJ.mpuCACR = x & (XEiJ.currentMPU < Model.MPU_MC68LC040 ? 0x00003f1f : 0xf8e0e000);
7401: case 0x0003:
7402: return MC68060.mmuTCR = x;
7403: case 0x0004:
7404: return MC68060.mmuITT0 = x;
7405: case 0x0005:
7406: return MC68060.mmuITT1 = x;
7407: case 0x0006:
7408: return MC68060.mmuDTT0 = x;
7409: case 0x0007:
7410: return MC68060.mmuDTT1 = x;
7411: case 0x0008:
7412: return XEiJ.mpuBUSCR = x & 0xf0000000;
7413: case 0x0800:
7414: return XEiJ.regSRS == 0 ? (XEiJ.regRn[15] = x) : (XEiJ.mpuUSP = x);
7415: case 0x0801:
7416: return XEiJ.mpuVBR = x & -4;
7417: case 0x0802:
7418: return XEiJ.mpuCAAR = x;
7419: case 0x0803:
7420: return XEiJ.regSRS == 0 || XEiJ.regSRM == 0 ? (XEiJ.mpuMSP = x) : (XEiJ.regRn[15] = x);
7421: case 0x0804:
7422: return XEiJ.regSRS == 0 || XEiJ.regSRM != 0 ? (XEiJ.mpuISP = x) : (XEiJ.regRn[15] = x);
7423: case 0x0805:
7424: return 0;
7425: case 0x0806:
7426: return MC68060.mmuURP = x;
7427: case 0x0807:
7428: return MC68060.mmuSRP = x;
7429: case 0x0808:
7430: return XEiJ.mpuPCR = 0x04300500 | XEiJ.MPU_060_REV << 8 | x & 0x00000083;
7431: }
7432: return x;
7433: }
7434:
7435:
7436:
7437:
7438:
7439:
7440: protected boolean exlIsFloatSubstituend () {
7441: return (exlType == ElementType.ETY_VARIABLE_FLOAT ||
7442:
7443: exlType == ElementType.ETY_INTEGER_REGISTER ||
7444: exlType == ElementType.ETY_FLOATING_POINT_REGISTER ||
7445: exlType == ElementType.ETY_PC ||
7446: exlType == ElementType.ETY_CCR ||
7447: exlType == ElementType.ETY_SR ||
7448: exlType == ElementType.ETY_FLOAT_CONTROL_REGISTER ||
7449: exlType == ElementType.ETY_CONTROL_REGISTER ||
7450: exlType == ElementType.ETY_SQUARE_BRACKET ||
7451: ((exlType == ElementType.ETY_OPERATOR_SIZE_BYTE ||
7452: exlType == ElementType.ETY_OPERATOR_SIZE_WORD ||
7453: exlType == ElementType.ETY_OPERATOR_SIZE_LONG ||
7454: exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE) &&
7455: (exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER ||
7456: exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET)) ||
7457: ((exlType == ElementType.ETY_OPERATOR_SIZE_QUAD ||
7458: exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE ||
7459: exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED ||
7460: exlType == ElementType.ETY_OPERATOR_SIZE_TRIPLE ||
7461: exlType == ElementType.ETY_OPERATOR_SIZE_PACKED) &&
7462: exlParamX.exlType == ElementType.ETY_SQUARE_BRACKET));
7463: }
7464:
7465:
7466:
7467:
7468:
7469: protected ExpressionElement exlEval (int mode) {
7470: exlType.etyEval (this, mode);
7471: return this;
7472: }
7473:
7474:
7475:
7476:
7477: protected int exlLengthOfCommaList () {
7478: return exlType == ElementType.ETY_OPERATOR_COMMA ? exlParamX.exlLengthOfCommaList () + 1 : 1;
7479: }
7480:
7481:
7482:
7483:
7484: protected ExpressionElement[] exlEvalCommaList (int mode) {
7485: return exlEvalCommaListSub (new ArrayList<ExpressionElement> (), mode).toArray (new ExpressionElement[0]);
7486: }
7487: protected ArrayList<ExpressionElement> exlEvalCommaListSub (ArrayList<ExpressionElement> list, int mode) {
7488: if (exlType == ElementType.ETY_OPERATOR_COMMA) {
7489: exlParamX.exlEvalCommaListSub (list, mode);
7490: list.add (exlParamY.exlEval (mode));
7491: } else {
7492: list.add (exlEval (mode));
7493: }
7494: return list;
7495: }
7496:
7497:
7498:
7499:
7500: protected LinkedList<ExpressionElement> exlToCommaList () {
7501: LinkedList<ExpressionElement> list = new LinkedList<ExpressionElement> ();
7502: ExpressionElement element = this;
7503: while (element.exlType == ElementType.ETY_OPERATOR_COMMA) {
7504: list.addFirst (element.exlParamY);
7505: element = element.exlParamX;
7506: }
7507: list.addFirst (element);
7508: return list;
7509: }
7510:
7511:
7512:
7513:
7514: protected LinkedList<ExpressionElement> exlToSeparatorList () {
7515: LinkedList<ExpressionElement> list = new LinkedList<ExpressionElement> ();
7516: ExpressionElement element = this;
7517: while (element.exlType == ElementType.ETY_SEPARATOR) {
7518: list.addFirst (element.exlParamY);
7519: element = element.exlParamX;
7520: }
7521: list.addFirst (element);
7522: return list;
7523: }
7524:
7525:
7526:
7527: protected void exlPrint () {
7528: switch (exlValueType) {
7529: case ETY_FLOAT:
7530: DebugConsole.dgtPrint (exlFloatValue.toString ());
7531: break;
7532: case ETY_STRING:
7533: DebugConsole.dgtPrint (exlStringValue);
7534: break;
7535: }
7536: }
7537:
7538:
7539:
7540:
7541: protected StringBuilder exlAppendTo (StringBuilder sb) {
7542: return exlType.etyAppendTo (sb, this);
7543: }
7544:
7545:
7546:
7547:
7548: protected StringBuilder exlAppendFunctionTo (StringBuilder sb, String funcName) {
7549: sb.append (funcName).append ('(');
7550: if (exlParamX != null) {
7551: exlParamX.exlAppendTo (sb);
7552: if (exlParamY != null) {
7553: exlParamY.exlAppendTo (sb.append (','));
7554: if (exlParamZ != null) {
7555: exlParamZ.exlAppendTo (sb.append (','));
7556: }
7557: }
7558: }
7559: return sb.append (')');
7560: }
7561:
7562:
7563:
7564:
7565:
7566: protected StringBuilder exlAppendPostfixOperatorTo (StringBuilder sb, String text) {
7567: if (exlParamX.exlType.etyPriority () <= exlType.etyPriority ()) {
7568: exlParamX.exlAppendTo (sb.append ('(')).append (')');
7569: } else {
7570: exlParamX.exlAppendTo (sb);
7571: }
7572: return sb.append (text);
7573: }
7574:
7575:
7576:
7577:
7578:
7579: protected StringBuilder exlAppendPrefixOperatorTo (StringBuilder sb, String text) {
7580: sb.append (text);
7581: if (exlParamX.exlType.etyPriority () <= exlType.etyPriority ()) {
7582: exlParamX.exlAppendTo (sb.append ('(')).append (')');
7583: } else {
7584: exlParamX.exlAppendTo (sb);
7585: }
7586: return sb;
7587: }
7588:
7589:
7590:
7591:
7592:
7593:
7594:
7595: protected StringBuilder exlAppendBinaryOperatorTo (StringBuilder sb, String text) {
7596: if (exlParamX.exlType.etyPriority () < exlType.etyPriority ()) {
7597: exlParamX.exlAppendTo (sb.append ('(')).append (')');
7598: } else {
7599: exlParamX.exlAppendTo (sb);
7600: }
7601: sb.append (text);
7602: if (exlParamY.exlType.etyPriority () <= exlType.etyPriority ()) {
7603: exlParamY.exlAppendTo (sb.append ('(')).append (')');
7604: } else {
7605: exlParamY.exlAppendTo (sb);
7606: }
7607: return sb;
7608: }
7609:
7610:
7611:
7612:
7613:
7614:
7615:
7616: protected StringBuilder exlAppendConditionalOperatorTo (StringBuilder sb, String text1, String text2) {
7617: if (exlParamX.exlType.etyPriority () <= exlType.etyPriority ()) {
7618: exlParamX.exlAppendTo (sb.append ('(')).append (')');
7619: } else {
7620: exlParamX.exlAppendTo (sb);
7621: }
7622: return exlParamZ.exlAppendTo (exlParamY.exlAppendTo (sb.append (text1)).append (text2));
7623: }
7624:
7625:
7626:
7627:
7628:
7629:
7630:
7631: protected StringBuilder exlAppendAssignmentOperatorTo (StringBuilder sb, String text) {
7632: if (exlParamX.exlType.etyPriority () <= exlType.etyPriority ()) {
7633: exlParamX.exlAppendTo (sb.append ('(')).append (')');
7634: } else {
7635: exlParamX.exlAppendTo (sb);
7636: }
7637: sb.append (text);
7638: if (exlParamY.exlType.etyPriority () < exlType.etyPriority ()) {
7639: exlParamY.exlAppendTo (sb.append ('(')).append (')');
7640: } else {
7641: exlParamY.exlAppendTo (sb);
7642: }
7643: return sb;
7644: }
7645:
7646:
7647:
7648:
7649: @Override public String toString () {
7650: return exlAppendTo (new StringBuilder ()).toString ();
7651: }
7652:
7653:
7654: }
7655:
7656:
7657:
7658:
7659:
7660: protected static void evxPrintError (String message, String source, int offset, int length) {
7661: StringBuilder sb = new StringBuilder ();
7662: sb.append (message).append ('\n');
7663: if (source != null) {
7664: if (offset == -1) {
7665: offset = source.length ();
7666: }
7667: int head = Math.max (0, offset - 20);
7668: int tail = Math.min (source.length (), offset + length + 20);
7669: sb.append (source.substring (head, tail)).append ('\n');
7670: for (int i = head; i < offset; i++) {
7671: sb.append (' ');
7672: }
7673: for (int i = 0; i < length; i++) {
7674: sb.append ('^');
7675: }
7676: DebugConsole.dgtPrintln (sb.toString ());
7677: }
7678: }
7679:
7680:
7681:
7682:
7683:
7684: protected ExpressionElement evxParse (String source, int mode) {
7685:
7686:
7687:
7688:
7689: LinkedList<ExpressionElement> tokenList = new LinkedList<ExpressionElement> ();
7690: ExpressionElement lastToken = null;
7691: char[] a = source.toCharArray ();
7692: int field = 0;
7693: int l = a.length;
7694: int p = 0;
7695: int c = p < l ? a[p++] : -1;
7696: while (0 <= c) {
7697:
7698: while (c == ' ' || c == '\b' || c == '\t' || c == '\n' || c == '\f' || c == '\r') {
7699: if (c == '\n' || c == '\r') {
7700:
7701: if (!(lastToken != null && lastToken.exlType == ElementType.ETY_TOKEN_SEMICOLON)) {
7702: tokenList.add (new ExpressionElement (ElementType.ETY_TOKEN_SEMICOLON, 0,
7703: ElementType.ETY_UNDEF, null, "",
7704: source, p - 1, 1));
7705: }
7706: lastToken = null;
7707: }
7708: c = p < l ? a[p++] : -1;
7709: }
7710: if (c < 0) {
7711: break;
7712: }
7713: int p0 = p - 1;
7714: ElementType type = ElementType.ETY_FLOAT;
7715: int subscript = 0;
7716: ElementType valueType = ElementType.ETY_UNDEF;
7717: EFP floatValue = null;
7718: String stringValue = "";
7719: token:
7720: {
7721:
7722: if (mode == EVM_ASSEMBLER) {
7723: int q = p;
7724: int d = c;
7725: if (lastToken == null) {
7726:
7727: int number = -1;
7728: if (d == '@') {
7729: d = q < l ? a[q++] : -1;
7730: if (d == '@') {
7731: d = q < l ? a[q++] : -1;
7732: }
7733: } else if ('1' <= d && d <= '9') {
7734: number = d - '0';
7735: d = q < l ? a[q++] : -1;
7736: for (int i = 2; i <= 4 && '0' <= d && d <= '9'; i++) {
7737: number = number * 10 + (d - '0');
7738: d = q < l ? a[q++] : -1;
7739: }
7740: }
7741: if (d == '$' || d == '@' ||
7742: '0' <= d && d <= '9' || 'A' <= d && d <= 'Z' || 'a' <= d && d <= 'z') {
7743: number = -1;
7744: }
7745: if (0 <= number) {
7746: p = q;
7747: c = d;
7748: while (c == ':') {
7749: c = p < l ? a[p++] : -1;
7750: }
7751: type = ElementType.ETY_LOCAL_LABEL_DEFINITION;
7752: subscript = number;
7753: break token;
7754: }
7755: } else {
7756:
7757: int number = -1;
7758: int offset = 0;
7759: if (d == '@') {
7760: number = 0;
7761: d = q < l ? a[q++] : -1;
7762: for (int i = 2; i <= 256 && d == '@'; i++) {
7763: offset++;
7764: d = q < l ? a[q++] : -1;
7765: }
7766: } else if ('1' <= d && d <= '9') {
7767: number = d - '0';
7768: d = q < l ? a[q++] : -1;
7769: for (int i = 2; i <= 4 && '0' <= d && d <= '9'; i++) {
7770: number = number * 10 + (d - '0');
7771: d = q < l ? a[q++] : -1;
7772: }
7773: }
7774: if (0 <= number) {
7775: if (d == 'B' || d == 'b') {
7776: d = q < l ? a[q++] : -1;
7777: offset = ~offset;
7778: } else if (d == 'F' || d == 'f') {
7779: d = q < l ? a[q++] : -1;
7780: } else {
7781: number = -1;
7782: }
7783: }
7784: if (0 <= number) {
7785: if (d == '$' || d == '@' ||
7786: '0' <= d && d <= '9' || 'A' <= d && d <= 'Z' || 'a' <= d && d <= 'z') {
7787: number = -1;
7788: }
7789: }
7790: if (0 <= number) {
7791: p = q;
7792: c = d;
7793: type = ElementType.ETY_LOCAL_LABEL_REFERENCE;
7794: subscript = offset << 16 | number;
7795: break token;
7796: }
7797: }
7798: }
7799:
7800:
7801:
7802: number:
7803: {
7804: int d = p < l ? a[p] : -1;
7805: int radix;
7806: int check = 1;
7807: if (c == '0') {
7808: if (d == 'X' || d == 'x') {
7809: p++;
7810: radix = 16;
7811: } else if (d == 'O' || d == 'o') {
7812: p++;
7813: radix = 8;
7814: } else if (d == 'B' || d == 'b') {
7815: p++;
7816: radix = 2;
7817: } else {
7818: radix = 10;
7819: check = 0;
7820: }
7821: } else if ('1' <= c && c <= '9') {
7822: radix = 10;
7823: check = 0;
7824: } else if (c == '$' &&
7825: (('0' <= d && d <= '9') || ('A' <= d && d <= 'F') || ('a' <= d && d <= 'f') || d == '_')) {
7826: radix = 16;
7827: } else if (c == '@' &&
7828: (('0' <= d && d <= '7') || d == '_')) {
7829: radix = 8;
7830: } else if (c == '%' &&
7831: (('0' <= d && d <= '1') || d == '_')) {
7832: radix = 2;
7833: } else {
7834: break number;
7835: }
7836:
7837: c = p < l ? a[p++] : -1;
7838: while ((radix <= 10 ?
7839: '0' <= c && c < '0' + radix :
7840: '0' <= c && c <= '9' || 'A' <= c && c <= 'F' || 'a' <= c && c <= 'f') ||
7841: c == '_') {
7842: if (c != '_') {
7843: check &= ~1;
7844: }
7845: c = p < l ? a[p++] : -1;
7846: }
7847:
7848: if (c == '.') {
7849: d = p < l ? a[p] : -1;
7850: if ((radix <= 10 ?
7851: '0' <= d && d < '0' + radix :
7852: '0' <= d && d <= '9' || 'A' <= d && d <= 'F' || 'a' <= d && d <= 'f') ||
7853: d == '_' ||
7854: (radix == 10 ? d == 'E' || d == 'e' : d == 'P' || d == 'p')) {
7855: check |= 2;
7856: c = p < l ? a[p++] : -1;
7857: while ((radix <= 10 ?
7858: '0' <= c && c < '0' + radix :
7859: '0' <= c && c <= '9' || 'A' <= c && c <= 'F' || 'a' <= c && c <= 'f') ||
7860: c == '_') {
7861: if (c != '_') {
7862: check &= ~2;
7863: }
7864: c = p < l ? a[p++] : -1;
7865: }
7866: }
7867: }
7868:
7869: if (radix == 10 ?
7870: c == 'E' || c == 'e' :
7871: c == 'P' || c == 'p') {
7872: check |= 4;
7873: c = p < l ? a[p++] : -1;
7874: if (c == '+' || c == '-') {
7875: c = p < l ? a[p++] : -1;
7876: }
7877: while ('0' <= c && c <= '9') {
7878: check &= ~4;
7879: c = p < l ? a[p++] : -1;
7880: }
7881: }
7882:
7883: while ('A' <= c && c <= 'Z' || 'a' <= c & c <= 'z') {
7884: check |= 8;
7885: c = p < l ? a[p++] : -1;
7886: }
7887: if (check != 0) {
7888: evxPrintError ((check & 1) != 0 ? (Multilingual.mlnJapanese ?
7889: "整数部に数字がありません" :
7890: "no figure appears at the integer part") :
7891: (check & 2) != 0 ? (Multilingual.mlnJapanese ?
7892: "小数部に数字がありません" :
7893: "no figure appears at the fractional part") :
7894: (check & 4) != 0 ? (Multilingual.mlnJapanese ?
7895: "指数部に数字がありません" :
7896: "no figure appears at the exponential part") :
7897: (check & 8) != 0 ? (Multilingual.mlnJapanese ?
7898: "浮動小数点数に不明な接尾辞が続いています" :
7899: "floating point number followed by an unknown postfix") :
7900: "",
7901: source, p0, p - p0);
7902: return null;
7903: }
7904: type = ElementType.ETY_FLOAT;
7905: floatValue = new EFP (String.valueOf (a, p0, p - p0));
7906: break token;
7907: }
7908:
7909:
7910:
7911: if (c == '\'') {
7912: c = p < l ? a[p++] : -1;
7913: if (c < 0) {
7914: evxPrintError (Multilingual.mlnJapanese ?
7915: "'...' が閉じていません" :
7916: "'...' is not closed",
7917: source, p0, p - p0);
7918: return null;
7919: }
7920: type = ElementType.ETY_FLOAT;
7921: floatValue = new EFP ((char) c);
7922: c = p < l ? a[p++] : -1;
7923: if (c != '\'') {
7924: evxPrintError (Multilingual.mlnJapanese ?
7925: "'...' が閉じていません" :
7926: "'...' is not closed",
7927: source, p0, p - p0);
7928: return null;
7929: }
7930: c = p < l ? a[p++] : -1;
7931: break token;
7932: }
7933:
7934:
7935:
7936: if (c == '"') {
7937: StringBuilder sb = new StringBuilder ();
7938: c = p < l ? a[p++] : -1;
7939: while (0 <= c && c != '"' && c != '\n') {
7940: if (c == '\\') {
7941: c = p < l ? a[p++] : -1;
7942: if (c == '\n') {
7943: c = p < l ? a[p++] : -1;
7944: continue;
7945: }
7946: if ('0' <= c && c <= '3') {
7947: c -= '0';
7948: int d = p < l ? a[p] : -1;
7949: if ('0' <= d && d <= '7') {
7950: p++;
7951: c = (c << 3) + (d - '0');
7952: d = p < l ? a[p] : -1;
7953: if ('0' <= d && d <= '7') {
7954: p++;
7955: c = (c << 3) + (d - '0');
7956: }
7957: }
7958: } else if ('4' <= c && c <= '7') {
7959: c -= '0';
7960: int d = p < l ? a[p] : -1;
7961: if ('0' <= d && d <= '7') {
7962: p++;
7963: c = (c << 3) + (d - '0');
7964: }
7965: } else if (c == 'b') {
7966: c = '\b';
7967: } else if (c == 'f') {
7968: c = '\f';
7969: } else if (c == 'n') {
7970: c = '\n';
7971: } else if (c == 'r') {
7972: c = '\r';
7973: } else if (c == 't') {
7974: c = '\t';
7975: } else if (c == 'x') {
7976: c = 0;
7977: for (int i = 0; i < 2; i++) {
7978: int d = p < l ? a[p++] : -1;
7979: if ('0' <= d && d <= '9' || 'A' <= d && d <= 'F' || 'a' <= d && d <= 'f') {
7980: evxPrintError (Multilingual.mlnJapanese ?
7981: "\\x?? が途切れています" :
7982: "unfinished \\x??",
7983: source, p - i - 3, i + 2);
7984: return null;
7985: }
7986: c = (c << 4) + (d <= '9' ? d - '0' : (d | 0x20) - ('a' - 10));
7987: }
7988: } else if (c == 'u') {
7989: c = 0;
7990: for (int i = 0; i < 4; i++) {
7991: int d = p < l ? a[p++] : -1;
7992: if ('0' <= d && d <= '9' || 'A' <= d && d <= 'F' || 'a' <= d && d <= 'f') {
7993: evxPrintError (Multilingual.mlnJapanese ?
7994: "\\u???? が途切れています" :
7995: "unfinished \\u????",
7996: source, p - i - 3, i + 2);
7997: return null;
7998: }
7999: c = (c << 4) + (d <= '9' ? d - '0' : (d | 0x20) - ('a' - 10));
8000: }
8001: } else if (c == '\"') {
8002: } else if (c == '\'') {
8003: } else if (c == '\\') {
8004: } else {
8005: evxPrintError (Multilingual.mlnJapanese ?
8006: "不明なエスケープシーケンスです" :
8007: "unknown escape sequence",
8008: source, p - 3, 2);
8009: return null;
8010: }
8011: }
8012: sb.append ((char) c);
8013: c = p < l ? a[p++] : -1;
8014: }
8015: if (c != '"') {
8016: evxPrintError (Multilingual.mlnJapanese ?
8017: "\"...\" が閉じていません" :
8018: "\"...\" is not closed",
8019: source, p0, p - p0);
8020: return null;
8021: }
8022: c = p < l ? a[p++] : -1;
8023: type = ElementType.ETY_STRING;
8024: stringValue = sb.toString ();
8025: break token;
8026: }
8027:
8028:
8029:
8030: if ('A' <= c && c <= 'Z' || 'a' <= c & c <= 'z' || c == '_') {
8031: c = p < l ? a[p++] : -1;
8032: while ('A' <= c && c <= 'Z' || 'a' <= c & c <= 'z' || c == '_' || '0' <= c && c <= '9' || c == '$') {
8033: c = p < l ? a[p++] : -1;
8034: }
8035: String identifier = String.valueOf (a, p0, (c < 0 ? p : p - 1) - p0);
8036: String lowerIdentifier = identifier.toLowerCase ();
8037: stringValue = lowerIdentifier;
8038: if (mode == EVM_COMMAND) {
8039: if (lastToken == null) {
8040:
8041: switch (lowerIdentifier) {
8042:
8043:
8044:
8045:
8046:
8047: case "d":
8048: type = ElementType.ETY_COMMAND_DUMP;
8049: subscript = 'b';
8050: break token;
8051: case "db":
8052: case "dw":
8053: case "dl":
8054: case "dq":
8055: case "ds":
8056: case "dd":
8057: case "dx":
8058: case "dt":
8059: case "dp":
8060: type = ElementType.ETY_COMMAND_DUMP;
8061: subscript = lowerIdentifier.charAt (1);
8062: break token;
8063: case "f":
8064: type = ElementType.ETY_COMMAND_FILL;
8065: subscript = 'b';
8066: break token;
8067: case "fb":
8068: case "fw":
8069: case "fl":
8070: case "fq":
8071: case "fs":
8072: case "fd":
8073: case "fx":
8074: case "ft":
8075: case "fp":
8076: type = ElementType.ETY_COMMAND_FILL;
8077: subscript = lowerIdentifier.charAt (1);
8078: break token;
8079: case "h":
8080: type = ElementType.ETY_COMMAND_HELP;
8081: break token;
8082: case "l":
8083: type = ElementType.ETY_COMMAND_LIST;
8084: break token;
8085: case "p":
8086: type = ElementType.ETY_COMMAND_PRINT;
8087: break token;
8088: case "x":
8089: type = ElementType.ETY_COMMAND_REGS;
8090: break token;
8091: case "xf":
8092: type = ElementType.ETY_COMMAND_FLOAT_REGS;
8093: break token;
8094: case "g":
8095: type = ElementType.ETY_COMMAND_RUN;
8096: break token;
8097: case "s":
8098: type = ElementType.ETY_COMMAND_STEP;
8099: break token;
8100: case "r":
8101: type = ElementType.ETY_COMMAND_RETURN;
8102: break token;
8103: case "i":
8104: type = ElementType.ETY_COMMAND_STOP;
8105: break token;
8106: case "t":
8107: type = ElementType.ETY_COMMAND_TRACE;
8108: break token;
8109: }
8110: }
8111: }
8112: if (mode == EVM_ASSEMBLER) {
8113: if (lastToken == null ||
8114: lastToken.exlType == ElementType.ETY_LABEL_DEFINITION ||
8115: lastToken.exlType == ElementType.ETY_LOCAL_LABEL_DEFINITION) {
8116:
8117: if (Assembler.ASM_MNEMONIC_MAP.containsKey (lowerIdentifier)) {
8118: type = ElementType.ETY_MNEMONIC;
8119: break token;
8120: }
8121: }
8122: switch (lowerIdentifier) {
8123:
8124: case "zd0":
8125: case "zd1":
8126: case "zd2":
8127: case "zd3":
8128: case "zd4":
8129: case "zd5":
8130: case "zd6":
8131: case "zd7":
8132: type = ElementType.ETY_ZERO_REGISTER;
8133: subscript = Integer.parseInt (lowerIdentifier.substring (2));
8134: break token;
8135: case "za0":
8136: case "za1":
8137: case "za2":
8138: case "za3":
8139: case "za4":
8140: case "za5":
8141: case "za6":
8142: case "za7":
8143: type = ElementType.ETY_ZERO_REGISTER;
8144: subscript = 8 + Integer.parseInt (lowerIdentifier.substring (2));
8145: break token;
8146: case "zsp":
8147: type = ElementType.ETY_ZERO_REGISTER;
8148: subscript = 15;
8149: stringValue = "za7";
8150: break token;
8151: case "zr0":
8152: case "zr1":
8153: case "zr2":
8154: case "zr3":
8155: case "zr4":
8156: case "zr5":
8157: case "zr6":
8158: case "zr7":
8159: case "zr8":
8160: case "zr9":
8161: case "zr10":
8162: case "zr11":
8163: case "zr12":
8164: case "zr13":
8165: case "zr14":
8166: case "zr15":
8167: type = ElementType.ETY_ZERO_REGISTER;
8168: subscript = Integer.parseInt (lowerIdentifier.substring (2));
8169: stringValue = subscript < 8 ? "zd" + subscript : "za" + (subscript - 8);
8170: break token;
8171: case "zpc":
8172: type = ElementType.ETY_ZERO_PC;
8173: break token;
8174:
8175: case "opc":
8176: type = ElementType.ETY_OPTIONAL_PC;
8177: break token;
8178:
8179: case "nc":
8180: type = ElementType.ETY_CACHE_SELECTION;
8181: subscript = 0;
8182: break token;
8183: case "dc":
8184: type = ElementType.ETY_CACHE_SELECTION;
8185: subscript = 1;
8186: break token;
8187: case "ic":
8188: type = ElementType.ETY_CACHE_SELECTION;
8189: subscript = 2;
8190: break token;
8191: case "bc":
8192: type = ElementType.ETY_CACHE_SELECTION;
8193: subscript = 3;
8194: break token;
8195: }
8196: }
8197:
8198: if (EVX_CONTROL_NAME_TO_MPU_CODE.containsKey (lowerIdentifier)) {
8199: type = ElementType.ETY_CONTROL_REGISTER;
8200: subscript = EVX_CONTROL_NAME_TO_MPU_CODE.get (lowerIdentifier);
8201: break token;
8202: }
8203: switch (lowerIdentifier) {
8204:
8205: case "pc":
8206: type = ElementType.ETY_PC;
8207: break token;
8208: case "ccr":
8209: type = ElementType.ETY_CCR;
8210: break token;
8211: case "sr":
8212: type = ElementType.ETY_SR;
8213: break token;
8214:
8215: case "fpiar":
8216: type = ElementType.ETY_FLOAT_CONTROL_REGISTER;
8217: subscript = 1;
8218: break token;
8219: case "fpsr":
8220: type = ElementType.ETY_FLOAT_CONTROL_REGISTER;
8221: subscript = 2;
8222: break token;
8223: case "fpcr":
8224: type = ElementType.ETY_FLOAT_CONTROL_REGISTER;
8225: subscript = 4;
8226: break token;
8227:
8228: case "infinity":
8229: type = ElementType.ETY_FLOAT;
8230: floatValue = INF;
8231: break token;
8232: case "nan":
8233: type = ElementType.ETY_FLOAT;
8234: floatValue = NAN;
8235: break token;
8236:
8237: case "apery":
8238: type = ElementType.ETY_MATH_APERY;
8239: break token;
8240: case "catalan":
8241: type = ElementType.ETY_MATH_CATALAN;
8242: break token;
8243: case "e":
8244: type = ElementType.ETY_MATH_NAPIER;
8245: break token;
8246: case "euler":
8247: type = ElementType.ETY_MATH_EULER;
8248: break token;
8249: case "pi":
8250: type = ElementType.ETY_MATH_PI;
8251: break token;
8252:
8253: case "d0":
8254: case "d1":
8255: case "d2":
8256: case "d3":
8257: case "d4":
8258: case "d5":
8259: case "d6":
8260: case "d7":
8261: type = ElementType.ETY_INTEGER_REGISTER;
8262: subscript = Integer.parseInt (lowerIdentifier.substring (1));
8263: break token;
8264: case "a0":
8265: case "a1":
8266: case "a2":
8267: case "a3":
8268: case "a4":
8269: case "a5":
8270: case "a6":
8271: case "a7":
8272: type = ElementType.ETY_INTEGER_REGISTER;
8273: subscript = 8 + Integer.parseInt (lowerIdentifier.substring (1));
8274: break token;
8275: case "sp":
8276: type = ElementType.ETY_INTEGER_REGISTER;
8277: subscript = 15;
8278: stringValue = "a7";
8279: break token;
8280: case "r0":
8281: case "r1":
8282: case "r2":
8283: case "r3":
8284: case "r4":
8285: case "r5":
8286: case "r6":
8287: case "r7":
8288: case "r8":
8289: case "r9":
8290: case "r10":
8291: case "r11":
8292: case "r12":
8293: case "r13":
8294: case "r14":
8295: case "r15":
8296: type = ElementType.ETY_INTEGER_REGISTER;
8297: subscript = Integer.parseInt (lowerIdentifier.substring (1));
8298: stringValue = subscript < 8 ? "d" + subscript : "a" + (subscript - 8);
8299: break token;
8300: case "fp0":
8301: case "fp1":
8302: case "fp2":
8303: case "fp3":
8304: case "fp4":
8305: case "fp5":
8306: case "fp6":
8307: case "fp7":
8308: type = ElementType.ETY_FLOATING_POINT_REGISTER;
8309: subscript = Integer.parseInt (lowerIdentifier.substring (2));
8310: break token;
8311:
8312: case "abs":
8313: type = ElementType.ETY_FUNCTION_ABS;
8314: break token;
8315: case "acos":
8316: type = ElementType.ETY_FUNCTION_ACOS;
8317: break token;
8318: case "acosh":
8319: type = ElementType.ETY_FUNCTION_ACOSH;
8320: break token;
8321: case "acot":
8322: type = ElementType.ETY_FUNCTION_ACOT;
8323: break token;
8324: case "acoth":
8325: type = ElementType.ETY_FUNCTION_ACOTH;
8326: break token;
8327: case "acsc":
8328: type = ElementType.ETY_FUNCTION_ACSC;
8329: break token;
8330: case "acsch":
8331: type = ElementType.ETY_FUNCTION_ACSCH;
8332: break token;
8333: case "agi":
8334: type = ElementType.ETY_FUNCTION_AGI;
8335: break token;
8336: case "agm":
8337: type = ElementType.ETY_FUNCTION_AGM;
8338: break token;
8339: case "asc":
8340: type = ElementType.ETY_FUNCTION_ASC;
8341: break token;
8342: case "asec":
8343: type = ElementType.ETY_FUNCTION_ASEC;
8344: break token;
8345: case "asech":
8346: type = ElementType.ETY_FUNCTION_ASECH;
8347: break token;
8348: case "asin":
8349: type = ElementType.ETY_FUNCTION_ASIN;
8350: break token;
8351: case "asinh":
8352: type = ElementType.ETY_FUNCTION_ASINH;
8353: break token;
8354: case "atan":
8355: type = ElementType.ETY_FUNCTION_ATAN;
8356: break token;
8357: case "atan2":
8358: type = ElementType.ETY_FUNCTION_ATAN2;
8359: break token;
8360: case "atanh":
8361: type = ElementType.ETY_FUNCTION_ATANH;
8362: break token;
8363: case "bin$":
8364: type = ElementType.ETY_FUNCTION_BIN_DOLLAR;
8365: break token;
8366: case "cbrt":
8367: type = ElementType.ETY_FUNCTION_CBRT;
8368: break token;
8369: case "ceil":
8370: type = ElementType.ETY_FUNCTION_CEIL;
8371: break token;
8372: case "chr$":
8373: type = ElementType.ETY_FUNCTION_CHR_DOLLAR;
8374: break token;
8375: case "cmp":
8376: type = ElementType.ETY_FUNCTION_CMP;
8377: break token;
8378: case "cmp0":
8379: type = ElementType.ETY_FUNCTION_CMP0;
8380: break token;
8381: case "cmp1":
8382: type = ElementType.ETY_FUNCTION_CMP1;
8383: break token;
8384: case "cmp1abs":
8385: type = ElementType.ETY_FUNCTION_CMP1ABS;
8386: break token;
8387: case "cmpabs":
8388: type = ElementType.ETY_FUNCTION_CMPABS;
8389: break token;
8390: case "cos":
8391: type = ElementType.ETY_FUNCTION_COS;
8392: break token;
8393: case "cosh":
8394: type = ElementType.ETY_FUNCTION_COSH;
8395: break token;
8396: case "cot":
8397: type = ElementType.ETY_FUNCTION_COT;
8398: break token;
8399: case "coth":
8400: type = ElementType.ETY_FUNCTION_COTH;
8401: break token;
8402: case "csc":
8403: type = ElementType.ETY_FUNCTION_CSC;
8404: break token;
8405: case "csch":
8406: type = ElementType.ETY_FUNCTION_CSCH;
8407: break token;
8408: case "cub":
8409: type = ElementType.ETY_FUNCTION_CUB;
8410: break token;
8411: case "dec":
8412: type = ElementType.ETY_FUNCTION_DEC;
8413: break token;
8414: case "deg":
8415: type = ElementType.ETY_FUNCTION_DEG;
8416: break token;
8417: case "div2":
8418: type = ElementType.ETY_FUNCTION_DIV2;
8419: break token;
8420: case "div3":
8421: type = ElementType.ETY_FUNCTION_DIV3;
8422: break token;
8423: case "divpi":
8424: type = ElementType.ETY_FUNCTION_DIVPI;
8425: break token;
8426: case "divrz":
8427: type = ElementType.ETY_FUNCTION_DIVRZ;
8428: break token;
8429: case "exp":
8430: type = ElementType.ETY_FUNCTION_EXP;
8431: break token;
8432: case "exp10":
8433: type = ElementType.ETY_FUNCTION_EXP10;
8434: break token;
8435: case "exp2":
8436: type = ElementType.ETY_FUNCTION_EXP2;
8437: break token;
8438: case "exp2m1":
8439: type = ElementType.ETY_FUNCTION_EXP2M1;
8440: break token;
8441: case "expm1":
8442: type = ElementType.ETY_FUNCTION_EXPM1;
8443: break token;
8444: case "floor":
8445: type = ElementType.ETY_FUNCTION_FLOOR;
8446: break token;
8447: case "frac":
8448: type = ElementType.ETY_FUNCTION_FRAC;
8449: break token;
8450: case "getexp":
8451: type = ElementType.ETY_FUNCTION_GETEXP;
8452: break token;
8453: case "getman":
8454: type = ElementType.ETY_FUNCTION_GETMAN;
8455: break token;
8456: case "hex$":
8457: type = ElementType.ETY_FUNCTION_HEX_DOLLAR;
8458: break token;
8459: case "ieeerem":
8460: type = ElementType.ETY_FUNCTION_IEEEREM;
8461: break token;
8462: case "inc":
8463: type = ElementType.ETY_FUNCTION_INC;
8464: break token;
8465: case "iseven":
8466: type = ElementType.ETY_FUNCTION_ISEVEN;
8467: break token;
8468: case "isinf":
8469: type = ElementType.ETY_FUNCTION_ISINF;
8470: break token;
8471: case "isint":
8472: type = ElementType.ETY_FUNCTION_ISINT;
8473: break token;
8474: case "isnan":
8475: type = ElementType.ETY_FUNCTION_ISNAN;
8476: break token;
8477: case "isodd":
8478: type = ElementType.ETY_FUNCTION_ISODD;
8479: break token;
8480: case "isone":
8481: type = ElementType.ETY_FUNCTION_ISONE;
8482: break token;
8483: case "iszero":
8484: type = ElementType.ETY_FUNCTION_ISZERO;
8485: break token;
8486: case "lgamma":
8487: type = ElementType.ETY_FUNCTION_LGAMMA;
8488: break token;
8489: case "log":
8490: type = ElementType.ETY_FUNCTION_LOG;
8491: break token;
8492: case "log10":
8493: type = ElementType.ETY_FUNCTION_LOG10;
8494: break token;
8495: case "log1p":
8496: type = ElementType.ETY_FUNCTION_LOG1P;
8497: break token;
8498: case "log2":
8499: type = ElementType.ETY_FUNCTION_LOG2;
8500: break token;
8501: case "max":
8502: type = ElementType.ETY_FUNCTION_MAX;
8503: break token;
8504: case "min":
8505: type = ElementType.ETY_FUNCTION_MIN;
8506: break token;
8507: case "mul2":
8508: type = ElementType.ETY_FUNCTION_MUL2;
8509: break token;
8510: case "mul3":
8511: type = ElementType.ETY_FUNCTION_MUL3;
8512: break token;
8513: case "mulpi":
8514: type = ElementType.ETY_FUNCTION_MULPI;
8515: break token;
8516: case "oct$":
8517: type = ElementType.ETY_FUNCTION_OCT_DOLLAR;
8518: break token;
8519: case "pow":
8520: type = ElementType.ETY_FUNCTION_POW;
8521: break token;
8522: case "quo":
8523: type = ElementType.ETY_FUNCTION_QUO;
8524: break token;
8525: case "rad":
8526: type = ElementType.ETY_FUNCTION_RAD;
8527: break token;
8528: case "random":
8529: type = ElementType.ETY_FUNCTION_RANDOM;
8530: break token;
8531: case "rcp":
8532: type = ElementType.ETY_FUNCTION_RCP;
8533: break token;
8534: case "rint":
8535: type = ElementType.ETY_FUNCTION_RINT;
8536: break token;
8537: case "rmode":
8538: type = ElementType.ETY_FUNCTION_RMODE;
8539: break token;
8540: case "round":
8541: type = ElementType.ETY_FUNCTION_ROUND;
8542: break token;
8543: case "rprec":
8544: type = ElementType.ETY_FUNCTION_RPREC;
8545: break token;
8546: case "sec":
8547: type = ElementType.ETY_FUNCTION_SEC;
8548: break token;
8549: case "sech":
8550: type = ElementType.ETY_FUNCTION_SECH;
8551: break token;
8552: case "sgn":
8553: type = ElementType.ETY_FUNCTION_SGN;
8554: break token;
8555: case "sin":
8556: type = ElementType.ETY_FUNCTION_SIN;
8557: break token;
8558: case "sinh":
8559: type = ElementType.ETY_FUNCTION_SINH;
8560: break token;
8561: case "sqrt":
8562: type = ElementType.ETY_FUNCTION_SQRT;
8563: break token;
8564: case "squ":
8565: type = ElementType.ETY_FUNCTION_SQU;
8566: break token;
8567: case "str$":
8568: type = ElementType.ETY_FUNCTION_STR_DOLLAR;
8569: break token;
8570: case "tan":
8571: type = ElementType.ETY_FUNCTION_TAN;
8572: break token;
8573: case "tanh":
8574: type = ElementType.ETY_FUNCTION_TANH;
8575: break token;
8576: case "tgamma":
8577: type = ElementType.ETY_FUNCTION_TGAMMA;
8578: break token;
8579: case "trunc":
8580: type = ElementType.ETY_FUNCTION_TRUNC;
8581: break token;
8582: case "ulp":
8583: type = ElementType.ETY_FUNCTION_ULP;
8584: break token;
8585: case "val":
8586: type = ElementType.ETY_FUNCTION_VAL;
8587: break token;
8588: }
8589:
8590: if (epbConstLongMap.containsKey (lowerIdentifier)) {
8591: type = ElementType.ETY_FLOAT;
8592: floatValue = new EFP (epbConstLongMap.get (lowerIdentifier));
8593: break token;
8594: }
8595: if (mode == EVM_ASSEMBLER &&
8596: lastToken == null) {
8597:
8598: while (c == ':') {
8599: c = p < l ? a[p++] : -1;
8600: }
8601: type = ElementType.ETY_LABEL_DEFINITION;
8602: stringValue = identifier;
8603: break token;
8604: }
8605:
8606: type = (lowerIdentifier.endsWith ("$") ?
8607: ElementType.ETY_VARIABLE_STRING :
8608: ElementType.ETY_VARIABLE_FLOAT);
8609: stringValue = identifier;
8610: break token;
8611: }
8612:
8613:
8614:
8615: {
8616: int d = p < l ? a[p] : -1;
8617: int e = p + 1 < l ? a[p + 1] : -1;
8618: int f = p + 2 < l ? a[p + 2] : -1;
8619: if (c == '!') {
8620: if (d == '=') {
8621: p++;
8622: type = ElementType.ETY_OPERATOR_NOT_EQUAL;
8623: } else {
8624: type = ElementType.ETY_TOKEN_EXCLAMATION_MARK;
8625: }
8626: } else if (c == '%') {
8627: if (d == '=') {
8628: p++;
8629: type = ElementType.ETY_OPERATOR_SELF_MODULUS;
8630: } else {
8631: type = ElementType.ETY_TOKEN_PERCENT_SIGN;
8632: }
8633: } else if (c == '&') {
8634: if (d == '&') {
8635: p++;
8636: type = ElementType.ETY_OPERATOR_LOGICAL_AND;
8637: } else if (d == '=') {
8638: p++;
8639: type = ElementType.ETY_OPERATOR_SELF_BITWISE_AND;
8640: } else {
8641: type = ElementType.ETY_OPERATOR_BITWISE_AND;
8642: }
8643: } else if (c == '#') {
8644: type = ElementType.ETY_TOKEN_NUMBER_SIGN;
8645: } else if (c == '(') {
8646: type = ElementType.ETY_TOKEN_LEFT_PARENTHESIS;
8647: } else if (c == ')') {
8648: type = ElementType.ETY_TOKEN_RIGHT_PARENTHESIS;
8649: } else if (c == '*') {
8650: if (d == '*') {
8651: if (e == '=') {
8652: p += 2;
8653: type = ElementType.ETY_OPERATOR_SELF_POWER;
8654: } else {
8655: p++;
8656: type = ElementType.ETY_OPERATOR_POWER;
8657: }
8658: } else if (d == '=') {
8659: p++;
8660: type = ElementType.ETY_OPERATOR_SELF_MULTIPLICATION;
8661: } else {
8662: type = ElementType.ETY_TOKEN_ASTERISK;
8663: }
8664: } else if (c == '+') {
8665: if (d == '+') {
8666: p++;
8667: type = ElementType.ETY_TOKEN_PLUS_PLUS;
8668: } else if (d == '=') {
8669: p++;
8670: type = ElementType.ETY_OPERATOR_SELF_ADDITION;
8671: } else {
8672: type = ElementType.ETY_TOKEN_PLUS_SIGN;
8673: }
8674: } else if (c == ',') {
8675: type = ElementType.ETY_TOKEN_COMMA;
8676: } else if (c == '-') {
8677: if (d == '-') {
8678: p++;
8679: type = ElementType.ETY_TOKEN_MINUS_MINUS;
8680: } else if (d == '=') {
8681: p++;
8682: type = ElementType.ETY_OPERATOR_SELF_SUBTRACTION;
8683: } else {
8684: type = ElementType.ETY_TOKEN_HYPHEN_MINUS;
8685: }
8686: } else if (c == '.') {
8687: if (!('0' <= e && e <= '9' || 'A' <= e && e <= 'Z' || 'a' <= e & e <= 'z' ||
8688: e == '$' || e == '_')) {
8689: if (d == 'B' || d == 'b') {
8690: p++;
8691: type = ElementType.ETY_OPERATOR_SIZE_BYTE;
8692: subscript = 'b';
8693: } else if (d == 'W' || d == 'w') {
8694: p++;
8695: type = ElementType.ETY_OPERATOR_SIZE_WORD;
8696: subscript = 'w';
8697: } else if (d == 'L' || d == 'l') {
8698: p++;
8699: type = ElementType.ETY_OPERATOR_SIZE_LONG;
8700: subscript = 'l';
8701: } else if (d == 'Q' || d == 'q') {
8702: p++;
8703: type = ElementType.ETY_OPERATOR_SIZE_QUAD;
8704: subscript = 'q';
8705: } else if (d == 'S' || d == 's') {
8706: p++;
8707: type = ElementType.ETY_OPERATOR_SIZE_SINGLE;
8708: subscript = 's';
8709: } else if (d == 'D' || d == 'd') {
8710: p++;
8711: type = ElementType.ETY_OPERATOR_SIZE_DOUBLE;
8712: subscript = 'd';
8713: } else if (d == 'X' || d == 'x') {
8714: p++;
8715: type = ElementType.ETY_OPERATOR_SIZE_EXTENDED;
8716: subscript = 'x';
8717: } else if (d == 'T' || d == 't') {
8718: p++;
8719: type = ElementType.ETY_OPERATOR_SIZE_TRIPLE;
8720: subscript = 't';
8721: } else if (d == 'P' || d == 'p') {
8722: p++;
8723: type = ElementType.ETY_OPERATOR_SIZE_PACKED;
8724: subscript = 'p';
8725: } else {
8726: type = ElementType.ETY_TOKEN_FULL_STOP;
8727: }
8728: } else {
8729: type = ElementType.ETY_TOKEN_FULL_STOP;
8730: }
8731: } else if (c == '/') {
8732: if (d == '=') {
8733: p++;
8734: type = ElementType.ETY_OPERATOR_SELF_DIVISION;
8735: } else {
8736: type = ElementType.ETY_TOKEN_SOLIDUS;
8737: }
8738: } else if (c == ':') {
8739: type = ElementType.ETY_TOKEN_COLON;
8740: } else if (c == ';') {
8741: type = ElementType.ETY_TOKEN_SEMICOLON;
8742: } else if (c == '<') {
8743: if (d == '<') {
8744: if (e == '=') {
8745: p += 2;
8746: type = ElementType.ETY_OPERATOR_SELF_LEFT_SHIFT;
8747: } else {
8748: p++;
8749: type = ElementType.ETY_OPERATOR_LEFT_SHIFT;
8750: }
8751: } else if (d == '=') {
8752: p++;
8753: type = ElementType.ETY_OPERATOR_LESS_OR_EQUAL;
8754: } else {
8755: type = ElementType.ETY_OPERATOR_LESS_THAN;
8756: }
8757: } else if (c == '=') {
8758: if (d == '=') {
8759: p++;
8760: type = ElementType.ETY_OPERATOR_EQUAL;
8761: } else {
8762: type = ElementType.ETY_OPERATOR_ASSIGNMENT;
8763: }
8764: } else if (c == '>') {
8765: if (d == '>') {
8766: if (e == '>') {
8767: if (f == '=') {
8768: p += 3;
8769: type = ElementType.ETY_OPERATOR_SELF_UNSIGNED_RIGHT_SHIFT;
8770: } else {
8771: p += 2;
8772: type = ElementType.ETY_OPERATOR_UNSIGNED_RIGHT_SHIFT;
8773: }
8774: } else if (e == '=') {
8775: p += 2;
8776: type = ElementType.ETY_OPERATOR_SELF_RIGHT_SHIFT;
8777: } else {
8778: p++;
8779: type = ElementType.ETY_OPERATOR_RIGHT_SHIFT;
8780: }
8781: } else if (d == '=') {
8782: p++;
8783: type = ElementType.ETY_OPERATOR_GREATER_OR_EQUAL;
8784: } else {
8785: type = ElementType.ETY_OPERATOR_GREATER_THAN;
8786: }
8787: } else if (c == '?') {
8788: type = ElementType.ETY_TOKEN_QUESTION_MARK;
8789: } else if (c == '@') {
8790: type = ElementType.ETY_OPERATOR_AT;
8791: } else if (c == '[') {
8792: type = ElementType.ETY_TOKEN_LEFT_SQUARE_BRACKET;
8793: } else if (c == ']') {
8794: type = ElementType.ETY_TOKEN_RIGHT_SQUARE_BRACKET;
8795: } else if (c == '^') {
8796: if (d == '=') {
8797: p++;
8798: type = ElementType.ETY_OPERATOR_SELF_BITWISE_XOR;
8799: } else {
8800: type = ElementType.ETY_OPERATOR_BITWISE_XOR;
8801: }
8802: } else if (c == '{') {
8803: type = ElementType.ETY_TOKEN_LEFT_CURLY_BRACKET;
8804: } else if (c == '|') {
8805: if (d == '|') {
8806: p++;
8807: type = ElementType.ETY_OPERATOR_LOGICAL_OR;
8808: } else if (d == '=') {
8809: p++;
8810: type = ElementType.ETY_OPERATOR_SELF_BITWISE_OR;
8811: } else {
8812: type = ElementType.ETY_OPERATOR_BITWISE_OR;
8813: }
8814: } else if (c == '}') {
8815: type = ElementType.ETY_TOKEN_RIGHT_CURLY_BRACKET;
8816: } else if (c == '~') {
8817: type = ElementType.ETY_TOKEN_TILDE;
8818: } else {
8819: evxPrintError (Multilingual.mlnJapanese ?
8820: "使用できない文字です" :
8821: "unusable character",
8822: source, p0, 1);
8823: return null;
8824: }
8825: c = p < l ? a[p++] : -1;
8826: }
8827:
8828: }
8829: lastToken = new ExpressionElement (type, subscript,
8830: valueType, floatValue, stringValue,
8831: source, p0, (c < 0 ? p : p - 1) - p0);
8832: tokenList.add (lastToken);
8833: if (type == ElementType.ETY_TOKEN_SEMICOLON) {
8834: lastToken = null;
8835: }
8836: }
8837:
8838: if (false) {
8839: for (ExpressionElement elem : tokenList) {
8840: DebugConsole.dgtPrintln (elem.exlType.name ());
8841: }
8842: }
8843:
8844:
8845:
8846:
8847: ExpressionElement nodeTree = evxParseSeparator (tokenList, mode);
8848: if (nodeTree == null) {
8849: return null;
8850: }
8851: if (!tokenList.isEmpty ()) {
8852: ExpressionElement elem = tokenList.peekFirst ();
8853: evxPrintError (Multilingual.mlnJapanese ?
8854: "; がありません" :
8855: "; is not found",
8856: elem.exlSource, elem.exlOffset, elem.exlLength);
8857: }
8858:
8859: return nodeTree;
8860:
8861: }
8862:
8863:
8864:
8865:
8866: protected ExpressionElement evxParsePrimitive (LinkedList<ExpressionElement> tokenList, int mode) {
8867: ExpressionElement elem = tokenList.pollFirst ();
8868: if (elem == null) {
8869: return null;
8870: }
8871: switch (elem.exlType) {
8872:
8873:
8874: case ETY_VARIABLE_FLOAT:
8875: {
8876: String variableName = elem.exlStringValue;
8877: ExpressionElement variableBody = evxVariableMap.get (variableName);
8878: if (variableBody == null) {
8879: variableBody = new ExpressionElement (ElementType.ETY_VARIABLE_FLOAT, 0,
8880: ElementType.ETY_FLOAT, new EFP (), "",
8881: elem.exlSource, elem.exlOffset, elem.exlLength);
8882: evxVariableMap.put (variableName, variableBody);
8883: }
8884: elem.exlType = ElementType.ETY_VARIABLE_FLOAT;
8885: elem.exlValueType = ElementType.ETY_FLOAT;
8886: elem.exlParamX = variableBody;
8887: return elem;
8888: }
8889:
8890:
8891: case ETY_VARIABLE_STRING:
8892: {
8893: String variableName = elem.exlStringValue;
8894: ExpressionElement variableBody = evxVariableMap.get (variableName);
8895: if (variableBody == null) {
8896: variableBody = new ExpressionElement (ElementType.ETY_VARIABLE_STRING, 0,
8897: ElementType.ETY_STRING, new EFP (), "",
8898: elem.exlSource, elem.exlOffset, elem.exlLength);
8899: evxVariableMap.put (variableName, variableBody);
8900: }
8901: elem.exlType = ElementType.ETY_VARIABLE_STRING;
8902: elem.exlValueType = ElementType.ETY_STRING;
8903: elem.exlParamX = variableBody;
8904: return elem;
8905: }
8906:
8907:
8908: case ETY_FLOAT:
8909: elem.exlValueType = ElementType.ETY_FLOAT;
8910: return elem;
8911:
8912:
8913: case ETY_STRING:
8914: elem.exlValueType = ElementType.ETY_STRING;
8915: return elem;
8916:
8917:
8918: case ETY_MATH_APERY:
8919: case ETY_MATH_CATALAN:
8920: case ETY_MATH_NAPIER:
8921: case ETY_MATH_EULER:
8922: case ETY_MATH_PI:
8923: elem.exlValueType = ElementType.ETY_FLOAT;
8924: return elem;
8925:
8926:
8927: case ETY_INTEGER_REGISTER:
8928: if (mode != EVM_ASSEMBLER) {
8929: elem.exlValueType = ElementType.ETY_FLOAT;
8930: return elem;
8931: }
8932:
8933: {
8934: ExpressionElement colon = tokenList.peekFirst ();
8935: if (colon == null) {
8936: return elem;
8937: }
8938: ExpressionElement dh = elem;
8939: ExpressionElement dl = dh;
8940: int h = dh.exlSubscript;
8941: int l = h;
8942:
8943: if (colon.exlType == ElementType.ETY_TOKEN_HYPHEN_MINUS ||
8944: colon.exlType == ElementType.ETY_TOKEN_SOLIDUS) {
8945: if (colon.exlType == ElementType.ETY_TOKEN_HYPHEN_MINUS) {
8946: tokenList.pollFirst ();
8947: dl = tokenList.peekFirst ();
8948: if (dl == null || dl.exlType != ElementType.ETY_INTEGER_REGISTER) {
8949: evxPrintError (Multilingual.mlnJapanese ?
8950: "不完全なレジスタリスト" :
8951: "incomplete register list",
8952: elem.exlSource, elem.exlOffset, colon.exlOffset + colon.exlLength - elem.exlOffset);
8953: return null;
8954: }
8955: tokenList.pollFirst ();
8956: l = dl.exlSubscript;
8957: if (l <= h) {
8958: evxPrintError (Multilingual.mlnJapanese ?
8959: "昇順でないレジスタリスト" :
8960: "register list not in ascending order",
8961: elem.exlSource, elem.exlOffset, dl.exlOffset + dl.exlLength - elem.exlOffset);
8962: return null;
8963: }
8964: colon = tokenList.peekFirst ();
8965: }
8966: int subscript = (2 << l) - (1 << h);
8967: while (colon != null && colon.exlType == ElementType.ETY_TOKEN_SOLIDUS) {
8968: tokenList.pollFirst ();
8969: dh = tokenList.peekFirst ();
8970: if (dh == null || dh.exlType != ElementType.ETY_INTEGER_REGISTER) {
8971: evxPrintError (Multilingual.mlnJapanese ?
8972: "不完全なレジスタリスト" :
8973: "incomplete register list",
8974: elem.exlSource, elem.exlOffset, colon.exlOffset + colon.exlLength - elem.exlOffset);
8975: return null;
8976: }
8977: tokenList.pollFirst ();
8978: h = dh.exlSubscript;
8979: dl = dh;
8980: l = dl.exlSubscript;
8981: colon = tokenList.peekFirst ();
8982: if (colon != null && colon.exlType == ElementType.ETY_TOKEN_HYPHEN_MINUS) {
8983: tokenList.pollFirst ();
8984: dl = tokenList.peekFirst ();
8985: if (dl == null || dl.exlType != ElementType.ETY_INTEGER_REGISTER) {
8986: evxPrintError (Multilingual.mlnJapanese ?
8987: "不完全なレジスタリスト" :
8988: "incomplete register list",
8989: elem.exlSource, elem.exlOffset, colon.exlOffset + colon.exlLength - elem.exlOffset);
8990: return null;
8991: }
8992: tokenList.pollFirst ();
8993: l = dl.exlSubscript;
8994: if (l <= h) {
8995: evxPrintError (Multilingual.mlnJapanese ?
8996: "昇順でないレジスタリスト" :
8997: "register list not in ascending order",
8998: elem.exlSource, elem.exlOffset, dl.exlOffset + dl.exlLength - elem.exlOffset);
8999: return null;
9000: }
9001: colon = tokenList.peekFirst ();
9002: }
9003: int mask = (2 << l) - (1 << h);
9004: if ((subscript & mask) != 0) {
9005: evxPrintError (Multilingual.mlnJapanese ?
9006: "レジスタが重複しています" :
9007: "duplicated register",
9008: elem.exlSource, elem.exlOffset, dl.exlOffset + dl.exlLength - elem.exlOffset);
9009: return null;
9010: }
9011: subscript |= mask;
9012: }
9013: return new ExpressionElement (
9014: ElementType.ETY_INTEGER_REGISTER_LIST, subscript,
9015: ElementType.ETY_UNDEF, null, null,
9016: elem.exlSource, elem.exlOffset, dl.exlOffset + dl.exlLength - elem.exlOffset,
9017: null, null, null);
9018: }
9019: }
9020: return elem;
9021:
9022:
9023: case ETY_FLOATING_POINT_REGISTER:
9024: if (mode != EVM_ASSEMBLER) {
9025: elem.exlValueType = ElementType.ETY_FLOAT;
9026: return elem;
9027: }
9028:
9029: {
9030: ExpressionElement hyphen = tokenList.peekFirst ();
9031: if (hyphen == null) {
9032: return elem;
9033: }
9034: ExpressionElement fpm = elem;
9035: int m = fpm.exlSubscript;
9036: ExpressionElement fpn = fpm;
9037: int n = fpn.exlSubscript;
9038:
9039: if (hyphen.exlType == ElementType.ETY_TOKEN_HYPHEN_MINUS ||
9040: hyphen.exlType == ElementType.ETY_TOKEN_SOLIDUS) {
9041: if (hyphen.exlType == ElementType.ETY_TOKEN_HYPHEN_MINUS) {
9042: tokenList.pollFirst ();
9043: fpn = tokenList.peekFirst ();
9044: if (fpn == null || fpn.exlType != ElementType.ETY_FLOATING_POINT_REGISTER) {
9045: evxPrintError (Multilingual.mlnJapanese ?
9046: "不完全なレジスタリスト" :
9047: "incomplete register list",
9048: elem.exlSource, elem.exlOffset, hyphen.exlOffset + hyphen.exlLength - elem.exlOffset);
9049: return null;
9050: }
9051: tokenList.pollFirst ();
9052: n = fpn.exlSubscript;
9053: if (n <= m) {
9054: evxPrintError (Multilingual.mlnJapanese ?
9055: "昇順でないレジスタリスト" :
9056: "register list not in ascending order",
9057: elem.exlSource, elem.exlOffset, fpn.exlOffset + fpn.exlLength - elem.exlOffset);
9058: return null;
9059: }
9060: hyphen = tokenList.peekFirst ();
9061: }
9062: int subscript = (2 << n) - (1 << m);
9063: while (hyphen != null && hyphen.exlType == ElementType.ETY_TOKEN_SOLIDUS) {
9064: tokenList.pollFirst ();
9065: fpm = tokenList.peekFirst ();
9066: if (fpm == null || fpm.exlType != ElementType.ETY_FLOATING_POINT_REGISTER) {
9067: evxPrintError (Multilingual.mlnJapanese ?
9068: "不完全なレジスタリスト" :
9069: "incomplete register list",
9070: elem.exlSource, elem.exlOffset, hyphen.exlOffset + hyphen.exlLength - elem.exlOffset);
9071: return null;
9072: }
9073: tokenList.pollFirst ();
9074: m = fpm.exlSubscript;
9075: fpn = fpm;
9076: n = fpn.exlSubscript;
9077: hyphen = tokenList.peekFirst ();
9078: if (hyphen != null && hyphen.exlType == ElementType.ETY_TOKEN_HYPHEN_MINUS) {
9079: tokenList.pollFirst ();
9080: fpn = tokenList.peekFirst ();
9081: if (fpn == null || fpn.exlType != ElementType.ETY_FLOATING_POINT_REGISTER) {
9082: evxPrintError (Multilingual.mlnJapanese ?
9083: "不完全なレジスタリスト" :
9084: "incomplete register list",
9085: elem.exlSource, elem.exlOffset, hyphen.exlOffset + hyphen.exlLength - elem.exlOffset);
9086: return null;
9087: }
9088: tokenList.pollFirst ();
9089: n = fpn.exlSubscript;
9090: if (n <= m) {
9091: evxPrintError (Multilingual.mlnJapanese ?
9092: "昇順でないレジスタリスト" :
9093: "register list not in ascending order",
9094: elem.exlSource, elem.exlOffset, fpn.exlOffset + fpn.exlLength - elem.exlOffset);
9095: return null;
9096: }
9097: hyphen = tokenList.peekFirst ();
9098: }
9099: int mask = (2 << n) - (1 << m);
9100: if ((subscript & mask) != 0) {
9101: evxPrintError (Multilingual.mlnJapanese ?
9102: "浮動小数点レジスタが重複しています" :
9103: "duplicated floating point register",
9104: elem.exlSource, elem.exlOffset, fpn.exlOffset + fpn.exlLength - elem.exlOffset);
9105: return null;
9106: }
9107: subscript |= mask;
9108: }
9109: return new ExpressionElement (
9110: ElementType.ETY_FLOATING_POINT_REGISTER_LIST, subscript,
9111: ElementType.ETY_UNDEF, null, null,
9112: elem.exlSource, elem.exlOffset, fpn.exlOffset + fpn.exlLength - elem.exlOffset,
9113: null, null, null);
9114: }
9115: }
9116: return elem;
9117:
9118:
9119: case ETY_PC:
9120: case ETY_CCR:
9121: case ETY_SR:
9122: case ETY_CONTROL_REGISTER:
9123: if (mode != EVM_ASSEMBLER) {
9124: elem.exlValueType = ElementType.ETY_FLOAT;
9125: return elem;
9126: }
9127:
9128: return elem;
9129:
9130:
9131: case ETY_FLOAT_CONTROL_REGISTER:
9132: if (mode != EVM_ASSEMBLER) {
9133: elem.exlValueType = ElementType.ETY_FLOAT;
9134: return elem;
9135: }
9136:
9137: {
9138: ExpressionElement cr = elem;
9139:
9140: int subscript = cr.exlSubscript;
9141: ExpressionElement solidus = tokenList.peekFirst ();
9142: while (solidus != null && solidus.exlType == ElementType.ETY_TOKEN_SOLIDUS) {
9143: tokenList.pollFirst ();
9144: cr = tokenList.peekFirst ();
9145: if (cr == null || cr.exlType != ElementType.ETY_FLOAT_CONTROL_REGISTER) {
9146: evxPrintError (Multilingual.mlnJapanese ?
9147: "不完全な浮動小数点制御レジスタリスト" :
9148: "incomplete floating point control register list",
9149: elem.exlSource, elem.exlOffset, solidus.exlOffset + solidus.exlLength - elem.exlOffset);
9150: return null;
9151: }
9152: tokenList.pollFirst ();
9153: int mask = cr.exlSubscript;
9154: if ((subscript & mask) != 0) {
9155: evxPrintError (Multilingual.mlnJapanese ?
9156: "浮動小数点制御レジスタが重複しています" :
9157: "duplicated floating point control register",
9158: elem.exlSource, elem.exlOffset, cr.exlOffset + cr.exlLength - elem.exlOffset);
9159: return null;
9160: }
9161: subscript |= mask;
9162: solidus = tokenList.peekFirst ();
9163: }
9164: return new ExpressionElement (
9165: ElementType.ETY_FLOATING_POINT_CONTROL_REGISTER_LIST, subscript,
9166: ElementType.ETY_UNDEF, null, null,
9167: elem.exlSource, elem.exlOffset, cr.exlOffset + cr.exlLength - elem.exlOffset,
9168: null, null, null);
9169: }
9170:
9171:
9172: case ETY_FUNCTION_ABS:
9173: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9174: case ETY_FUNCTION_ACOS:
9175: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9176: case ETY_FUNCTION_ACOSH:
9177: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9178: case ETY_FUNCTION_ACOT:
9179: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9180: case ETY_FUNCTION_ACOTH:
9181: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9182: case ETY_FUNCTION_ACSC:
9183: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9184: case ETY_FUNCTION_ACSCH:
9185: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9186: case ETY_FUNCTION_AGI:
9187: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9188: case ETY_FUNCTION_AGM:
9189: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9190: case ETY_FUNCTION_ASC:
9191: return evxParseFunctionFloatString (elem, tokenList, mode);
9192: case ETY_FUNCTION_ASEC:
9193: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9194: case ETY_FUNCTION_ASECH:
9195: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9196: case ETY_FUNCTION_ASIN:
9197: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9198: case ETY_FUNCTION_ASINH:
9199: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9200: case ETY_FUNCTION_ATAN:
9201: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9202: case ETY_FUNCTION_ATAN2:
9203: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9204: case ETY_FUNCTION_ATANH:
9205: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9206: case ETY_FUNCTION_BIN_DOLLAR:
9207: return evxParseFunctionStringFloat (elem, tokenList, mode);
9208: case ETY_FUNCTION_CBRT:
9209: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9210: case ETY_FUNCTION_CEIL:
9211: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9212: case ETY_FUNCTION_CHR_DOLLAR:
9213: return evxParseFunctionStringFloat (elem, tokenList, mode);
9214: case ETY_FUNCTION_CMP:
9215: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9216: case ETY_FUNCTION_CMP0:
9217: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9218: case ETY_FUNCTION_CMP1:
9219: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9220: case ETY_FUNCTION_CMP1ABS:
9221: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9222: case ETY_FUNCTION_CMPABS:
9223: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9224: case ETY_FUNCTION_COS:
9225: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9226: case ETY_FUNCTION_COSH:
9227: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9228: case ETY_FUNCTION_COT:
9229: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9230: case ETY_FUNCTION_COTH:
9231: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9232: case ETY_FUNCTION_CSC:
9233: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9234: case ETY_FUNCTION_CSCH:
9235: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9236: case ETY_FUNCTION_CUB:
9237: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9238: case ETY_FUNCTION_DEC:
9239: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9240: case ETY_FUNCTION_DEG:
9241: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9242: case ETY_FUNCTION_DIV2:
9243: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9244: case ETY_FUNCTION_DIV3:
9245: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9246: case ETY_FUNCTION_DIVPI:
9247: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9248: case ETY_FUNCTION_DIVRZ:
9249: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9250: case ETY_FUNCTION_EXP:
9251: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9252: case ETY_FUNCTION_EXP10:
9253: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9254: case ETY_FUNCTION_EXP2:
9255: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9256: case ETY_FUNCTION_EXP2M1:
9257: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9258: case ETY_FUNCTION_EXPM1:
9259: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9260: case ETY_FUNCTION_FLOOR:
9261: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9262: case ETY_FUNCTION_FRAC:
9263: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9264: case ETY_FUNCTION_GETEXP:
9265: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9266: case ETY_FUNCTION_GETMAN:
9267: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9268: case ETY_FUNCTION_HEX_DOLLAR:
9269: return evxParseFunctionStringFloat (elem, tokenList, mode);
9270: case ETY_FUNCTION_IEEEREM:
9271: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9272: case ETY_FUNCTION_INC:
9273: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9274: case ETY_FUNCTION_ISEVEN:
9275: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9276: case ETY_FUNCTION_ISINF:
9277: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9278: case ETY_FUNCTION_ISINT:
9279: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9280: case ETY_FUNCTION_ISNAN:
9281: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9282: case ETY_FUNCTION_ISODD:
9283: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9284: case ETY_FUNCTION_ISONE:
9285: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9286: case ETY_FUNCTION_ISZERO:
9287: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9288: case ETY_FUNCTION_LGAMMA:
9289: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9290: case ETY_FUNCTION_LOG:
9291: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9292: case ETY_FUNCTION_LOG10:
9293: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9294: case ETY_FUNCTION_LOG1P:
9295: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9296: case ETY_FUNCTION_LOG2:
9297: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9298: case ETY_FUNCTION_MAX:
9299: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9300: case ETY_FUNCTION_MIN:
9301: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9302: case ETY_FUNCTION_MUL2:
9303: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9304: case ETY_FUNCTION_MUL3:
9305: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9306: case ETY_FUNCTION_MULPI:
9307: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9308: case ETY_FUNCTION_OCT_DOLLAR:
9309: return evxParseFunctionStringFloat (elem, tokenList, mode);
9310: case ETY_FUNCTION_POW:
9311: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9312: case ETY_FUNCTION_QUO:
9313: return evxParseFunctionFloatFloatFloat (elem, tokenList, mode);
9314: case ETY_FUNCTION_RAD:
9315: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9316: case ETY_FUNCTION_RANDOM:
9317: return evxParseFunctionFloat (elem, tokenList, mode);
9318: case ETY_FUNCTION_RCP:
9319: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9320: case ETY_FUNCTION_RINT:
9321: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9322: case ETY_FUNCTION_RMODE:
9323: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9324: case ETY_FUNCTION_ROUND:
9325: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9326: case ETY_FUNCTION_RPREC:
9327: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9328: case ETY_FUNCTION_SEC:
9329: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9330: case ETY_FUNCTION_SECH:
9331: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9332: case ETY_FUNCTION_SGN:
9333: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9334: case ETY_FUNCTION_SIN:
9335: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9336: case ETY_FUNCTION_SINH:
9337: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9338: case ETY_FUNCTION_SQRT:
9339: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9340: case ETY_FUNCTION_SQU:
9341: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9342: case ETY_FUNCTION_STR_DOLLAR:
9343: return evxParseFunctionStringFloat (elem, tokenList, mode);
9344: case ETY_FUNCTION_TAN:
9345: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9346: case ETY_FUNCTION_TANH:
9347: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9348: case ETY_FUNCTION_TGAMMA:
9349: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9350: case ETY_FUNCTION_TRUNC:
9351: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9352: case ETY_FUNCTION_ULP:
9353: return evxParseFunctionFloatFloat (elem, tokenList, mode);
9354: case ETY_FUNCTION_VAL:
9355: return evxParseFunctionFloatString (elem, tokenList, mode);
9356:
9357:
9358: case ETY_TOKEN_LEFT_PARENTHESIS:
9359: {
9360: ExpressionElement paramX = evxParseComma (tokenList, mode);
9361: if (paramX == null) {
9362: return null;
9363: }
9364: ExpressionElement right = tokenList.peekFirst ();
9365: if (right == null || right.exlType != ElementType.ETY_TOKEN_RIGHT_PARENTHESIS) {
9366: evxPrintError (Multilingual.mlnJapanese ?
9367: "(...) が閉じていません" :
9368: "(...) is not closed",
9369: elem.exlSource, elem.exlOffset, paramX.exlOffset + paramX.exlLength - elem.exlOffset);
9370: return null;
9371: }
9372: tokenList.pollFirst ();
9373: if (paramX.exlValueType == ElementType.ETY_FLOAT ||
9374: paramX.exlValueType == ElementType.ETY_STRING) {
9375: return paramX;
9376: }
9377: if (mode != EVM_ASSEMBLER) {
9378: evxPrintError (Multilingual.mlnJapanese ?
9379: "引数の型が違います" :
9380: "wrong type of parameter",
9381: elem.exlSource, elem.exlOffset, right.exlOffset + right.exlLength - elem.exlOffset);
9382: return null;
9383: }
9384:
9385: if (paramX.exlType == ElementType.ETY_INTEGER_REGISTER) {
9386: return new ExpressionElement (
9387: ElementType.ETY_REGISTER_INDIRECT, paramX.exlSubscript,
9388: ElementType.ETY_UNDEF, null, null,
9389: elem.exlSource, elem.exlOffset, right.exlOffset + right.exlLength - elem.exlOffset,
9390: null, null, null);
9391: }
9392: return new ExpressionElement (
9393: ElementType.ETY_PARENTHESIS, 0,
9394: ElementType.ETY_UNDEF, null, null,
9395: elem.exlSource, elem.exlOffset, right.exlOffset + right.exlLength - elem.exlOffset,
9396: paramX, null, null);
9397: }
9398:
9399:
9400: case ETY_TOKEN_LEFT_SQUARE_BRACKET:
9401: {
9402: ExpressionElement paramX = evxParseComma (tokenList, mode);
9403: if (paramX == null) {
9404: return null;
9405: }
9406: ExpressionElement right = tokenList.pollFirst ();
9407: if (right == null ||
9408: right.exlType != ElementType.ETY_TOKEN_RIGHT_SQUARE_BRACKET) {
9409: evxPrintError (Multilingual.mlnJapanese ?
9410: "[...] が閉じていません" :
9411: "[...] is not closed",
9412: elem.exlSource, elem.exlOffset, paramX.exlOffset + paramX.exlLength - elem.exlOffset);
9413: return null;
9414: }
9415: if (mode != EVM_ASSEMBLER) {
9416: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
9417: evxPrintError (Multilingual.mlnJapanese ?
9418: "アドレスの型が違います" :
9419: "wrong type of address",
9420: elem.exlSource, elem.exlOffset, right.exlOffset + right.exlLength - elem.exlOffset);
9421: return null;
9422: }
9423: }
9424: return new ExpressionElement (
9425: ElementType.ETY_SQUARE_BRACKET, 0,
9426: mode == EVM_ASSEMBLER ? ElementType.ETY_UNDEF : ElementType.ETY_FLOAT, null, "",
9427: elem.exlSource, elem.exlOffset, right.exlOffset + right.exlLength - elem.exlOffset,
9428: paramX, null, null);
9429: }
9430:
9431: }
9432:
9433: if (mode == EVM_ASSEMBLER) {
9434: return elem;
9435: }
9436:
9437: evxPrintError (Multilingual.mlnJapanese ?
9438: "文法エラー" :
9439: "syntax error",
9440: elem.exlSource, elem.exlOffset, elem.exlLength);
9441: return null;
9442:
9443: }
9444:
9445:
9446:
9447:
9448: protected ExpressionElement evxParseFunctionFloat (ExpressionElement elem, LinkedList<ExpressionElement> tokenList, int mode) {
9449: return evxParseFunction0 (elem, tokenList,
9450: ElementType.ETY_FLOAT, mode);
9451: }
9452: protected ExpressionElement evxParseFunctionString (ExpressionElement elem, LinkedList<ExpressionElement> tokenList, int mode) {
9453: return evxParseFunction0 (elem, tokenList,
9454: ElementType.ETY_STRING, mode);
9455: }
9456: protected ExpressionElement evxParseFunction0 (ExpressionElement elem, LinkedList<ExpressionElement> tokenList,
9457: ElementType valueType, int mode) {
9458: ExpressionElement commaOrParen = tokenList.pollFirst ();
9459: if (commaOrParen == null || commaOrParen.exlType != ElementType.ETY_TOKEN_LEFT_PARENTHESIS) {
9460: evxPrintError (Multilingual.mlnJapanese ?
9461: "( がありません" :
9462: "( is not found",
9463: elem.exlSource, -1, 1);
9464: return null;
9465: }
9466: commaOrParen = tokenList.pollFirst ();
9467: if (commaOrParen == null || commaOrParen.exlType != ElementType.ETY_TOKEN_RIGHT_PARENTHESIS) {
9468: evxPrintError (Multilingual.mlnJapanese ?
9469: ") がありません" :
9470: ") is not found",
9471: elem.exlSource, -1, 1);
9472: return null;
9473: }
9474: elem.exlValueType = valueType;
9475: elem.exlParamX = null;
9476: elem.exlParamY = null;
9477: elem.exlParamZ = null;
9478: elem.exlLength = commaOrParen.exlOffset + commaOrParen.exlLength - elem.exlOffset;
9479: return elem;
9480: }
9481:
9482:
9483:
9484:
9485: protected ExpressionElement evxParseFunctionFloatFloat (ExpressionElement elem, LinkedList<ExpressionElement> tokenList, int mode) {
9486: return evxParseFunction1 (elem, tokenList,
9487: ElementType.ETY_FLOAT, ElementType.ETY_FLOAT, mode);
9488: }
9489: protected ExpressionElement evxParseFunctionFloatString (ExpressionElement elem, LinkedList<ExpressionElement> tokenList, int mode) {
9490: return evxParseFunction1 (elem, tokenList,
9491: ElementType.ETY_FLOAT, ElementType.ETY_STRING, mode);
9492: }
9493: protected ExpressionElement evxParseFunctionStringFloat (ExpressionElement elem, LinkedList<ExpressionElement> tokenList, int mode) {
9494: return evxParseFunction1 (elem, tokenList,
9495: ElementType.ETY_STRING, ElementType.ETY_FLOAT, mode);
9496: }
9497: protected ExpressionElement evxParseFunction1 (ExpressionElement elem, LinkedList<ExpressionElement> tokenList,
9498: ElementType valueType, ElementType paramTypeX, int mode) {
9499: ExpressionElement commaOrParen = tokenList.pollFirst ();
9500: if (commaOrParen == null || commaOrParen.exlType != ElementType.ETY_TOKEN_LEFT_PARENTHESIS) {
9501: evxPrintError (Multilingual.mlnJapanese ?
9502: "( がありません" :
9503: "( is not found",
9504: elem.exlSource, -1, 1);
9505: return null;
9506: }
9507: ExpressionElement paramX = evxParseAssignment (tokenList, mode);
9508: if (paramX == null) {
9509: return null;
9510: }
9511: if (paramX.exlValueType != paramTypeX) {
9512: evxPrintError (Multilingual.mlnJapanese ?
9513: "1 番目の引数の型が違います" :
9514: "wrong type of the 1st parameter",
9515: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
9516: return null;
9517: }
9518: commaOrParen = tokenList.pollFirst ();
9519: if (commaOrParen == null || commaOrParen.exlType != ElementType.ETY_TOKEN_RIGHT_PARENTHESIS) {
9520: evxPrintError (Multilingual.mlnJapanese ?
9521: ") がありません" :
9522: ") is not found",
9523: elem.exlSource, -1, 1);
9524: return null;
9525: }
9526: elem.exlValueType = valueType;
9527: elem.exlParamX = paramX;
9528: elem.exlParamY = null;
9529: elem.exlParamZ = null;
9530: elem.exlLength = commaOrParen.exlOffset + commaOrParen.exlLength - elem.exlOffset;
9531: return elem;
9532: }
9533:
9534:
9535:
9536:
9537: protected ExpressionElement evxParseFunctionFloatFloatFloat (ExpressionElement elem, LinkedList<ExpressionElement> tokenList, int mode) {
9538: return evxParseFunction2 (elem, tokenList,
9539: ElementType.ETY_FLOAT, ElementType.ETY_FLOAT, ElementType.ETY_FLOAT, mode);
9540: }
9541: protected ExpressionElement evxParseFunction2 (ExpressionElement elem, LinkedList<ExpressionElement> tokenList,
9542: ElementType valueType, ElementType paramTypeX, ElementType paramTypeY, int mode) {
9543: ExpressionElement commaOrParen = tokenList.pollFirst ();
9544: if (commaOrParen == null || commaOrParen.exlType != ElementType.ETY_TOKEN_LEFT_PARENTHESIS) {
9545: evxPrintError (Multilingual.mlnJapanese ?
9546: "( がありません" :
9547: "( is not found",
9548: elem.exlSource, -1, 1);
9549: return null;
9550: }
9551: ExpressionElement paramX = evxParseAssignment (tokenList, mode);
9552: if (paramX == null) {
9553: return null;
9554: }
9555: if (paramX.exlValueType != paramTypeX) {
9556: evxPrintError (Multilingual.mlnJapanese ?
9557: "1 番目の引数の型が違います" :
9558: "wrong type of the 1st parameter",
9559: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
9560: return null;
9561: }
9562: commaOrParen = tokenList.pollFirst ();
9563: if (commaOrParen == null || commaOrParen.exlType != ElementType.ETY_OPERATOR_COMMA) {
9564: evxPrintError (Multilingual.mlnJapanese ?
9565: ", がありません" :
9566: ", is not found",
9567: elem.exlSource, -1, 1);
9568: return null;
9569: }
9570: ExpressionElement paramY = evxParseAssignment (tokenList, mode);
9571: if (paramY == null) {
9572: return null;
9573: }
9574: if (paramX.exlValueType != paramTypeY) {
9575: evxPrintError (Multilingual.mlnJapanese ?
9576: "2 番目の引数の型が違います" :
9577: "wrong type of the 2nd parameter",
9578: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
9579: return null;
9580: }
9581: commaOrParen = tokenList.pollFirst ();
9582: if (commaOrParen == null || commaOrParen.exlType != ElementType.ETY_TOKEN_RIGHT_PARENTHESIS) {
9583: evxPrintError (Multilingual.mlnJapanese ?
9584: ") がありません" :
9585: ") is not found",
9586: elem.exlSource, -1, 1);
9587: return null;
9588: }
9589: elem.exlValueType = valueType;
9590: elem.exlParamX = paramX;
9591: elem.exlParamY = paramY;
9592: elem.exlParamZ = null;
9593: elem.exlLength = commaOrParen.exlOffset + commaOrParen.exlLength - elem.exlOffset;
9594: return elem;
9595: }
9596:
9597:
9598:
9599:
9600: protected ExpressionElement evxParseAt (LinkedList<ExpressionElement> tokenList, int mode) {
9601: ExpressionElement paramX = evxParsePrimitive (tokenList, mode);
9602: if (paramX == null) {
9603: return null;
9604: }
9605: ExpressionElement elem = tokenList.peekFirst ();
9606: while (elem != null) {
9607: switch (elem.exlType) {
9608: case ETY_OPERATOR_AT:
9609: break;
9610: default:
9611: return paramX;
9612: }
9613: tokenList.pollFirst ();
9614: ExpressionElement paramY = evxParsePrimitive (tokenList, mode);
9615: if (paramY == null) {
9616: return null;
9617: }
9618: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
9619: evxPrintError (Multilingual.mlnJapanese ?
9620: "アドレスの型が違います" :
9621: "wrong type of the address",
9622: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
9623: return null;
9624: }
9625: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
9626: evxPrintError (Multilingual.mlnJapanese ?
9627: "ファンクションコードの型が違います" :
9628: "wrong type of the function code",
9629: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
9630: return null;
9631: }
9632: elem.exlValueType = ElementType.ETY_FLOAT;
9633: elem.exlParamX = paramX;
9634: elem.exlParamY = paramY;
9635: elem.exlOffset = paramX.exlOffset;
9636: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
9637: paramX = elem;
9638: elem = tokenList.peekFirst ();
9639: }
9640: return paramX;
9641: }
9642:
9643:
9644:
9645:
9646: protected ExpressionElement evxParsePostfix (LinkedList<ExpressionElement> tokenList, int mode) {
9647:
9648: ExpressionElement paramX = evxParseAt (tokenList, mode);
9649: if (paramX == null) {
9650: return null;
9651: }
9652:
9653: for (ExpressionElement operator = tokenList.peekFirst ();
9654: operator != null;
9655: operator = tokenList.peekFirst ()) {
9656:
9657:
9658:
9659:
9660: if (operator.exlType == ElementType.ETY_TOKEN_PLUS_PLUS ||
9661: operator.exlType == ElementType.ETY_TOKEN_MINUS_MINUS) {
9662: tokenList.pollFirst ();
9663: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
9664: evxPrintError (Multilingual.mlnJapanese ?
9665: "引数の型が違います" :
9666: "wrong type of parameter",
9667: operator.exlSource, operator.exlOffset, operator.exlLength);
9668: return null;
9669: }
9670: if (mode == EVM_ASSEMBLER) {
9671: evxPrintError (Multilingual.mlnJapanese ?
9672: "副作用を起こす演算子はここでは使えません" :
9673: "operators which cause a side effect is unusable here",
9674: operator.exlSource, operator.exlOffset, operator.exlLength);
9675: return null;
9676: }
9677: if (!paramX.exlIsFloatSubstituend ()) {
9678: evxPrintError (Multilingual.mlnJapanese ?
9679: "引数が場所を示していません" :
9680: "parameter is not indicating a location",
9681: operator.exlSource, operator.exlOffset, operator.exlLength);
9682: return null;
9683: }
9684: paramX = new ExpressionElement (
9685: operator.exlType == ElementType.ETY_TOKEN_PLUS_PLUS ?
9686: ElementType.ETY_OPERATOR_POSTINCREMENT :
9687: ElementType.ETY_OPERATOR_POSTDECREMENT, 0,
9688: ElementType.ETY_FLOAT, null, null,
9689: paramX.exlSource, paramX.exlOffset, operator.exlOffset + operator.exlLength - paramX.exlOffset,
9690: paramX, null, null);
9691: continue;
9692: }
9693:
9694: if (mode != EVM_ASSEMBLER) {
9695: break;
9696: }
9697:
9698:
9699:
9700:
9701:
9702:
9703: if ((operator.exlType == ElementType.ETY_OPERATOR_SIZE_WORD ||
9704: operator.exlType == ElementType.ETY_OPERATOR_SIZE_LONG) &&
9705: (paramX.exlValueType == ElementType.ETY_FLOAT ||
9706: paramX.exlType == ElementType.ETY_INTEGER_REGISTER)) {
9707: tokenList.pollFirst ();
9708: paramX = new ExpressionElement (
9709: ElementType.ETY_SIZE, operator.exlSubscript,
9710: ElementType.ETY_UNDEF, null, null,
9711: paramX.exlSource, paramX.exlOffset, operator.exlOffset + operator.exlLength - paramX.exlOffset,
9712: paramX, null, null);
9713: continue;
9714: }
9715:
9716:
9717:
9718:
9719:
9720:
9721: if ((paramX.exlValueType == ElementType.ETY_FLOAT ||
9722: (paramX.exlType == ElementType.ETY_SIZE &&
9723: paramX.exlParamX.exlValueType == ElementType.ETY_FLOAT)) &&
9724: operator.exlType == ElementType.ETY_TOKEN_LEFT_PARENTHESIS) {
9725: tokenList.pollFirst ();
9726: ExpressionElement commaRight = tokenList.peekFirst ();
9727: if (commaRight != null && commaRight.exlType != ElementType.ETY_TOKEN_RIGHT_PARENTHESIS) {
9728: for (;;) {
9729:
9730: ExpressionElement paramY = evxParseColon (tokenList, mode);
9731: if (paramY == null) {
9732: return null;
9733: }
9734: paramX = new ExpressionElement (
9735: ElementType.ETY_OPERATOR_COMMA, 0,
9736: paramY.exlValueType, null, null,
9737: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
9738: paramX, paramY, null);
9739: commaRight = tokenList.peekFirst ();
9740: if (commaRight == null || commaRight.exlType != ElementType.ETY_TOKEN_COMMA) {
9741: break;
9742: }
9743: tokenList.pollFirst ();
9744: }
9745: }
9746: if (commaRight == null || commaRight.exlType != ElementType.ETY_TOKEN_RIGHT_PARENTHESIS) {
9747: evxPrintError (Multilingual.mlnJapanese ?
9748: "(...) が閉じていません" :
9749: "(...) is not closed",
9750: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
9751: return null;
9752: }
9753: tokenList.pollFirst ();
9754: paramX = new ExpressionElement (
9755: ElementType.ETY_PARENTHESIS, 0,
9756: ElementType.ETY_UNDEF, null, null,
9757: paramX.exlSource, paramX.exlOffset, commaRight.exlOffset + commaRight.exlLength - paramX.exlOffset,
9758: paramX, null, null);
9759: continue;
9760: }
9761:
9762:
9763:
9764:
9765: if (operator.exlType == ElementType.ETY_TOKEN_LEFT_CURLY_BRACKET) {
9766: tokenList.pollFirst ();
9767: ExpressionElement paramY = evxParseAssignment (tokenList, mode);
9768: if (paramY == null) {
9769: return null;
9770: }
9771: ExpressionElement colon = tokenList.peekFirst ();
9772: if (colon == null) {
9773: evxPrintError (Multilingual.mlnJapanese ?
9774: "不完全なビットフィールドまたは k-factor" :
9775: "incomplete bit-field or k-factor",
9776: operator.exlSource, operator.exlOffset, paramY.exlOffset + paramY.exlLength - operator.exlOffset);
9777: return null;
9778: }
9779: tokenList.pollFirst ();
9780: if (colon.exlType == ElementType.ETY_TOKEN_COLON) {
9781:
9782: ExpressionElement paramZ = evxParseAssignment (tokenList, mode);
9783: if (paramZ == null) {
9784: return null;
9785: }
9786: ExpressionElement right = tokenList.peekFirst ();
9787: if (right == null || right.exlType != ElementType.ETY_TOKEN_RIGHT_CURLY_BRACKET) {
9788: evxPrintError (Multilingual.mlnJapanese ?
9789: "不完全なビットフィールド" :
9790: "incomplete bit-field",
9791: operator.exlSource, operator.exlOffset, paramZ.exlOffset + paramZ.exlLength - operator.exlOffset);
9792: return null;
9793: }
9794: tokenList.pollFirst ();
9795: if (!(paramY.exlValueType == ElementType.ETY_FLOAT ||
9796: paramY.exlType == ElementType.ETY_IMMEDIATE ||
9797: (paramY.exlType == ElementType.ETY_INTEGER_REGISTER && paramY.exlSubscript < 8))) {
9798: evxPrintError (Multilingual.mlnJapanese ?
9799: "ビットフィールドのオフセットの型が違います" :
9800: "wrong type of bit-field offset",
9801: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
9802: }
9803: if (!(paramZ.exlValueType == ElementType.ETY_FLOAT ||
9804: paramZ.exlType == ElementType.ETY_IMMEDIATE ||
9805: (paramZ.exlType == ElementType.ETY_INTEGER_REGISTER && paramZ.exlSubscript < 8))) {
9806: evxPrintError (Multilingual.mlnJapanese ?
9807: "ビットフィールドの幅の型が違います" :
9808: "wrong type of bit-field width",
9809: paramZ.exlSource, paramZ.exlOffset, paramZ.exlLength);
9810: }
9811: paramX = new ExpressionElement (
9812: ElementType.ETY_BIT_FIELD, 0,
9813: ElementType.ETY_UNDEF, null, null,
9814: paramX.exlSource, paramX.exlOffset, right.exlOffset + right.exlLength - paramX.exlOffset,
9815: paramX, paramY, paramZ);
9816: continue;
9817: }
9818: if (colon.exlType == ElementType.ETY_TOKEN_RIGHT_CURLY_BRACKET) {
9819:
9820: if (!(paramY.exlValueType == ElementType.ETY_FLOAT ||
9821: paramY.exlType == ElementType.ETY_IMMEDIATE ||
9822: (paramY.exlType == ElementType.ETY_INTEGER_REGISTER && paramY.exlSubscript < 8))) {
9823: evxPrintError (Multilingual.mlnJapanese ?
9824: "k-factor の型が違います" :
9825: "wrong type of k-factor",
9826: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
9827: }
9828: paramX = new ExpressionElement (
9829: ElementType.ETY_K_FACTOR, 0,
9830: ElementType.ETY_UNDEF, null, null,
9831: paramX.exlSource, paramX.exlOffset, colon.exlOffset + colon.exlLength - paramX.exlOffset,
9832: paramX, paramY, null);
9833: continue;
9834: }
9835:
9836: evxPrintError (Multilingual.mlnJapanese ?
9837: "不完全なビットフィールドまたは k-factor" :
9838: "incomplete bit-field or k-factor",
9839: operator.exlSource, operator.exlOffset, paramY.exlOffset + paramY.exlLength - operator.exlOffset);
9840: return null;
9841: }
9842:
9843: break;
9844: }
9845:
9846: return paramX;
9847:
9848: }
9849:
9850:
9851:
9852:
9853: protected ExpressionElement evxParsePrefix (LinkedList<ExpressionElement> tokenList, int mode) {
9854: ExpressionElement operator = tokenList.peekFirst ();
9855: if (operator == null) {
9856: return null;
9857: }
9858: ElementType type = operator.exlType;
9859: if (type == ElementType.ETY_TOKEN_PLUS_PLUS) {
9860: type = ElementType.ETY_OPERATOR_PREINCREMENT;
9861: } else if (type == ElementType.ETY_TOKEN_MINUS_MINUS) {
9862: type = ElementType.ETY_OPERATOR_PREDECREMENT;
9863: } else if (type == ElementType.ETY_TOKEN_PLUS_SIGN) {
9864: type = ElementType.ETY_OPERATOR_NOTHING;
9865: } else if (type == ElementType.ETY_TOKEN_HYPHEN_MINUS) {
9866: type = ElementType.ETY_OPERATOR_NEGATION;
9867: } else if (type == ElementType.ETY_TOKEN_TILDE) {
9868: type = ElementType.ETY_OPERATOR_BITWISE_NOT;
9869: } else if (type == ElementType.ETY_TOKEN_EXCLAMATION_MARK) {
9870: type = ElementType.ETY_OPERATOR_LOGICAL_NOT;
9871: } else if (mode == EVM_ASSEMBLER &&
9872: type == ElementType.ETY_TOKEN_NUMBER_SIGN) {
9873: type = ElementType.ETY_IMMEDIATE;
9874: } else {
9875: return evxParsePostfix (tokenList, mode);
9876: }
9877: tokenList.pollFirst ();
9878: ExpressionElement paramX = evxParsePrefix (tokenList, mode);
9879: if (paramX == null) {
9880: return null;
9881: }
9882: if (mode == EVM_ASSEMBLER &&
9883: type == ElementType.ETY_OPERATOR_NEGATION &&
9884: paramX.exlType == ElementType.ETY_REGISTER_INDIRECT &&
9885: 8 <= paramX.exlSubscript) {
9886: return new ExpressionElement (
9887: ElementType.ETY_PREDECREMENT, paramX.exlSubscript - 8,
9888: ElementType.ETY_UNDEF, null, null,
9889: operator.exlSource, operator.exlOffset, paramX.exlOffset + paramX.exlLength - operator.exlOffset,
9890: null, null, null);
9891: }
9892: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
9893: evxPrintError (Multilingual.mlnJapanese ?
9894: "引数の型が違います" :
9895: "wrong type of parameter",
9896: operator.exlSource, operator.exlOffset, operator.exlLength);
9897: return null;
9898: }
9899: if (type == ElementType.ETY_OPERATOR_PREINCREMENT ||
9900: type == ElementType.ETY_OPERATOR_PREDECREMENT) {
9901: if (mode == EVM_ASSEMBLER) {
9902: evxPrintError (Multilingual.mlnJapanese ?
9903: "副作用を起こす演算子はここでは使えません" :
9904: "operators which cause a side effect is unusable here",
9905: operator.exlSource, operator.exlOffset, operator.exlLength);
9906: return null;
9907: }
9908: if (!paramX.exlIsFloatSubstituend ()) {
9909: evxPrintError (Multilingual.mlnJapanese ?
9910: "引数が場所を示していません" :
9911: "parameter is not indicating a location",
9912: operator.exlSource, operator.exlOffset, operator.exlLength);
9913: return null;
9914: }
9915: }
9916: return new ExpressionElement (
9917: type, 0,
9918: ElementType.ETY_FLOAT, null, null,
9919: operator.exlSource, operator.exlOffset, paramX.exlOffset + paramX.exlLength - operator.exlOffset,
9920: paramX, null, null);
9921: }
9922:
9923:
9924:
9925:
9926: protected ExpressionElement evxParseExponentiation (LinkedList<ExpressionElement> tokenList, int mode) {
9927: ExpressionElement paramX = evxParsePrefix (tokenList, mode);
9928: if (paramX == null) {
9929: return null;
9930: }
9931: ExpressionElement elem = tokenList.peekFirst ();
9932: if (elem != null) {
9933: switch (elem.exlType) {
9934: case ETY_OPERATOR_POWER:
9935: break;
9936: default:
9937: return paramX;
9938: }
9939: tokenList.pollFirst ();
9940: ExpressionElement paramY = evxParseExponentiation (tokenList, mode);
9941: if (paramY == null) {
9942: return null;
9943: }
9944: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
9945: evxPrintError (Multilingual.mlnJapanese ?
9946: "1 番目の引数の型が違います" :
9947: "wrong type of the 1st parameter",
9948: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
9949: return null;
9950: }
9951: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
9952: evxPrintError (Multilingual.mlnJapanese ?
9953: "2 番目の引数の型が違います" :
9954: "wrong type of the 2nd parameter",
9955: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
9956: return null;
9957: }
9958: elem.exlValueType = ElementType.ETY_FLOAT;
9959: elem.exlParamX = paramX;
9960: elem.exlParamY = paramY;
9961: elem.exlOffset = paramX.exlOffset;
9962: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
9963: return elem;
9964: }
9965: return paramX;
9966: }
9967:
9968:
9969:
9970:
9971: protected ExpressionElement evxParseMultiplication (LinkedList<ExpressionElement> tokenList, int mode) {
9972:
9973: ExpressionElement paramX = evxParseExponentiation (tokenList, mode);
9974: if (paramX == null) {
9975: return null;
9976: }
9977: for (ExpressionElement operator = tokenList.peekFirst ();
9978: operator != null;
9979: operator = tokenList.peekFirst ()) {
9980: ElementType type = operator.exlType;
9981: if (type == ElementType.ETY_TOKEN_ASTERISK) {
9982: type = ElementType.ETY_OPERATOR_MULTIPLICATION;
9983: } else if (type == ElementType.ETY_TOKEN_SOLIDUS) {
9984: type = ElementType.ETY_OPERATOR_DIVISION;
9985: } else if (type == ElementType.ETY_TOKEN_PERCENT_SIGN) {
9986: type = ElementType.ETY_OPERATOR_MODULUS;
9987: } else {
9988: break;
9989: }
9990: tokenList.pollFirst ();
9991:
9992: ExpressionElement paramY = evxParseExponentiation (tokenList, mode);
9993: if (paramY == null) {
9994: return null;
9995: }
9996: if (paramX.exlValueType == ElementType.ETY_FLOAT &&
9997: paramY.exlValueType == ElementType.ETY_FLOAT) {
9998: paramX = new ExpressionElement (
9999: type, 0,
10000: ElementType.ETY_FLOAT, null, null,
10001: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10002: paramX, paramY, null);
10003: continue;
10004: }
10005: if (mode == EVM_ASSEMBLER) {
10006:
10007: if (type == ElementType.ETY_OPERATOR_MULTIPLICATION &&
10008: (paramX.exlType == ElementType.ETY_INTEGER_REGISTER ||
10009: (paramX.exlType == ElementType.ETY_SIZE &&
10010: paramX.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER)) &&
10011: paramY.exlValueType == ElementType.ETY_FLOAT) {
10012: paramX = new ExpressionElement (
10013: ElementType.ETY_SCALE_FACTOR, 0,
10014: ElementType.ETY_UNDEF, null, null,
10015: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10016: paramX, paramY, null);
10017: continue;
10018: }
10019: if (type == ElementType.ETY_OPERATOR_MULTIPLICATION &&
10020: (paramY.exlType == ElementType.ETY_INTEGER_REGISTER ||
10021: (paramY.exlType == ElementType.ETY_SIZE &&
10022: paramY.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER)) &&
10023: paramX.exlValueType == ElementType.ETY_FLOAT) {
10024: paramX = new ExpressionElement (
10025: ElementType.ETY_SCALE_FACTOR, 0,
10026: ElementType.ETY_UNDEF, null, null,
10027: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10028: paramY, paramX, null);
10029: continue;
10030: }
10031: }
10032: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10033: evxPrintError (Multilingual.mlnJapanese ?
10034: "1 番目の引数の型が違います" :
10035: "wrong type of the 1st parameter",
10036: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10037: } else {
10038: evxPrintError (Multilingual.mlnJapanese ?
10039: "2 番目の引数の型が違います" :
10040: "wrong type of the 2nd parameter",
10041: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10042: }
10043: return null;
10044: }
10045: return paramX;
10046: }
10047:
10048:
10049:
10050:
10051: protected ExpressionElement evxParseAddition (LinkedList<ExpressionElement> tokenList, int mode) {
10052: ExpressionElement paramX = evxParseMultiplication (tokenList, mode);
10053: if (paramX == null) {
10054: return null;
10055: }
10056: ExpressionElement operator = tokenList.peekFirst ();
10057: while (operator != null) {
10058: ElementType type = operator.exlType;
10059: ElementType valueType = paramX.exlValueType;
10060: ExpressionElement paramY;
10061: if (type == ElementType.ETY_TOKEN_PLUS_SIGN) {
10062: tokenList.pollFirst ();
10063: if (mode == EVM_ASSEMBLER &&
10064: paramX.exlType == ElementType.ETY_REGISTER_INDIRECT &&
10065: 8 <= paramX.exlSubscript) {
10066: return new ExpressionElement (
10067: ElementType.ETY_POSTINCREMENT, paramX.exlSubscript - 8,
10068: ElementType.ETY_UNDEF, null, null,
10069: paramX.exlSource, paramX.exlOffset, operator.exlOffset + operator.exlLength - paramX.exlOffset,
10070: null, null, null);
10071: }
10072: paramY = evxParseMultiplication (tokenList, mode);
10073: if (paramY == null) {
10074: return null;
10075: }
10076: if (paramX.exlValueType == ElementType.ETY_FLOAT) {
10077: if (paramY.exlValueType == ElementType.ETY_FLOAT) {
10078: type = ElementType.ETY_OPERATOR_ADDITION_FLOAT_FLOAT;
10079: valueType = ElementType.ETY_FLOAT;
10080: } else if (paramY.exlValueType == ElementType.ETY_STRING) {
10081: type = ElementType.ETY_OPERATOR_ADDITION_FLOAT_STRING;
10082: valueType = ElementType.ETY_STRING;
10083: } else {
10084: if (mode != EVM_ASSEMBLER) {
10085: evxPrintError (Multilingual.mlnJapanese ?
10086: "2 番目の引数の型が違います" :
10087: "wrong type of the 2nd parameter",
10088: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset);
10089: return null;
10090: }
10091: }
10092: } else if (paramX.exlValueType == ElementType.ETY_STRING) {
10093: if (paramY.exlValueType == ElementType.ETY_FLOAT) {
10094: type = ElementType.ETY_OPERATOR_ADDITION_STRING_FLOAT;
10095: valueType = ElementType.ETY_STRING;
10096: } else if (paramY.exlValueType == ElementType.ETY_STRING) {
10097: type = ElementType.ETY_OPERATOR_ADDITION_STRING_STRING;
10098: valueType = ElementType.ETY_STRING;
10099: } else {
10100: if (mode != EVM_ASSEMBLER) {
10101: evxPrintError (Multilingual.mlnJapanese ?
10102: "2 番目の引数の型が違います" :
10103: "wrong type of the 2nd parameter",
10104: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset);
10105: return null;
10106: }
10107: }
10108: } else {
10109: if (mode != EVM_ASSEMBLER) {
10110: evxPrintError (Multilingual.mlnJapanese ?
10111: "1 番目の引数の型が違います" :
10112: "wrong type of the 1st parameter",
10113: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset);
10114: return null;
10115: }
10116: }
10117: } else if (mode != EVM_ASSEMBLER &&
10118: type == ElementType.ETY_TOKEN_HYPHEN_MINUS) {
10119: tokenList.pollFirst ();
10120: paramY = evxParseMultiplication (tokenList, mode);
10121: if (paramY == null) {
10122: return null;
10123: }
10124: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10125: evxPrintError (Multilingual.mlnJapanese ?
10126: "1 番目の引数の型が違います" :
10127: "wrong type of the 1st parameter",
10128: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset);
10129: return null;
10130: }
10131: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10132: evxPrintError (Multilingual.mlnJapanese ?
10133: "2 番目の引数の型が違います" :
10134: "wrong type of the 2nd parameter",
10135: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset);
10136: return null;
10137: }
10138: type = ElementType.ETY_OPERATOR_SUBTRACTION;
10139: valueType = ElementType.ETY_FLOAT;
10140: } else {
10141: return paramX;
10142: }
10143: paramX = new ExpressionElement (
10144: type, 0,
10145: valueType, null, null,
10146: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10147: paramX, paramY, null);
10148: operator = tokenList.peekFirst ();
10149: }
10150: return paramX;
10151: }
10152:
10153:
10154:
10155:
10156: protected ExpressionElement evxParseShift (LinkedList<ExpressionElement> tokenList, int mode) {
10157: ExpressionElement paramX = evxParseAddition (tokenList, mode);
10158: if (paramX == null) {
10159: return null;
10160: }
10161: ExpressionElement elem = tokenList.peekFirst ();
10162: while (elem != null) {
10163: switch (elem.exlType) {
10164: case ETY_OPERATOR_LEFT_SHIFT:
10165: case ETY_OPERATOR_RIGHT_SHIFT:
10166: case ETY_OPERATOR_UNSIGNED_RIGHT_SHIFT:
10167: break;
10168: default:
10169: return paramX;
10170: }
10171: tokenList.pollFirst ();
10172: ExpressionElement paramY = evxParseAddition (tokenList, mode);
10173: if (paramY == null) {
10174: return null;
10175: }
10176: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10177: evxPrintError (Multilingual.mlnJapanese ?
10178: "1 番目の引数の型が違います" :
10179: "wrong type of the 1st parameter",
10180: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10181: return null;
10182: }
10183: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10184: evxPrintError (Multilingual.mlnJapanese ?
10185: "2 番目の引数の型が違います" :
10186: "wrong type of the 2nd parameter",
10187: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10188: return null;
10189: }
10190: elem.exlValueType = ElementType.ETY_FLOAT;
10191: elem.exlParamX = paramX;
10192: elem.exlParamY = paramY;
10193: elem.exlOffset = paramX.exlOffset;
10194: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10195: paramX = elem;
10196: elem = tokenList.peekFirst ();
10197: }
10198: return paramX;
10199: }
10200:
10201:
10202:
10203:
10204: protected ExpressionElement evxParseComparison (LinkedList<ExpressionElement> tokenList, int mode) {
10205: ExpressionElement paramX = evxParseShift (tokenList, mode);
10206: if (paramX == null) {
10207: return null;
10208: }
10209: ExpressionElement elem = tokenList.peekFirst ();
10210: while (elem != null) {
10211: switch (elem.exlType) {
10212: case ETY_OPERATOR_LESS_THAN:
10213: case ETY_OPERATOR_LESS_OR_EQUAL:
10214: case ETY_OPERATOR_GREATER_THAN:
10215: case ETY_OPERATOR_GREATER_OR_EQUAL:
10216: break;
10217: default:
10218: return paramX;
10219: }
10220: tokenList.pollFirst ();
10221: ExpressionElement paramY = evxParseShift (tokenList, mode);
10222: if (paramY == null) {
10223: return null;
10224: }
10225: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10226: evxPrintError (Multilingual.mlnJapanese ?
10227: "1 番目の引数の型が違います" :
10228: "wrong type of the 1st parameter",
10229: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10230: return null;
10231: }
10232: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10233: evxPrintError (Multilingual.mlnJapanese ?
10234: "2 番目の引数の型が違います" :
10235: "wrong type of the 2nd parameter",
10236: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10237: return null;
10238: }
10239: elem.exlValueType = ElementType.ETY_FLOAT;
10240: elem.exlParamX = paramX;
10241: elem.exlParamY = paramY;
10242: elem.exlOffset = paramX.exlOffset;
10243: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10244: paramX = elem;
10245: elem = tokenList.peekFirst ();
10246: }
10247: return paramX;
10248: }
10249:
10250:
10251:
10252:
10253: protected ExpressionElement evxParseEquality (LinkedList<ExpressionElement> tokenList, int mode) {
10254: ExpressionElement paramX = evxParseComparison (tokenList, mode);
10255: if (paramX == null) {
10256: return null;
10257: }
10258: ExpressionElement elem = tokenList.peekFirst ();
10259: while (elem != null) {
10260: switch (elem.exlType) {
10261: case ETY_OPERATOR_EQUAL:
10262: case ETY_OPERATOR_NOT_EQUAL:
10263: break;
10264: default:
10265: return paramX;
10266: }
10267: tokenList.pollFirst ();
10268: ExpressionElement paramY = evxParseComparison (tokenList, mode);
10269: if (paramY == null) {
10270: return null;
10271: }
10272: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10273: evxPrintError (Multilingual.mlnJapanese ?
10274: "1 番目の引数の型が違います" :
10275: "wrong type of the 1st parameter",
10276: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10277: return null;
10278: }
10279: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10280: evxPrintError (Multilingual.mlnJapanese ?
10281: "2 番目の引数の型が違います" :
10282: "wrong type of the 2nd parameter",
10283: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10284: return null;
10285: }
10286: elem.exlValueType = ElementType.ETY_FLOAT;
10287: elem.exlParamX = paramX;
10288: elem.exlParamY = paramY;
10289: elem.exlOffset = paramX.exlOffset;
10290: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10291: paramX = elem;
10292: elem = tokenList.peekFirst ();
10293: }
10294: return paramX;
10295: }
10296:
10297:
10298:
10299:
10300: protected ExpressionElement evxParseBitwiseAnd (LinkedList<ExpressionElement> tokenList, int mode) {
10301: ExpressionElement paramX = evxParseEquality (tokenList, mode);
10302: if (paramX == null) {
10303: return null;
10304: }
10305: ExpressionElement elem = tokenList.peekFirst ();
10306: while (elem != null) {
10307: switch (elem.exlType) {
10308: case ETY_OPERATOR_BITWISE_AND:
10309: break;
10310: default:
10311: return paramX;
10312: }
10313: tokenList.pollFirst ();
10314: ExpressionElement paramY = evxParseEquality (tokenList, mode);
10315: if (paramY == null) {
10316: return null;
10317: }
10318: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10319: evxPrintError (Multilingual.mlnJapanese ?
10320: "1 番目の引数の型が違います" :
10321: "wrong type of the 1st parameter",
10322: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10323: return null;
10324: }
10325: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10326: evxPrintError (Multilingual.mlnJapanese ?
10327: "2 番目の引数の型が違います" :
10328: "wrong type of the 2nd parameter",
10329: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10330: return null;
10331: }
10332: elem.exlValueType = ElementType.ETY_FLOAT;
10333: elem.exlParamX = paramX;
10334: elem.exlParamY = paramY;
10335: elem.exlOffset = paramX.exlOffset;
10336: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10337: paramX = elem;
10338: elem = tokenList.peekFirst ();
10339: }
10340: return paramX;
10341: }
10342:
10343:
10344:
10345:
10346: protected ExpressionElement evxParseBitwiseXor (LinkedList<ExpressionElement> tokenList, int mode) {
10347: ExpressionElement paramX = evxParseBitwiseAnd (tokenList, mode);
10348: if (paramX == null) {
10349: return null;
10350: }
10351: ExpressionElement elem = tokenList.peekFirst ();
10352: while (elem != null) {
10353: switch (elem.exlType) {
10354: case ETY_OPERATOR_BITWISE_XOR:
10355: break;
10356: default:
10357: return paramX;
10358: }
10359: tokenList.pollFirst ();
10360: ExpressionElement paramY = evxParseBitwiseAnd (tokenList, mode);
10361: if (paramY == null) {
10362: return null;
10363: }
10364: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10365: evxPrintError (Multilingual.mlnJapanese ?
10366: "1 番目の引数の型が違います" :
10367: "wrong type of the 1st parameter",
10368: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10369: return null;
10370: }
10371: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10372: evxPrintError (Multilingual.mlnJapanese ?
10373: "2 番目の引数の型が違います" :
10374: "wrong type of the 2nd parameter",
10375: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10376: return null;
10377: }
10378: elem.exlValueType = ElementType.ETY_FLOAT;
10379: elem.exlParamX = paramX;
10380: elem.exlParamY = paramY;
10381: elem.exlOffset = paramX.exlOffset;
10382: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10383: paramX = elem;
10384: elem = tokenList.peekFirst ();
10385: }
10386: return paramX;
10387: }
10388:
10389:
10390:
10391:
10392: protected ExpressionElement evxParseBitwiseOr (LinkedList<ExpressionElement> tokenList, int mode) {
10393: ExpressionElement paramX = evxParseBitwiseXor (tokenList, mode);
10394: if (paramX == null) {
10395: return null;
10396: }
10397: ExpressionElement elem = tokenList.peekFirst ();
10398: while (elem != null) {
10399: switch (elem.exlType) {
10400: case ETY_OPERATOR_BITWISE_OR:
10401: break;
10402: default:
10403: return paramX;
10404: }
10405: tokenList.pollFirst ();
10406: ExpressionElement paramY = evxParseBitwiseXor (tokenList, mode);
10407: if (paramY == null) {
10408: return null;
10409: }
10410: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10411: evxPrintError (Multilingual.mlnJapanese ?
10412: "1 番目の引数の型が違います" :
10413: "wrong type of the 1st parameter",
10414: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10415: return null;
10416: }
10417: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10418: evxPrintError (Multilingual.mlnJapanese ?
10419: "2 番目の引数の型が違います" :
10420: "wrong type of the 2nd parameter",
10421: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10422: return null;
10423: }
10424: elem.exlValueType = ElementType.ETY_FLOAT;
10425: elem.exlParamX = paramX;
10426: elem.exlParamY = paramY;
10427: elem.exlOffset = paramX.exlOffset;
10428: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10429: paramX = elem;
10430: elem = tokenList.peekFirst ();
10431: }
10432: return paramX;
10433: }
10434:
10435:
10436:
10437:
10438: protected ExpressionElement evxParseLogicalAnd (LinkedList<ExpressionElement> tokenList, int mode) {
10439: ExpressionElement paramX = evxParseBitwiseOr (tokenList, mode);
10440: if (paramX == null) {
10441: return null;
10442: }
10443: ExpressionElement elem = tokenList.peekFirst ();
10444: while (elem != null) {
10445: switch (elem.exlType) {
10446: case ETY_OPERATOR_LOGICAL_AND:
10447: break;
10448: default:
10449: return paramX;
10450: }
10451: tokenList.pollFirst ();
10452: ExpressionElement paramY = evxParseBitwiseOr (tokenList, mode);
10453: if (paramY == null) {
10454: return null;
10455: }
10456: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10457: evxPrintError (Multilingual.mlnJapanese ?
10458: "1 番目の引数の型が違います" :
10459: "wrong type of the 1st parameter",
10460: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10461: return null;
10462: }
10463: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10464: evxPrintError (Multilingual.mlnJapanese ?
10465: "2 番目の引数の型が違います" :
10466: "wrong type of the 2nd parameter",
10467: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10468: return null;
10469: }
10470: elem.exlValueType = ElementType.ETY_FLOAT;
10471: elem.exlParamX = paramX;
10472: elem.exlParamY = paramY;
10473: elem.exlOffset = paramX.exlOffset;
10474: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10475: paramX = elem;
10476: elem = tokenList.peekFirst ();
10477: }
10478: return paramX;
10479: }
10480:
10481:
10482:
10483:
10484: protected ExpressionElement evxParseLogicalOr (LinkedList<ExpressionElement> tokenList, int mode) {
10485: ExpressionElement paramX = evxParseLogicalAnd (tokenList, mode);
10486: if (paramX == null) {
10487: return null;
10488: }
10489: ExpressionElement elem = tokenList.peekFirst ();
10490: while (elem != null) {
10491: switch (elem.exlType) {
10492: case ETY_OPERATOR_LOGICAL_OR:
10493: break;
10494: default:
10495: return paramX;
10496: }
10497: tokenList.pollFirst ();
10498: ExpressionElement paramY = evxParseLogicalAnd (tokenList, mode);
10499: if (paramY == null) {
10500: return null;
10501: }
10502: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10503: evxPrintError (Multilingual.mlnJapanese ?
10504: "1 番目の引数の型が違います" :
10505: "wrong type of the 1st parameter",
10506: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10507: return null;
10508: }
10509: if (paramY.exlValueType != ElementType.ETY_FLOAT) {
10510: evxPrintError (Multilingual.mlnJapanese ?
10511: "2 番目の引数の型が違います" :
10512: "wrong type of the 2nd parameter",
10513: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10514: return null;
10515: }
10516: elem.exlValueType = ElementType.ETY_FLOAT;
10517: elem.exlParamX = paramX;
10518: elem.exlParamY = paramY;
10519: elem.exlOffset = paramX.exlOffset;
10520: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10521: paramX = elem;
10522: elem = tokenList.peekFirst ();
10523: }
10524: return paramX;
10525: }
10526:
10527:
10528:
10529:
10530: protected ExpressionElement evxParseConditional (LinkedList<ExpressionElement> tokenList, int mode) {
10531: ExpressionElement paramX = evxParseLogicalOr (tokenList, mode);
10532: if (paramX == null) {
10533: return null;
10534: }
10535: ExpressionElement elem = tokenList.peekFirst ();
10536: if (elem != null) {
10537: switch (elem.exlType) {
10538: case ETY_TOKEN_QUESTION_MARK:
10539: break;
10540: default:
10541: return paramX;
10542: }
10543: tokenList.pollFirst ();
10544: ExpressionElement paramY = evxParseConditional (tokenList, mode);
10545: if (paramY == null) {
10546: return null;
10547: }
10548: ExpressionElement colon = tokenList.pollFirst ();
10549: if (colon == null) {
10550: evxPrintError (Multilingual.mlnJapanese ?
10551: ": がありません" :
10552: ": is not found",
10553: elem.exlSource, -1, 1);
10554: return null;
10555: }
10556: if (colon.exlType != ElementType.ETY_TOKEN_COLON) {
10557: evxPrintError (Multilingual.mlnJapanese ?
10558: ": がありません" :
10559: ": is not found",
10560: colon.exlSource, colon.exlOffset, 1);
10561: return null;
10562: }
10563: ExpressionElement paramZ = evxParseConditional (tokenList, mode);
10564: if (paramZ == null) {
10565: return null;
10566: }
10567: if (paramX.exlValueType != ElementType.ETY_FLOAT) {
10568: evxPrintError (Multilingual.mlnJapanese ?
10569: "1 番目の引数の型が違います" :
10570: "wrong type of the 1st parameter",
10571: paramX.exlSource, paramX.exlOffset, paramZ.exlOffset + paramZ.exlLength - paramX.exlOffset);
10572: return null;
10573: }
10574: if (!(paramY.exlValueType == ElementType.ETY_FLOAT ||
10575: paramY.exlValueType == ElementType.ETY_STRING)) {
10576: evxPrintError (Multilingual.mlnJapanese ?
10577: "2 番目の引数の型が違います" :
10578: "wrong type of the 2nd parameter",
10579: paramX.exlSource, paramX.exlOffset, paramZ.exlOffset + paramZ.exlLength - paramX.exlOffset);
10580: return null;
10581: } else if (paramY.exlValueType != paramZ.exlValueType) {
10582: evxPrintError (Multilingual.mlnJapanese ?
10583: "3 番目の引数の型が違います" :
10584: "wrong type of the 3rd parameter",
10585: paramX.exlSource, paramX.exlOffset, paramZ.exlOffset + paramZ.exlLength - paramX.exlOffset);
10586: return null;
10587: }
10588: elem.exlType = paramY.exlValueType == ElementType.ETY_FLOAT ? ElementType.ETY_OPERATOR_CONDITIONAL_FLOAT : ElementType.ETY_OPERATOR_CONDITIONAL_STRING;
10589: elem.exlValueType = paramY.exlValueType;
10590: elem.exlParamX = paramX;
10591: elem.exlParamY = paramY;
10592: elem.exlParamZ = paramZ;
10593: elem.exlOffset = paramX.exlOffset;
10594: elem.exlLength = paramZ.exlOffset + paramZ.exlLength - paramX.exlOffset;
10595: return elem;
10596: }
10597: return paramX;
10598: }
10599:
10600:
10601:
10602:
10603: protected ExpressionElement evxParseAssignment (LinkedList<ExpressionElement> tokenList, int mode) {
10604: ExpressionElement paramX = evxParseConditional (tokenList, mode);
10605: if (paramX == null) {
10606: return null;
10607: }
10608: ExpressionElement elem = tokenList.peekFirst ();
10609: if (elem != null) {
10610: switch (elem.exlType) {
10611: case ETY_OPERATOR_ASSIGNMENT:
10612: case ETY_OPERATOR_SELF_POWER:
10613: case ETY_OPERATOR_SELF_MULTIPLICATION:
10614: case ETY_OPERATOR_SELF_DIVISION:
10615: case ETY_OPERATOR_SELF_MODULUS:
10616: case ETY_OPERATOR_SELF_ADDITION:
10617: case ETY_OPERATOR_SELF_SUBTRACTION:
10618: case ETY_OPERATOR_SELF_LEFT_SHIFT:
10619: case ETY_OPERATOR_SELF_RIGHT_SHIFT:
10620: case ETY_OPERATOR_SELF_UNSIGNED_RIGHT_SHIFT:
10621: case ETY_OPERATOR_SELF_BITWISE_AND:
10622: case ETY_OPERATOR_SELF_BITWISE_XOR:
10623: case ETY_OPERATOR_SELF_BITWISE_OR:
10624: break;
10625: default:
10626: return paramX;
10627: }
10628: tokenList.pollFirst ();
10629: ExpressionElement paramY = evxParseAssignment (tokenList, mode);
10630: if (paramY == null) {
10631: return null;
10632: }
10633: if (mode == EVM_ASSEMBLER) {
10634: evxPrintError (Multilingual.mlnJapanese ?
10635: "副作用を起こす演算子はここでは使えません" :
10636: "operators which cause a side effect is unusable here",
10637: elem.exlSource, elem.exlOffset, elem.exlLength);
10638: return null;
10639: }
10640: if (!(paramX.exlIsFloatSubstituend () ||
10641: paramX.exlType == ElementType.ETY_VARIABLE_STRING)) {
10642: evxPrintError (Multilingual.mlnJapanese ?
10643: "引数が場所を示していません" :
10644: "parameter is not indicating a location",
10645: paramX.exlSource, paramX.exlOffset, paramX.exlLength);
10646: return null;
10647: }
10648: if (elem.exlType == ElementType.ETY_OPERATOR_ASSIGNMENT &&
10649: paramX.exlType == ElementType.ETY_VARIABLE_STRING &&
10650: paramY.exlValueType == ElementType.ETY_STRING) {
10651: elem.exlType = ElementType.ETY_OPERATOR_ASSIGN_STRING_TO_VARIABLE;
10652: elem.exlValueType = ElementType.ETY_STRING;
10653: } else if (elem.exlType == ElementType.ETY_OPERATOR_SELF_ADDITION &&
10654: paramX.exlType == ElementType.ETY_VARIABLE_STRING &&
10655: paramY.exlValueType == ElementType.ETY_STRING) {
10656: elem.exlType = ElementType.ETY_OPERATOR_CONCAT_STRING_TO_VARIABLE;
10657: elem.exlValueType = ElementType.ETY_STRING;
10658: } else if (elem.exlType == ElementType.ETY_OPERATOR_ASSIGNMENT &&
10659: paramX.exlType == ElementType.ETY_SQUARE_BRACKET &&
10660: paramY.exlValueType == ElementType.ETY_STRING) {
10661: elem.exlType = ElementType.ETY_OPERATOR_ASSIGN_STRING_TO_MEMORY;
10662: elem.exlValueType = ElementType.ETY_STRING;
10663: } else if (elem.exlType == ElementType.ETY_OPERATOR_SELF_ADDITION &&
10664: paramX.exlType == ElementType.ETY_SQUARE_BRACKET &&
10665: paramY.exlValueType == ElementType.ETY_STRING) {
10666: elem.exlType = ElementType.ETY_OPERATOR_CONCAT_STRING_TO_MEMORY;
10667: elem.exlValueType = ElementType.ETY_STRING;
10668: } else if (paramX.exlType != ElementType.ETY_VARIABLE_STRING &&
10669: paramY.exlValueType == ElementType.ETY_FLOAT) {
10670: elem.exlValueType = ElementType.ETY_FLOAT;
10671: } else {
10672: evxPrintError (Multilingual.mlnJapanese ?
10673: "引数の型が違います" :
10674: "wrong type of parameter",
10675: paramY.exlSource, paramY.exlOffset, paramY.exlLength);
10676: return null;
10677: }
10678: elem.exlParamX = paramX;
10679: elem.exlParamY = paramY;
10680: elem.exlOffset = paramX.exlOffset;
10681: elem.exlLength = paramY.exlOffset + paramY.exlLength - elem.exlOffset;
10682: return elem;
10683: }
10684: return paramX;
10685: }
10686:
10687:
10688:
10689:
10690: protected ExpressionElement evxParseColon (LinkedList<ExpressionElement> tokenList, int mode) {
10691:
10692: ExpressionElement paramX = evxParseAssignment (tokenList, mode);
10693: if (paramX == null) {
10694: return null;
10695: }
10696: for (ExpressionElement operator = tokenList.peekFirst ();
10697: operator != null && operator.exlType == ElementType.ETY_TOKEN_COLON;
10698: operator = tokenList.peekFirst ()) {
10699: tokenList.pollFirst ();
10700:
10701: ExpressionElement paramY = evxParseAssignment (tokenList, mode);
10702: if (paramY == null) {
10703: return null;
10704: }
10705: if (mode == EVM_ASSEMBLER) {
10706: if (paramX.exlType == ElementType.ETY_INTEGER_REGISTER && paramX.exlSubscript < 8 &&
10707: paramY.exlType == ElementType.ETY_INTEGER_REGISTER && paramY.exlSubscript < 8) {
10708:
10709: int h = paramX.exlSubscript;
10710: int l = paramY.exlSubscript;
10711: int subscript = h << 3 | l;
10712: return new ExpressionElement (
10713: ElementType.ETY_DATA_REGISTER_PAIR, subscript,
10714: ElementType.ETY_UNDEF, null, null,
10715: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10716: null, null, null);
10717: }
10718: if (paramX.exlType == ElementType.ETY_REGISTER_INDIRECT &&
10719: paramY.exlType == ElementType.ETY_REGISTER_INDIRECT) {
10720:
10721: int r = paramX.exlSubscript;
10722: int s = paramY.exlSubscript;
10723: int subscript = r << 4 | s;
10724: return new ExpressionElement (
10725: ElementType.ETY_REGISTER_INDIRECT_PAIR, subscript,
10726: ElementType.ETY_UNDEF, null, null,
10727: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10728: null, null, null);
10729: }
10730: }
10731: paramX = new ExpressionElement (
10732: ElementType.ETY_OPERATOR_COLON, 0,
10733: ElementType.ETY_UNDEF, null, null,
10734: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10735: paramX, paramY, null);
10736: }
10737: return paramX;
10738: }
10739:
10740:
10741:
10742:
10743: protected ExpressionElement evxParseComma (LinkedList<ExpressionElement> tokenList, int mode) {
10744:
10745: ExpressionElement paramX = evxParseColon (tokenList, mode);
10746: if (paramX == null) {
10747: return null;
10748: }
10749: for (ExpressionElement operator = tokenList.peekFirst ();
10750: operator != null && operator.exlType == ElementType.ETY_TOKEN_COMMA;
10751: operator = tokenList.peekFirst ()) {
10752: tokenList.pollFirst ();
10753:
10754: ExpressionElement paramY = evxParseColon (tokenList, mode);
10755: if (paramY == null) {
10756: return null;
10757: }
10758: paramX = new ExpressionElement (
10759: ElementType.ETY_OPERATOR_COMMA, 0,
10760: paramY.exlValueType, null, null,
10761: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset,
10762: paramX, paramY, null);
10763: }
10764: return paramX;
10765: }
10766:
10767:
10768:
10769:
10770: protected ExpressionElement evxParseCommand (LinkedList<ExpressionElement> tokenList, int mode) {
10771: ExpressionElement elem = tokenList.peekFirst ();
10772: if (elem == null) {
10773: return null;
10774: }
10775: int minParamCount = 0;
10776: int maxParamCount = 0;
10777: switch (elem.exlType) {
10778: case ETY_COMMAND_ASSEMBLE:
10779: case ETY_COMMAND_RUN:
10780: case ETY_COMMAND_STEP:
10781: case ETY_COMMAND_TRACE:
10782: maxParamCount = 1;
10783: break;
10784: case ETY_COMMAND_DUMP:
10785: case ETY_COMMAND_LIST:
10786: maxParamCount = 2;
10787: break;
10788: case ETY_COMMAND_FILL:
10789: minParamCount = 2 + 1;
10790: maxParamCount = 2 + 65536;
10791: break;
10792: case ETY_COMMAND_HELP:
10793: maxParamCount = 65536;
10794: break;
10795: case ETY_COMMAND_PRINT:
10796: maxParamCount = 65536;
10797: break;
10798: case ETY_COMMAND_FLOAT_REGS:
10799: case ETY_COMMAND_REGS:
10800: case ETY_COMMAND_RETURN:
10801: case ETY_COMMAND_STOP:
10802: break;
10803: default:
10804: return evxParseComma (tokenList, mode);
10805: }
10806: elem = tokenList.pollFirst ();
10807: int paramCount = 0;
10808: ExpressionElement paramX = null;
10809: if (!tokenList.isEmpty () &&
10810: tokenList.peekFirst ().exlType != ElementType.ETY_TOKEN_SEMICOLON) {
10811: paramX = evxParseComma (tokenList, mode);
10812: if (paramX == null) {
10813: return null;
10814: }
10815: paramCount = paramX.exlLengthOfCommaList ();
10816: }
10817: if (paramCount < minParamCount) {
10818: evxPrintError (Multilingual.mlnJapanese ?
10819: "引数が足りません" :
10820: "too few arguments",
10821: elem.exlSource, elem.exlOffset, elem.exlLength);
10822: return null;
10823: }
10824: if (maxParamCount < paramCount) {
10825: evxPrintError (Multilingual.mlnJapanese ?
10826: "引数が多すぎます" :
10827: "too many arguments",
10828: elem.exlSource, elem.exlOffset, elem.exlLength);
10829: return null;
10830: }
10831: elem.exlValueType = ElementType.ETY_VOID;
10832: elem.exlParamX = paramX;
10833: return elem;
10834: }
10835:
10836:
10837:
10838:
10839: protected ExpressionElement evxParseLine (LinkedList<ExpressionElement> tokenList, int mode) {
10840: ExpressionElement paramX = null;
10841: String stringValue = null;
10842: int subscript = -1;
10843: ExpressionElement paramY = null;
10844: ExpressionElement elem = tokenList.peekFirst ();
10845: if (elem == null) {
10846: return null;
10847: }
10848: ExpressionElement head = elem;
10849: ExpressionElement tail = elem;
10850:
10851: if (elem.exlType == ElementType.ETY_LABEL_DEFINITION ||
10852: elem.exlType == ElementType.ETY_LOCAL_LABEL_DEFINITION) {
10853: paramX = elem;
10854: tokenList.pollFirst ();
10855: elem = tokenList.peekFirst ();
10856: }
10857:
10858: elem = tokenList.peekFirst ();
10859: if (elem != null && elem.exlType == ElementType.ETY_MNEMONIC) {
10860: tail = elem;
10861: stringValue = elem.exlStringValue;
10862: tokenList.pollFirst ();
10863: elem = tokenList.peekFirst ();
10864:
10865: if (elem != null && (elem.exlType == ElementType.ETY_OPERATOR_SIZE_BYTE ||
10866: elem.exlType == ElementType.ETY_OPERATOR_SIZE_WORD ||
10867: elem.exlType == ElementType.ETY_OPERATOR_SIZE_LONG ||
10868: elem.exlType == ElementType.ETY_OPERATOR_SIZE_QUAD ||
10869: elem.exlType == ElementType.ETY_OPERATOR_SIZE_SINGLE ||
10870: elem.exlType == ElementType.ETY_OPERATOR_SIZE_DOUBLE ||
10871: elem.exlType == ElementType.ETY_OPERATOR_SIZE_EXTENDED ||
10872: elem.exlType == ElementType.ETY_OPERATOR_SIZE_PACKED)) {
10873: tail = elem;
10874: subscript = elem.exlSubscript;
10875: tokenList.pollFirst ();
10876: elem = tokenList.peekFirst ();
10877: }
10878:
10879: if (elem != null && elem.exlType != ElementType.ETY_TOKEN_SEMICOLON) {
10880: paramY = evxParseComma (tokenList, mode);
10881: tail = paramY;
10882: elem = tokenList.peekFirst ();
10883: }
10884: }
10885: if (elem != null && elem.exlType != ElementType.ETY_TOKEN_SEMICOLON) {
10886: evxPrintError (Multilingual.mlnJapanese ?
10887: "文法エラー" :
10888: "syntax error",
10889: elem.exlSource, elem.exlOffset, elem.exlLength);
10890: return null;
10891: }
10892: return new ExpressionElement (
10893: ElementType.ETY_LINE, subscript,
10894: ElementType.ETY_VOID, null, stringValue,
10895: head.exlSource, head.exlOffset, tail.exlOffset + tail.exlLength - head.exlOffset,
10896: paramX, paramY, null);
10897: }
10898:
10899:
10900:
10901:
10902: protected ExpressionElement evxParseSeparator (LinkedList<ExpressionElement> tokenList, int mode) {
10903:
10904: ExpressionElement paramX = (mode == EVM_EXPRESSION ? evxParseComma (tokenList, mode) :
10905: mode == EVM_COMMAND ? evxParseCommand (tokenList, mode) :
10906: mode == EVM_ASSEMBLER ? evxParseLine (tokenList, mode) :
10907: null);
10908: if (paramX == null) {
10909: return null;
10910: }
10911: for (ExpressionElement elem = tokenList.peekFirst ();
10912: elem != null &&
10913: elem.exlType == ElementType.ETY_TOKEN_SEMICOLON;
10914: elem = tokenList.peekFirst ()) {
10915:
10916: do {
10917: tokenList.pollFirst ();
10918: if (tokenList.isEmpty ()) {
10919: break;
10920: }
10921: elem = tokenList.peekFirst ();
10922: } while (elem.exlType == ElementType.ETY_TOKEN_SEMICOLON);
10923:
10924: ExpressionElement paramY = (mode == EVM_EXPRESSION ? evxParseComma (tokenList, mode) :
10925: mode == EVM_COMMAND ? evxParseCommand (tokenList, mode) :
10926: mode == EVM_ASSEMBLER ? evxParseLine (tokenList, mode) :
10927: null);
10928: if (paramY == null) {
10929: return null;
10930: }
10931: ExpressionElement separator = new ExpressionElement (
10932: ElementType.ETY_SEPARATOR, 0,
10933: paramY.exlValueType, null, null,
10934: paramX.exlSource, paramX.exlOffset, paramY.exlOffset + paramY.exlLength - paramX.exlOffset);
10935: separator.exlParamX = paramX;
10936: separator.exlParamY = paramY;
10937: paramX = separator;
10938: }
10939: return paramX;
10940: }
10941:
10942:
10943:
10944:
10945:
10946: public static final int ORM_BASIC = 0;
10947: public static final int ORM_BIT_FIELD = 1;
10948: public static final int ORM_K_FACTOR = 2;
10949: public static final int ORM_RELATIVE = 3;
10950:
10951:
10952:
10953:
10954:
10955:
10956: public static final int ORT_ERROR = -1;
10957: public static final int ORT_DATA_REGISTER = 0;
10958: public static final int ORT_ADDRESS_REGISTER = 1;
10959: public static final int ORT_POSTINCREMENT = 2;
10960: public static final int ORT_PREDECREMENT = 3;
10961: public static final int ORT_IMMEDIATE = 4;
10962: public static final int ORT_ABSOLUTE_ADDRESS = 5;
10963:
10964:
10965: public static final int ORT_RELATIVE_ADDRESS = 6;
10966: public static final int ORT_ADDRESS_INDIRECT = 7;
10967:
10968:
10969: public static final int ORT_PROGRAM_INDIRECT = 8;
10970:
10971:
10972: public static final int ORT_CONDITION_CODE = 9;
10973: public static final int ORT_STATUS_REGISTER = 10;
10974: public static final int ORT_REGISTER_LIST = 11;
10975: public static final int ORT_REGISTER_PAIR = 12;
10976: public static final int ORT_INDIRECT_PAIR = 13;
10977: public static final int ORT_FLOAT_REGISTER = 14;
10978: public static final int ORT_FLOAT_LIST = 15;
10979: public static final int ORT_FLOAT_CONTROL = 16;
10980: public static final int ORT_CACHE_SELECTION = 17;
10981: public static final int ORT_CONTROL_REGISTER = 18;
10982:
10983:
10984:
10985:
10986:
10987: public class Operand {
10988:
10989:
10990: public int asoOperandMode;
10991:
10992:
10993: public ExpressionElement asoOperandElement;
10994: public ExpressionElement asoBasicElement;
10995:
10996:
10997: public int asoMinimumOperationSize;
10998: public int asoMaximumOperationSize;
10999: public int asoOperationSize;
11000:
11001:
11002:
11003:
11004: public boolean asoWithBitField;
11005:
11006: public int asoBitFieldOffsetRegister;
11007: public ExpressionElement asoBitFieldOffsetElement;
11008: public int asoBitFieldOffsetValue;
11009: public int asoBitFieldWidthRegister;
11010: public ExpressionElement asoBitFieldWidthElement;
11011: public int asoBitFieldWidthValue;
11012:
11013:
11014:
11015: public boolean asoWithKFactor;
11016:
11017: public int asoKFactorRegister;
11018: public ExpressionElement asoKFactorElement;
11019: public int asoKFactorValue;
11020:
11021:
11022: public int asoOperandType;
11023: public int asoSubscript;
11024:
11025:
11026:
11027: public boolean asoBaseRegisterSuppress;
11028:
11029: public int asoMinimumBaseDisplacementSize;
11030: public int asoMaximumBaseDisplacementSize;
11031: public ExpressionElement asoBaseDisplacementElement;
11032: public int asoBaseDisplacementValue;
11033: public int asoBaseDisplacementSize;
11034:
11035: public boolean asoMemoryIndirect;
11036:
11037:
11038: public int asoMinimumOuterDisplacementSize;
11039: public int asoMaximumOuterDisplacementSize;
11040: public ExpressionElement asoOuterDisplacementElement;
11041: public int asoOuterDisplacementValue;
11042: public int asoOuterDisplacementSize;
11043:
11044: public boolean asoPostindex;
11045: public boolean asoIndexSuppress;
11046: public int asoIndexRegister;
11047: public ExpressionElement asoScaleFactorElement;
11048: public int asoScaleFactorValue;
11049: public int asoLog2ScaleFactor;
11050:
11051:
11052: public ExpressionElement asoImmediateElement;
11053: public int asoImmediateValue;
11054: public int asoImmediateSize;
11055:
11056:
11057: public int asoMinimumAbsoluteAddressSize;
11058: public int asoMaximumAbsoluteAddressSize;
11059: public ExpressionElement asoAbsoluteAddressElement;
11060: public int asoAbsoluteAddressValue;
11061: public int asoAbsoluteAddressSize;
11062:
11063:
11064:
11065: public int asoBaseAddress;
11066: public ExpressionElement asoRelativeAddressElement;
11067: public int asoRelativeAddressValue;
11068: public int asoRelativeAddressSize;
11069:
11070:
11071:
11072:
11073: public Operand (int operandMode, ExpressionElement operandElement,
11074: int minimumOperationSize, int maximumOperationSize) {
11075: this (operandMode, operandElement,
11076: minimumOperationSize, maximumOperationSize,
11077: 0);
11078: }
11079: public Operand (int operandMode, ExpressionElement operandElement,
11080: int minimumOperationSize, int maximumOperationSize,
11081: int baseAddress) {
11082: asoOperandMode = operandMode;
11083: asoOperandElement = operandElement;
11084: asoMinimumOperationSize = minimumOperationSize;
11085: asoMaximumOperationSize = maximumOperationSize;
11086: asoBaseAddress = baseAddress;
11087:
11088: asoBasicElement = asoOperandElement;
11089: asoOperationSize = maximumOperationSize;
11090:
11091:
11092:
11093:
11094: asoWithBitField = false;
11095: if (asoOperandMode != ORM_BIT_FIELD) {
11096: if (asoOperandElement.exlType == ElementType.ETY_BIT_FIELD) {
11097: evxPrintError (Multilingual.mlnJapanese ?
11098: "予期しないビットフィールド" :
11099: "unexpected bit-field",
11100: asoOperandElement.exlSource, asoOperandElement.exlOffset, asoOperandElement.exlLength);
11101: asoOperandType = ORT_ERROR;
11102: return;
11103: }
11104: } else {
11105: if (asoOperandElement.exlType != ElementType.ETY_BIT_FIELD) {
11106: evxPrintError (Multilingual.mlnJapanese ?
11107: "ビットフィールドが必要です" :
11108: "bit-field is required",
11109: asoOperandElement.exlSource, asoOperandElement.exlOffset, asoOperandElement.exlLength);
11110: asoOperandType = ORT_ERROR;
11111: return;
11112: }
11113: asoBasicElement = asoOperandElement.exlParamX;
11114: asoBitFieldOffsetRegister = -1;
11115: asoBitFieldOffsetElement = asoOperandElement.exlParamY;
11116: if (asoBitFieldOffsetElement.exlType == ElementType.ETY_INTEGER_REGISTER) {
11117: asoBitFieldOffsetRegister = asoBitFieldOffsetElement.exlSubscript;
11118: } else {
11119: if (asoBitFieldOffsetElement.exlType == ElementType.ETY_IMMEDIATE) {
11120: asoBitFieldOffsetElement = asoBitFieldOffsetElement.exlParamX;
11121: }
11122: asoBitFieldOffsetValue = asoBitFieldOffsetElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11123: }
11124: asoBitFieldWidthRegister = -1;
11125: asoBitFieldWidthElement = asoOperandElement.exlParamZ;
11126: if (asoBitFieldWidthElement.exlType == ElementType.ETY_INTEGER_REGISTER) {
11127: asoBitFieldWidthRegister = asoBitFieldWidthElement.exlSubscript;
11128: } else {
11129: if (asoBitFieldWidthElement.exlType == ElementType.ETY_IMMEDIATE) {
11130: asoBitFieldWidthElement = asoBitFieldWidthElement.exlParamX;
11131: }
11132: asoBitFieldWidthValue = asoBitFieldWidthElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11133: }
11134: }
11135:
11136:
11137:
11138:
11139: asoWithKFactor = false;
11140: if (asoOperandMode != ORM_K_FACTOR) {
11141: if (asoOperandElement.exlType == ElementType.ETY_K_FACTOR) {
11142: evxPrintError (Multilingual.mlnJapanese ?
11143: "予期しない k-factor" :
11144: "unexpected k-factor",
11145: asoOperandElement.exlSource, asoOperandElement.exlOffset, asoOperandElement.exlLength);
11146: asoOperandType = ORT_ERROR;
11147: return;
11148: }
11149: } else {
11150: if (asoOperandElement.exlType != ElementType.ETY_K_FACTOR) {
11151: evxPrintError (Multilingual.mlnJapanese ?
11152: "k-factor が必要です" :
11153: "k-factor is required",
11154: asoOperandElement.exlSource, asoOperandElement.exlOffset, asoOperandElement.exlLength);
11155: asoOperandType = ORT_ERROR;
11156: return;
11157: }
11158: asoBasicElement = asoOperandElement.exlParamX;
11159: asoKFactorRegister = -1;
11160: asoKFactorElement = asoOperandElement.exlParamY;
11161: if (asoKFactorElement.exlType == ElementType.ETY_INTEGER_REGISTER) {
11162: asoKFactorRegister = asoKFactorElement.exlSubscript;
11163: } else {
11164: if (asoKFactorElement.exlType == ElementType.ETY_IMMEDIATE) {
11165: asoKFactorElement = asoKFactorElement.exlParamX;
11166: }
11167: asoKFactorValue = asoKFactorElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11168: }
11169: }
11170:
11171:
11172:
11173:
11174: asoBaseRegisterSuppress = false;
11175:
11176: asoMinimumBaseDisplacementSize = 0;
11177: asoMaximumBaseDisplacementSize = 0;
11178: asoBaseDisplacementElement = null;
11179: asoBaseDisplacementValue = 0;
11180: asoBaseDisplacementSize = 0;
11181:
11182: asoMemoryIndirect = false;
11183:
11184: asoMinimumOuterDisplacementSize = 0;
11185: asoMaximumOuterDisplacementSize = 0;
11186: asoOuterDisplacementElement = null;
11187: asoOuterDisplacementValue = 0;
11188: asoOuterDisplacementSize = 0;
11189:
11190: asoPostindex = false;
11191: asoIndexSuppress = true;
11192: asoIndexRegister = 0;
11193: asoScaleFactorElement = null;
11194: asoScaleFactorValue = 1;
11195: asoLog2ScaleFactor = 0;
11196:
11197: asoImmediateElement = null;
11198: asoImmediateValue = 0;
11199: asoImmediateSize = 0;
11200:
11201: asoMinimumAbsoluteAddressSize = 2;
11202: asoMaximumAbsoluteAddressSize = 4;
11203: asoAbsoluteAddressElement = null;
11204: asoAbsoluteAddressValue = 0;
11205: asoAbsoluteAddressSize = 0;
11206:
11207:
11208:
11209: if (asoOperandMode == ORM_RELATIVE) {
11210: if (asoBasicElement.exlValueType != ElementType.ETY_FLOAT) {
11211: evxPrintError (Multilingual.mlnJapanese ?
11212: "相対アドレスが必要です" :
11213: "relative address is required",
11214: asoBasicElement.exlSource, asoBasicElement.exlOffset, asoBasicElement.exlLength);
11215: asoOperandType = ORT_ERROR;
11216: return;
11217: }
11218: asoOperandType = ORT_RELATIVE_ADDRESS;
11219: asoRelativeAddressElement = asoBasicElement;
11220: asoRelativeAddressValue = asoRelativeAddressElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti () - asoBaseAddress;
11221: asoRelativeAddressSize = (asoRelativeAddressValue == 0 ? 0 :
11222: (byte) asoRelativeAddressValue == asoRelativeAddressValue ? 1 :
11223: (short) asoRelativeAddressValue == asoRelativeAddressValue ? 2 :
11224: 4);
11225: return;
11226: }
11227:
11228:
11229:
11230:
11231: if (asoBasicElement.exlType == ElementType.ETY_INTEGER_REGISTER) {
11232: if (asoBasicElement.exlSubscript < 8) {
11233: asoOperandType = ORT_DATA_REGISTER;
11234: asoSubscript = asoBasicElement.exlSubscript;
11235: } else {
11236: asoOperandType = ORT_ADDRESS_REGISTER;
11237: asoSubscript = asoBasicElement.exlSubscript - 8;
11238: }
11239: return;
11240: }
11241:
11242:
11243:
11244: if (asoBasicElement.exlType == ElementType.ETY_POSTINCREMENT) {
11245: asoOperandType = ORT_POSTINCREMENT;
11246: asoSubscript = asoBasicElement.exlSubscript;
11247: return;
11248: }
11249:
11250:
11251:
11252: if (asoBasicElement.exlType == ElementType.ETY_PREDECREMENT) {
11253: asoOperandType = ORT_PREDECREMENT;
11254: asoSubscript = asoBasicElement.exlSubscript;
11255: return;
11256: }
11257:
11258:
11259:
11260: if (asoBasicElement.exlType == ElementType.ETY_IMMEDIATE) {
11261: asoOperandType = ORT_IMMEDIATE;
11262: asoImmediateElement = asoBasicElement.exlParamX;
11263: asoImmediateValue = asoImmediateElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11264: asoImmediateSize = (asoImmediateValue == 0 ? 0 :
11265: (byte) asoImmediateValue == asoImmediateValue ? 1 :
11266: (short) asoImmediateValue == asoImmediateValue ? 2 :
11267: 4);
11268: return;
11269: }
11270:
11271:
11272:
11273: if (asoBasicElement.exlValueType == ElementType.ETY_FLOAT) {
11274: asoOperandType = ORT_ABSOLUTE_ADDRESS;
11275: asoMinimumAbsoluteAddressSize = 2;
11276: asoMaximumAbsoluteAddressSize = 4;
11277: asoAbsoluteAddressElement = asoBasicElement;
11278: asoAbsoluteAddressValue = asoAbsoluteAddressElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11279: asoAbsoluteAddressSize = ((short) asoAbsoluteAddressValue == asoAbsoluteAddressValue ? 2 :
11280: 4);
11281: return;
11282: }
11283:
11284:
11285:
11286:
11287: if (asoBasicElement.exlType == ElementType.ETY_SIZE && (asoBasicElement.exlSubscript == 'w' ||
11288: asoBasicElement.exlSubscript == 'l') &&
11289: asoBasicElement.exlParamX.exlValueType == ElementType.ETY_FLOAT) {
11290: asoOperandType = ORT_ABSOLUTE_ADDRESS;
11291: if (asoBasicElement.exlSubscript == 'w') {
11292: asoMinimumAbsoluteAddressSize = 2;
11293: asoMaximumAbsoluteAddressSize = 2;
11294: } else {
11295: asoMinimumAbsoluteAddressSize = 4;
11296: asoMaximumAbsoluteAddressSize = 4;
11297: }
11298: asoAbsoluteAddressElement = asoBasicElement.exlParamX;
11299: asoAbsoluteAddressValue = asoAbsoluteAddressElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11300: asoAbsoluteAddressSize = ((short) asoAbsoluteAddressValue == asoAbsoluteAddressValue ? 2 :
11301: 4);
11302: return;
11303: }
11304:
11305:
11306:
11307: if (asoBasicElement.exlType == ElementType.ETY_REGISTER_INDIRECT &&
11308: 8 <= asoBasicElement.exlSubscript) {
11309: asoOperandType = ORT_ADDRESS_INDIRECT;
11310: asoSubscript = asoBasicElement.exlSubscript - 8;
11311: return;
11312: }
11313:
11314:
11315:
11316: if (asoBasicElement.exlType == ElementType.ETY_CCR) {
11317: asoOperandType = ORT_CONDITION_CODE;
11318: return;
11319: }
11320:
11321:
11322:
11323: if (asoBasicElement.exlType == ElementType.ETY_SR) {
11324: asoOperandType = ORT_STATUS_REGISTER;
11325: return;
11326: }
11327:
11328:
11329:
11330: if (asoBasicElement.exlType == ElementType.ETY_INTEGER_REGISTER_LIST) {
11331: asoOperandType = ORT_REGISTER_LIST;
11332: asoSubscript = asoBasicElement.exlSubscript;
11333: return;
11334: }
11335:
11336:
11337:
11338: if (asoBasicElement.exlType == ElementType.ETY_DATA_REGISTER_PAIR) {
11339: asoOperandType = ORT_REGISTER_PAIR;
11340: asoSubscript = asoBasicElement.exlSubscript;
11341: return;
11342: }
11343:
11344:
11345:
11346: if (asoBasicElement.exlType == ElementType.ETY_REGISTER_INDIRECT_PAIR) {
11347: asoOperandType = ORT_INDIRECT_PAIR;
11348: asoSubscript = asoBasicElement.exlSubscript;
11349: return;
11350: }
11351:
11352:
11353:
11354: if (asoBasicElement.exlType == ElementType.ETY_FLOATING_POINT_REGISTER) {
11355: asoOperandType = ORT_FLOAT_REGISTER;
11356: asoSubscript = asoBasicElement.exlSubscript;
11357: return;
11358: }
11359:
11360:
11361:
11362: if (asoBasicElement.exlType == ElementType.ETY_FLOATING_POINT_REGISTER_LIST) {
11363: asoOperandType = ORT_FLOAT_LIST;
11364: asoSubscript = asoBasicElement.exlSubscript;
11365: return;
11366: }
11367:
11368:
11369:
11370: if (asoBasicElement.exlType == ElementType.ETY_FLOATING_POINT_CONTROL_REGISTER_LIST) {
11371: asoOperandType = ORT_FLOAT_CONTROL;
11372: asoSubscript = asoBasicElement.exlSubscript;
11373: return;
11374: }
11375:
11376:
11377:
11378: if (asoBasicElement.exlType == ElementType.ETY_CACHE_SELECTION) {
11379: asoOperandType = ORT_CACHE_SELECTION;
11380: asoSubscript = asoBasicElement.exlSubscript;
11381: return;
11382: }
11383:
11384:
11385:
11386: if (asoBasicElement.exlType == ElementType.ETY_CONTROL_REGISTER) {
11387: asoOperandType = ORT_CONTROL_REGISTER;
11388: asoSubscript = asoBasicElement.exlSubscript;
11389: return;
11390: }
11391:
11392:
11393:
11394:
11395:
11396:
11397:
11398:
11399:
11400:
11401:
11402:
11403:
11404:
11405: if (asoBasicElement.exlType == ElementType.ETY_PARENTHESIS) {
11406:
11407:
11408:
11409:
11410:
11411:
11412:
11413: asoMemoryIndirect = false;
11414: LinkedList<ExpressionElement> baseList = asoBasicElement.exlParamX.exlToCommaList ();
11415: LinkedList<ExpressionElement> outerList = null;
11416: for (int i = 0, l = baseList.size (); i < l; i++) {
11417: if (baseList.get (i).exlType == ElementType.ETY_SQUARE_BRACKET) {
11418: asoMemoryIndirect = true;
11419: outerList = baseList;
11420: baseList = outerList.remove (i).exlParamX.exlToCommaList ();
11421: break;
11422: }
11423: }
11424:
11425: asoBaseRegisterSuppress = true;
11426: asoOperandType = ORT_ADDRESS_INDIRECT;
11427: asoSubscript = 0;
11428: for (int i = 0, l = baseList.size (); i < l; i++) {
11429: ExpressionElement e = baseList.get (i);
11430: ElementType t = e.exlType;
11431: if (((t == ElementType.ETY_INTEGER_REGISTER ||
11432: t == ElementType.ETY_ZERO_REGISTER) && 8 <= e.exlSubscript) ||
11433: t == ElementType.ETY_PC ||
11434: t == ElementType.ETY_ZERO_PC) {
11435: baseList.remove (i);
11436: if (t == ElementType.ETY_INTEGER_REGISTER ||
11437: t == ElementType.ETY_ZERO_REGISTER) {
11438: asoOperandType = ORT_ADDRESS_INDIRECT;
11439: asoSubscript = e.exlSubscript - 8;
11440: } else {
11441: asoOperandType = ORT_PROGRAM_INDIRECT;
11442: }
11443: asoBaseRegisterSuppress = (t == ElementType.ETY_ZERO_REGISTER ||
11444: t == ElementType.ETY_ZERO_PC);
11445: break;
11446: }
11447: }
11448:
11449: asoPostindex = false;
11450: asoIndexSuppress = true;
11451: asoIndexRegister = 0;
11452: asoScaleFactorElement = null;
11453: asoScaleFactorValue = 1;
11454: asoLog2ScaleFactor = 0;
11455:
11456: ExpressionElement indexElement = null;
11457: for (int i = 0, l = baseList.size (); i < l; i++) {
11458: ExpressionElement e = baseList.get (i);
11459: ElementType t = e.exlType;
11460: if (t == ElementType.ETY_INTEGER_REGISTER ||
11461: (t == ElementType.ETY_SIZE && (e.exlSubscript == 'w' ||
11462: e.exlSubscript == 'l') &&
11463: e.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) ||
11464: t == ElementType.ETY_SCALE_FACTOR) {
11465: indexElement = e;
11466: baseList.remove (i);
11467: break;
11468: }
11469: }
11470:
11471: if (indexElement == null && asoMemoryIndirect) {
11472: for (int i = 0, l = outerList.size (); i < l; i++) {
11473: ExpressionElement e = outerList.get (i);
11474: ElementType t = e.exlType;
11475: if (t == ElementType.ETY_INTEGER_REGISTER ||
11476: (t == ElementType.ETY_SIZE && (e.exlSubscript == 'w' ||
11477: e.exlSubscript == 'l') &&
11478: e.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER) ||
11479: t == ElementType.ETY_SCALE_FACTOR) {
11480: asoPostindex = true;
11481: indexElement = e;
11482: outerList.remove (i);
11483: break;
11484: }
11485: }
11486: }
11487: if (indexElement != null) {
11488: ExpressionElement e = indexElement;
11489: ElementType t = e.exlType;
11490: asoIndexSuppress = false;
11491: asoIndexRegister = (t == ElementType.ETY_INTEGER_REGISTER ? e.exlSubscript :
11492: t == ElementType.ETY_SIZE ? e.exlParamX.exlSubscript :
11493: e.exlParamX.exlType == ElementType.ETY_INTEGER_REGISTER ? e.exlParamX.exlSubscript :
11494: e.exlParamX.exlParamX.exlSubscript);
11495: if (t == ElementType.ETY_SCALE_FACTOR) {
11496: asoScaleFactorElement = e.exlParamY;
11497: asoScaleFactorValue = asoScaleFactorElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11498: asoLog2ScaleFactor = (asoScaleFactorValue == 1 ? 0 :
11499: asoScaleFactorValue == 2 ? 1 :
11500: asoScaleFactorValue == 4 ? 2 :
11501: asoScaleFactorValue == 8 ? 3 :
11502: 0);
11503: }
11504: }
11505:
11506: asoMinimumBaseDisplacementSize = 0;
11507: asoMaximumBaseDisplacementSize = 4;
11508: asoBaseDisplacementElement = null;
11509: asoBaseDisplacementValue = 0;
11510: asoBaseDisplacementSize = 0;
11511: for (int i = 0, l = baseList.size (); i < l; i++) {
11512: ExpressionElement e = baseList.get (i);
11513: ElementType t = e.exlType;
11514: if (e.exlValueType == ElementType.ETY_FLOAT) {
11515: asoMinimumBaseDisplacementSize = 0;
11516: asoMaximumBaseDisplacementSize = 4;
11517: asoBaseDisplacementElement = e;
11518: baseList.remove (i);
11519: } else if (t == ElementType.ETY_SIZE && (e.exlSubscript == 'w' ||
11520: e.exlSubscript == 'l') &&
11521: e.exlParamX.exlType == ElementType.ETY_FLOAT) {
11522: asoBaseDisplacementElement = e.exlParamX;
11523: if (e.exlSubscript == 'w') {
11524: asoMinimumBaseDisplacementSize = 2;
11525: asoMaximumBaseDisplacementSize = 2;
11526: } else {
11527: asoMinimumBaseDisplacementSize = 4;
11528: asoMaximumBaseDisplacementSize = 4;
11529: }
11530: baseList.remove (i);
11531: }
11532: asoBaseDisplacementValue = asoBaseDisplacementElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11533: asoBaseDisplacementSize = (asoBaseDisplacementValue == 0 ? 0 :
11534: !asoMemoryIndirect && (byte) asoBaseDisplacementValue == asoBaseDisplacementValue ? 1 :
11535: (short) asoBaseDisplacementValue == asoBaseDisplacementValue ? 2 :
11536: 4);
11537: break;
11538: }
11539:
11540: asoMinimumOuterDisplacementSize = 0;
11541: asoMaximumOuterDisplacementSize = 4;
11542: asoOuterDisplacementElement = null;
11543: asoOuterDisplacementValue = 0;
11544: asoOuterDisplacementSize = 0;
11545: for (int i = 0, l = outerList.size (); i < l; i++) {
11546: ExpressionElement e = outerList.get (i);
11547: ElementType t = e.exlType;
11548: if (e.exlValueType == ElementType.ETY_FLOAT) {
11549: asoMinimumOuterDisplacementSize = 0;
11550: asoMaximumOuterDisplacementSize = 4;
11551: asoOuterDisplacementElement = e;
11552: outerList.remove (i);
11553: } else if (t == ElementType.ETY_SIZE &&
11554: e.exlParamX.exlType == ElementType.ETY_FLOAT) {
11555: asoOuterDisplacementElement = e.exlParamX;
11556: if (e.exlSubscript == 'w') {
11557: asoMinimumOuterDisplacementSize = 2;
11558: asoMaximumOuterDisplacementSize = 2;
11559: } else {
11560: asoMinimumOuterDisplacementSize = 4;
11561: asoMaximumOuterDisplacementSize = 4;
11562: }
11563: outerList.remove (i);
11564: }
11565: asoOuterDisplacementValue = asoOuterDisplacementElement.exlEval (EVM_EXPRESSION).exlFloatValue.geti ();
11566: asoOuterDisplacementSize = (asoOuterDisplacementValue == 0 ? 0 :
11567: (short) asoOuterDisplacementValue == asoOuterDisplacementValue ? 2 :
11568: 4);
11569: break;
11570: }
11571:
11572: if (0 < baseList.size ()) {
11573: ExpressionElement e = baseList.get (0);
11574: evxPrintError (Multilingual.mlnJapanese ?
11575: "文法エラー" :
11576: "syntax error",
11577: e.exlSource, e.exlOffset, e.exlLength);
11578: asoOperandType = ORT_ERROR;
11579: return;
11580: }
11581: if (0 < outerList.size ()) {
11582: ExpressionElement e = outerList.get (0);
11583: evxPrintError (Multilingual.mlnJapanese ?
11584: "文法エラー" :
11585: "syntax error",
11586: e.exlSource, e.exlOffset, e.exlLength);
11587: asoOperandType = ORT_ERROR;
11588: return;
11589: }
11590: return;
11591: }
11592:
11593: evxPrintError (Multilingual.mlnJapanese ?
11594: "文法エラー" :
11595: "syntax error",
11596: asoBasicElement.exlSource, asoBasicElement.exlOffset, asoBasicElement.exlLength);
11597: asoOperandType = ORT_ERROR;
11598:
11599: }
11600:
11601:
11602:
11603:
11604:
11605:
11606:
11607: public void asoUpdate (int baseAddress, boolean first, boolean last) {
11608: asoBaseAddress = baseAddress;
11609:
11610: }
11611:
11612:
11613:
11614:
11615: public String toString () {
11616: return this.appendTo (new StringBuilder ()).toString ();
11617: }
11618: public StringBuilder appendTo (StringBuilder sb) {
11619: switch (asoOperandType) {
11620:
11621:
11622:
11623: case ORT_DATA_REGISTER:
11624: return sb.append ('d').append (asoSubscript);
11625:
11626:
11627:
11628: case ORT_ADDRESS_REGISTER:
11629: if (asoSubscript < 7) {
11630: return sb.append ('a').append (asoSubscript);
11631: } else {
11632: return sb.append ("sp");
11633: }
11634:
11635:
11636:
11637: case ORT_POSTINCREMENT:
11638: if (asoSubscript < 7) {
11639: return sb.append ("(a").append (asoSubscript).append (")+");
11640: } else {
11641: return sb.append ("(sp)+");
11642: }
11643:
11644:
11645:
11646: case ORT_PREDECREMENT:
11647: if (asoSubscript < 7) {
11648: return sb.append ("-(a").append (asoSubscript).append (')');
11649: } else {
11650: return sb.append ("-(sp)");
11651: }
11652:
11653:
11654:
11655: case ORT_IMMEDIATE:
11656: if (asoOperationSize <= 1) {
11657: return XEiJ.fmtHex2 (sb.append ('#'), asoImmediateValue);
11658: } else if (asoOperationSize <= 2) {
11659: return XEiJ.fmtHex4 (sb.append ('#'), asoImmediateValue);
11660: } else {
11661: return XEiJ.fmtHex8 (sb.append ('#'), asoImmediateValue);
11662: }
11663:
11664:
11665:
11666:
11667:
11668: case ORT_ABSOLUTE_ADDRESS:
11669: if (asoAbsoluteAddressSize <= 2) {
11670: return XEiJ.fmtHex4 (sb.append ('$'), asoAbsoluteAddressValue).append (".w");
11671: } else {
11672: return XEiJ.fmtHex8 (sb.append ('$'), asoAbsoluteAddressValue).append (".l");
11673: }
11674:
11675:
11676:
11677: case ORT_RELATIVE_ADDRESS:
11678: return XEiJ.fmtHex8 (sb.append ('$'), asoRelativeAddressValue + asoBaseAddress);
11679:
11680:
11681:
11682: case ORT_CONDITION_CODE:
11683: return sb.append ("ccr");
11684:
11685:
11686:
11687: case ORT_STATUS_REGISTER:
11688: return sb.append ("sr");
11689:
11690:
11691:
11692: case ORT_REGISTER_LIST:
11693: {
11694: int m = asoSubscript;
11695: m = (m & 0x8000) << 2 | (m & 0x7f00) << 1 | (m & 0x00ff);
11696: boolean s = false;
11697: while (m != 0) {
11698: int i = Integer.numberOfTrailingZeros (m);
11699: m += 1 << i;
11700: int j = Integer.numberOfTrailingZeros (m);
11701: m -= 1 << j;
11702: j--;
11703: if (s) {
11704: sb.append ('/');
11705: }
11706: if (i <= 7) {
11707: sb.append ('d').append (i);
11708: } else if (i <= 16) {
11709: sb.append ('a').append (i - 9);
11710: } else {
11711: sb.append ("sp");
11712: }
11713: if (i < j) {
11714: sb.append ('-');
11715: if (j <= 7) {
11716: sb.append ('d').append (j);
11717: } else if (j <= 16) {
11718: sb.append ('a').append (j - 9);
11719: } else {
11720: sb.append ("sp");
11721: }
11722: }
11723: s = true;
11724: }
11725: return sb;
11726: }
11727:
11728:
11729:
11730: case ORT_REGISTER_PAIR:
11731: {
11732: int h = asoSubscript >> 3;
11733: int l = asoSubscript & 7;
11734: return sb.append ('d').append (h).append (":d").append (l);
11735: }
11736:
11737:
11738:
11739: case ORT_INDIRECT_PAIR:
11740: {
11741: int r = asoSubscript >> 4;
11742: int s = asoSubscript & 15;
11743: sb.append ('(');
11744: if (r <= 7) {
11745: sb.append ('d').append (r);
11746: } else if (r <= 14) {
11747: sb.append ('a').append (r - 8);
11748: } else {
11749: sb.append ("sp");
11750: }
11751: sb.append ("):(");
11752: if (s <= 7) {
11753: sb.append ('d').append (s);
11754: } else if (s <= 14) {
11755: sb.append ('a').append (s - 8);
11756: } else {
11757: sb.append ("sp");
11758: }
11759: return sb.append (')');
11760: }
11761:
11762:
11763:
11764: case ORT_FLOAT_REGISTER:
11765: return sb.append ("fp").append (asoSubscript);
11766:
11767:
11768:
11769: case ORT_FLOAT_LIST:
11770: {
11771: int m = asoSubscript;
11772: boolean s = false;
11773: while (m != 0) {
11774: int i = Integer.numberOfTrailingZeros (m);
11775: m += 1 << i;
11776: int j = Integer.numberOfTrailingZeros (m);
11777: m -= 1 << j;
11778: j--;
11779: if (s) {
11780: sb.append ('/');
11781: }
11782: sb.append ("fp").append (i);
11783: if (i < j) {
11784: sb.append ("-fp").append (j);
11785: }
11786: s = true;
11787: }
11788: return sb;
11789: }
11790:
11791:
11792:
11793: case ORT_FLOAT_CONTROL:
11794: {
11795: int m = asoSubscript;
11796: boolean s = false;
11797: while (m != 0) {
11798: int i = Integer.numberOfTrailingZeros (m);
11799: m -= 1 << i;
11800: if (s) {
11801: sb.append ('/');
11802: }
11803: sb.append (EVX_FLOAT_CONTROL_NAME_ARRAY[i]);
11804: s = true;
11805: }
11806: return sb;
11807: }
11808:
11809:
11810:
11811: case ORT_CACHE_SELECTION:
11812: return sb.append (EVX_CACHE_NAME_ARRAY[asoSubscript]);
11813:
11814:
11815:
11816: case ORT_CONTROL_REGISTER:
11817: return sb.append (EVX_CONTROL_MPU_CODE_TO_NAME.get (asoSubscript));
11818:
11819:
11820:
11821:
11822:
11823:
11824:
11825:
11826:
11827:
11828:
11829:
11830:
11831: case ORT_ADDRESS_INDIRECT:
11832: case ORT_PROGRAM_INDIRECT:
11833: if (!asoBaseRegisterSuppress &&
11834: asoBaseDisplacementSize <= 1 &&
11835: !asoMemoryIndirect &&
11836: !asoIndexSuppress) {
11837: sb.append ('(');
11838:
11839: if (asoOperandType == ORT_PROGRAM_INDIRECT) {
11840: XEiJ.fmtHex8 (sb.append ('$'), asoBaseDisplacementValue + asoBaseAddress);
11841: } else {
11842: XEiJ.fmtHex2 (sb.append ('$'), asoBaseDisplacementValue);
11843: }
11844: sb.append (',');
11845:
11846: if (asoOperandType == ORT_PROGRAM_INDIRECT) {
11847: sb.append ("pc");
11848: } else if (asoSubscript < 7) {
11849: sb.append ('a').append (asoSubscript);
11850: } else {
11851: sb.append ("sp");
11852: }
11853: sb.append (',');
11854:
11855: if (asoIndexRegister < 8) {
11856: sb.append ('d').append (asoIndexRegister);
11857: } else if (asoIndexRegister < 15) {
11858: sb.append ('a').append (asoIndexRegister - 8);
11859: } else {
11860: sb.append ("sp");
11861: }
11862: if (0 < asoLog2ScaleFactor) {
11863: sb.append ('*').append (1 << asoLog2ScaleFactor);
11864: }
11865: sb.append (')');
11866: } else {
11867: sb.append ('(');
11868:
11869: if (asoMemoryIndirect) {
11870: sb.append ('[');
11871: }
11872:
11873: if (0 < asoBaseDisplacementSize) {
11874: if (asoOperandType == ORT_PROGRAM_INDIRECT) {
11875: XEiJ.fmtHex8 (sb.append ('$'), asoBaseDisplacementValue + asoBaseAddress);
11876: } else if (asoBaseDisplacementSize <= 2) {
11877: XEiJ.fmtHex4 (sb.append ('$'), asoBaseDisplacementValue);
11878: } else {
11879: XEiJ.fmtHex8 (sb.append ('$'), asoBaseDisplacementValue);
11880: }
11881: sb.append (',');
11882: }
11883:
11884: if (asoBaseRegisterSuppress) {
11885: sb.append ('z');
11886: }
11887: if (asoOperandType == ORT_PROGRAM_INDIRECT) {
11888: sb.append ("pc");
11889: } else if (asoSubscript < 7) {
11890: sb.append ('a').append (asoSubscript);
11891: } else {
11892: sb.append ("sp");
11893: }
11894:
11895: if (!asoIndexSuppress && !asoPostindex) {
11896: sb.append (',');
11897: if (asoIndexRegister < 8) {
11898: sb.append ('d').append (asoIndexRegister);
11899: } else if (asoIndexRegister < 15) {
11900: sb.append ('a').append (asoIndexRegister - 8);
11901: } else {
11902: sb.append ("sp");
11903: }
11904: if (0 < asoLog2ScaleFactor) {
11905: sb.append ('*').append (1 << asoLog2ScaleFactor);
11906: }
11907: }
11908:
11909: if (asoMemoryIndirect) {
11910: sb.append (']');
11911:
11912: if (0 < asoOuterDisplacementSize) {
11913: if (asoBaseDisplacementSize <= 2) {
11914: XEiJ.fmtHex4 (sb.append ('$'), asoOuterDisplacementValue);
11915: } else {
11916: XEiJ.fmtHex8 (sb.append ('$'), asoOuterDisplacementValue);
11917: }
11918: sb.append (',');
11919: }
11920:
11921: if (!asoIndexSuppress && asoPostindex) {
11922: sb.append (',');
11923: if (asoIndexRegister < 8) {
11924: sb.append ('d').append (asoIndexRegister);
11925: } else if (asoIndexRegister < 15) {
11926: sb.append ('a').append (asoIndexRegister - 8);
11927: } else {
11928: sb.append ("sp");
11929: }
11930: if (0 < asoLog2ScaleFactor) {
11931: sb.append ('*').append (1 << asoLog2ScaleFactor);
11932: }
11933: }
11934: }
11935: sb.append (')');
11936: }
11937: return sb;
11938:
11939: }
11940:
11941: return sb.append ("???");
11942:
11943: }
11944:
11945:
11946: }
11947:
11948:
11949:
11950: }
11951:
11952:
11953: