Ya matsp i want to write a inline assembly block which starts from __asm or something like that
can you please help me now?and suggest me which compiler should i use?and also where link me to few sites which implements assembly in C??
Ya matsp i want to write a inline assembly block which starts from __asm or something like that
can you please help me now?and suggest me which compiler should i use?and also where link me to few sites which implements assembly in C??
Well, it's not helping that you are using an old compiler, but google found this:
http://www.gamedev.net/community/for...21&gforum_id=0
along with many other hits.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Do we have to include any header files?for that?
Not inline assembly, no (not for Visual Studio anyway, but I doubt you have to for any other compiler either).
But Turbo C is a very old compiler and a bad one too. It may have been good in its time, but now it's time to close the lid and move on.
You need a compiler which supports "smart" assembly code, meaning the asm syntax gives you a way to refer to variables and function parameters. Otherwise you are going to have to manually calculate offsets from the base pointer, and your code will break every time you change something.
Also, writing inline assembly can often lead to slower code, unintuitive as it sounds. Inline assembly code forces the compiler to dump its registers to memory because the asm code you write changes the values of the registers. Thus the compiler can't cache values in registers across your asm block. This often leads to inner loops which are actually slower than if you'd just let the compiler handle it.
You really should be using assembler ONLY to access system features which can't be accessed with C code. Ideally, write the assembly routines in their own source file and link the C code against it, instead of just dropping instructions inline.
Turbo C worked great and still does. All that's wrong with it is that it's 16-bit real mode. But this is not a downside if you WANT 16-bit real mode code.
In my spare time I hack on my own operating system. The stage2 boot loader is written in 16-bit C which I compile using Turbo C. Best tool for the job. Without it, I'd be stuck writing the boot loader in straight assembly, which believe me, sucks bad.
Oh thanks brewbuck it means i dont have to change any compiler right??
Well 16 bit is too much, maybe we should go back to straightforward 8-bit coding. Now we would never care about integral sizes any more! Much better and imagine the portability
In fact high level instructions are just confusing most of the time. A lot of time spent to ponder is my syntax ok here? Since the computational capability of a minimal set of instructions is enough, i believe we should all revert to brain........ :P
A typical example of ...cheap programming practices.Code:... goto johny_walker_red_label; johny_walker_blue_label: exit(-149$); johny_walker_red_label : exit( -22$);
Hey you are right !xuftugulus thanks man yo man yo!!
but from where to get a 8 bit compiler?can you suggest me the links?
You could always try google: http://www.google.ca/search?q=8-bit+c+compiler
I see there's a GPL one called anyc.
But I'm not sure if you really want to be using an 8-bit C compiler or not . . . .
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.