From b5d9cf5c89cb89dc49a2ff0af7ad9b334b4d8953 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Tue, 23 Feb 2021 11:35:43 +0100 Subject: [PATCH] Disk read stuff --- src/bootloader_bios_disk.asm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/bootloader_bios_disk.asm b/src/bootloader_bios_disk.asm index 21e3204..211051f 100644 --- a/src/bootloader_bios_disk.asm +++ b/src/bootloader_bios_disk.asm @@ -1,5 +1,24 @@ disk_read: pusha + push dx mov ah, BIOS_DISK_READ - mov al, dh ; number of sectors to read + mov al, dh ; sector count + mov cl, 0x02 + + mov ch, 0x00 ; read from first cylinder + mov dh, 0x00 ; head + + ; data pointer: es:bx (standard) + int BIOS_DISK_INT ; do the interrupt + jc disk_error ; if flag is set then jump to error + +disk_error: + mov bx, DISK_ERROR + call println + + mov dh, ah + + +DISK_ERROR: db "Disk read error", ASCII_END +SECTORS_ERROR: db "Invalid number of sectors read", ASCII_END