+ ; blank out the existing boot signature to really see if a boot sector
+ ; gets loaded correctly
+ xor ax, ax
+ mov [bootsig], ax
+
+ ; load from BOOT_DEV into 7c00h and jump
+ mov bx, 7c00h
+ mov ax, 0201h ; ah: call 2 (read sectors), al: count = 1
+ mov cx, 1 ; ch: cylinder 0, cl: sector 1
+ mov dx, BOOT_DEV ; dh: head 0, dl: boot device number
+ int 13h
+ floppy_motor_off ; turn floppy motor off (if dl < 80h)
+
+ jc .fail ; BIOS will set the carry flag on failure
+ mov ax, [bootsig]
+ cmp ax, 0aa55h
+ jnz .fail ; fail if what we loaded is not a valid boot sect
+
+ mov ax, 0e0dh
+ mov bx, 7
+ int 10h
+ mov ax, 0e0ah
+ int 10h
+
+ jmp 7c00h ; all checks passed, jump there
+
+.fail: mov ax, str_bootfail
+ call printstr
+.hang: cli
+ hlt