HLA: The High Level Assembly Programming Language
At the eastern edge of US-60, between University Avenue and
the Box Springs Mountain Park, sits the bustling University of
California-Riverside (UCR) campus. A modern university, encompassing
everything from botany to computer science, UCR employs some of
the finest professors in the entire southwestern United States.
UCR was established as a campus of the University of California in
1954. Today, it boasts an enrollment of over 17,000 students.
The High Level Assembly (HLA) programming language began at UCR in 1996
as a project of computer science professor Randall Hyde. Hyde began his
project envisioning a programming language that everyone would love.
He
writes:
When I began writing HLA in the fall of 1996, I had visions
of creating one of those "universally accepted" language projects that
everyone would love. I'd get big "pats on the back" and people would
talk about how great I was. [But] as the design for HLA began to
solidify, and I had to make some hard decisions about compromises in
the language, those visions of glory faded quickly."
Hyde released the first prototype of HLA in September 1999, designated
Version 1.0. As he expected, some people voiced complaints about the
new programming language. As Hyde admits:
I fully expected some people to
voice rigorous complaints about the language itself. I was not disappointed.
One thing, however, that I should have forseen and prepared for is the fact
that a large number of people would voice complaints about HLA in total
ignorance. That is, I didn't anticipate some individuals looking at some
sample code and making assumptions about the language without first
looking to see if those complaints were valid.
HLA was developed initially as a tool to teach assembly language programming.
As Hyde notes:
The principle goal of HLA was to leverage students' existing
programming knowledge. For example, good Pascal programmers can get their
first C/C++ program operational in a few minutes. In HLA, I wanted to create
a language with high level control structures and declarations that made
it possible for someone familiar with an imperative language like Pascal
or C/C++ to get their first HLA programming running in a matter of minutes
(or, at worst, a matter of hours). Of course, to achieve this goal, I
needed to add high-level data declarations and high-level control
constructs to the HLA language.
But how does HLA differ from other High Level Assembly languages? According
to Hyde, the differences are fairly complex.
He
notes:
HLA/86 probably falls in the
high-level-to-very-high-level range because it provides high level data types
and data structuring abilities, high level and very high level control structures,
extensive parameter passing facilities (more than most high level
languages), a very extensive compile time language, a very extensive standard
library, built-in parsing facilities for language extension, and many other
features.
The average programmer starting out on HLA no doubt will be reading the
HLA
Standard Reference Manual for quite awhile before he or she
begins to write the first HLA program. I myself spent over two hours
simply reading and taking notes on how assembly differed from BASIC,
C/C++ and Pascal, other languages I had tried previously. The learning curve was indeed steep, but
the rewards were worth it. As I noted on my project page for my game
HLA
Adventure, "HLA stands for High Level Assembly, and it's a great way for
people to learn assembly without being submerged off the bat in offsets,
memory locations and MOV instructions."
HLA Adventure is one of many HLA-related projects now being developed
by programmers around the world. For example, Sevag Krikorian is
developing
HIDE, an
integrated development environment for use in coding, debugging and compiling
HLA programs. HIDE even was written in HLA.
For those interested in learning more about HLA and the Art of Assembly
Language programming, Yahoo Groups offers
aoaprogramming,
which, as the Web site states, is a "forum for those interested in learning and
working with Randall Hyde's HLA assembler." At the time of this
writing, aoaprogramming had over 1,089 members.
HLA currently is available for both Windows and Linux. First introduced
by Hyde in March of 2002, the Linux version of HLA eventually incorporated
console-mode functions usable in both Windows and Linux. This change allowed
console programs relying on specific console mode functions to be compiled
successfully under both Windows and Linux. As
Hyde
notes, "The VT100 terminals emulation that Linux supports has only
a subset of the capabilities of the original HLA Console library, so
many things are not implemented from the old library."
A simple HLA program, called test.hla and using standard console-mode
functions, might contain the following code:
>
// Player vs. Dragon demo. An example of HLA code.
// ------------------------------------------------------
// Sample game introduction of "Player vs. Dragon".
// ------------------------------------------------------
program west;
// ------------------------------------------------------
// Include files "console.hhf" and "stdlib.hhf" into
// the program.
// ------------------------------------------------------
#include("console.hhf");
#include("stdlib.hhf");
// ------------------------------------------------------
// Begin program "west".
// ------------------------------------------------------
begin west;
// ------------------------------------------------------
// Set console foreground color to white, background
// to blue.
// ------------------------------------------------------
console.setAttrs( console.white, console.blue );
// ------------------------------------------------------
// Clear the console screen.
// ------------------------------------------------------
console.cls();
// ------------------------------------------------------
// Start the main loop of the program, designated
// "mainlp".
// ------------------------------------------------------
mainlp:
// ------------------------------------------------------
// Change foreground color to green, background to blue.
// ------------------------------------------------------
console.setAttrs( console.green, console.blue );
// ------------------------------------------------------
// Use "stdout.puts" to display text on the console
// mode screen. "nl" means "next line".
// ------------------------------------------------------
stdout.puts("A green dragon approaches, spreading her wings high" nl);
stdout.puts("across the landscape, plunging it into darkness! The" nl);
stdout.puts("dragon looks at you and says:");
// ------------------------------------------------------
// Change foreground color to yellow, background to blue.
// ------------------------------------------------------
console.setAttrs( console.yellow, console.blue );
// ------------------------------------------------------
// Use "stdout.puts" to display more text.
// ------------------------------------------------------
stdout.puts(" 'I am the last of my kind." nl);
stdout.puts("Here you are, a human, come here to slay me?! I breathe" nl);
stdout.puts("fire upon trees, rustling the bad kami out of the forests" nl);
stdout.puts("and valleys of this forgotten world. I keep my peace inside" nl);
stdout.puts("these caves, only to be disturbed by your species which" nl);
stdout.puts("pollute this landscape! I was once happy in my silence" nl);
stdout.puts("here, yet you come to make me miserable! I won't allow" nl);
stdout.puts("it, knave! Prepare to feel my wrath!!!'" nl);
// ------------------------------------------------------
// Change foreground color to cyan, background to blue.
// ------------------------------------------------------
console.setAttrs( console.cyan, console.blue );
// ------------------------------------------------------
// Use "stdout.puts" to display a brief message.
// ------------------------------------------------------
stdout.puts("The dragon moves about angrily, stomping the floor!" nl);
// ------------------------------------------------------
// Change foreground color to white, background to blue.
// ------------------------------------------------------
console.setAttrs( console.white, console.blue );
// ------------------------------------------------------
// Use "stdout.puts" to display another message.
// ------------------------------------------------------
stdout.puts("What now, adventurer?" nl);
// ------------------------------------------------------
// End the program. Total lines: 75. Bytes: 3,895.
// ------------------------------------------------------
end west;
What this program does is change the background color of the screen to blue, setting
various other color registers to green, yellow, cyan and white. It then outputs
text to the screen via the command stdout.puts, which is similar to how C++
handles string output. Also, notice the use of nl
at the end of some lines. This stands for next line, moving the cursor one
line down, like a carriage return.
This simple example shows a limited subset of the entire HLA Standard
Library, which incorporates everything from file I/O to popping the stack, switching
register values and other traditional assembly language commands. With a larger
understanding of HLA, it is possible to write almost anything in HLA, including
versions of HLA itself.
HLA also can use a variety of freeware and shareware assemblers, such as MASM, FASM
and Gas. For those curious, assemblers are tools that help create binary files, which
then can run independent of HLA. The best part about HLA is it is a constantly evolving
programming language. In fact, HLA will soon reach version 2.0. This version is
reported to be significantly faster than current versions. For now, version 1.76 of HLA is
available freely from
Hyde's
Web site. HLA can be installed under Linux after reading the HLA Installation Guide.
HLA is a robust, complete programming language. As Hyde has
written:
The HLA (High Level Assembly) language was developed as a tool to help
teach assembly language programming and machine organization to University
students at the University of California, Riverside. The basic idea was
to teach students assembly language programming by leveraging their
knowledge of high level languages like C/C++ and Pascal /Delphi. At
the same time, HLA was designed to allow advanced assembly language
programmers write more readable and more powerful assembly language code.
For Linux users, HLA is a strong programming tool that allows them to
create powerful programs on a variety of different levels. As HLA becomes
more feature-rich, additional applications will be written using HLA under
Linux. With HLA and Linux, programmers can develop new and exciting
applications anyone can use.
Resources
UCR: About
Riverside
"What
is HLA All About, Anyway?"
"What
is a 'High Level Assembler'?"
"Art of
Assembly Language Programming and HLA", by Randall Hyde










