Code: Select all
[BITS 16]
mov ax, 07C0h ; Set up 4K stack space after this bootloader
add ax, 288 ; (4096 + 512) / 16 bytes per paragraph
mov ss, ax
mov sp, 4096
mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax
However, when the [ORG 0x7c00] directive is added, does it affect segmentation offset?
If it does, then is this code, essentially equivalent to the original:
Code: Select all
[BITS 16]
[ORG 0x7c00]
mov ax, 0x120
mov ss, ax
mov sp, 0x1000
; The segment is: 0x0120:0x7c00 right? So that translates to 0x1200 + 0x7c00 = 0x8e00, right?
; For the data segment, it is: 0x000:0x7c00 which is just 0x7c00.
mov ax, 0
mov ds, ax