home *** CD-ROM | disk | FTP | other *** search
- Program FirstInlineMacro;
- { This is a sample program that demonstrates the coding if an }
- { inline macro that will return the uppercase of a character. }
- { It simply compares the value of the character passed to the }
- { routine, and determines if it is in the range a to z. If }
- { so, it will subtract $20 from the value of the character }
- { passed. This has the effect of changing the character to }
- { its uppercase representation. }
-
- Var
- S : String; { Test string used in this example }
- I : Byte; { Loop control variable }
-
- Function UpperCase( Ch : Char ) : Char;
- { This inline macro will convert the character passed as a }
- { parameter to its upper case representation. }
-
- Inline( $58/ { POP AX }
- $3D/$61/$00/ { CMP AX,$0061 }
- $7C/$08/ { JL 08 }
- $3D/$7A/$00/ { CMP AX,$007A }
- $7F/$03/ { JG 03 }
- $2D/$20/$00 ); { SUB AX,0020 }
-
- Begin
- S := '?@@this is a testz[\'; { Initialize string to boundary }
- { values. }
- Writeln( 'Before translation S = ', S ); { Echo to screen }
- For I := 1 to Length( S ) Do{ Convert each character }
- S[I] := UpperCase( S[I] );
- Writeln( 'After translation S = ', S );{ Echo to screen }
- Readln; { Pause for viewing }
- End.
-