The information in this article applies to:
SUMMARY
Most high-level programming languages use variables for data and
functions or procedures for code. MASM uses labels for both data and
code.
MORE INFORMATION
A MASM label is made up of a segment and an offset. In your MASM program,
you can use the SEG and OFFSET operators to access the corresponding
portion of the label. The the SEG and OFFSET directives work in a way
similar to the C FP_SEG and FP_OFF macros. However, FP_SEG and FP_OFF work
on C pointers, not MASM labels or memory addresses.
Should the assembler generate code to move a byte or a word to MyLabel? The
answer depends on how MyLabel was defined. If MyLabel was defined as a
byte, a 0 byte is moved to MyLabel, but if MyLabel was defined as a word, a
0 word is moved to MyLabel.
If you want to move a value to a label that has a size different from the size for the type associated with the label, cast the label. You can cast a label by placing the type that you want to associate with the label, followed by PTR, in front of the data label. For example, the following instruction casts MyLabel to a label for a WORD:
The WORD PTR does not mean MyLabel contains a pointer to a word; it means
the data at MyLabel should be considered to be a word.
Similarly, you can tell the assembler whether to make a call or a jump NEAR or FAR by specifying the distance for the code label. For example, the following instruction tells the assembler to generate a 32-bit NEAR jump to the label CodeLabel:
A jump such as this one is helpful when writing Windows NT or OS/2 flat
model programs.
Additional query words: kbinf 5.10 6.00 6.10
Keywords : |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |