[comp.sys.atari.st] Fix for Sozobon assembler

mj@myrias.UUCP (Michal Jaegermann) (06/06/89)

   It was already reported here a number of times, in particular by
David Brooks, that 'btst' instruction with an immediate operand has
problems in a Sozobon jas assembler.  The assembler inserts into
produced machine code an extra word creating slight indigestion.  The
instruction does not seem to be produced by a Sozobon compiler so an
impact of this bug appears to be limited.  Still Dale Shumacher was
recently posting dLibs fixes.  Some of them were just skipping 'btst'
in assembler modules.
 
   I turns out that exactly the same problem affects not only
'btst', but also 'bchg', 'bclr' and 'bset'.  A reason for it seems
to be a simple typo in a file opcodes.h.  To fix it replace the
following lines from that file (they are NOT consecutive)
 
 {"bchg$s",     O_IMM,  O_DN,   S_L,    "x0o41%1e",     F_L },
 {"bclr$s",     O_IMM,  O_DN,   S_L,    "x0o42%1e",     F_L },
 {"bset$s",     O_IMM,  O_DN,   S_L,    "x0o43%1e",     F_L },
 {"btst$s",     O_IMM,  O_DN,   S_L,    "x0o40%1e",     F_L },
 
respectively with
 
 {"bchg$s",     O_IMM,  O_DN,   S_W,    "x0o41%1e",     F_W },
 {"bclr$s",     O_IMM,  O_DN,   S_W,    "x0o42%1e",     F_W },
 {"bset$s",     O_IMM,  O_DN,   S_W,    "x0o43%1e",     F_W },
 {"btst$s",     O_IMM,  O_DN,   S_W,    "x0o40%1e",     F_W },
 
Recompile jas.ttp (makefile supplied with a source) and the bug is gone.
 
   I cannot guarantee 100% that this fix does not have any nasty side
effects.  The author seems to be from school "If it was hard to write
it should be hard to understand" :-( and comments in sources are
rather sparse.  Hence it is hard to be sure that everything is OK.  My
limited testing so far did not uncovered any surprises.  If you will
find one - please tell us all.
 
    Just to keep things in order - here is an excerpt from a header:
/*
 * Copyright (c) 1988 by Sozobon, Limited.  Author: Joseph M Treat
 *
 * 2) Modified versions must be clearly marked as such.
 *
 */
So mark your fixed version accordingly! 
================================================================
Michal Jaegermann
Myrias Research Corporation
Edmonton, Alberta, CANADA
...{ncc, alberta}!myrias!mj
================================================================
P.S.  I did not check other addressing modes, so I do not know if they
work correctly.  From the way things look it appears that they should.
Anybody with 68000 assembler test suite on hand? 

kbad@atari.UUCP (Ken Badertscher) (06/08/89)

In article <1242@myrias.UUCP> mj@myrias.UUCP (Michal Jaegermann) writes:
| P.S.  I did not check other addressing modes, so I do not know if they
| work correctly.  From the way things look it appears that they should.
| Anybody with 68000 assembler test suite on hand? 


The distribution disk with MADMAC (Atari's macro assembler) includes
a file called CODE.S which contains all the combinations of opcode
and addressing mode that the 68000 can handle.  Unfortunately, since
it's part of the developer package we can't post it to the net.


-- 
   |||   Ken Badertscher  (ames!atari!kbad)
   |||   Atari R&D System Software Engine
  / | \  #include <disclaimer>