Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#388 M68K/BCPL: compch/charicmp returns wrong value

m68k-amiga
closed-fixed
nobody
Shell/DOS (109)
5
2012-03-01
2012-02-29
Mark K
No

The AROS version of BCPL compch at GV offset $130 (called charicmp in the AROS source) returns a value with the wrong sign.

The Kickstart implementation of compch subtracts the two arguments: retval = uppercase(char1) - uppercase(char2). The result is negative if 1st arg earlier than the second, positive if 1st arg is later. However the current AROS code returns the opposite: retval = uppercase(char2) - uppercase(char1).

To fix that, replace the instruction before BRTS in charicmp with this:
2: sub.l %d0,%d1
move.l %d1,%d0 ;Because BRTS moves d0 to d1
BRTS

Discussion

  • Toni Wilen
    Toni Wilen
    2012-03-01

    • status: open --> closed-fixed