Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Assembly and C

Assembly and C

Assembly and C

I am working on creating my own operating system and
I've written it all in Assembly so far and for debugging
reasons I want to rewrite some of it in C. The problem
is that I'm not very experienced with C and I need to
be able to link my assembly code with my C code in
a way that allows me to share variables. I'm not
familiar with GAS format so simply using this in the C
code is out of the question.

Does anyone have any suggestions? Tutorials?


RE: Assembly and C

When you are doing a project in C,just use:

    /*here you insert your code in assembler*/
you will be able to use all the variable you declared in that block,just make sure the size of operands coincide.

Best Regards,

aphrodita@mail.krovatka.ru     {uiuc rules}

RE: Assembly and C

 Really nice to know that u have done it all in assembly.
I too started writing that way, (coz i was scared at GCC,
inline assemly..)
 But now i have moved all my code to c and "assmebly".

I would rather advice u to port ur code to "C"..(provided
u r in the begining stage...) That would help u a lot.

Write "C" code, compile and link it to a binary 32-bit
image, ( U have linker scripts , which help u
to relocate code to any address..For exp, if u want to
have ur kernel addresses start from C0000000h, u can tell
"ld" via linker scripts..its so flexible..Try "info ld" in

Write bootsector in assembly, load the kernel and pass
control to it..Since "C" code is pure 32-bit, u need to be
in PM b4 jumping into "C" code.
All the best

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close