Memory adress of screen

Discussion in 'C Programming' started by jmorgan, Mar 26, 2008.

  1. jmorgan

    jmorgan Guest

    <html>
    <b>Hi,

    I thought that the memory address of DOS screen is 0x0b00.
    But this didnt work for me.
    Can anyone help in accessing the screen by using this address.
    </b>
    </html>
     
    jmorgan, Mar 26, 2008
    #1
    1. Advertising

  2. In article <>,
    jmorgan <> wrote:

    ><b>Hi,


    >I thought that the memory address of DOS screen is 0x0b00.
    >But this didnt work for me.
    >Can anyone help in accessing the screen by using this address.


    Hmmm, word for word the same as a posting from 19 Mar 2006 19:46:35 -0800
    --
    "Is there any thing whereof it may be said, See, this is new? It hath
    been already of old time, which was before us." -- Ecclesiastes
     
    Walter Roberson, Mar 26, 2008
    #2
    1. Advertising

  3. jmorgan

    jacob navia Guest

    Richard Heathfield wrote:
    > jmorgan said:
    >
    >> I thought that the memory address of DOS screen is 0x0b00.
    >> But this didnt work for me.
    >> Can anyone help in accessing the screen by using this address.

    >
    > <OT>
    > In MS-DOS, the base segment of text video memory is either 0xB000 (if you
    > have a monochrome video adapter) or 0xB800 (for colour). At the cost of
    > making your program non-portable to non-MS-DOS platforms, you can access
    > video memory by setting a pointer to it, like this:
    >
    > unsigned char *scrptr = (unsigned char *)0xB8000000UL;
    >
    > (Make sure you're using large memory model, or it's a bit more
    > complicated.)


    If I remember correctly you can still use far pointers
    in the medium or small memory model if you qualify
    them with "_far", for instance


    unsigned char _far *scrptr = (unsigned char _far *)0xB8000000UL;


    --
    jacob navia
    jacob at jacob point remcomp point fr
    logiciels/informatique
    http://www.cs.virginia.edu/~lcc-win32
     
    jacob navia, Mar 26, 2008
    #3
  4. jmorgan said:

    > I thought that the memory address of DOS screen is 0x0b00.
    > But this didnt work for me.
    > Can anyone help in accessing the screen by using this address.


    <OT>
    In MS-DOS, the base segment of text video memory is either 0xB000 (if you
    have a monochrome video adapter) or 0xB800 (for colour). At the cost of
    making your program non-portable to non-MS-DOS platforms, you can access
    video memory by setting a pointer to it, like this:

    unsigned char *scrptr = (unsigned char *)0xB8000000UL;

    (Make sure you're using large memory model, or it's a bit more
    complicated.)

    Assuming you have a straight 80x25 text display, you can now update the
    character at x, y like this:

    *(scrptr + 160 * y + 2 * x) = 'A';

    and the attribute byte for that character like this:

    *(scrptr + 160 * y + 2 * x + 1) = 0xF0; /* That's either black on white or
    white on black - I forget which */

    For a far better answer, I suggest you ask this in comp.os.msdos.programmer
    where the DOS fans hang out, because they're much more likely to give you
    the benefit of their expertise.
    </OT>

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
     
    Richard Heathfield, Mar 26, 2008
    #4
  5. jmorgan wrote:
    >
    > I thought that the memory address of DOS screen is 0x0b00.
    > But this didnt work for me.
    > Can anyone help in accessing the screen by using this address.


    <OT>
    The address of the text screen buffer on an IBM-PC compatible in real
    mode is B800:0000.
    </OT>

    How to access this in C depends on implementation-specific extensions
    in your particular compiler. You will need to go elsewhere to get
    this implementation-specific information.

    --
    +-------------------------+--------------------+-----------------------+
    | Kenneth J. Brody | www.hvcomputer.com | #include |
    | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
    +-------------------------+--------------------+-----------------------+
    Don't e-mail me at: <mailto:>
     
    Kenneth Brody, Mar 26, 2008
    #5
  6. jacob navia said:

    > Richard Heathfield wrote:


    <snip>

    >> unsigned char *scrptr = (unsigned char *)0xB8000000UL;
    >>
    >> (Make sure you're using large memory model, or it's a bit more
    >> complicated.)

    >
    > If I remember correctly you can still use far pointers
    > in the medium or small memory model if you qualify
    > them with "_far", for instance


    ....which, as I said, is more complicated (but yes, you're right).

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
     
    Richard Heathfield, Mar 26, 2008
    #6
  7. jmorgan

    santosh Guest

    Walter Roberson wrote:

    > In article <>,
    > jmorgan <> wrote:
    >
    >><b>Hi,

    >
    >>I thought that the memory address of DOS screen is 0x0b00.
    >>But this didnt work for me.
    >>Can anyone help in accessing the screen by using this address.

    >
    > Hmmm, word for word the same as a posting from 19 Mar 2006 19:46:35
    > -0800


    That's strange indeed. Even the tags? Maybe it's a periodic post from a
    spammer to harvest the email IDs of the respondents?
     
    santosh, Mar 26, 2008
    #7
  8. jmorgan

    Bartc Guest

    "santosh" <> wrote in message
    news:fsdvdn$qt$...
    > Walter Roberson wrote:
    >
    >> In article <>,
    >> jmorgan <> wrote:
    >>
    >>><b>Hi,

    >>
    >>>I thought that the memory address of DOS screen is 0x0b00.
    >>>But this didnt work for me.
    >>>Can anyone help in accessing the screen by using this address.

    >>
    >> Hmmm, word for word the same as a posting from 19 Mar 2006 19:46:35
    >> -0800

    >
    > That's strange indeed. Even the tags? Maybe it's a periodic post from a
    > spammer to harvest the email IDs of the respondents?


    Maybe a cut-and-paste from the earlier message by someone who wasn't happy
    with the answers at the time. Or maybe thought the DOS memory address may
    have changed in last two years.

    The subject line looks like his own work though, with his own spelling of
    'address'.

    --
    Bart
     
    Bartc, Mar 26, 2008
    #8
  9. In article <fsdt2c$biq$>,
    Walter Roberson <-cnrc.gc.ca> wrote:
    >In article <>,
    >jmorgan <> wrote:
    >
    >><b>Hi,

    >
    >>I thought that the memory address of DOS screen is 0x0b00.
    >>But this didnt work for me.
    >>Can anyone help in accessing the screen by using this address.

    >
    >Hmmm, word for word the same as a posting from 19 Mar 2006 19:46:35 -0800


    Wow. Can you say "Too much time on my hands..." ?

    > "Is there any thing whereof it may be said, See, this is new? It hath
    > been already of old time, which was before us." -- Ecclesiastes


    I guess not.
     
    Kenny McCormack, Mar 26, 2008
    #9
  10. On 26 Mar 2008 at 19:00, Kenny McCormack wrote:
    > In article <fsdt2c$biq$>,
    > Walter Roberson <-cnrc.gc.ca> wrote:
    >>In article <>,
    >>jmorgan <> wrote:
    >>
    >>><b>Hi,

    >>
    >>>I thought that the memory address of DOS screen is 0x0b00.
    >>>But this didnt work for me.
    >>>Can anyone help in accessing the screen by using this address.

    >>
    >>Hmmm, word for word the same as a posting from 19 Mar 2006 19:46:35 -0800

    >
    > Wow. Can you say "Too much time on my hands..." ?


    Jeez, that's truly scary... I mean, I know there are some anaroks around
    here, but that's ridiculous!
     
    Antoninus Twink, Mar 26, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bk
    Replies:
    0
    Views:
    478
  2. Jarod_24

    adress of server

    Jarod_24, Apr 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    323
    Jarod_24
    Apr 2, 2004
  3. Jarod_24

    adress of project folder

    Jarod_24, Apr 3, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    329
    Jarod_24
    Apr 5, 2004
  4. Lars Netzel
    Replies:
    2
    Views:
    334
    Lars Netzel
    Jul 9, 2004
  5. TIM
    Replies:
    9
    Views:
    561
    Kevin Goodsell
    Apr 12, 2004
Loading...

Share This Page