Hi everyone

Is it possible to generate a asm file from a delphi pas file? (similar to the -S witch from c++ builder compiler)
the delphi compiler from delphi 6 does not support that feature.
any tricks
Posted on 2005-04-06 17:08:06 by SADE
You could always disassemble the output exe (or the .obj, can't remember if delphi creates those). There's freeware versions of IDA available at...

http://www.themel.com/ida.html
http://www.simtel.com/product.php?id=27629 (ida37fw.zip, 3.7)
http://www.simtel.com/product.php?id=29498 (idafre41.zip, 4.1)
Posted on 2005-04-06 17:26:07 by f0dder
Hi f0dder,

Yes I can disassemble the output exe, but my idea is to ouput an asm file and then be able to assemble the asm file using TASM or a different assembler.

Posted on 2005-04-06 21:51:18 by SADE
Hi,
That will be difficult. These disasemblers don't exactly produce code that can be assembled by another assembler. Just recreate the things you do in that source file in ASM after learing ASM
:P

Thomas :P
Posted on 2005-04-08 10:23:58 by thomasantony
I was talking about the delphi compiler producing an asm (tasm) file not a disassembler ;)
I emailed the same question to one of the Delphi creators and he emailed me back saying that the feature wont be added.

Emitting ASM code could be done, no doubt about that, but there just isn't
much justification to put effort into that instead of working on language
features or new optimizations.
Posted on 2005-04-09 00:08:09 by SADE
I don't know much about pascal but I do know that it doesn't produce that good code. It will be great if you learn a more powerful language
like; C, C++ and PowerBasic ask Hutch inline asm. But if you don't have time then good luck, maybe a google search. Borland's package you're
able to download with FREE Tasm.
Posted on 2005-04-09 23:01:38 by Xor Stance
I am using MASM and Delphi for my projects right now.
thanks.
Posted on 2005-04-09 23:58:23 by SADE
Even Delphi has better code generation than PowerBASIC, and the language is more powerful... quite sad, really, since Delphi isn't exactly known for good code generation.
Posted on 2005-04-10 06:30:28 by f0dder
I didn't knew that because, in school I had use Turbo Pascal then I thought that it wasn't that powerful enough butI heard about Delphi
years ago, but I never ever mess with it. I thought it was like the Turbo Pascal.

I prefer as for me like; HLA, C/C++. I came to love the syntax off it. It's Java a good language? My friend from Canada told me that he uses
Java but the performance to handle large apps it's ok.
Posted on 2005-04-10 10:35:50 by Xor Stance
I started programming with Turbo Pascal myself. The pascal language itself is okay, and isn't really "limited" - it's just a bit too typesafe for my liking, and "gets in your way" too often. Object pascal (delphi) is sortof okay, and if you're mostly doing GUIs it's powerful enough. The delphi codegenerator just happens to suck, and the necessary runtimes are very bloated.

PowerBASIC code generator sucks (there was a thread about it here which, if you cut away all the flamewars and nonsense, shows what I mean). Suffice to say that pure C code beat a mixed PB/Asm routine (arc drawing, iirc) by far. It also seemed as if it would be hard to write the PB routine without any asm. (Of course somebody is going to claim that inline asm is "native PB code", but that is of course nonsense).

These days I prefer C/C++/Assembly. I can write code fast, it performs fast, and it works very well for what I do. .NET language seems pretty okay if you're mainly concentrated on GUIs and stuff that isn't performance critical. C# seems like a nice language, and the .NET framework doesn't seem all too bad, really.

JAVA... humm. It seems like an okay language, but the VM's I've seen are horrible. Slow, not as stable as they're supposed to be, and use a lot of RAM. Microsoft's VM performed okay, but that one's not available anymore. I wouldn't use JAVA except if I was forced to it (cell phones and the like), because of the poor VM performance.
Posted on 2005-04-10 11:06:48 by f0dder
I check Powerbasic syntax and it uses such words that I simply can't remember for fancyness I seen. Not even the name sounds good,
;) but I do have to respect them for using such language. Nor do I like pascal anymore, C has been years back ago still beat them up.
C++ I guess if we ever need a higher language, C++ will evolve. The only languages I like for syntax and name it's ; HLA, Masm, C/C++,
X/HTML, Python(I haven't check it up, but I had seeing in a page about inline asm and such good theories that it was ported in Linux, but
I will use it for Windows.)
_? ? ? ? ?_
|? ? ? ? ? ?|
? ExAsm? ? = Extreme Legacy Assembler until I learn I hope soon, I had maded a deal with my friends that each one learn one of thisanguages
L? ? ? ? ?_|? ?and them we teach each other, hope I get and I was thinking of a dominant IDE Extreme Legacy Visual Assembler.

This are my wishes for now, and evolve Masm to a higher-level and C/C++ and HLA.

IDE to HLA, Masm(16-bits, 32-bits & 64-bits), C/C++ and even higher-level so, we could make an OS to write kernel quicker.
Posted on 2005-04-10 12:03:51 by Xor Stance
I'm not too fond of HLA myself... If I want something high-level, I go all the way, and choose a compiler with a good optimizer. I don't like the syntax of HLA either. But it's an impressive project, and the standard library is a good thing if you plan to do full-asm development. When writing assembly code, I prefer fasm because of it's no-nonsense approach.

Python is an interesting scripting language, however they IMO made a mistake by not designing a proper library, but rather wrapping POSIX syntax... and it sucks that you need more or less platform-specific stuff to do "interesting" things.

I tend to avoid inline assembly - if something is speed-sensitive enough that it needs asm code, it's usually larger blocks that need redoing.


and even higher-level so, we could make an OS to write kernel quicker.

Dunno... A mix of C/C++ and assembly works pretty well for this, for me at least. It's the balance between ease of writing, ease of debugging, control, and fast code.
Posted on 2005-04-11 06:18:54 by f0dder
I've taken a look at HLA and FASM myself. I like HLA's approach in encapsulating the advantages of high level and low level languages in order to ease the learning process. I like FASM's approach at self-assembly of the source, not new, but not easy to accomplish either.

They are, of course, very interesting projects, but I choose to stick with NASM (for now at least). Most of the NASM syntax seems more natural to me than the alternatives, though there are a few things I wouldn't mind changing. One of which is the fact I don't really care for an assembler capable of "optimization", that is what a compiler is for, anything beyond macros is a little too much for an assembler in my opinion.
Posted on 2005-04-11 07:00:04 by SpooK

Most of the NASM syntax seems more natural to me than the alternatives

Same here - and fortunately nasm and fasm are almost the same.


One of which is the fact I don't really care for an assembler capable of "optimization", that is what a compiler is for, anything beyond macros is a little too much for an assembler in my opinion.

I personally like short/near jump optimization, since it is tedious to add "short" everywhere jumps are being done, and removing the "short" keyword again if the jump distance becomes too far. I don't see any problem with this, as you can still specify "near" if you need a near jump, and "align <whatever>" to keep labels aligned.

Apart from that, I agree - assemblers shouldn't optimize, they should assemble.
Posted on 2005-04-11 08:22:26 by f0dder
Well, I do like the HLA syntax though; because Stdout and but some doesn't sounds good like putw or something like that; but I don't have a choice right now, to choose another asm. The only thing I don't like from Nasm it's the @, I don't know if you can use instead off it #.
Doesn't mean that I don't like it much, but I do prefer and like more the #. I mean in the includefiles or I don't remember, but why not use
Masm? My problem with it, it's that it's still has no good documentation or just Iczelion because the Win32API isn't exactly implemented nor
does a beginner will be directed to it. Well most common problems are solved by the Ms guide as the best documentation. But there hasn't
being of the use for .586, .686, I mean one for FREE ver or maybe I don't know.

Just a question did Ms implemented the C API to Masm? Or it was Hutch?
How much did Hutch fix or implement it?
I don't really have the time and having taking time reading guide off doing other things.

It's obvious that ms wouldn't want their os to be down by another that's why they prohibited the use to write another os.
That's why we have other asm for that.

;) But for the future projects I don't know if it will be acomplish at this state, just I know that someday I will work on it and not exactly is commented there.




Posted on 2005-04-11 20:17:10 by Xor Stance

The only thing I don't like from Nasm it's the @, I don't know if you can use instead off it #.

Where is '@' used in nasm? Or do you mean the '%', as in %define ?


but why not use Masm? My problem with it, it's that it's still has no good documentation

You can find the MASM manuals online...


Just a question did Ms implemented the C API to Masm?

If you're talking about windows.inc and such, it was done by Iczelion, hutch, and a number of other people have made contributions.


It's obvious that ms wouldn't want their os to be down by another that's why they prohibited the use to write another os.

I don't think Microsoft are afraid of anybody who are silly enough to do an all-asm OS. The license restrictions in MASM are only in the "free" versions from the DDKs, if you buy MASM as a standalone product, or get it with visual studio, you can use it for whatever you want. Visual C++ from the (free) visual c++ toolkit has a much more free license, you could use it to develop your own OS if you want to.
Posted on 2005-04-12 01:00:50 by f0dder