0

I am trying to read the next sector of a disk through bios functions. Here is my code

[org 0x7c00]

; Jump past bios paramater
jmp 0x0000:0x7c16
times 0x16 - ($ - $$) db 0x00

; Set ds register to 0
mov ax, 0x0000
mov ds, ax
mov [DISK], dl

; Read from disk
mov ah, 0x02   ; Function
mov al, 0x01   ; Sectors to read
mov ch, 0x00   ; Cylinder 
mov cl, 0x02   ; Sectors
mov dh, 0x00   ; Head
mov dl, [DISK]   ; Disk

mov ax, 0x0000 
mov es, ax     ; Offset
mov bx, 0x7e00

int 0x13 

; Print char
mov al, [0x7e01]
mov ah, 0x0e
int 0x10

jmp $

DISK: db 0

times 0x1fe - ($ - $$) db 0x00
db 0x55, 0xaa

times 1024 db 'a'

But it just prints out one space. Here is how I assemble and run it.

nasm -f bin test.asm -o test.bin
qemu-system-x86_64 -drive format=raw,file=test.bin

If there is a better way to do this please tell me. Also please don't just say to write this on dos instead of bare metal.

0 Answers0