The MASM Forum

Miscellaneous => 16 bit DOS Programming => Topic started by: ggmasm32 on December 19, 2015, 06:04:13 AM

Title: anyone did inline asm and compiled with turbo c compiler?
Post by: ggmasm32 on December 19, 2015, 06:04:13 AM
because of the earlier requirement I posted here ( mixing c and asm) now I need to compile all my C files with tcc.
I currently have installed turbo C4 installed in my system.
I needed to put some inline assembly code at the same time and did several attempts after looking around online through mostly masm from msdn.

tried following variants, so far none of them works, so I am wondering if anyone has done in the past did this?
Does TCC support compiling inline asm code in C file? If so are syntax different than VS?

__asm__
(
    push eax
    pop  eax
);

__asm
{
    push eax
    pop  eax
};
Title: Re: anyone did inline asm and compiled with turbo c compiler?
Post by: jj2007 on December 19, 2015, 07:01:06 AM
Why don't you try Pelles C (http://forum.pellesc.de/index.php?action=unread)? A great free compiler, and surely supports Masm32 syntax.
Title: Re: anyone did inline asm and compiled with turbo c compiler?
Post by: ACP on December 19, 2015, 08:40:52 AM
In Borland C++ or Turbo C you can use following syntax for short number of instrucitons:

Code: [Select]
asm mov ah,9
asm mov dx, offset msg
asm int 21h

For longer code it is better to use:

Code: [Select]
asm {
        mov ah,9
        mov dx, offset msg
        int 21h
}

You can also use semicolon to place multiple assembly language instruction in one line:

Code: [Select]
asm {
        push ax; push dx
        mov ah,9
        mov dx, offset msg
        int 21h
       pop dx; pop ax
}
Title: Re: anyone did inline asm and compiled with turbo c compiler?
Post by: BlueMR2 on December 22, 2015, 04:27:13 AM
It's been forever since I've done that, but ACP's examples look about right.  :-)
Title: Re: anyone did inline asm and compiled with turbo c compiler?
Post by: caballero on December 22, 2015, 05:05:51 AM
Some examples (http://www.abreojosensamblador.net/Productos/AOE/html/Pags_en/Chap19.html#Ce)
Title: Re: anyone did inline asm and compiled with turbo c compiler?
Post by: BlueMR2 on December 23, 2015, 12:42:59 AM
Some examples (http://www.abreojosensamblador.net/Productos/AOE/html/Pags_en/Chap19.html#Ce)

FYI, that page is blocked by my AV vendor as being compromised.
Title: Re: anyone did inline asm and compiled with turbo c compiler?
Post by: caballero on December 23, 2015, 02:18:24 AM
Ooops, in that case, you won't have a look to that   :P