Hello,
Is there any difference between HLA and normal Assembly language?

If I learn HLA, am I learning normal Assembly as well ?

Lastly, can HLA be used in MASAM or NASM and can normal Assembly be used in HLA?
Posted on 2003-11-16 08:42:55 by Weng

Is there any difference between HLA and normal Assembly language?


HLA is an assembly language yes but its current implementation is as a compiler. It translates the HLA source code to masm, fasm. tasm or gas and use the appropriate assembler to transtate the assembly code to object code. If you learn HLA while reading the art of assembly language you will be learning assembly language and if you decide to learn another assembler all you would have to learn is the difference between the assembler's syntax and HLA's syntax.


Lastly, can HLA be used in MASAM or NASM and can normal Assembly be used in HLA?


You can't exactly used the HLA compiler with masm but you can do high level style assembly programming with masm because masm is a high level assembler just like HLA. The difference is that HLA uses a high level syntax and supports more high level features(like built in support for object oriented programming) but HLA just like masm can be used to write pure assembly code also. HLA also has a more powerful macro system than masm that allows you to extend the language. Here is trivial code example that demonstrate the differerence between HLA and masm.

 

masm:

.if eax != 0
mov eax, 0
.endif

HLA

if ( eax <> 0 ) then
mov( 0, eax ) ;
endif;


Check out this thread to see and example of pure asm code with HLA.
http://www.asmcommunity.net/board/index.php?topic=15887
Posted on 2003-11-16 09:24:06 by Odyssey
Originally posted by Weng
Hello,
Is there any difference between HLA and normal Assembly language?


HLA (in caps) is a product, "normal Assembly language" refers to a generic class of products. The comparison isn't exact.

Yes, there is a difference between HLA and every other assembler out there. Then again, there is a difference between every assembler and all the other assemblers out there :-)

HLA is a member of a class of assemblers known as "high-level assemblers". Assemblers in this category include MASM, TASM, and HLA. All three have their differences, though HLA is quite a bit different from the other two (TASM is, to a certain degree, upwards compatible with MASM, though this compatibility is waning as TASM isn't really supported anymore and doesn't track the improvements made to MASM).

High-level assemblers, like HLA, MASM, and TASM, let you work in a multi-paradigm fashion -- you can write low-level assembly code using bare machine instructions but you can also write higher-level code using high-level control structures like IF/WHILE/FOR/etc. "Traditional assemblers" (i.e., not high-level assemblers) generally provide only the low-level machine instructions. As such, the high-level assemblers tend to be more flexible as you can do pretty much everything that's possible with a low-level assembler plus you have the ability to use the high-level statements, when appropriate. Even if you choose *not* to use any high-level assembly statements, you can still do all the low-level stuff you can do with traditional assemblers. Therefore, using a high-level assembler does not limit you in any way; in fact, using the traditional assembler is the more limiting approach.


If I learn HLA, am I learning normal Assembly as well ?

As long as you make sure you learn all the machine instructions (i.e., the low-level code) and are capable of writing programs without using the high-level control constructs, then yes, you are learning normal assembly as well.


Lastly, can HLA be used in MASAM or NASM and can normal Assembly be used in HLA?


HLA, due to its implementation, provides a "#asm..#endasm" clause that lets you inject MASM, TASM, FASM, or Gas code into the output that HLA produces. Very rarely do you need this facility as HLA supports all the normal machine instructions you'll use. So the answer to the second question is "yes, you can inject traditional assembly code into an HLA program." The other direction isn't exactly possible (that is, there is no in-line statement that lets you insert HLA code into a traditional assembly source file). However, as noted earlier, MASM and TASM support high-level statements of their own, so you can use high-level assembly in MASM and TASM code, independent of HLA. With other assemblers, injecting high-level assembly code is achieved (rather poorly, I might add) by the use of macros. Another way to use HLA code with traditional assemblers is to compile the HLA code to an object file and link that object file with the code written in the other assembler. For example, MASM and FASM users are able to call various routines in the HLA standard library (which is all written in HLA) using special include files that provide linkages to these routines (indeed, there is no reason most other assemblers cannot also call HLA Standard Library routines, other than the fact that no one has yet written the header/include files that make the HLA stdlib routines visible to these other assemblers).

Regardless of which assembler you learn with, the bottom line is that the major difference between all these assemblers is their basic syntax. Syntax is easily learned - it's the semantics that are difficult to learn (that is, learning to "think" in assembly"). So if you learn with HLA (because it's generally easier to learn with this assembler than with others) and then decide you have to work in MASM or some other assembler at a later time, you'll find that it only takes you about a week to learn the syntactical differences; but the programming paradigm carries straight across to the new assembler.
Cheers,
Randy Hyde
Posted on 2003-11-16 14:37:28 by rhyde
Hello all,

Thanks for your replies.....I think I have cleared up most of the initial confusion about HLA and assembly.

So, I will like to confirm several points about HLA and assemblers:

