The Art of Assembly Language Programming - book and online book, HLA (High Level Assembler) links to downloads, tutorials, and sample code
program HelloWorld; #include( "stdlib.hhf" ) begin HelloWorld; stdout.put( "Hello, World of Assembly Language", nl ); end HelloWorld;As you see, HLA provides a sort of object-oriented library. See below for some more simple examples. The HLA development kit is not small. Besides HLA itself (for which there is a Windows installer) you will also need MASM (ml.exe), which you can also get from Hyde's download page. The package is called MASM32 and includes a huge number of ASM examples. HLA itself comes with an almost unbelievable amount of sample code, which you must download separately from the HLA installer. And the entire electronic version of the book is evailable for download in a zip file.
// This program generates the fibonocci
// sequence for n=1..40.
//
// The fibonocci sequence is defined recursively
// for positive integers as follows:
//
// fib(1) = 1;
// fib(2) = 1;
// fib( n ) = fib( n-1 ) + fib( n-2 ).
//
// This program provides an iterative solution.
program fib;
#include( "stdlib.hhf" );
static
FibCntr: int32;
CurFib: int32;
LastFib: int32;
TwoFibsAgo: int32;
begin fib;
// Some simple initialization:
mov( 1, LastFib );
mov( 1, TwoFibsAgo );
// Print fib(1) and fib(2) as a special case:
stdout.put
(
"fib( 1) = 1", nl
"fib( 2) = 1", nl
);
// Use a loop to compute the remaining fib values:
mov( 3, FibCntr );
while( FibCntr <= 40 ) do
// Get the last two computed fibonocci values
// and add them together:
mov( LastFib, ebx );
mov( TwoFibsAgo, eax );
add( ebx, eax );
// Save the result and print it:
mov( eax, CurFib );
stdout.put( "fib(",FibCntr:2, ") =", CurFib:10, nl );
// Recycle current LastFib (in ebx) as TwoFibsAgo,
// and recycle CurFib as LastFib.
mov( eax, LastFib );
mov( ebx, TwoFibsAgo );
// Bump up our loop counter:
add( 1, FibCntr );
endwhile;
end fib;
-- DaleBrayden - 14 Sep 2003