home *** CD-ROM | disk | FTP | other *** search
- Program HiLoWordDemo;
- { This is a very simply example of the power of an Inline }
- { Macro. All that the two routines will do is return the Low }
- { and High words of the long integer value parameter that was }
- { passed. }
- Var
- L : LongInt; { Variable to be passed to the function }
- W : Word; { Variable for function result }
-
- Function HiWord( L : LongInt ) : Word;
- { THis function will return the high word of the longint }
- { varible that was passed. }
- Inline( $5B/ { POP BX }
- $58 ); { POP AX }
-
- Function LoWord( L : LongInt ) : Word;
- { This function will return the low word of the longint value }
- { that was passed to this function. }
- Inline( $58/ { POP AX }
- $5B ); { POP BX }
-
- Begin
- WRiteln( 'HiWord = ', HiWord( $FFFF0000 ) );
- { Call the routine with a value }
- Writeln( 'LoWord = ', LoWord( $FFFF0000 ) );
- { Call the routine with a value }
- L := $0000FFFF;
- W := HiWord( L ); { Call the function with a variable }
- Writeln( 'HiWord = ', W );{ Echo result to screen }
- L := $0000FFFF;
- W := LoWord( L ); { Call the function with a variable }
- Writeln( 'LoWord = ', W );{ Echo results to the screen }
- Readln; { Pause for screen viewing }
- End.
-