absolute address

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DosFreak

    #1

    absolute address


    in delphi you can use Ptr to an absolute address, can i do this in vc++.
    in dos, i can use a dos font. i assume that if i save the dos font to
    disk, then edit it, i have a new font. any copyright issues. or michael
    mediford 20 years wrote editfont which did exactly that for dos. i was
    trying to do the same for win32. but anyways, i was trying to get
    biosinfo from the computer using vc++; seems like every computer is
    different, it would be easier to use a pointer to point to it.

    Marc...



    --
    DosFreak
    ------------------------------------------------------------------------
    Posted via http://www.codecomments.com
    ------------------------------------------------------------------------

  • Carl Daniel [VC++ MVP]

    #2
    Re: absolute address

    DosFreak wrote:
    in delphi you can use Ptr to an absolute address, can i do this in
    vc++. in dos, i can use a dos font. i assume that if i save the dos
    font to disk, then edit it, i have a new font. any copyright issues.
    or michael mediford 20 years wrote editfont which did exactly that
    for dos. i was trying to do the same for win32. but anyways, i was
    trying to get biosinfo from the computer using vc++; seems like every
    computer is different, it would be easier to use a pointer to point
    to it.
    There is no access to physical memory under Windows unless you write a
    kernel device driver (and please, don't).

    -cd


    Comment

    • Steve in Albury

      #3
      Re: absolute address

      Are you trying to access memory in bios to get the font, or are you trying
      to store a vriable at a particular memory location?

      Steve

      Comment

      • Tamas Demjen

        #4
        Re: absolute address

        DosFreak wrote:
        in delphi you can use Ptr to an absolute address, can i do this in vc++.
        The Delphi Ptr function converts an integer to a pointer. In C/C++, all
        you need is a cast:

        void* p = reinterpret_cas t<void*>(0xFFFF 5);

        As others have said, this only works in DOS. You'll get an access
        violation if you try to execute this in Win32.

        Also, you should never use an integer to store a pointer, because that's
        not going to work on x64, where int is 32-bit and void* is 64-bit. A lot
        of Delphi code uses integers for HDC and HANDLE variables. There will be
        major portability issues with those programs.

        And finally, if you plan to distribute your product, you shouldn't steal
        the font from the BIOS. There are plenty of monospace fonts out there,
        and some of them were designed to look like a DOS terminal.

        Tom

        Comment

        • Steve McKewen

          #5
          Re: absolute address

          I have used copies of monospaced fonts read out of bioses in portable
          equipment, but I have always ended up modifying the font at least a little
          bit.
          Nowadays I just write a font edit program and draw the font I want.
          It ends up just being an array definition that contains all of the bytes
          from the font.

          If you want a font that is exactly the same as a bios font, but don't want
          to actually use the bios font, then you will have to write your own font
          draw functions anyway. I do that, but only in embedded stuff where I don't
          have access to font systems that meet my needs.

          Steve


          Comment

          Working...