Taking the "fright" out of Opcodes and Hex-numbers.
High Level Assembly (HLA) is a modern assembler + standard library package that allows a programmer to ease his way toward ASM coding by leveraging concepts already learned from typical high-level languages. By using HLA, one can investigate and play with a few ASM instructions at a time while coding the remainder of the application using built-in functions and flow-control constructs that one should already be accustomed to. As one gains confidence with traditional assembly coding, they can begin to eliminate the high-level parts of the application by re-coding them in straight ASM.
Here is an example to demonstrate how an HLA application looks very close to how one might write the same program in C or other traditional language.
// cross-platform: Linux & Windows now; others in the works...
// get HLA here: http://www.artofasm.com
program demo;
#include( "stdlib.hhf" )
const
ITERATIONS :uns32 := 10000;
MAX_VALUE :uns32 := 100;
static
items :uns32[ITERATIONS];
freq :uns32[MAX_VALUE+1];
mixed :file;
sorted :file;
begin demo;
/* initialization
*/
rand.randomize();
mixed.create(); // these are file objects
mixed.openNew( "sfalse.txt" );
sorted.create();
sorted.openNew( "strue.txt" );
/* create the unsorted array
*/
mov( 0, ecx );
repeat
rand.range( 0, MAX_VALUE ); // returns value in 'eax'
mov( eax, items[ecx*4] ); // puts value into array
mixed.put( (type uns32 ecx):5, ": ", (type uns32 eax), nl );
// mirror to file
add( 1, ecx );
until ( ecx = ITERATIONS );
/* record the frequencies of the numbers
*/
for( mov( 0, ecx ); ecx < ITERATIONS; inc( ecx ) ) do
mov( items[ecx*4], eax ); // get value from array
inc( freq[eax*4] ); // increment its frequency count
endfor;
/* use frequency table to re-order the array
*/
xor( ecx, ecx ); // could also use 'mov( 0, ecx )'
xor( ebx, ebx );
while( ebx < MAX_VALUE+1 ) do
mov( freq[ebx*4], eax ); // get frequency count
if ( eax != 0 ) then
// keep storing that number until eax = 0
repeat
mov( ebx, items[ecx*4] );
sorted.put( (type uns32 ecx):5, ": ", (type uns32 ebx), nl );
// mirror to file
inc( ecx ); // could also use 'add( 1, ecx )'
dec( eax ); // sets Zero Flag if eax = 0
until ( @z ); // check if Zero Flag is set
endif;
add( 1, ebx );
endwhile;
mixed.close();
sorted.close();
end demo;
Get HLA and the *free* online version of "Art of Assembly" here: http://www.artofasm.com
Get an IDE specifically for HLA (Windows only) here: http://sevag.krikorian.googlepages.com/