home *** CD-ROM | disk | FTP | other *** search
- Program AccessVarParam;
- { This is an example program that demonstrates how to access a }
- { var parameter from a inline code. It involves using the LES }
- { operator to Load into the Extra Segment the segment address }
- { of the address passed for the var parameter, and then request }
- { the offset be placed into the DI register. We can then use }
- { this as a pointer to where the parameter is actually stored. }
- { After all, that is what we receive - a pointer. }
-
- Var
- Result : Word; { This is the variable that will be passed }
- { as a Var parameter to the procedure. }
- IncValue : Byte; { Value we will add to the var parameter }
-
- Procedure AddValue( Var X : Word; Y : Byte );
- { This inline procedure will accept a Var parameter, and then }
- { add to it the second parameter that has been passed to this }
- { procedure. It serves no other purpose other than to show how }
- { to access a Var parameter. }
- Begin
- Inline( $8B/$46/$04/ { MOV AX,[BP+04] }
- $C4/$7E/$06/ { LES DI,[BP+06] }
- $26/$01/$05 ); { ADD ES:[DI],AX }
- End;
-
- Begin
- Result := 10; { Initialize the var parameter to 10 }
- IncValue := 40; { Set the value to increment the Var param }
- AddValue( Result, IncValue );
- Writeln( Result ); { Echo results to the screen }
- Readln; { Pause for screen viewing }
- End.
-