High Level Assembly

High Level Assembly

Infobox_Software
name = High Level Assembly (HLA) Language
developer = Randall Hyde
latest_release_version = 1.102 Beta
latest_release_date = release date|2008|05|02
operating_system = Windows, Linux, FreeBSD, Mac OS X
genre = Assembler
license =
website = http://webster.cs.ucr.edu/AsmTools/HLA/index.html

High Level Assembler (HLA) is an assembly language developed by Randall Hyde which can use high-level language constructs to aid x86 assembly programmer beginners and advanced assembly developers alike. It fully supports advanced data types and object-oriented assembly language programming. It uses a syntax loosely based on several high-level languages (HLL), such as Pascal, Ada, Modula-2, and C, to allow the creation of readable assembly language programs, and to allow HLL programmers to learn HLA as rapidly as possible.

Origins and goals

HLA was originally conceived as a tool to teach assembly language programming at the college/university level. The idea is to leverage students' existing programming knowledge when learning assembly language to get them up to speed as rapidly as possible. Most students taking an assembly language programming course have already been introduced to high-level control structures such as IF, WHILE, FOR, etc. HLA allows students to immediately apply that programming knowledge to assembly language coding early in their course, allowing them to master other prerequisite subjects in assembly prior to learning how to code low-level forms of these control structures. "The Art of Assembly Language Programming" by Randall Hyde uses HLA for this very purpose (see #External links to read an on-line version of the book).

ources of HLA controversy

High vs. low-level assembler

A common misconception about HLA is that it is not a "low-level assembler" like Microsoft's MASM or Borland's TASM products. People generally develop this misconception after looking at a typical "hello world" program in HLA that consists of a single macro invocation for the program's body:

program helloWorld; #include("stdlib.hhf") begin helloWorld; stdout.put( "Hello World" nl ); end helloWorld;

Combined with the Pascal and C-like declarations for a program, many people get the impression that HLA is not an assembly language at all, but rather some sort of high-level language. In fact, the "stdout.put" statement in the above code is nothing more than an assembly language macro that expands to code like the following:

program HelloWorld; #include( "stdlib.hhf" ) static hwString :string := "Hello World", nl; begin HelloWorld; // Push the address of the "Hello World" string push( hwString ); // Call an HLA Standard Library function that // will print the string whose address has // been pushed on the stack. call stdout.puts; end HelloWorld;

There is absolutely nothing stopping a programmer from writing the "Hello World" program in low-level assembly language, should they really want to do this. However, for the beginner who is experiencing their first hour with assembly language, the former code is far more approachable than this latter code (i.e., explaining the stack and how parameters are passed to a procedure via the stack is a relatively advanced subject).

