How does assembly ORG instruction calculate offset?

Viewed 48

I am trying to create a simple BIOS boot sector, for which I use an x86 assembly language. I found out that the layout of memory throughout the booting process looks like the picture beneath this text. My idea is to use the ORG assembly instruction to inform the assembler to set a relative memory address (in this case 0x7c00). This way I do not have to bother about calculating memory addresses on the spot. The assembly code looks like this:

[org 0x7C00]
    mov ah, 0x0e
    mov al, [0x09]    ;this is the offset of 'the_secret'
    int 0x10

the_secret:
    db "X"

    times 510 - ($-$$) db 0
    dw 0xaa55

The problem is that when I assemble this code into binary and start the boot process, the "X" does not come up in the terminal. What is the mistake I am making here?

enter image description here

0 Answers
Related