The following two statements for initializing the data segment register
mov AX, @Data
mov DS, AX
but the actual data segment address is known only when the loader loads the program in memory.
- What does the assembler puts in place of @data?
- When the loader gets the actual data segment base address does it replace the instruction mov AX, @data with the mov AX, Actual Base Address?
- Why it is necessary to write this statement when the actual base address is not known before the loading stage?
Each time you write an instruction like mov AX, @Data the compiler/assembler inserts 3 bytes in your program:
AX it will be 0B8h
- What does the assembler puts in place of @data?
This number represents the distance between the start of the executable (when loaded in memory) and the start of the data section. This number is expressed in paragraphs aka chunks of 16 bytes.
- When the loader gets the actual data segment base address does it replace the instruction mov AX, @data with the mov AX, Actual Base Address?
The loader only updates the 2nd and 3rd bytes. It never touches the 1st byte!
- Why it is necessary to write this statement when the actual base address is not known before the loading stage?
Everywhere your write these instructions (there can be many of these), you provide DOS with placeholders where the DOS loader can insert the correct addresses.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With