You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
1.8 KiB
ArmAsm

; BIOS puts our boot sector at 0000:7c00
org 0x7c00
; We're (probably) in real mode
bits 16
; Disable interrupts, fuck knows what an interrupt would do right now
cli
xor ax, ax
mov ds, ax
mov es, ax
; Put the stack base at the address of our program text (stack will grow high->low away from it).
; We're not doing anything with a stack right now but who knows we might want to later
mov ss, ax
mov sp, 0x7c00
; Segment for VGA (0xb800 * 16 = 0xb8000)
mov ax, 0xb800
mov fs, ax
; Set VGA mode
; https://mendelson.org/wpdos/videomodes.txt
mov ah, 0x00
mov al, 0x03
int 0x10
; Reveal the true nature of jen
xor bx, bx
mov ax, 17
loop:
cmp ax, bx
jle done
lea si, [womble + bx]
mov dh, [si]
mov di, bx
shl di, 1
mov byte fs:[di], dh
mov byte fs:[di + 1], 0x1f
inc bx
jmp loop
done:
hlt
womble:
db "jen is a womble!"
; TODO: enable A20
; TODO: load a second stage
; TODO: grab all the info we can from bios interrupts and deliver it to ths OS nicely
; e.g. in a fixed memory location
; TODO:
; - Generate GPT in justfile
; - Parse global parition table
; - Load second stage from GPT partition with a particular UUID / name like GRUB does
; (it's Hah!IdontNeedEFI in GRUB)
; - https://en.wikipedia.org/wiki/BIOS_boot_partition
; - Future work:
; - Boot from UEFI
; - Boot on non-GPT partitioned disk
; MBR bootstrap field is 440 bytes long
%if ($ - $$) > 440
%error "exceeded mbr bootstrap field size"
%endif
; Pad to the end of the MBR bootstrap field
times 440 - ($ - $$) db 0
; Unique disk ID
dd 0x00000000
; Reserved
dw 0x0000
; Zero the partition fields
; TODO: fill in the field pointing to the GPT table
times 510 - ($ - $$) db 0
; Boot signature
db 0x55
db 0xaa