These are some things I tried
1. I changed it to write mode and set the drive number to 0x81 the next thing I knew I overwritten sector 2 of main hard disk! by accident this proves that my processor and bios has no problem reading my IO instructions
2. I tried drive 0x82 and my operating system bounces with a message Failed to read sector
3. I tried drive 0x80 and I had no error message but it did not successfully output A which is what the program on sector 2 was written to do
4. Apparently the Bios sets the DL register to the correct drive number after it jumps to 0x7c00 so I then didn't bother setting the DL register and again I had no error message but it failed to show me the letter A
Here is my code:
Code: Select all
[org 0]
[bits 16]
jmp 0x07c0:start
start:
mov ax, cs
mov ds, ax
mov es, ax
mov si, loading
call print
mov ah, 02h ; Read mode
mov al, 1 ; number of sectors to read
mov ch, 0 ; Cylinder
mov cl, 2 ; Sector
mov dh, 0 ; Head
mov bx, 0x07e0
mov es, bx
mov bx, 0
int 13h
jc failed
jmp 0x07e0:0
failed:
mov si, wfail
call print
jmp $
print:
lodsb
cmp al, 0
je done
mov ah, 0x0e
int 10h
jmp print
done:
ret
loading:
db "Grape Loading",13,10, 0
wfail:
db "Failed to read sector",13,10,0
times 510 - ($-$$) db 0
dw 0xaa55
and the kernel
Code: Select all
[org 0]
[bits 16]
mov ah, 0x0e
mov al, 65
int 10h
jmp $
Thanks!