diff options
| author | 2024-02-24 18:01:09 +0200 | |
|---|---|---|
| committer | 2024-02-24 18:01:09 +0200 | |
| commit | c053056b8effb5c35454f8e90548f43be0ce1ef0 (patch) | |
| tree | c4195f1e6f41729e3de4c5b52fd70e1c77afa71d /boot.asm | |
| download | mbr-trans-flag-main.tar.gz mbr-trans-flag-main.tar.xz mbr-trans-flag-main.zip | |
Diffstat (limited to 'boot.asm')
| -rw-r--r-- | boot.asm | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/boot.asm b/boot.asm new file mode 100644 index 0000000..f80ba16 --- /dev/null +++ b/boot.asm | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | ;; This thing is licensed under Creative Commons Zero v1.0 Universal, which essentially means | ||
| 2 | ;; "Public Domain". (You can do anything you want without asking for permission). | ||
| 3 | ;; | ||
| 4 | ;; SPDX-License-Identifier: CC0-1.0 | ||
| 5 | ;; | ||
| 6 | ;; To compile | ||
| 7 | ;; $ nasm -f bin -o boot.bin boot.asm | ||
| 8 | ;; | ||
| 9 | ;; To run | ||
| 10 | ;; $ qemu-system-i386 -fda boot.bin | ||
| 11 | ;; | ||
| 12 | ;; You can also run this by burning it to a floppy or a hard drive but I am not to be held | ||
| 13 | ;; responsible for any lost partitions, filesystems, or bootloaders. | ||
| 14 | |||
| 15 | BITS 16 | ||
| 16 | |||
| 17 | mov ax, 0xB800 | ||
| 18 | mov es, ax | ||
| 19 | xor di, di | ||
| 20 | |||
| 21 | mov ax, 0xBB20 | ||
| 22 | mov cx, 80*5 | ||
| 23 | rep stosw | ||
| 24 | |||
| 25 | mov ah, 0xDD | ||
| 26 | mov cx, 80*5 | ||
| 27 | rep stosw | ||
| 28 | |||
| 29 | mov ah, 0xFF | ||
| 30 | mov cx, 80*5 | ||
| 31 | rep stosw | ||
| 32 | |||
| 33 | mov ah, 0xDD | ||
| 34 | mov cx, 80*5 | ||
| 35 | rep stosw | ||
| 36 | |||
| 37 | mov ah, 0xBB | ||
| 38 | mov cx, 80*5 | ||
| 39 | rep stosw | ||
| 40 | |||
| 41 | halt: | ||
| 42 | cli | ||
| 43 | hlt | ||
| 44 | jmp halt | ||
| 45 | |||
| 46 | ; There's still ~463 bytes free here | ||
| 47 | |||
| 48 | times 510-($-$$) db 0 | ||
| 49 | dw 0xAA55 | ||