Memory adress of screen

J

jmorgan

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

Walter Roberson

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.

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

jacob navia

Richard said:
jmorgan said:


<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;
 
R

Richard Heathfield

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

Kenneth Brody

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>
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:[email protected]>
 
R

Richard Heathfield

jacob navia said:
Richard Heathfield wrote:


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

santosh

Walter said:
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?
 
B

Bartc

santosh said:
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'.
 
K

Kenny McCormack

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

Antoninus Twink

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!
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top