diff options
-rw-r--r-- | src/Makefile | 3 | ||||
-rw-r--r-- | src/boot.asm | 15 | ||||
-rw-r--r-- | src/stage2_real_functions.asm | 6 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/Makefile b/src/Makefile index 3ec465d..fed9fd3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -112,3 +112,6 @@ run-qemu-debug: image.bin run-bochs: bochs -q -f bochs.config 'boot:floppy' 'floppya: 1_44=image.bin, status=inserted' + +run-bochs-hd: + bochs -q -f bochs.config 'boot:disk' 'ata0-master: type=disk, path=image.bin, mode=flat, cylinders=64, heads=4, spt=8, translation=none' diff --git a/src/boot.asm b/src/boot.asm index b047d58..b5febd7 100644 --- a/src/boot.asm +++ b/src/boot.asm @@ -66,9 +66,12 @@ MESSAGE_BOOT_DRIVE: MESSAGE_LOADING_STAGE_2: db "Loading stage 2 boot loader", 0 +MESSAGE_DETECTING_DISK_GEOMETRY: + db "Detecting disk geometry ", 0 + MESSAGE_LOADING_KERNEL: db "Loading kernel", 0 - + BOOT_DRIVE: db 0 @@ -84,13 +87,17 @@ stage2: mov si, MESSAGE_STAGE_2_LOADED call print_string +; detect disk geometry + mov si, MESSAGE_DETECTING_DISK_GEOMETRY + call print_string + mov dl, [BOOT_DRIVE] + call detect_disk_geometry + call print_newline + ; print a message we are now loading the kernel mov si, MESSAGE_LOADING_KERNEL call print_string -; detect disk geometry - mov dl, [BOOT_DRIVE] - call detect_disk_geometry ; load kernel to 0x8400 (directly after stage 2 ; of the boot loader) diff --git a/src/stage2_real_functions.asm b/src/stage2_real_functions.asm index bb05b6e..2db8947 100644 --- a/src/stage2_real_functions.asm +++ b/src/stage2_real_functions.asm @@ -54,7 +54,7 @@ read_from_disk: add bx, 0x200 ; advance write buffer position add [CURRENT_SECTOR], BYTE 1 ; next sector mov ch, [SECTORS_PER_CYLINDER] - cmp [CURRENT_SECTOR], ch ; assuming 18 sectors per track for now + cmp [CURRENT_SECTOR], ch ; after the end of the current track? je .next_head jmp .read_next_sector @@ -62,7 +62,7 @@ read_from_disk: mov [CURRENT_SECTOR], BYTE 1 ; start from first sector again add [CURRENT_HEAD], BYTE 1 ; advance head mov ch, [NOF_HEADS] - cmp [CURRENT_HEAD], ch ; 2 heads on floppies + cmp [CURRENT_HEAD], ch ; after the number of heads? je .next_track jmp .read_next_sector @@ -81,8 +81,8 @@ read_from_disk: ; very efficient though.. ; IN dl: drive to read from read_one_sector_from_disk: + mov ah, 0x02 ; read sectors from drive - mov al, 1 ; read 1 sector mov ch, BYTE [CURRENT_CYLINDER] mov dh, BYTE [CURRENT_HEAD] |