Is anybody up for getting a project together that converts C/C++ source to ASM source?

I'm tired of time-consuming conversion! :)
Posted on 2001-09-28 07:25:22 by gscundiff
Isn't that exactly what a disassembler does?

If you use an advanced disassembler (IDA perhaps), I think you can use the generated asm code almost directly in your assembler.

Posted on 2001-09-28 08:05:14 by Delight
Yep, that is so. I do use dissassembly of a program if I have the executable.

However, I was referring to conversion of C/C++ -sources- to .asm source where only the source is available.

One can find lots of interesting sources in C/C++ and you have to hand convert them to .asm which means learning and understanding "THAT LANGUAGE" completely, which I don't want to do..I'm an old 6510/68000 machine code/assembler guy trying to get back into programming assembler on WIN32 and I have enough trouble with that let alone trying to learn/understand another couple of different languages at the same time! I would have gone the Visual C++ route if I wanted to learn C.

Nah, I think it's absurd that ML people have to learn C (aside from picking up techniques you learn while converting), and if you ask me this modern Win32 Assembler is rapidly approaching C anyway...

Geez, want some cheese with that whine ??

Sorry :mad:

I've seen some MASM to C++ converters out there, just thought a C++ to MASM converter would benefit the Win32asm community a lot. Ya know, it might even get those C/C++ people more interested in Assembler !
Posted on 2001-09-28 08:35:05 by gscundiff
And here we have the great assembly code writers who always
whine about how they can always outperform compilers... and now
they want automated tools to convert C->asm? :grin: .

Ok, sorry, that sounded a bit harsh. Such a tool already exists.
Use the commandline switch to (whatever) C compiler to generate
asm output, and voila! You have asm source. I just can't see any
good reason to do this. First of all, you can just compile the C source
and link any asm of your own against it, without having to understand
anything at all.

And if you really want speed, which should be the reason you are
programmign in assembly?:confused: , you're better off doing the
conversion yourself... unless you fear you can't beat an automated tool :grin:
Posted on 2001-09-28 09:16:40 by f0dder
Hi !

Well, fodder gets the point .. ;)

But nevertheless a tool which will convert the structures, enums, defines and the conditional defines and perhabs the interfaces, too, will help us a lot ! It is a hard work to translate a c++-includefile of 250k by hand as I did for the DX8-Stuff !!!

(Well of course I have started a project in delphi which should do this task, but I have let it fall because of a leck of a usefull c++ - parser. (I have not enought time to create one by myself ... and what I have written needs too much memory and time ...))

Greetings, CALEB
Posted on 2001-09-28 15:05:34 by Caleb

Speed is just one of the factors I program for, tight and efficient code would be the other two, and striking a comfortable balance between the three would be my desired result. You're right about wanting speed, but don't forget efficiency...which brings me to the reason I started this thread...

**Dreamy harp music swirls**
If I have a manuscript written in Spanish, and my native (and only) language is English, why should I take the extended time to learn the Spanish language in order to translate it into English so I can understand it? But (I know...I know, I would pick up the beauty of the Spanish language and learn a lot of its' nuances that don't easily translate..etc,etc) wouldn't it be faster and a more efficient use of my time to just have it translated into English and jump right in?
**Dreamy harp music is interrupted by blaring truck horn**

OK, ok, it's still a conversion, but it's quick - I don't have to own and learn to operate a C compiler package - and I didn't waste two years of my life learning a language I don't want to or need to understand in order to put an assembly program together. It's bad enough having to work with kludgy API's, let alone tacking on assembler to some C program. And I can't tell you how many hours I've wasted trying to translate C into assembler getting hung up on some little syntax thing that I didn't understand. I know that if I went to all the trouble of downloading the free Borland C++ builder and learning to use it to compile the C source, then running it through a dissassembler and on and on and on...nope, that's not the efficient assembler programmer way.

->Just an aside here:
Yes, I am old enough to have been a machine coder and then an assembler. At the time when C became the rage my music career took me away from programming for a couple of decades. I've retired myself from music now and I find that I want to slip back into programming only to see that "professional programmers" nowadays use Visual Basic/Visual C++ for all their work. This disgusts me to no end...until I find Win32asm. It's a compromise between true assembler and the more modern over-bloated platforms in use today. At least that's something I can compromise my integrity for. So here I am, jumping back into assembler even at the expense of having to put up with API's and C++ like programming. I've run across many fine tutorials and example programs in Win32asm, and crave many, many more.

I appreciate and applaud your diversity in that you obviously learned C and Assembler and speak (at the least) both of those languages. It would certainly be easier for the likes of me to have that ability, but alas, I don't yet have the desire to learn C. However, if that is the concensus - that you need to learn and understand C in order to program assembler - then I'll have to rethink putting my time and effort into Win32asm.

And in answer...a general purpose compiler will NEVER beat a hand-wound Tulsa Tightwind!



fOdder can have -all- the points!

I appreciate your insight in recognizing that this would be a useful project and the fact that you started working on one. I can understand not having enough time to pursue all that you want. And that's my point here, just trying to make more efficient use of learning time.


To Everyone Else:

Sorry for the direction this thread has turned, which would be more appropriate for THE CRUSADES thread at this point.
Posted on 2001-09-28 16:33:35 by gscundiff

For all of the hoo hah about optimising compilers, the main win with VC is that you can produce an assembler listing with it. They are usually no real joy to work with and they usually need a lot of cleaning up but they can be useful to get the basic architecture for an algorithm which you can then rewrite in a clean and tidy way.

With your background in REAL code :) this is not as ugly as it may appear but like normal, once you have been writing this stuff for years, rewriting it into "assembler" rather than a compiler listing is a viable proposition which often has very good results.

It also has a lot to do with how well written the C++ is in the first place, I have just ported an old sorting algorithm that a friend wrote in C++ and his code was so tidy that it converted to masm with no big deal, especially as I was more or less brain dead at the time.

Usually the more "sophisticated" the source is, the harder it is to convert as you have to pull apart the torturous logic of current compilers to make sense of it.

Posted on 2001-09-29 20:14:33 by hutch--
I understand what your saying, and what you
want, but I don't think anyone here has that
talent, I could write a program that would at
lease put the code into your grasp, but I don't
think that such a tool would be worth the effort.

Most of the assembly programmers today code
just for a hobby, they are not into really making
tools that but assembly back into the main stream.

I once thought that it was comming back alive, just
to find out that I was really dreaming. and the fact
that you are from the USA, will surly be your down fall.

You see, to write something like what you want would
take awhile, and could be done, but it's not worth it.
Why?? well I spent about 6 Months on a Visual Designer
that was something like VB, I never finished it when I
found that my efforts was not good enough.

So I quit the project, Couse I know that if I did finish
it, people would use it and they would be the same
people that would not lend a hand to help support
the project. this is why a porogram that you suggest
would not be Worth the effort, it's kinda like working
hard, but you get nothing in return.

mostly if I was from my home land, French as I am
I would have gotton more support, but I am from the USA
and this is my down fall on this forum.

To be honest I am finishing MVD, but it will not
be available for free, as I soon will not own it.
So, it goes from open source to commercial
software. this buts it out of my hands.

Posted on 2002-11-12 21:49:39 by Zcoder
You are basically talking about a high-level assembly language, using C/C++ as the source.

VC can output assembly listings form C/C++, but it ain't pretty.
Posted on 2002-11-12 23:02:36 by ThoughtCriminal
at least my borland c++ compiler has the option 'compile via assembler', so i get the whole program in an asm-file too. but it's a turbo-assembler (awful syntax), i can't stand it and dont use it. but maybe you VC++ compiler has it too.
Posted on 2002-11-13 12:37:39 by hartyl
maybe i have misunderstood what you want as i havent really read the whole thread but as far as i get it isnt what you really want is a sort of compiler?
I mean thats what a compiler basically does, parses the source, builds a symbol table, put it in a syntax tree and convert it to asm source.
Posted on 2002-11-14 04:18:10 by clippy

**Dreamy harp music swirls**
If I have a manuscript written in Spanish, and my native (and only) language is English, why should I take the extended time to learn the Spanish language in order to translate it into English so I can understand it? But (I know...I know, I would pick up the beauty of the Spanish language and learn a lot of its' nuances that don't easily translate..etc,etc) wouldn't it be faster and a more efficient use of my time to just have it translated into English and jump right in?
**Dreamy harp music is interrupted by blaring truck horn**

So you are conversant in Assembly but NOT in C.... and you have a C source you need to understand? And you don't want to have to learn C, ne?

You seem rather rare... but no, IMO pure Asm doesn't need learning C... it just so happens that A LOT of documentation is written for C programmers. MSDN's docs, for instance, almost all assume that you are programming in C, maybe in C++. Because most of MS's docs are all written for C programmers, and Windows is an MS product... and Win32Asm is programming for Windows in assembly... well you know who to blame now.... :grin:

As an aside, I think you CAN find Win32 stuff targeted specifically to ASM programmers on the web pages of some of the board members.
Posted on 2002-11-15 02:52:32 by AmkG
Many thanks to all the replies here...and many miles since the thread was originally started. More than a year later of working off of the Win32API and M$ SDK documentation, I find C to be much more easily understood than I did then. I guess I found that I didn't have to own/understand/operate a C programming package to understand the language, and it really wasn't as painful as I first envisioned. There's a slight learning curve to climb when you've dropped out for so long, but perseverance and dogged determination through trial and error are virtues which still serve me well, although they often do not take me down the shortest path...but then again, there are so many wonderful things to discover along the journey!
Posted on 2002-11-15 08:03:49 by gscundiff