ZTree.com  | ZEN  | About...  

 Index   Back

windows programs in assembly language   [OT]

By: Jim Wilson       
Date: Jul 20,2000 at 23:38
In Response to: windows programs in assembly language (Steve Rawling)

> You may be correct there Jim.

> However, I quote from page 12 of the Vedit 5.20
> manual

> "Written mostly in 32-bit assembly language,
> VEDIT is exceptionally small and uses no overlays
> or .DLLs."

> Anyway everybody knows I'm one eyed on the matter
> of editors.

> Actually, I confess to my ignorance about the
> merits of assembly vs various other programming
> languages.

> Why has assembly language got a mystical respect.
> Is it more powerful,concise but damned difficult
> or something?

> How is it written?

> Can anyone show me a few lines of assembly
> language?

Depending upon the detail given this topic could cover a considerable amount of time. But perhaps I can sum it up more succinctly...

Assembly is the only programming language that has a one-to-one relationship with the CPU; i.e. a single line of code equals a single machine instruction. Every other language -- C, C++, Pascal, Ada, Cobol, Fortran, etc. -- are know as high level languages. The definition of high level is basically a set of words/instructions that appear to be normal words. Although most wouldn't be used in a conversation (unless, of course, you happen to be a programmer) they're mostly comprised of groups of letters that form what appear to be words.

For example, in C there is a function called printf (short for formatted print). With this function you could declare something like:

printf ("This is a test...")

The end result of this program would be to have the words This is a test... displayed on the screen. However, in assembler this rather simple example could require 10 lines of code to reproduce the (seemingly) exact same thing. Since I'm not an assembler programmer I can say that this example isn't accurate, but it does demonstrate my point:

mov ax, ds
mov ds, cs:[local_ds]
mov ss, [local_ds]
mov esp, stack
mov ax, 0x0503
mov ax, 'This is a test...'
int 0x31

Now, who in their right mind would want to program in the latter and not the former? Masochists mostly! :-)

Actually, there is two distinct benefits: speed and size. No other language, no matter how good the programmer or how efficient the compiler, can produce code that runs as fast, or creates executables as small, as an equivalently skilled assembly language programmer. But that doesn't mean that many have the patience (or skill) to develop in assembler, regardless of it's benefits.

Now, after you actually write your source code you have to compile it to get your executable program. With the high level languages one simple statement, like printf, can produce what equates to hundreds of machine language instructions. In contrast, assembler will essentially correlate into a single machine instruction for each line of code (disregarding certain macros, of course -- but that's another topic). This can, and does, have a staggering effect on program speed, and the size of the subsequent executables. The advantages are numerous.

This difference really meant something a few years back, when machines were far less powerful, but sadly it's less important today and so has been virtually dismissed as unnecessary. Inefficient languages and programming paradigms (like C++) have become all the rage, but do little more then clog up your hard drive with fat, sloppy programs. GUI's also present a particularly daunting challenge to assembly programmers as well. Gone are the days when you could develop programs that talked directly to the hardware -- one of assemblers true hallmarks. That's been superceded by DLL's and API's that remove control from the programmer and gives it directly to Micro$oft.

How Steve Gibson is still able to produce such high quality programs given these restraints is beyond me. It's a true testament to his skill and determination, if nothing else.

Well, I guess my explanation wasn't succinct after all... hope this helps you somewhat though.

Jim

1,081 views      
Thread locked
 

Messages in this Thread

 
96,637 Postings in 12,231 Threads, 350 registered users, 71 users online (0 registered, 71 guests)
Index | Admin contact |   Forum Time: Mar 28, 2024 - 10:33 am UTC  |  Hits:62,363,239  (15,636 Today )
RSS Feed