4.5 The HLA TYPE Section


4.5 The HLA TYPE Section

Let's say that you simply do not like the names that HLA uses for declaring byte, word, double word, real, and other variables. Let's say that you prefer Pascal's naming convention or, perhaps, C's naming convention. You want to use terms like integer, float, double, or whatever. If HLA were Pascal you could redefine the names in the type section of the program. With C you could use a #define or a typedef statement to accomplish the task. Well, HLA, like Pascal, has its own type statement that also lets you create aliases of these names. The following example demonstrates how to set up some C-/C++-/Pascal-compatible names in your HLA programs:

 type      integer:         int32;      float:           real32;      double:          real64;      colors:          byte; 

Now you can declare your variables with more meaningful statements like:

 static      i:                    integer;      x:                    float;      HouseColor:           colors; 

If you are an Ada, C/C++, or FORTRAN programmer (or any other language, for that matter), you can pick type names you're more comfortable with. Of course, this doesn't change how the 80x86 or HLA reacts to these variables one iota, but it does let you create programs that are easier to read and understand because the type names are more indicative of the actual underlying types. One warning for C/C++ programmers: Don't get too excited and go off and define an int data type. Unfortunately, int is an 80x86 machine instruction (interrupt) and therefore, this is a reserved word in HLA.

The type section is useful for much more than creating type isomorphisms (that is, giving a new name to an existing type). The following sections will demonstrate many of the possible things you can do in the type section.




The Art of Assembly Language
The Art of Assembly Language
ISBN: 1593272073
EAN: 2147483647
Year: 2005
Pages: 246
Authors: Randall Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net