X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=mach.c;h=e8a719bce782baef14c7775692ee96ee634b50be;hp=c3f6d83e11d4c3ade2aa60540820a13e094b2be9;hb=ff8188b7e279f99cf11ac8a283c4146af324d26f;hpb=05d0350b35a6a6b255cb2a3fab7796f5d4ee4d02 diff --git a/mach.c b/mach.c index c3f6d83..e8a719b 100644 --- a/mach.c +++ b/mach.c @@ -705,7 +705,7 @@ int m_bitop(WORD inst, WORD siz) int m_dbra(WORD inst, WORD siz) { - VALUE v; + uint32_t v; siz = siz; inst |= a0reg; @@ -822,10 +822,12 @@ int m_move(WORD inst, WORD size) int siz = (int)size; // Try to optimize to MOVEQ + // N.B.: We can get away with casting the uint64_t to a 32-bit value + // because it checks for a SIZL (i.e., a 32-bit value). if (CHECK_OPTS(OPT_MOVEL_MOVEQ) && (siz == SIZL) && (am0 == IMMED) && (am1 == DREG) && ((a0exattr & (TDB | DEFINED)) == DEFINED) - && (a0exval + 0x80 < 0x100)) + && ((uint32_t)a0exval + 0x80 < 0x100)) { m_moveq((WORD)0x7000, (WORD)0); @@ -969,7 +971,7 @@ int m_movep(WORD inst, WORD siz) // int m_br(WORD inst, WORD siz) { - VALUE v; + uint32_t v; if (a0exattr & DEFINED) { @@ -979,7 +981,7 @@ int m_br(WORD inst, WORD siz) return error(rel_error); //} - v = a0exval - (sloc + 2); + v = (uint32_t)a0exval - (sloc + 2); // Optimize branch instr. size if (siz == SIZN) @@ -1105,7 +1107,7 @@ int m_trap(WORD inst, WORD siz) // int m_movem(WORD inst, WORD siz) { - VALUE eval; + uint64_t eval; WORD i; WORD w; WORD rmask; @@ -1229,7 +1231,7 @@ int m_br30(WORD inst, WORD siz) if ((a0exattr & TDB) != cursect) return error(rel_error); - VALUE v = a0exval - (sloc + 2); + uint32_t v = a0exval - (sloc + 2); D_word(inst); D_long(v); @@ -1251,7 +1253,6 @@ int m_br30(WORD inst, WORD siz) // int m_bfop(WORD inst, WORD siz) { - if ((bfval1 > 31) || (bfval1 < 0)) return error("bfxxx offset: immediate value must be between 0 and 31"); @@ -1280,7 +1281,7 @@ int m_bfop(WORD inst, WORD siz) bfparam1 = bfval1 << 12; } - D_word((inst|am0|a0reg|am1|a1reg)); + D_word((inst | am0 | a0reg | am1 | a1reg)); ea0gen(siz); // Generate EA // Second instruction word - Dest register (if exists), Do, Offset, Dw, Width @@ -1628,7 +1629,7 @@ int m_cpbr(WORD inst, WORD siz) if ((a0exattr & TDB) != cursect) return error(rel_error); - VALUE v = a0exval - (sloc + 2); + uint32_t v = a0exval - (sloc + 2); // Optimize branch instr. size if (siz == SIZL) @@ -1682,7 +1683,7 @@ int m_cpdbr(WORD inst, WORD siz) { CHECK00; - VALUE v; + uint32_t v; WORD condition = inst & 0x1f; // Grab condition sneakily placed in the lower 5 bits of inst inst &= 0xffe0; // And then mask them out - you ain't seen me, roit? @@ -2182,14 +2183,14 @@ int m_pack(WORD inst, WORD siz) return error(undef_error); if (a0exval + 0x8000 > 0x10000) - return error(""); + return error(""); if (*tok != EOL) return error(extra_stuff); D_word((a0exval & 0xffff)); - + return OK; @@ -2575,7 +2576,7 @@ int m_pflush(WORD inst, WORD siz) // hardcoded in 68ktab but there is aliasing // between 68030 and 68040 opcode. So we just // set the 3 lower bits to 1 in pflushn inside - // 68ktab and detect it here. + // 68ktab and detect it here. inst = (inst & 0xff8) | 8; inst |= (tok[1] & 7) | (5 << 8); if (tok[3] != EOL) @@ -2651,7 +2652,7 @@ int m_pload(WORD inst, WORD siz, WORD extension) // a 68020 + 68551 socket and since this is // an Atari targetted assembler.... CHECKNO30; - + inst |= am1; D_word(inst); @@ -2684,7 +2685,7 @@ int m_pload(WORD inst, WORD siz, WORD extension) D_word(inst); ea1gen(siz); - + return OK; } @@ -3106,7 +3107,7 @@ int m_fdbcc(WORD inst, WORD siz) if ((a1exattr & TDB) != cursect) return error(rel_error); - VALUE v = a1exval - sloc; + uint32_t v = a1exval - sloc; if ((v + 0x8000) > 0x10000) return error(range_error);