High Level Assembly

From ArticleWorld


High Level Assembly (HLA) is an assembly-like language that can use high level contructs, aiding x86 assembly programmers. Randall Hyde, its developer, conceived it especially for teaching assembly language to programmers used to high level languages. However, advanced programmers also use HLA in development.

High-level and low-level

Many beginners initially do not realize why the HLA is an assembly language. The traditional "Hello, World!" example looks like this:

program helloWorld;
#include("stdlib.hhf")
begin helloWorld;

  stdout.put( "Hello World" nl );

end helloWorld;

This looks like a combination of C and Pascal. Nevertheless, this is merely a macro, expanded to:

program HelloWorld;
#include( "stdlib.hhf" )

static
 hwString :string := "Hello World" nl;

begin HelloWorld;
   push( hwString );
   call stdout.puts;

end HelloWorld;

This is possible because of HLA's macro support. In fact, HLA supports all low-level x86 instructions. A programmer can do low-level assembly in HLA by simply not using HLA's added features.

Features

There are two features that make HLA so popular. These are:

  • The macro system. The compiler can expand HLA macros into actual HLA code, enhancing a program's readability and portability. HLA programmers can add their own macros. The macro expander itself is very capable and friendly, making programs that use macros quite easy to debug when needed.
  • The HLA Standard Library. This is a comprehensive collection of routines and macros that save important programming time for implementing commonly used functions. However, its most important highlight is its portability, allowing programs for Windows and Unix to be written under HLA and simply recompiled in most cases.

Compilation

The main tool for HLA compilation is hlaparse (HLAPARSE.EXE under Windows). This parses and translates HLA files into a low-level assembly version, which is later assembled to object code by an external assembler, like MASM, TASM or Gas. This allows the programmer to use various assemblers, ensuring a higher degree portability.