Calling an Int from C

Hi i dont know how to do to pass an address in real mode to an interruption in C. For example the int13 subfunction 0x48 ask for the address of the buffer in DS:SI registers. Well what i do is to create an structure and pass the address of it, but it doesnt work.
To be more especific what i wanna do is to call a bios int to get disk parameters and the int subfuction ask me an address where i wanna recive the disk info, something like this:

/* Begin Code */

struct DiskInfo {

int Var1;
int var2; //Etc...

}

void main (void)

{

asm {

mov ah, 0x48 //Int13 subfunction number
mov dl, 0x80 //Drive number (c:)
mov si, &DiskInfo //Buffer ---> This is the problematic part *
}

}

/* End Code */

* Here i store the Structure base address to si register, but it doesnt return me the values!!
can someone help me???

Thanks

Comments

  • : Hi i dont know how to do to pass an address in real mode to an interruption in C. For example the int13 subfunction 0x48 ask for the address of the buffer in DS:SI registers. Well what i do is to create an structure and pass the address of it, but it doesnt work.
    : To be more especific what i wanna do is to call a bios int to get disk parameters and the int subfuction ask me an address where i wanna recive the disk info, something like this:
    :
    : /* Begin Code */
    :
    : struct DiskInfo {
    :
    : int Var1;
    : int var2; //Etc...
    :
    : }
    :
    : void main (void)
    :
    : {
    :
    : asm {
    :
    : mov ah, 0x48 //Int13 subfunction number
    : mov dl, 0x80 //Drive number (c:)
    : mov si, &DiskInfo //Buffer ---> This is the problematic part *
    : }
    :
    : }
    :
    : /* End Code */
    :
    : * Here i store the Structure base address to si register, but it doesnt return me the values!!
    : can someone help me???
    :
    : Thanks
    :

    First you need a variable of type DiskInfo: :-)
    [code]
    DiskInfo disk_info;
    [/code]
    then use the LEA instruction or the OFFSET operator, something like this:
    [code]
    mov si, OFFSET disk_info
    lea si, disk_info
    [/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion