A very primitive bootloader created with NASM assembly language.
- In real mode memory is addressed using a logical address rather than a physical address.
- Given a logical address starting at A, with offset B, reconstructed physical address would be (A * 0x10 + B).
- Code resides at 0x7C00, so DS may begin at 0x7C0
mov ax, 0x7C0
mov ds, ax
- We create the stack segment right after the 512 bytes of the bootloader, i.e., from 0x7E0 and stack pointer is set initially to point to 0x2000.
mov ax, 0x7E0
mov ss, ax
mov sp, 0x2000
- AH = 07h
- AL = number of lines by which to scroll down (00h = clear entire window)
- BH = attribute uses to write blank lines on top of the window
- CH, CL = row, column of window's upper left corner
- DH, DL = row, column of window's lower right corner
- AH = 02h
- BH = page number
- We have set page number as [bp + 4] because, contents of bp takes up 2 bytes and the argument takes up two bytes (Also note that the new bp is the old sp).
- AH = 0Eh
- AL = character to write
- BH = page number