Disk geometry (Int 13h AH=08h) problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
chargh
Posts: 2
Joined: Fri Aug 19, 2011 6:25 am

Disk geometry (Int 13h AH=08h) problem

Post by chargh »

Currently I'm making my boot-loader a little bit more fancy. Now a problem arises when I try to acquire the disc geometry. I call bios interrupt 13h AH=08h (in 16bit mode) for the first hard drive (which is a 1mb image loaded with qemu 'qemu <image_name>'). The max head number is 15, the max sector number is 63 and the max cylinder number is 0. If I'm correct this results in a disk smaller then 1mb? I use my own assembler which is non-English, but I know for sure that the code I wrote is the code that is written, here is the result from ndisasm:

Code: Select all

mov ax,0x0
mov es,ax
mov di,0x0
mov ah,0x8
mov dl,[0x8227] ;here is the drive id stored (0h80)
int 0x13
jc error
cmp dl, 0
je error
After this code I call my print number routine which tells me that cx contains the number 63, so cylinder count == 0. So what is wrong with this code? Is there a other way to acquire the disk geometry (the disk doesn't have a MBR because I use a different layout that I designed myself). I searched for a way to force the bios to use LBA (since some places hinted at the existence of such functionality) but could not find any information, is it possible?
Last edited by chargh on Fri Aug 19, 2011 7:02 am, edited 1 time in total.
chargh
Posts: 2
Joined: Fri Aug 19, 2011 6:25 am

Re: Int 13h AH=08h

Post by chargh »

I tried AH=48h, but it gives me a error (sets the carry).

EDIT: Never mind, if I increase the disk size it works.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Disk geometry (Int 13h AH=08h) problem

Post by egos »

If max cylinder number is 0 then cylinder count = 1. That's alright.

You should ignore "max cylinder number" value when using this service for large disks. Only SPT and Heads values are useful for bootloaders to convert LBA to CHS.
If you have seen bad English in my words, tell me what's wrong, please.
Post Reply