summaryrefslogtreecommitdiff
path: root/boot.asm
blob: f80ba167fd6250991bc6408b9ab92837fdd1dd69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
;; This thing is licensed under Creative Commons Zero v1.0 Universal, which essentially means
;; "Public Domain".  (You can do anything you want without asking for permission).
;;
;; SPDX-License-Identifier: CC0-1.0
;;
;; To compile
;; $ nasm -f bin -o boot.bin boot.asm
;;
;; To run
;; $ qemu-system-i386 -fda boot.bin
;;
;; You can also run this by burning it to a floppy or a hard drive but I am not to be held
;; responsible for any lost partitions, filesystems, or bootloaders.

BITS 16

    mov ax, 0xB800
    mov es, ax
    xor di, di

    mov ax, 0xBB20
    mov cx, 80*5
    rep stosw

    mov ah, 0xDD
    mov cx, 80*5
    rep stosw

    mov ah, 0xFF
    mov cx, 80*5
    rep stosw

    mov ah, 0xDD
    mov cx, 80*5
    rep stosw

    mov ah, 0xBB
    mov cx, 80*5
    rep stosw

halt:
    cli
    hlt
    jmp halt

    ; There's still ~463 bytes free here

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