Did you ever
needed to create a single 16-bit number out of two 8-bit bytes? Try
this:
{$apptype console}program makewrd;uses
Windows, SysUtils;var
b1, b2 : byte;
w : word;begin
b1 := 128;
b2 := 255;{ create a WORD (16-bit integer)
by concatenating two BYTEs (8-bit) }
w := MAKEWORD( b1, b2 );
WriteLn( Format( '%d',[ w ]));{ now break up the WORD we created
in to it's original two bytes }
WriteLn( Format( 'b1 = %d, b2 = %d',[ LOBYTE( w ), HIBYTE( w )]));end.
Listing #1
: Delphi code. Right click mkword.pas
to download.