Click to See Complete Forum and Search --> : Segment:Offset adddressing


susiriss
December 31st, 2004, 05:46 AM
Dear friends,
Can anyone show me how to implement segment: offset addressing in C/C++. I just want to read the buffer pointed by the DS:SI after calling the function 48h of BIOS interrupt 13h which yields hard disk parameters.
How can I read the 4-byte integer at offset 8h from the DS:SI buffer address. Please help me and attach a sample code if possible.

Thanks, you were always helpful !
susiriss.

OReubens
December 31st, 2004, 08:32 PM
I'm assuming you need this in a 16bit (DOS) C/C++ program ?


long int far * lpfData = (long int far *)(((long unsigned int)regs.x.DS<<16) + regs.x.SI + 8);


you can then dereference lpfData to get the value.

If you need this in a 32Bit program, things are somewhat more difficult. For starters because you can't as easily call interrupts from 32bit code.