Segment: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "The memory '''segment''' is the hexadecimal byte address in relation to a segment register. The value in a Segment register is multiplied by 16 or shifted one hexadecimal byte to the left(this adds an extra 0 to the end of the hex number). The value in the Offset register is added to it. So, the Absolute address for any combination of Segment and Offset is found using the formula: :::AbsoluteMemoryAddress = (Segment value * 16) + Offset value ''Example:'' {{WhiteS...")
 
No edit summary
Line 10: Line 10:


''Example:''
''Example:''
{{WhiteStart}} '' ''
{{WhiteStart}}
           Segment Address =  F000{{text|0 ← shifted left|red}}
           Segment Address =  F000{{text|0 ← shifted left|red}}
             Offset Address =  + FACE
             Offset Address =  + FACE
                               ------
                               ------
                               FFACE  or  1,047,246 '' ''
                               FFACE  or  1,047,246
{{WhiteEnd}}
{{WhiteEnd}}



Revision as of 02:51, 23 January 2023

The memory segment is the hexadecimal byte address in relation to a segment register.


The value in a Segment register is multiplied by 16 or shifted one hexadecimal byte to the left(this adds an extra 0 to the end of the hex number). The value in the Offset register is added to it. So, the Absolute address for any combination of Segment and Offset is found using the formula:


AbsoluteMemoryAddress = (Segment value * 16) + Offset value


Example: Template:WhiteStart

          Segment Address =   F0000 ← shifted left
           Offset Address =  + FACE
                             ------
                              FFACE  or  1,047,246

Template:WhiteEnd

The Offset value is the position of a value after the segment address. Many pairs can be used to refer to the same memory position.


See also:



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link