This week 5 lucky Members will receive a copy of The Official Ubuntu Server Book by Benjamin Mako Hill and Linux Journal's very own Kyle Rankin. No entry necessary. Check back here early next week to find out who the lucky Online Members are.




Comments
Hla is my first gate to the
Hla is my first gate to the real asm, I like it.
THX for developing such tool.
HLA Programming
The useful tool for training and creation of the applications.
What's the point of all this?
What's the point of all this? Real assembly language programmers don't need C++ style crutches (which is what HLA looks like) and unless one is prepared to fully understand the underlying machine architecture, one will *NEVER* be any good at assembly language.
As for not having to deal with individual MPU instructions, memory management, chip registers, etc., that's where the challenge in assembly language lies. Take that stuff out and you just have yet another weird language.
HLA is far more robust than what was described...
...in the article. It can use assembly commands like MOV, ADD, SUB, etc. It can even make calls to the BIOS. HLA is a mixture of Pascal, C/C++ and Assembly, but by and large it is a High Level Assembly programming language. Some would call it an HLL Pre-parser, but I don't.
Paul
Your article re. HLA ...
Just like to add, for the sake of any ol'timers out there who recall those fun and heady days of the C64 ... (it was a big hit in Toronto and all Canada ... and then TPUG and Comal for the C64 ...) and then the IBM Comal 80 ...
Users groups were THEN fun and exciting for students, young and old a like ...
Well HLA, for me, brings that back ... even better ... you can download it free ... and it assembles into 32 bit machine code ... which is MUCH more compact the any C++ stuff I've compiled ... and REALLY flies. It is very well structured like C++, or Pacsal (as C64 Comal and Comal 80 was ) and you have (a) great library(s) to draw from ... and of course you can make and reuse all your procedures ... (Many users freely share their procedures too.)
And Bonus! What you write in HLA will compile under HLA for Windows as well as HLA for Linux!
(And of course, you can learn a lot about the hardware too.)
And MOST amazingly, you have a very experienced and capable, but humble and approachable and very helpful teacher and author to correspond with on line, in the person of Randall Hyde !!!
Since HLA and so much online stuff is free to download, this also makes it very easy on your (student) budget!
David
Post new comment