I know that in the end of Master Boot Record (MBR) there is a magic number that tells BIOS it is the bootloader, And that we need to fill in the amount of bytes left until it is 512 bytes (MBR size), but how can do we calculate the amount of bytes that remain?
[bits 16] ; 16 bits assembly
[org 0x7c00]
start:
;; Call VideoService interrupt 0x10
;; ah = 0x00 -> SetVideoMode
;; al = 0x13 -> 320x200 16 color
mov ah, 0x00
mov al, 0x13
int 0x10
times 510 - ($ - $$) db 0 ; instead of 510, what number do I need to use?
dw 0xaa55 ; magic number tells BIOS it is the bootloader
Instead of 510, what number do I need to use?