Fixed bug: some offsets were just plain wrong

This commit is contained in:
ceriel 1993-02-08 13:35:44 +00:00
parent 468d98750c
commit 6da226ab2b
3 changed files with 29 additions and 5 deletions

View file

@ -42,6 +42,7 @@ extern expr_t exp_1,exp_2;
extern valu_t rel_1,rel_2; extern valu_t rel_1,rel_2;
#endif #endif
extern int model; /* 68000/68010 */ extern int model; /* 68000/68010 */
extern int curr_instr;
/* addressing mode bits */ /* addressing mode bits */
#define DTA 0x01 #define DTA 0x01

View file

@ -9,6 +9,11 @@
*/ */
operation operation
: { curr_instr = curr_token; }
_operation
;
_operation
: bcdx DREG ',' DREG : bcdx DREG ',' DREG
{ emit2($1 | $2 | $4<<9);} { emit2($1 | $2 | $4<<9);}
| bcdx '-' '(' AREG ')' ',' '-' '(' AREG ')' | bcdx '-' '(' AREG ')' ',' '-' '(' AREG ')'

View file

@ -8,6 +8,23 @@
* Motorola 68000/68010 auxiliary functions * 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) ea_1(sz, bits)
{ {
register flag; register flag;
@ -376,7 +393,7 @@ ea5x73(rg, sz)
/* pc relative with index */ /* pc relative with index */
if (sz == SIZE_NON) if (sz == SIZE_NON)
sz = SIZE_DEF; sz = SIZE_DEF;
exp_2.val -= (DOTVAL + 2); exp_2.val -= (DOTVAL + extension_offset());
mrg_2 = 073; mrg_2 = 073;
checksize(sz, 2|4); checksize(sz, 2|4);
index(rg<<12 | (sz&0200)<<4); index(rg<<12 | (sz&0200)<<4);
@ -416,10 +433,11 @@ ea707172(sz)
return; return;
} }
if ((exp_2.typ & ~S_DOT) == DOTTYP) { 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); sm = small(sm, 2);
if (sm) { /* pc relative */ if (sm) { /* pc relative */
exp_2.val -= (DOTVAL+2); exp_2.val -= (DOTVAL+off);
mrg_2 = 072; mrg_2 = 072;
} }
} else { } else {
@ -447,13 +465,13 @@ ea6x(rg, ir, sz)
ea72() ea72()
{ {
mrg_2 = 072; mrg_2 = 072;
exp_2.val -= (DOTVAL + 2); exp_2.val -= (DOTVAL + extension_offset());
} }
ea73(ri, sz) ea73(ri, sz)
{ {
mrg_2 = 073; mrg_2 = 073;
exp_2.val -= (DOTVAL + 2); exp_2.val -= (DOTVAL + extension_offset());
checksize(sz, 2|4); checksize(sz, 2|4);
index(ri<<12 | (sz&0200)<<4); index(ri<<12 | (sz&0200)<<4);
} }