Avatar of tacom8
tacom8
 asked on

adding asmbly to c code

hey there, this a lame question but how can i add a block of c code in borland C... i know asm whatever will add on line but how could i add like a block?

also are there any headers i should include for 8086 stuff so i can use my registers and what not


thanks for the help
C

Avatar of undefined
Last Comment
tacom8

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Exceter

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Exceter

Note: I do realize that those are not written directly in assembly language. :-)
akshayxx

here is small example on how do u do it with gnu c compiles gcc
__asm__ is used to make assembly calls

int foo( int a )
{
  int b = 10;

  a = 20;
  __asm__ ("mov %1, %0" : "=r"
   (a) : "r" (b) ); /* a = b */
  return a;
}

This  is simply copying b to a, and the return value is always 10.

and here is a link for inline assembly with gcc
http://www.tldp.org/HOWTO/Assembly-HOWTO/gcc.html
akshayxx

sorry ignore my comments.. as just now i noticed . u want this to be with borland C.. Sorry for bothering u ppl
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
tacom8

ASKER
hey thanks for the help fellas ill give it a shot later..
but it looks like it should do the trick