[comp.sys.amiga] Bug in Lattice C 4.01

gay%elde.epfl.ch@cunyvm.cuny.edu (David Gay) (08/01/88)

I recently found a bug in Lattice C 4.01 (both patches), in the 16-bit
library routine movmem (well, actually there were 2 bugs !). Here is a
correct version:

        CSECT   text
        XDEF    _movmem

_movmem MOVEA.L 4(A7),A0
        MOVEA.L 8(A7),A1
        MOVE.W  12(A7),D0
        BLE     exit
        CMPA.L  A0,A1
        BCS     upwards

        ADDA.W  D0,A0           The old version had ADDA.L ...
        ADDA.W  D0,A1
        SUBQ.W  #1,D0
lpdown  MOVE.B  -(A0),-(A1)
        DBRA    D0,lpdown
        RTS

upwards SUBQ.W  #1,D0           This line was missing
loopup  MOVE.B  (A0)+,(A1)+
        DBRA    D0,loopup
exit    RTS

        END

To