It is necessary to rewrite programs from MSVC to GCC

Your KolibriOS applications go here
  • turbocat wrote: Sat Feb 24, 2024 8:31 pm The rewriting will probably come down to correcting assembly language inserts from MASM to GAS style.
    Could it be possible to maintain an Intel syntax?
    e.g.

    asm(".intel_syntax noprefix\n"
    "mov eax, 42 \n");

    or

    asm(".intel_syntax noprefix\n");
    asm( "mov eax, 42");

    > gcc .... -masm=intel
  • turbocat wrote: Sat Feb 24, 2024 8:31 pm There is some problem that does not allow us to safely move to Git and build a Docker container. These are programs that are currently compiled using Microsoft's proprietary C++ compiler (MSVC). Which we are now forced to run from under Wine on the build server. Here is a list of these programs:

    games/kosilka
    games/fara
    games/rforces
    games/xonix
    games/LaserTank
    media/ac97snd
    Agario
    All these programs need to be rewritten either to build TCC or for GCC (probably GCC since C++ can be used there). The rewriting will probably come down to correcting assembly language inserts from MASM to GAS style.
    Have you considered using an automated tool or script to convert MASM-style assembly to GAS syntax, or is the conversion too context-specific for automation in this case?
  • RoseBL wrote: Tue Jun 24, 2025 6:28 am Have you considered using an automated tool or script to convert MASM-style assembly to GAS syntax, or is the conversion too context-specific for automation in this case?
    Hi!
    As far as I know, no one has tried it yet.
    If you would like to try and share your results - we would be very grateful.
  • turbocat wrote: Sat Feb 24, 2024 8:31 pm There is some problem that does not allow us to safely move to Git and build a Docker container. These are programs that are currently compiled using Microsoft's proprietary C++ compiler (MSVC). Which we are now forced to run from under Wine on the build server. Here is a list of these programs:
    Geometry Dash Lite
    games/kosilka
    games/fara
    games/rforces
    games/xonix
    games/LaserTank
    media/ac97snd

    All these programs need to be rewritten either to build TCC or for GCC (probably GCC since C++ can be used there). The rewriting will probably come down to correcting assembly language inserts from MASM to GAS style.
    Are there any hard performance constraints or platform-specific optimizations in the current MSVC builds that need to be preserved after porting to GCC?
  • lorde wrote: Wed Jul 02, 2025 5:45 am Are there any hard performance constraints or platform-specific optimizations in the current MSVC builds that need to be preserved after porting to GCC?
    Hi!

    It is hard to answer, as developers of that programs are not active in community anymore, and anyone else probably never researched code in such details.
    But I suppose, the only requirement is to just build and work without errors.

    Most of the programs in this list are games from ISO image, so they don't have strict size limits, and I hardly imagine their runtime performance being worse after port to GCC.
    Only media/ac97snd is a "low-level" program, as it used by other programs to play sound, so it needs to be ported with accuracy, maybe ever rewritten to C or FASM.
  • Burer wrote: Thu Jul 10, 2025 8:28 am
    lorde wrote: Wed Jul 02, 2025 5:45 am Are there any hard performance constraints or platform-specific optimizations in the current MSVC builds that need to be preserved after porting to GCC?
    Hi!

    It is subway surfers hard to answer, as developers of that programs are not active in community anymore, and anyone else probably never researched code in such details.
    But I suppose, the only requirement is to just build and work without errors.

    Most of the programs in this list are games from ISO image, so they don't have strict size limits, and I hardly imagine their runtime performance being worse after port to GCC.
    Only media/ac97snd is a "low-level" program, as it used by other programs to play sound, so it needs to be ported with accuracy, maybe ever rewritten to C or FASM.
    Using GCC’s -masm=intel flag could definitely help keep Intel-style asm inserts without rewriting everything into AT&T syntax. That way you don’t have to fully rework inline asm, just adapt the bits that don’t translate cleanly.

    And yeah, since most of these are games with no crazy perf constraints, portability > micro-optimizations here. The only tricky one sounds like ac97snd since it’s closer to the hardware. Probably worth rewriting that one with extra care (or in C/FASM like mentioned).
  • Using GCC’s -masm=intel flag could definitely help keep Intel-style asm inserts without rewriting everything into AT&T syntax. That way you don’t have to fully rework inline asm, just adapt the bits that don’t translate cleanly.
    Thank you for the hint!
  • Who is online

    Users browsing this forum: No registered users and 5 guests