1 ////////////////////////////////////////////////////////////////////////////////////////////////////
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
15 w = (WORD)(aNexattr & DEFINED);
16 tdb = (WORD)(aNexattr & TDB);
19 case DREG: // "Do nothing" - they're in the opword
28 break; // This is a performance hit, though
29 case ADISP: // expr(An)
30 if(w) { // Just deposit it
32 rmark(cursect, sloc, tdb, MWORD, NULL);
33 if(v + 0x8000 >= 0x18000)
34 return(error(range_error));
36 } else { // Arrange for fixup later on
37 fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
42 if(w) { // Just deposit it
43 if((aNexattr & TDB) == cursect)
45 else if((aNexattr & TDB) != ABS)
48 if(v + 0x8000 >= 0x10000)
49 return(error(range_error));
51 } else { // Arrange for fixup later on
52 fixup(FU_WORD|FU_SEXT|FU_PCREL, sloc, aNexpr);
57 w = (WORD)((aNixreg << 12) | aNixsiz); // Compute ixreg and size+scale
58 if(aNexattr & DEFINED) { // Deposit a byte...
60 return(error(abs_error)); // Can't mark bytes
62 return(error(range_error));
65 } else { // Fixup the byte later
66 fixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
71 w = (WORD)((aNixreg << 12) | aNixsiz); // Compute ixreg and size+scale
72 if(aNexattr & DEFINED) { // Deposit a byte...
73 if((aNexattr & TDB) == cursect)
75 else if((aNexattr & TDB) != ABS)
79 return(error(range_error));
82 } else { // Fixup the byte later
83 fixup(FU_WBYTE|FU_SEXT|FU_PCREL, sloc, aNexpr);
92 return(error("illegal byte-sized relative reference"));
93 if(v + 0x100 >= 0x200)
94 return(error(range_error));
97 fixup(FU_BYTE|FU_SEXT, sloc+1, aNexpr);
105 rmark(cursect, sloc, tdb, MWORD, NULL);
106 if(v + 0x10000 >= 0x20000)
107 return(error(range_error));
110 fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
117 rmark(cursect, sloc, tdb, MLONG, NULL);
120 fixup(FU_LONG, sloc, aNexpr);
125 interror(1); // IMMED size problem
131 rmark(cursect, sloc, tdb, MWORD, NULL);
132 if(v + 0x8000 >= 0x10000)
133 return(error(range_error));
136 fixup(FU_WORD|FU_SEXT, sloc, aNexpr);
143 rmark(cursect, sloc, tdb, MLONG, NULL);
146 fixup(FU_LONG, sloc, aNexpr);
156 return(error("unsupported 68020 addressing mode"));
158 interror(3); // Bad addressing mode in ea gen
164 // Undefine dirty macros