1) There is high and low level assembly language
2) HLA belongs to high level assembly
3) High level assembly can do what low level assembly does and also provides higher level features
4) Each assembler has its own version of assembly syntax
5) The style and logic of programming assembly is the same for all versions except for the basic syntax
6) HLA is a compiler with its own version of assembly language
7) If I learn HLA, then learning low level assembly is easy. Its just learning the difference in syntax.

Are the above mentioned correct ? It seems that programming in assembly is different from programming in higher level languages like C or VB, where 1 language suits all compilers.

So is it true that low level assembly is used to program hardware while higher level assembly can program hardware and software also? Just curious and asking only: Are computer viruses and worms written in assembly and is it high or low level assembly? I have read in a website that most malicious programs are written in assembly because of its power. Is it true?

Please reply......thanks!
Posted on 2003-11-17 11:26:15 by Weng
Originally posted by Weng
Hello all,

Thanks for your replies.....I think I have cleared up most of the initial confusion about HLA and assembly.

So, I will like to confirm several points about HLA and assemblers:

1) There is high and low level assembly language


Yes.
MASM, TASM, HLA belong to what is normally considered the set of high-level assemblers (on the x86, anyway). Some would also include PL/M-86 in this category, though I'm not sure I'd consider PL/M an assembly language.

NASM, FASM, Gas, and most other assemblers are what we would normally call "traditional assemblers." The term "low-level assembler" is a bit of a misnomer as most of the things you can do with a low-level assembler can be done with a high-level assembler as well (as you noted). NASM, however, could be considered a bit "lower level" than most other assemblers as it gives you finer control over opcode generation (that most other assemblers *don't* provide).


2) HLA belongs to high level assembly

Yes, as its name implies :-)


3) High level assembly can do what low level assembly does and also provides higher level features

Yes.


4) Each assembler has its own version of assembly syntax

Yes, and for the most part each assembler's syntax is incompatible with all the other assemblers. The only exception is TASM, which is (for the most part) upwards compatible with MASM (though the reverse is *not* true).


5) The style and logic of programming assembly is the same for all versions except for the basic syntax


Well, as long as you stick to the low-level assembly statements, this is correct. Obviously, if you take advantage of the high-level constructs in a high-level assembler, those constructs (and the programming paradigm associated with them) are not available in traditional assemblers.

High-level constructs appear in assemblers for two reasons: (1) to ease the transition from a high-level language to assembly language, and (2) to allow the programmer to easily write code (and to write code that is more readable). As long as you don't use the high-level constructs to avoid learning the low-level programming, the "style and logic of programming" you learn with a high-level assembler will be perfectly applicable to traditional assemblers.


6) HLA is a compiler with its own version of assembly language


There are two things to consider here:
1. The definition of the *language*. HLA is an assembly language, period.
2. The implementation of the translator for the language. HLA is implemented as a compiler. The fact that it is a compiler does not change the fact that the language HLA processes is an assembly language. You could write an "assembler" for HLA and it would process *exactly* the same set of source files that the HLA "compiler" processes. Therefore, the difference between a compiler and an assembler, for the purposes of HLA users, is simply an academic notion.


7) If I learn HLA, then learning low level assembly is easy. Its just learning the difference in syntax.

Again, as long as you don't use the high-level constructs as a crutch to avoid the low-level machine instructions, you *will* be learning assembly language. Should you choose to switch to a different assembler at some time in the future, you'll find that the conversion is fairly straight-forward.


Are the above mentioned correct ? It seems that programming in assembly is different from programming in higher level languages like C or VB, where 1 language suits all compilers.


There is no "ANSI Standard" for x86 assembly language. In some respects this is bad (we have many different assemblers, each with a different syntax), in some respects this is good (a standard stifles innovation - HLA is a *very* power assembly language and would probably have never been created if there was an "ANSI standard" that it had to conform to; ditto for most of the other assemblers).



So is it true that low level assembly is used to program hardware while higher level assembly can program hardware and software also? Just curious and asking only: Are computer viruses and worms written in assembly and is it high or low level assembly? I have read in a website that most malicious programs are written in assembly because of its power. Is it true?


You can use traditional and high-level assembly languages for all of these purposes. There really is little difference between their capabilities. You can write apps in traditional assembly language, you can program the hardware using high-level assemblers. Both forms of assembly languages are largely suitable for any applications for which you'd want to use assembly. High-level assemblers *are* a little more convenient for writing applications - they eliminate much of the grunt work you'd need to do when using a traditional assembler, but the application domains for these two types of languages are more similar than dissimilar. That said, Win32 programming is *much* nicer (IMO) when using a high-level assembler than when using a traditional assembler.


Please reply......thanks!


Hope that helps.
Cheers,
Randy Hyde
Posted on 2003-11-17 12:38:26 by rhyde

That said, Win32 programming is *much* nicer (IMO) when using a high-level assembler than when using a traditional assembler.


Yes, I agree.


You could write an "assembler" for HLA and it would process *exactly* the same set of source files that the HLA "compiler" processes.


Can't wait for the HLA assembler that will assemble sources faster than masm.:) I like HLA the language but I'm not too fond of the current implementation. :)
Posted on 2003-11-17 15:53:24 by Odyssey