MEmory Addres of DOS screen

Discussion in 'C Programming' started by Arun, Mar 20, 2006.

  1. Arun

    Arun Guest

    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.
    Arun, Mar 20, 2006
    #1
    1. Advertising

  2. Arun

    osmium Guest

    "Arun" writes:

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


    This is the wrong newsgroup. The right one probably has ms-dos or some
    variant of that in it's name. It seems reasonable that a search of Google
    groups might find the answer already posted. At the very least it will tell
    you which groups are active and likely to be useful.
    osmium, Mar 20, 2006
    #2
    1. Advertising

  3. Arun

    santosh Guest

    Arun wrote:
    > 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.


    It is not the memory address of the "DOS screen", whatever that may be,
    but the start of the video memory in the PC's address space. As such,
    your query is highly off-topic to this group. alt.lang.asm would be a
    better group for instance.
    santosh, Mar 20, 2006
    #3
  4. "Arun" <> wrote in message
    news:...
    > 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.
    >


    Sigh... yes. You didn't state compiler you use. This works for DJGPPv2.03
    and OWv1.3.

    #include <stdio.h>
    #include <stdlib.h>
    #ifdef __DJGPP__
    #include <sys/nearptr.h>
    #endif
    #ifdef __WATCOMC__
    #include <i86.h>
    #endif

    #define BSCR 0xB8000
    #ifdef __I86__
    #undef BSCR
    #define BSCR 0xB800
    #endif

    void twiddle(void)
    {
    #ifdef __I86__
    unsigned char __far *screen=MK_FP(BSCR,0);
    #else
    unsigned char *screen=(void *)BSCR;
    #endif

    #ifdef __DJGPP__
    __djgpp_nearptr_enable();
    screen+=__djgpp_conventional_base;
    #endif

    *(screen)+=1;
    *(screen+1)+=1;
    }

    int main(void)
    {
    unsigned long i;

    for (i=0;i<100000;i++)
    twiddle();

    exit(EXIT_SUCCESS);
    #ifdef __WATCOMC__
    return(0);
    #endif
    }


    Rod Pemberton
    Rod Pemberton, Mar 21, 2006
    #4
  5. "Rod Pemberton" <> writes:
    > "Arun" <> wrote in message
    > news:...
    >> 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.
    >>

    >
    > Sigh... yes. You didn't state compiler you use. This works for DJGPPv2.03
    > and OWv1.3.
    >
    > #include <stdio.h>
    > #include <stdlib.h>
    > #ifdef __DJGPP__
    > #include <sys/nearptr.h>
    > #endif

    [snip]
    > exit(EXIT_SUCCESS);
    > #ifdef __WATCOMC__
    > return(0);
    > #endif
    > }


    Can you *please* take this to a newsgroup where it's topical? Posting
    this code in a forum that's lacking in DOS experts who can confirm
    whether it's correct is not helpful to the original poster. In a
    system-specific newsgroup, they might know better approaches for
    whatever task the OP is trying to accomplish.

    (Watcom C needs a "return(0);" *after* a call to
    "exit(EXIT_SUCCESS);"???)

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Mar 21, 2006
    #5
  6. Arun

    Default User Guest

    Keith Thompson wrote:

    > "Rod Pemberton" <> writes:


    [troll stuff]

    > Can you please take this to a newsgroup where it's topical?


    He's trolling, just killfile or at least stop replying to him. He's
    made it clear that he cares not about topicality.



    Brian
    Default User, Mar 21, 2006
    #6
  7. "Keith Thompson" <> wrote in message
    news:...
    > "Rod Pemberton" <> writes:
    > > "Arun" <> wrote in message
    > > news:...
    > >> 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.
    > >>

    > >
    > > Sigh... yes. You didn't state compiler you use. This works for

    DJGPPv2.03
    > > and OWv1.3.
    > >

    > Can you *please* take this to a newsgroup where it's topical?


    He posted here for whatever reason. Many other newsgroups seem to be dead
    lately. So perhaps this group was his only hope. Feel free to complain to
    the OP. It has never stopped you yet.

    > Posting
    > this code in a forum that's lacking in DOS experts who can confirm
    > whether it's correct is not helpful to the original poster.


    There is no need to confirm whether it is correct or not. You should assume
    I'm the "DOS expert" because I posted it.

    > In a
    > system-specific newsgroup, they might know better approaches for
    > whatever task the OP is trying to accomplish.


    Perhaps. But, he chose to post here for whatever reason.

    > (Watcom C needs a "return(0);" *after* a call to
    > "exit(EXIT_SUCCESS);"???)


    Yes, version 1.3 of OW generates warnings if any function including main()
    doesn't contain a return. Hopefully, they've fixed it in 1.4 or 1.5 or soon
    to be 1.6.


    Rod Pemberton
    Rod Pemberton, Mar 21, 2006
    #7
  8. "Default User" <> wrote in message
    news:...
    > Keith Thompson wrote:
    >
    > > "Rod Pemberton" <> writes:

    >
    > [troll stuff]
    >
    > > Can you please take this to a newsgroup where it's topical?

    >
    > He's trolling, just killfile or at least stop replying to him. He's
    > made it clear that he cares not about topicality.


    I'm being the troll? You didn't need to post. You knew the thread was
    off-topic for you from subject line of his post. I'm helping someone who
    apparently needs help in an area where I can help. It doesn't harm anyone
    to respond to his post here. If you don't like off-topic posts please go to
    a moderated newsgroup.


    Rod Pemberton
    Rod Pemberton, Mar 21, 2006
    #8
  9. Arun

    Al Balmer Guest

    On Tue, 21 Mar 2006 16:38:26 -0500, "Rod Pemberton"
    <> wrote:

    >
    >"Keith Thompson" <> wrote in message
    >news:...
    >> "Rod Pemberton" <> writes:
    >> > "Arun" <> wrote in message
    >> > news:...
    >> >> Hi,
    >> >>
    >> >> I thought that the memory address of DOS screen is 0x0b00.

    <snip>
    >> >

    >> Can you *please* take this to a newsgroup where it's topical?

    >
    >He posted here for whatever reason.


    For a first-time poster, we generally assume he didn't know any
    better, and direct him to a more suitable forum. In this case, that
    was done, two days ago. Since he seems to be gone, we assume he found
    the more suitable forum, or wasn't interested enough to pursue it.
    <snip>
    >
    >> Posting
    >> this code in a forum that's lacking in DOS experts who can confirm
    >> whether it's correct is not helpful to the original poster.

    >
    >There is no need to confirm whether it is correct or not. You should assume
    >I'm the "DOS expert" because I posted it.


    Hah. I sincerely hope you're more of an expert on DOS than on
    topicality.
    >

    <snip>

    --
    Al Balmer
    Sun City, AZ
    Al Balmer, Mar 21, 2006
    #9
  10. Al Balmer opined:

    > On Tue, 21 Mar 2006 16:38:26 -0500, "Rod Pemberton"
    > <> wrote:
    >>
    >>There is no need to confirm whether it is correct or not. You should
    >>assume I'm the "DOS expert" because I posted it.

    >
    > Hah. I sincerely hope you're more of an expert on DOS than on
    > topicality.


    Ah, now I see what I'm missing, courtesy of the killfile...

    So, if I now start posting about particle physics (in the context of C,
    of course), that makes me an expert in it. It's good to know. LoL

    --
    BR, Vladimir

    The goys have proven the following theorem...
    -- Physicist John von Neumann, at the start of a classroom
    lecture.
    Vladimir S. Oka, Mar 21, 2006
    #10
  11. Arun

    CBFalconer Guest

    Al Balmer wrote:
    > "Rod Pemberton" <> wrote:
    >

    .... snip ...
    >>
    >> There is no need to confirm whether it is correct or not. You
    >> should assume I'm the "DOS expert" because I posted it.

    >
    > Hah. I sincerely hope you're more of an expert on DOS than on
    > topicality.


    It's all in the sig!

    --

    +-------------------+ .:\:\:/:/:.
    | PLEASE DO NOT F :.:\:\:/:/:.:
    | FEED THE TROLLS | :=.' - - '.=:
    | | '=(\ 9 9 /)='
    | Thank you, | ( (_) )
    | Management | /`-vvv-'\
    +-------------------+ / \
    | | @@@ / /|,,,,,|\ \
    | | @@@ /_// /^\ \\_\
    @x@@x@ | | |/ WW( ( ) )WW
    \||||/ | | \| __\,,\ /,,/__
    \||/ | | | jgs (______Y______)
    /\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    ==============================================================

    fix (vb.): 1. to paper over, obscure, hide from public view; 2.
    to work around, in a way that produces unintended consequences
    that are worse than the original problem. Usage: "Windows ME
    fixes many of the shortcomings of Windows 98 SE". - Hutchison
    CBFalconer, Mar 21, 2006
    #11
  12. On Tue, 21 Mar 2006 16:45:50 -0500, in comp.lang.c , "Rod Pemberton"
    <> wrote:

    >
    >"Default User" <> wrote in message
    >news:...
    >> Keith Thompson wrote:
    >>
    >> > "Rod Pemberton" <> writes:

    >>
    >> [troll stuff]
    >>
    >> > Can you please take this to a newsgroup where it's topical?

    >>
    >> He's trolling, just killfile or at least stop replying to him. He's
    >> made it clear that he cares not about topicality.

    >
    >I'm being the troll?


    Yes. You're posting offtopic posts, deliberately and knowing full well
    they're offtopic. Why do you do that, if its not with the purpose of
    annoying people?

    > You didn't need to post. You knew the thread was
    >off-topic for you from subject line of his post. I'm helping someone who
    >apparently needs help in an area where I can help.


    No, you're making the classic mistake of helping him in exactly the
    place you shouldn't. Again, why do you do that, if its not with the
    purpose of actually being UNhelpful?


    >It doesn't harm anyone
    >to respond to his post here. If you don't like off-topic posts please go to
    >a moderated newsgroup.


    Expect to get flamed more often.
    Mark McIntyre
    --
    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Mark McIntyre, Mar 21, 2006
    #12
  13. On Tue, 21 Mar 2006 16:38:26 -0500, in comp.lang.c , "Rod Pemberton"
    <> wrote:

    >
    >"Keith Thompson" <> wrote in message
    >news:...
    >> Posting
    >> this code in a forum that's lacking in DOS experts who can confirm
    >> whether it's correct is not helpful to the original poster.

    >
    >There is no need to confirm whether it is correct or not. You should assume


    Why? Because you say so? Don't make me laugh.

    >I'm the "DOS expert" because I posted it.


    Well, I'm a real DOS expert, and your code was utter, complete
    nonsense. You apparently have absolutely no idea what you're talking
    about.
    Of course, neither your ridiculous statement nor mine is even remotely
    verifiable. Here in CLC, there's nobody to peer-review our claims. So
    they're worthless.

    >Perhaps. But, he chose to post here for whatever reason.


    Because unlike you, he knew no better. He's blameless. You're not.

    Mark McIntyre
    --
    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Mark McIntyre, Mar 21, 2006
    #13
  14. Arun

    Randy Howard Guest

    Rod Pemberton wrote
    (in article <dvpjvf$484j$>):

    >
    > "Arun" <> wrote in message
    > news:...
    >> 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.
    >>

    >
    > Sigh... yes. You didn't state compiler you use. This works for DJGPPv2.03
    > and OWv1.3.


    Not only is it Off-topic here, but it's incorrect as a solution
    for all DOS systems. Monochrome adapters used b000, color b800.
    You need to detect which is present, and do the right thing.




    --
    Randy Howard (2reply remove FOOBAR)
    "The power of accurate observation is called cynicism by those
    who have not got it." - George Bernard Shaw
    Randy Howard, Mar 24, 2006
    #14
    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. Ben Fairbank
    Replies:
    2
    Views:
    5,452
  2. john san
    Replies:
    19
    Views:
    739
    Diez B. Roggisch
    Feb 18, 2005
  3. tomhr
    Replies:
    27
    Views:
    1,417
    Mike Wahler
    Jan 12, 2006
  4. Joyti
    Replies:
    5
    Views:
    407
    Tomás
    Jun 1, 2006
  5. Suvarna Kale
    Replies:
    1
    Views:
    2,458
    George
    Jul 29, 2008
Loading...

Share This Page