Author Topic: anyone did inline asm and compiled with turbo c compiler?  (Read 1953 times)

ggmasm32

  • Member
  • **
  • Posts: 51
anyone did inline asm and compiled with turbo c compiler?
« 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
};

jj2007

  • Member
  • *****
  • Posts: 7760
  • Assembler is fun ;-)
    • MasmBasic
Re: anyone did inline asm and compiled with turbo c compiler?
« Reply #1 on: December 19, 2015, 07:01:06 AM »
Why don't you try Pelles C? A great free compiler, and surely supports Masm32 syntax.

ACP

  • Regular Member
  • *
  • Posts: 10
Re: anyone did inline asm and compiled with turbo c compiler?
« Reply #2 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
}
ASM beyond Repair https://corexor.wordpress.com blog about assembly related stuff

BlueMR2

  • Member
  • **
  • Posts: 115
Re: anyone did inline asm and compiled with turbo c compiler?
« Reply #3 on: December 22, 2015, 04:27:13 AM »
It's been forever since I've done that, but ACP's examples look about right.  :-)

caballero

  • Member
  • ****
  • Posts: 785
    • Abre Ojos Ensamblador
Re: anyone did inline asm and compiled with turbo c compiler?
« Reply #4 on: December 22, 2015, 05:05:51 AM »
En un lugar de la Mancha de cuyo nombre no quiero acordarme

BlueMR2

  • Member
  • **
  • Posts: 115
Re: anyone did inline asm and compiled with turbo c compiler?
« Reply #5 on: December 23, 2015, 12:42:59 AM »
Some examples

FYI, that page is blocked by my AV vendor as being compromised.

caballero

  • Member
  • ****
  • Posts: 785
    • Abre Ojos Ensamblador
Re: anyone did inline asm and compiled with turbo c compiler?
« Reply #6 on: December 23, 2015, 02:18:24 AM »
Ooops, in that case, you won't have a look to that   :P
En un lugar de la Mancha de cuyo nombre no quiero acordarme