HLA supports all the same low-level machine instructions as other x86 assemblers and, indeed, HLA's high-level control structures are based on the ones found in MASM and TASM (whose HLL-like features predated the arrival of HLA by several years). One can write low-level assembly code in HLA just as easily as with any other assembler by simply ignoring the HLL-control constructs. Indeed, in contrast to HLLs like Pascal and C(++), HLA doesn't require inline asm statements. HLL-like features appear in HLA to provide a learning aid for beginning programmers by smoothing the learning curve, with the assumption that they will discontinue the use of those statements once they master the low-level instruction set (in practice, many experienced programmers continue to use HLL-like statements in HLA, MASM, and TASM, long after they've mastered the low-level instruction set, but this is usually done for readability purposes).

Distinguishing features

Two HLA features set it apart from other x86 assemblers: its powerful macro system (compile-time language) and the HLA Standard Library.

Macro system

HLA's compile-time language allows programmers to extend the HLA language with ease, even creating their own little Domain Specific Language to help them easily solve common programming problems. The stdout.put macro briefly described earlier is a good example of a sophisticated macro that can simplify programmers' lives. Consider the following invocation of the stdout.put macro:

stdout.put( "I=", i, " s=", s, " u=", u, " r=", r:10:2, nl );

The stdout.put macro processes each of the arguments to determine the argument's type and then calls an appropriate procedure in the HLA Standard library to handle the output of each of these operands. Assuming i is a 32-bit signed integer, s is a string variable, u is a 32-bit unsigned integer, and r is a 32-bit floating point value, the macro invocation above expands to code like the following:

push( iEqualsStr ); // "I=" string call stdout.puts; // Print "I=" push( i ); call stdout.puti32; // Print i as a 32-bit signed integer. push( sEqualsStr ); // " s=" string call stdout.puts; // print " s=" push( s ); // Push the address of the string call stdout.puts; // and print it. push( uEqualsStr ); // Push the address of " u=" string call stdout.puts; // and print it. push( rEqualsStr ); // Push the address of " r=" string call stdout.puts; // and print it. push((type dword r)); // Push r's value onto the stack. pushd( 10 ); // Push the field width. pushd( 2 ); // Push decimal positions. call stdout.putr32; // Print the value as real. call stdout.newln; // Print a new line character sequence.

It should be rather clear that the former code is much easier to write, read, and maintain than this latter code; this is one of the advantages of using macros in assembly language code. Of course, most assemblers provide some sort of macro capability, the advantage that HLA offers over other assemblers is that it is capable of processing macro arguments like "r:10:2" using HLA's extensive compile-time string functions, and HLA's macro facilities can figure out the types of variables (such as i, u, s, and r in this example) and use that information to direct macro expansion, as was done in this example.

tandard library

The HLA Standard Library is an extensive set of prewritten routines and macros (like the stdout.put macro described above) that make life easier for programmers, saving them from reinventing the wheel every time they write a new application. Perhaps just as important, the HLA Standard Library allows programmers to write portable applications that run under Windows or Linux with nothing more than a recompile of the source code.

Design of the HLA system

The HLA v1.x language system is a command-line driven tool that consists of several components, including a "shell" program (e.g., hla.exe under Windows), the HLA language compiler (e.g., hlaparse.exe), a low-level translator (e.g., MASM, TASM, or FASM under Windows or Gas under Linux), a linker (link.exe under Windows, ld under Linux), and other tools such as a resource compiler for Windows. Versions prior to 1.90 relied on an external assembler back end; versions 1.9x to 2.0 of HLA will have FASM built in, with permission of Tomasz Grysztar, the author of FASM.

The HLA "shell" application processes command line parameters and routes appropriate files to each of the programs that make up the HLA system. It accepts as input ".hla" files (HLA source files), ".asm" files (source files for MASM, TASM, FASM, or Gas assemblers), ".obj" files for input to the linker, and ".rc" files (for use by a resource compiler.)

The HLAPARSE.EXE (just "hlaparse" under Linux) is a "compiler" that translates HLA source files into an intermediate ".asm" form (much like GCC translates C/C++ files into assembly language source files). The output of the HLAPARSE program is translated into object code by MASM, FASM, TASM, or Gas. The object code is linked into an executable format by a linker. Of course, this activity is transparent to the user -- the "shell" program performs all these steps automatically. Though using secondary assemblers such as MASM or Gas to process HLA output is somewhat controversial amongst "old-school" assembly programmers, there are two big advantages offered by this scheme. First, it is a trivial matter to translate HLA syntax assembly code into MASM, TASM, FASM, or Gas assembly code. This is a very nice utility for those who need to translate code amongst different assemblers. HLA is the only assembler that provides the ability to translate its code into so many different syntaxes. Second, as HLA v1.x is primarily designed as a teaching tool, and not as a tool for production, the actual assembly of source code by HLA itself is not of high priority. This allows for exhaustive prototyping, testing and debugging both the HLA language and the assembler. HLA will enter production stage with version 2.x, which will be written in HLA v1.x (therefore actually in FASM the first time). It will have its own built-in assembler, enabling HLA to emit object code directly, and be self-compilable.

ee also

*Comparison of assemblers

External links

* [http://webster.cs.ucr.edu/AsmTools/HLA/ Homepage]


Wikimedia Foundation. 2010.

Нужен реферат?

Look at other dictionaries:

  • High Level Assembly — (HLA) Développeur Randall Hyde Environnements …   Wikipédia en Français

  • High Level Assembly — Para el concepto general, ver ensamblador de alto nivel. Este artículo es acerca de una implementación específica Para otros usos de este término, véase HLA (desambiguación). El High Level Assembly (HLA) es un lenguaje ensamblador desarrollado… …   Wikipedia Español

  • High-level assembler — High level assemblers are assembly language translators that incorporate features found in modern high level programming languages into an assembler.Some high level assemblers are Borland s TASM, Microsoft s MASM, IBM s HLASM (for z/Architecture… …   Wikipedia

  • high-level — high′ lev′el adj. 1) of or involving participants having high status: a high level meeting[/ex] 2) having authority or status: high level personnel[/ex] 3) cmp (of a programming language) based on a vocabulary of Englishlike statements for… …   From formal English to slang

  • High-level programming language — In computing, a high level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low level programming languages, it may use natural language elements, be easier to use, or more… …   Wikipedia

  • High Level Bridge (Edmonton) — Infobox Bridge bridge name=High Level Bridge caption=Sourdough Raft Race, passing beneath the High Level Bridge s Great Divide waterfall with the LRT bridge in the background official name= carries=109th St. Southbound crosses=North Saskatchewan… …   Wikipedia

  • high-level — /huy lev euhl/, adj. 1. undertaken by or composed of participants having a high status: a high level meeting; a high level investigation. 2. having senior authority or high status: high level personnel. 3. (of a programming language) based on a… …   Universalium

  • high-level language —    Any machine independent programming language that uses English like syntax in which each statement corresponds to many assembly language instructions. High level languages free programmers from dealing with the underlying machine architecture… …   Dictionary of networking

  • High-level language —   A language for instructing a computer which is easier to use than the machine level instructions that a computer can interpret directly. See also Assembly, Machine Language and Low level language …   International financial encyclopaedia

  • high-level language — noun A programming language, requiring a compiler to translate into a form a particular machine understands, focusing on user friendly code development by automating core tasks such as accessing memory. See Also: intermediate language, low level… …   Wiktionary

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”