Is the MorphOS SDK capable of compiling for the 68000 cpu?
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    ausPPC
    Posts: 543 from 2007/8/6
    From: Pending...
    This question is due to a 68k based Texas Instruments calculator program that I am trying to adapt to run on environments that are more familiar to me.

    The main problem I'm having is that it mixes 68k assembly into the C source file. While I'm confident enough to remove various TI system calls, the dependency on a 68k target has prevented me from being able to recompile my attempted modifications.

    Alternately, can vbcc handle mixed 68k assembly and C? If so, it doesn't seem to like the gcc method of doing this.

    This is the simplest example of a mixed source function from the program:

    Code:
    static inline unsigned long bswap32(unsigned long v) {
    asm("rol.w #8,%[dst]nt"
    "swap %[dst]nt"
    "rol.w #8,%[dst]"
    : [dst] "+d" (v)
    :
    : "cc");
    return v;
    }

    Clipboard01.jpg

    btw Why does the forum Code feature clobber indentation and backslashes?
    PPC assembly ain't so bad... ;)
  • »11.06.15 - 23:20
    Profile Visit Website
  • MorphOS Developer
    jacadcaps
    Posts: 3021 from 2003/3/5
    From: Canada
    MorphOS SDK does not contain a 68k target compiler. It won't compile any 68k asm.
  • »12.06.15 - 07:00
    Profile Visit Website
  • Butterfly
    Butterfly
    munk
    Posts: 94 from 2006/3/27
    Quote:

    ausPPC wrote:
    This question is due to a 68k based Texas Instruments calculator program that I am trying to adapt to run on environments that are more familiar to me.

    Inline asm is always processor dependent. You have to protect such code with appropriate checks.

    Quote:

    Alternately, can vbcc handle mixed 68k assembly and C? If so, it doesn't seem to like the gcc method of doing this.

    Yes, your snippet is GCC-style inline asm. VBCC uses a different approach.
  • »12.06.15 - 08:16
    Profile
  • MorphOS Developer
    itix
    Posts: 1520 from 2003/2/24
    From: Finland
    You can compile 68k assembly to object code and include this code as binary blob in your PPC native build. Or even in 68k native build if you want to. I did that to Scout and FileMaster long ago and I just called 68k code from PPC code using the built-in 68k emulator.

    However, inline asm is different case and in this case it would be better replace inline asm with native code. You find some useful macros from hardware/byteswap.h header file.

    So try to replace inline asm with native code. Perhaps use macros to conditionally use 68k inline asm or native code or MorphOS macros that do the same.
    1 + 1 = 3 with very large values of 1
  • »12.06.15 - 11:02
    Profile