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>