Re: Delphi 8: Confusion

From: Rob Kennedy (.)
Date: 01/03/04


Date: Sat, 03 Jan 2004 03:37:11 -0600

Skybuck Flying wrote:
> How come debug disassembly shows assembler instructions ?

You're confusing what the compiler produces with how the IDE presents
that product. The compiler produces a binary file, which is interpretted
by the CPU as a series of instructions. Open an EXE in Notepad and see
for yourself: no assembly language. The most effective way of presenting
those CPU instructions in a human-readable manner is by using assembler
language. Intel has one syntax for that, and AT&T has another; the GNU
compilers use the AT&T syntax, but either syntax results in the same
executable file.

The Delphi compiler has a built-in assembler, which means you can use
the ASM keyword to embed assembly instructions within your code. I don't
know whether Delphi 8 retains that ability. The Delphi debugger contains
a disassembler so that it can present the currently executing
instruction to the developer in the CPU window. In a sense, the CPU is
itself a disassembler, but instead of creating a text representation of
the instructions, it executes them.

With .Net, the compiler does not produce true executable code. Instead,
it generates instructions in an intermediate language (abbreviated IL, I
believe). The .Net run-time system, for which version 1.0 was included
with Windows XP, and which you can download separately as the MS .Net
Framework (*not* the SDK), includes a virtual machine that interprets
the IL instructions and translates them to CPU instructions to pass them
along to the CPU. The interpretter can be configured to just-in-time
compile the IL, which means that it will cache the CPU instructions for
improved run-time performance the second time that code is executed.

IL is the least common denominator for all .Net languages.

It's possible to write a program in IL, just as it's possible to write a
program in plain assembler. And whereas you might use Turbo Assembler to
compiler plain assembler, you would use Microsoft's ilasm.exe to
compiler IL. That program is included with the .Net Framework, as are
csc.exe and vbc.exe, which compiler C# and VB.Net.

Many people compare .Net to Java, but whereas Java refers both to the
language *and* to the run-time environment (the virtual machine), .Net
is *only* the run-time environment. Many different languages can be used
to write .Net code, as long as you have a compiler that can do it.
Microsoft has provided compilers for C#, C++, and VB; Borland has
provided one for Delphi.

.Net also uses things that are called assemblies. As I understand them,
they really have nothing to do with assembler language. Rather, they're
similar to Delphi's packages.

One reason you might want to use Delphi 8 instead of the Win32 versions
is that a .Net program will run on any system that supports the .Net
run-time environment. Windows CE is an oft-requested target for Delphi,
but since Delphi requires much more of the Platform SDK than Windows CE
provides and since it generates code strictly for Intel processors,
Delphi simply hasn't been an option. However, if Windows CE supports
.Net, then Delphi 8 will in turn support Windows CE. Likewise, the Mono
project aims to provide a .Net environment for Linux, so Delphi 8 might
also work as a replacement for Kylix, and wouldn't have to fool around
with CLX, either.

-- 
Rob
P.S.: Do you realize that no one at Borland is seeing your messages? All 
messages to the borland.public.* hierarchy must be posted *directly* to 
Borland's servers: newsgroups.borland.com or forums.borland.com. 
Borland's servers are not part of Usenet. Cross-posting is futile.


Relevant Pages

  • Re: What micros do you actually hate to work with?
    ... the compiler was pretty good to start with. ... level optimizations and fine tuning every bit of the compiler. ... emitting fewer instructions in the end. ... as assembler written by an expert. ...
    (comp.arch.embedded)
  • Re: Buffer overrun exploit example
    ... >I can't go spend years learning ASM and then returning to Delphi lol... ... - inline asm is the best way to learn assembler - you get all ... Everything else is just in the instructions. ...
    (alt.comp.lang.borland-delphi)
  • Re: Intrinsic functions
    ... map into the appropriate bit and bitmap instructions" ... the compiler should recognize some function names as ... "intrinsic function" that is included to the compilation unit. ... the assembler imports the machine code (containing the specialized ...
    (comp.programming)
  • Re: Investigating MMX instructions in Delphi.
    ... >this last one) natively in inline asembler. ... But for older assembler, this ... I thought that Delphi aligned procedures / functions on 16 byte ... >sometimes even higher) by using properly aligned instructions, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Learning to use PICS
    ... the BASIC compiler and the complexity of the problem. ... by an experienced assembler programmer. ... multiple BASIC instructions and generate fewer machine code instructions. ...
    (sci.electronics.basics)