CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Location
    Sri Lanka
    Posts
    120

    Segment:Offset adddressing

    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.

  2. #2
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: Segment:Offset adddressing

    I'm assuming you need this in a 16bit (DOS) C/C++ program ?

    Code:
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured