Click here to Skip to main content
15,881,744 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I am a novice C/C++ developer still in college. One of the topics that I would like to explore is the inline assembly that C language has. However, I have not been able to locate any resource (via google) that teaches me how to use inline assembly in the Turbo C IDE. I am using Turbo C as it is most familiar to me. I have not already learnt assembly via GASS as I am not familiar with the environment GNU/Linux provides for C. Please provide me with resources to learn assembly via TASM. I am an absolute novice in assembly and would like to learn the assembly for x86 processor family.
Posted

This question caught my eye. I think it is great that you are interested in exploring the low level universe of programming. It can be a frustrating experience, but when you get something working and you understand what you just did, it is a great feeling.

I used Turbo C many years ago when it was DOS based and later when it evolved into C++ Builder, but I have not followed the latest history. I just Googled a bit and it looks like they made a stripped down version of C++ Builder that they named Turbo C. I assume that is what you have.

I don't know what the latest version is or when it was released, but I suspect you might be limited in functionality. As far as I understand, Turbo C is no longer supported and it might not be able to handle the newer instruction sets introduced in modern CPUs. My advice would be to use a newer IDE if it is possible for you. I don't know if Visual Studio is ideal, but it is what I have used in the past.

I did find a couple of links to the old Turbo C stuff. Maybe that can help you out:
http://www.ic.unicamp.br/~celio/mc404/turboc201/embedded-asm.html[^]
https://sites.google.com/site/pratiktambe/assemblyandc[^]

If you instead want to try out Visual Studio, here are two CodeProject articles to get you started:
Using Inline Assembly in C/C++[^]
Inline Assembly in GCC Vs VC++[^]

I like the links given in Solution 1. Below are some of my old links, but since my inline assembly code was done a few years ago in order to optimize video compression code, the links might be a little advanced for you at this stage.
Paul Hsieh's Assembly Lab[^]
Assembly Gems[^]
Mark Larson: Assembly Optimization Tips[^]
Agner: Optimizing assembly code[^]

The last link (Agner) is one of those with advanced context, but I included it here because it is the reference for anyone looking into using assembly code for optimization purposes. Additionally, there is a great list of links at the bottom of that page.


All the best.
Soren Madsen
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 25-Mar-13 18:56pm    
5ed.
—SA
SoMad 25-Mar-13 20:22pm    
Thank you Sergey.

Soren Madsen
parths 26-Mar-13 3:17am    
Thanks for the excellent set of links. 5'ed!
SoMad 26-Mar-13 18:17pm    
You are welcome. If anyone find it useful, I am happy.

Soren Madsen
 
Share this answer
 
Comments
Member 9940953 25-Mar-13 13:36pm    
I have a small problem- the first link you linked to is for MASM which will be present in Visual C/C++ and the second one you linked to is related to A86 assembler. Neither of the links are related to TASM or Turbo Assembler. However, both are useful for me (and I'm definitely going to start reading the A86 reference) but neither allow me to inline the code in my Turbo C code. In TASM, the asm command doesn't have _ preceeding it. Its simple asm mov eax,#FFFF or asm mov eax,FFFFh
Style-7 25-Mar-13 14:18pm    
http://www.ic.unicamp.br/~celio/mc404/turboc201/embedded-asm.html

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900