Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:papc:chapter_6_4 [2025/05/18 21:11] – [Floating point vector data types] ktokarzen:multiasm:papc:chapter_6_4 [2026/03/29 18:50] (current) – [Data Types and Encoding] ktokarz
Line 1: Line 1:
 ====== Data Types and Encoding ====== ====== Data Types and Encoding ======
 +The x86 family of processors allows for computations on integer, floating-point, and vector data. This data is stored in memory as binary strings of varying lengths. In this chapter, we will present fundamental data types, as well as the types based on them found in assembly language programs.
 ===== Fundamental data types ===== ===== Fundamental data types =====
 Fundamental data types cover the types of data elements that are stored in memory as 8-bit (Byte), 16-bit (Word), 32-bit (Doubleword), 64-bit (Quadword) or 128-bit (Double quadword), as shown in figure {{ref>fundamentaldata}}. Many instructions allow for processing data of these types without special interpretation. It depends on the programming engineer how to interpret the inputs and results of instruction execution. The order of bytes in the data types containing more than a single byte is little-endian. The lower (least significant) byte is stored at the lower address of the data. This address represents the address of the data as a whole. Fundamental data types cover the types of data elements that are stored in memory as 8-bit (Byte), 16-bit (Word), 32-bit (Doubleword), 64-bit (Quadword) or 128-bit (Double quadword), as shown in figure {{ref>fundamentaldata}}. Many instructions allow for processing data of these types without special interpretation. It depends on the programming engineer how to interpret the inputs and results of instruction execution. The order of bytes in the data types containing more than a single byte is little-endian. The lower (least significant) byte is stored at the lower address of the data. This address represents the address of the data as a whole.
  
 <figure fundamentaldata> <figure fundamentaldata>
-{{ :en:multiasm:cs:fundamental_data_types.png?700 |Illustration of fundamental data types}}+{{ :en:multiasm:cs:fundamental_data_types.png?600 |Illustration of fundamental data types}}
 <caption>Fundamental data types</caption> <caption>Fundamental data types</caption>
 </figure> </figure>
Line 46: Line 47:
  
 <figure packedint128> <figure packedint128>
-{{ :en:multiasm:cs:packed_integers_128.png?750 |Illustration of 128-bit packed integer data types}}+{{ :en:multiasm:cs:packed_integers_128.png?600 |Illustration of 128-bit packed integer data types}}
 <caption>128-bit packed integer data types</caption> <caption>128-bit packed integer data types</caption>
 </figure> </figure>
Line 53: Line 54:
  
 <figure packedint256> <figure packedint256>
-{{ :en:multiasm:cs:packed_integers_256.png?800 |Illustration of 256-bit packed integer data types}}+{{ :en:multiasm:cs:packed_integers_256.png?600 |Illustration of 256-bit packed integer data types}}
 <caption>256-bit packed integer data types</caption> <caption>256-bit packed integer data types</caption>
 </figure> </figure>
Line 60: Line 61:
  
 <figure packedint512> <figure packedint512>
-{{ :en:multiasm:cs:packed_integers_512.png?800 |Illustration of 512-bit packed integer data types}}+{{ :en:multiasm:cs:packed_integers_512.png?600 |Illustration of 512-bit packed integer data types}}
 <caption>512-bit packed integer data types</caption> <caption>512-bit packed integer data types</caption>
 </figure> </figure>
Line 69: Line 70:
  
 <figure floattypes> <figure floattypes>
-{{ :en:multiasm:cs:floating_types.png?700 |Illustration of floating point data types}}+{{ :en:multiasm:cs:floating_types.png?600 |Illustration of floating point data types}}
 <caption>Floating point data types in x64 architecture</caption> <caption>Floating point data types in x64 architecture</caption>
 </figure> </figure>
Line 75: Line 76:
 <table tablefloattypes> <table tablefloattypes>
 <caption>Floating point data types</caption> <caption>Floating point data types</caption>
