2 // RMAC - Reboot's Macro Assembler for the Atari Jaguar Console System
3 // EAGEN0.C - Effective Address Code Generation
4 // Generated Code for eaN (Included twice by "eagen.c")
5 // Copyright (C) 199x Landon Dyer, 2011 Reboot and Friends
6 // RMAC derived from MADMAC v1.07 Written by Landon Dyer, 1986
7 // Source Utilised with the Kind Permission of Landon Dyer
17 w = (WORD)(aNexattr & DEFINED);
18 tdb = (WORD)(aNexattr & TDB);
22 case DREG: // "Do nothing" - they're in the opword
31 break; // This is a performance hit, though
32 case ADISP: // expr(An)
36 rmark(cursect, sloc, tdb, MWORD, NULL);
38 if (v + 0x8000 >= 0x18000)
39 return error(range_error);
44 { // Arrange for fixup later on
45 fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
53 if ((aNexattr & TDB) == cursect)
55 else if ((aNexattr & TDB) != ABS)
58 if (v + 0x8000 >= 0x10000)
59 return error(range_error);
64 { // Arrange for fixup later on
65 fixup(FU_WORD|FU_SEXT|FU_PCREL, sloc, aNexpr);
71 w = (WORD)((aNixreg << 12) | aNixsiz); // Compute ixreg and size+scale
73 if (aNexattr & DEFINED)
74 { // Deposit a byte...
76 return error(abs_error); // Can't mark bytes
78 if (v + 0x80 >= 0x180)
79 return error(range_error);
85 { // Fixup the byte later
86 fixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
92 w = (WORD)((aNixreg << 12) | aNixsiz); // Compute ixreg and size+scale
94 if (aNexattr & DEFINED)
95 { // Deposit a byte...
96 if ((aNexattr & TDB) == cursect)
98 else if ((aNexattr & TDB) != ABS)
101 if (v + 0x80 >= 0x100)
102 return error(range_error);
108 { // Fixup the byte later
109 fixup(FU_WBYTE|FU_SEXT|FU_PCREL, sloc, aNexpr);
121 return error("illegal byte-sized relative reference");
123 if (v + 0x100 >= 0x200)
124 return error(range_error);
130 fixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
140 rmark(cursect, sloc, tdb, MWORD, NULL);
142 if (v + 0x10000 >= 0x20000)
143 return error(range_error);
149 fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
158 rmark(cursect, sloc, tdb, MLONG, NULL);
164 fixup(FU_LONG, sloc, aNexpr);
170 interror(1); // IMMED size problem
178 rmark(cursect, sloc, tdb, MWORD, NULL);
180 if (v + 0x8000 >= 0x10000)
181 return error(range_error);
187 fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
196 rmark(cursect, sloc, tdb, MLONG, NULL);
202 fixup(FU_LONG, sloc, aNexpr);
213 return error("unsupported 68020 addressing mode");
215 interror(3); // Bad addressing mode in ea gen
221 // Undefine dirty macros