From: ceriel Date: Mon, 8 Feb 1993 13:35:44 +0000 (+0000) Subject: Fixed bug: some offsets were just plain wrong X-Git-Tag: release-5-5~344 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=6da226ab2b80fcee48687c87d17abc44771e8f7b;p=ack.git Fixed bug: some offsets were just plain wrong --- diff --git a/mach/m68k2/as/mach1.c b/mach/m68k2/as/mach1.c index 88acece95..0660aff2c 100644 --- a/mach/m68k2/as/mach1.c +++ b/mach/m68k2/as/mach1.c @@ -42,6 +42,7 @@ extern expr_t exp_1,exp_2; extern valu_t rel_1,rel_2; #endif extern int model; /* 68000/68010 */ +extern int curr_instr; /* addressing mode bits */ #define DTA 0x01 diff --git a/mach/m68k2/as/mach4.c b/mach/m68k2/as/mach4.c index 9d47a9675..114b6b76d 100644 --- a/mach/m68k2/as/mach4.c +++ b/mach/m68k2/as/mach4.c @@ -9,6 +9,11 @@ */ operation + : { curr_instr = curr_token; } + _operation + ; + +_operation : bcdx DREG ',' DREG { emit2($1 | $2 | $4<<9);} | bcdx '-' '(' AREG ')' ',' '-' '(' AREG ')' diff --git a/mach/m68k2/as/mach5.c b/mach/m68k2/as/mach5.c index 268319063..63c5450fd 100644 --- a/mach/m68k2/as/mach5.c +++ b/mach/m68k2/as/mach5.c @@ -8,6 +8,23 @@ * Motorola 68000/68010 auxiliary functions */ +static int +extension_offset() +{ + switch(curr_instr) { + case MOVEM: + case FMOVE: + case FMOVEM: + case FDYADIC: + case FMONADIC: + case FSINCOS: + case FSCC: + case FTST: + return 4; + } + return 2; +} + ea_1(sz, bits) { register flag; @@ -376,7 +393,7 @@ ea5x73(rg, sz) /* pc relative with index */ if (sz == SIZE_NON) sz = SIZE_DEF; - exp_2.val -= (DOTVAL + 2); + exp_2.val -= (DOTVAL + extension_offset()); mrg_2 = 073; checksize(sz, 2|4); index(rg<<12 | (sz&0200)<<4); @@ -416,10 +433,11 @@ ea707172(sz) return; } if ((exp_2.typ & ~S_DOT) == DOTTYP) { - sm = fitw(exp_2.val-(DOTVAL+2)); + int off = extension_offset(); + sm = fitw(exp_2.val-(DOTVAL+off)); sm = small(sm, 2); if (sm) { /* pc relative */ - exp_2.val -= (DOTVAL+2); + exp_2.val -= (DOTVAL+off); mrg_2 = 072; } } else { @@ -447,13 +465,13 @@ ea6x(rg, ir, sz) ea72() { mrg_2 = 072; - exp_2.val -= (DOTVAL + 2); + exp_2.val -= (DOTVAL + extension_offset()); } ea73(ri, sz) { mrg_2 = 073; - exp_2.val -= (DOTVAL + 2); + exp_2.val -= (DOTVAL + extension_offset()); checksize(sz, 2|4); index(ri<<12 | (sz&0200)<<4); }