To Make Assembelly language program

V

VijayJaiswal

How can i make and execute assembelly language programes in c language.
I have not make a single assembelly program yet, so please give a small
example. Also mension all the instructions necessary, so that i can
make and execute assembely language programme on c compiler.
 
M

Malcolm

VijayJaiswal said:
How can i make and execute assembelly language programes in c language.
I have not make a single assembelly program yet, so please give a small
example. Also mension all the instructions necessary, so that i can
make and execute assembely language programme on c compiler.
Most C compilers provide an "asm" or __asm or similar keyword as an
extension.

However the details of how to use it are specific to your particular
compiler.
 
J

jacob navia

VijayJaiswal said:
How can i make and execute assembelly language programes in c language.

Your compiler's documentation tells you how to do it.
I have not make a single assembelly program yet, so please give a small
example.

Do your own homework. Since you say:

I have not make a single assembelly program yet

this means that you do not know at all assembly, i.e. you are a student
that should answer a homework question.

Also mension all the instructions necessary, so that i can
make and execute assembely language programme on c compiler.

You can't execute anything in the c compiler.
 
J

junky_fellow

How can i make and execute assembelly language programes in c language.
I have not make a single assembelly program yet, so please give a small
example. Also mension all the instructions necessary, so that i can
make and execute assembely language programme on c compiler.

why dont you start with some simple processor (like 8085). There are
a lots of good books available on 8085 architecture and its assembly
programming.
 
S

santosh

VijayJaiswal said:
How can i make and execute assembelly language programes in c language.
I have not make a single assembelly program yet, so please give a small
example. Also mension all the instructions necessary, so that i can
make and execute assembely language programme on c compiler.

If you don't know assembly yet, then learn it first. Until then stay
away from inline assembly. For x86 assembly, look at:

http://www.drpaulcarter.com/pcasm/
http://webster.cs.ucr.edu/
 
J

jacob navia

santosh said:
If you don't know assembly yet, then learn it first.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

EXACTLY!

"I do not know how to drive a car. Please tell me (with examples)
how can I win the F1 race so that I can impress my girlfriend"
 
C

Chris Thomasson

jacob navia said:
?????
What has THAT to do with the subject?

I do not understand the connection...

Humm. It shows you how to create C API from a assembly language library. It
shows how to use assembly from C.

Is that not helpful to you? It has full source code for the assembly and the
C.
 
M

Malcolm

santosh said:
If you don't know assembly yet, then learn it first. Until then stay
away from inline assembly. For x86 assembly, look at:
That's not necessarily good advice.
A C compiler will give you IO facilities that make it much easier to write a
trivial assembler routine. For instance, an assembly program to add two
numbers together is no good unless you can see the result.
 
S

santosh

Malcolm said:
That's not necessarily good advice.
A C compiler will give you IO facilities that make it much easier to write a
trivial assembler routine. For instance, an assembly program to add two
numbers together is no good unless you can see the result.

What prevents one from calling scanf() printf() etc. from within one's
assembly routines? Granted the ABI will tie you to a particular
implementation, but that's not a big deal when you're doing assembly to
start with.

Also, it's very simple to write small assembly subroutines to convert
string input to a value as well as the reverse, as long as you confine
yourself to integers. I myself did it within a couple of weeks of
starting on assembly. Also note that the authors of the assembly
programming books whose sites I mentioned in my previous post provide a
significant amount of premade library routines to do such common tasks
and provide them freely. So the problems you state aren't really there.

Typically inline assembly builds on pre-existing knowledge of assembly.
The OP has mentioned that he hasn't written a single assembler program
yet, which likely means that he knows no assembly. Hence my suggestion
to him to learn standalone assembly first before tackling the
complexities of a compiler's inline assembly feature.
 
J

Jack Klein

why dont you start with some simple processor (like 8085). There are
a lots of good books available on 8085 architecture and its assembly
programming.

I have no idea what your answer means. The OP did not mention a
processor, how did you know he isn't working on an 8085 platform to
begin with?

Is there some reason that you think that C somehow supports 8085
assembly language, even though it does not support any other
processor's assembly language?

Finally, I am fairly sure there are absolutely no manufacturers of the
8085 processor left today, making the idea a particularly futile one.
 
M

Malcolm

santosh said:
What prevents one from calling scanf() printf() etc. from within one's
assembly routines? Granted the ABI will tie you to a particular
implementation, but that's not a big deal when you're doing assembly to
start with.
You need an assembler that links to some sort of library, and to work out
the linking and calling convention. It's the way to go after you have got
things up and running, but if you are not clear on how to load a value into
the accumulator, it's quite a tall order to set up a call to printf() to
print it out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top