-^ Name              ^ Bits  ^ Mantissa bits  ^ Exponent bits  ^ Min value                                 ^ Max value                                 +^ Name              ^ Bits  ^ Mantissa bits  ^ Exponent bits  ^ Min value                                  ^ Max value                                  
-| Double extended   | 80    | 64             | 15             | {{:en:multiasm:cs:float_ep_min.png?125}}  | {{:en:multiasm:cs:float_ep_max.png?125}}  | +| Double extended   | 80    | 64             | 15             | {{:en:multiasm:cs:float_ep_min.png?105 }}  | {{:en:multiasm:cs:float_ep_max.png?105 }}  | 
-| Double precision  | 64    | 52             | 11             | {{:en:multiasm:cs:float_dp_min.png?120}}  | {{:en:multiasm:cs:float_dp_max.png?115}}  +| Double precision  | 64    | 52             | 11             | {{:en:multiasm:cs:float_dp_min.png?100 }}  | {{:en:multiasm:cs:float_dp_max.png?95 }}   
-| Single precision  | 32    | 23             | 8              | {{:en:multiasm:cs:float_sp_min.png?120}}  | {{:en:multiasm:cs:float_sp_max.png?110}}  +| Single precision  | 32    | 23             | 8              | {{:en:multiasm:cs:float_sp_min.png?100 }}  | {{:en:multiasm:cs:float_sp_max.png?90 }}   
-| Half precision    | 16    | 10             | 5              | {{:en:multiasm:cs:float_hp_min.png?110}}  | {{:en:multiasm:cs:float_hp_max.png?100}}  +| Half precision    | 16    | 10             | 5              | {{:en:multiasm:cs:float_hp_min.png?90 }}   | {{:en:multiasm:cs:float_hp_max.png?80 }}   
-| Brain Float       | 16    | 7              | 8              | {{:en:multiasm:cs:float_bf_min.png?120}}  | {{:en:multiasm:cs:float_bf_max.png?110}}  |+| Brain Float       | 16    | 7              | 8              | {{:en:multiasm:cs:float_bf_min.png?100 }}  | {{:en:multiasm:cs:float_bf_max.png?90 }}   |
 </table> </table>
  
 ===== Floating point vector data types ===== ===== Floating point vector data types =====
-Floating point vectors are formed with single or double precision packed data formats. They are processed by SSE or AVX instructions in a SIMD approach of processing. A 128-bit packed data format can store four single-precision data elements or two double-precision data elements. A 256-bit packed data format can store eight single-precision values or four double-precision values. A 512-bit packed data format can store sixteen single-precision values or eight double-precision values. These packed data types are shown in figure {{ref>packedfloattypes}}. Instructions operating on 16-bit half-precision values or Brain Floats can use twice as many such elements simultaneously in comparison to single-precision data.+Floating-point vectors are formed with single or double-precision packed data formats. They are processed by SSE or AVX instructions in a SIMD approach of processing. A 128-bit packed data format can store four single-precision data elements or two double-precision data elements. A 256-bit packed data format can store eight single-precision values or four double-precision values. A 512-bit packed data format can store sixteen single-precision values or eight double-precision values. These packed data types are shown in figure {{ref>packedfloattypes}}. Instructions operating on 16-bit half-precision values or Brain Floats can use twice as many such elements simultaneously in comparison to single-precision data.
 It is worth mentioning that some instructions operate on a single floating-point value, using only the lowest elements of the operands.  It is worth mentioning that some instructions operate on a single floating-point value, using only the lowest elements of the operands. 
  
 <figure packedfloattypes> <figure packedfloattypes>
-{{ :en:multiasm:cs:packed_floats.png?800 |Illustration of packed floating point data types}} +{{ :en:multiasm:cs:packed_floats.png?600 |Illustration of packed floating point data types}} 
-<caption>Pcked floating point data types in x64 architecture</caption>+<caption>Packed floating point data types in x64 architecture</caption>
 </figure> </figure>
  
 ===== Bit field data type ===== ===== Bit field data type =====
 +A bit field is a data type whose size is counted by the number of bits it occupies. The bit field can start at any bit position in the fundamental data type and can be up to 32 bits long. MASM supports it with the RECORD data type. The bit field type is shown in figure {{ref>bitfieldtype}}.
 +
 +<figure bitfieldtype>
 +{{ :en:multiasm:cs:bit_field_type.png?300 |Illustration of bit field data type}}
 +<caption>The bit field data type</caption>
 +</figure>
 +
 +
 +===== Pointers =====
 +Pointers store the address of the memory which contains interesting information. They can point to the data or the instruction. If the segmentation is enabled, pointers can be near or far. The far pointer contains the logical address (formed with the segment and offset parts). The near pointer contains the offset only. The offset can be 16, 32 or 64 bits long. The segment selector is always stored as a 16-bit number. Illustration of possible pointer types is shown in figure {{ref>pointertypes}}.
 +
 +<figure pointertypes>
 +{{ :en:multiasm:cs:pointers_types.png?600 |Illustration of near and far pointers types}}
 +<caption>The near and far pointers types</caption>
 +</figure>
 +
 +<note>
 +The offset is often the result of complex addressing mode calculations and is called an effective address.
 +</note>
 +
en/multiasm/papc/chapter_6_4.1747591917.txt.gz · Last modified: by ktokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0