diff options
| author | Quentin LADEVIE <qladevie@wanadev.fr> | 2026-06-06 12:51:06 +0200 |
|---|---|---|
| committer | Quentin LADEVIE <qladevie@wanadev.fr> | 2026-06-06 12:51:06 +0200 |
| commit | 4a352f191406b3947a4fc3f2d15a9e2c78e3874c (patch) | |
| tree | 65042a5ed55598300eea207d6a6a2d020fe19b0a /src | |
| parent | c85b21beda0b65118d6128df6e397c6f95c50281 (diff) | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/boot.s | 57 |
1 files changed, 51 insertions, 6 deletions
@@ -1,15 +1,59 @@ - mov ax, 0x7c0 + ; TODO: Check which MBR partition is bootable and it's type + + cld ; clear the direction flag so that sto* and lod* increment di + + ; Test for EDD + mov ah, 0x41 + mov bx, 0x55AA ; boot signature word, why ? + mov dl, 0x80 ; drive index (HDD 1) + int 0x13 + jc exit + cmp bx, 0xAA55 + jne exit + + ; Read sector 1 + ; fill disk address packet (read 1 sector at offset 1) + mov ax, 0 + mov es, ax + mov di, 0x200 + mov ax, 16 ; size of packet + stosb + mov ax, 0 ; always 0 + stosb + mov ax, 1 ; number of sectors + stosb + mov ax, 0 ; always 0 + stosb + mov ax, 0x200 ; offset + stosw + mov ax, 0x7c0 ; segment + stosw + mov ax, 0x1 ; lower 4 bytes of LBA + stosd + mov ax, 0x0 ; upper 2 bytes of LBA + stosd + mov ax, 0 mov ds, ax - mov ax, 0xb800 ; protected mode video memory segment (addr / 16) - mov es, ax - mov si, msg + mov si, 0x200 + mov ah, 0x42 + mov dl, 0x80 ; drive index (HDD 1) + int 0x13 + +main_continuation: - cld + mov ax, 0xb800 ; protected mode video memory segment (seg / 16 + off) + mov es, ax + mov ax, 0x7c0 + mov ds, ax + mov si, 0x22b + ; mov si, msg call print cli + jmp hang + ; print using BIOS functions ; print_loop: ; lodsb ; load byte from DS:SI into al @@ -34,7 +78,6 @@ print: mov dx, 160 mul dx - xor di, di mov di, bx add di, ax @@ -79,3 +122,5 @@ hang: ; db 'TEST' ; times 0x800000 - ($-$$) db 0 + +exit: |
