 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Alan Brown Guest
|
Posted: Thu Feb 24, 2005 7:32 am Post subject: Setting Pointer to Video memory |
|
|
Subject: Setting Pointer to Video memory
Newsgroups: Optus:comp.lang.c++.moderated
Hi People,
[Sorry for the cross-posting - my post seems not to have reached the other
group.]
I am trying to create a Help Screen in a program. I want to swap out the
video memory, use the screen, then swap back the original contents of the
screen.
The following is the relevant parts of a program that works -
---------------------------------------------------------
#include <dos.h>;
#include <conio.h>;
...
...
...
struct Scrn // struct for Screen memory
{
char n[4000];
};
...
...
...
void ScreenSwap() // Test swapping windows
{
ShowHeader("Screen Swapping");
int i;
Scrn dest;
for (i=0; i<4000; i++) // Write out Video memory to structure
{
dest.n[i] = peekb(0xb800, 0000 + i);
}
getch(); // Pause...
textcolor(LIGHTRED); // Clear Screen to different colors
textbackground(BLACK);
clrscr();
getch(); // Pause...
for (i=0; i<4000; i++) // Read back from structure into Video memory
{
pokeb(0xb800, 0000 + i, dest.n[i]);
}
getch();
}
...
...
...
---------------------------------------------------------
The above works. But I want to use 'memcopy' or 'memmove' instead. But I
am not able to set a pointer to an absolute address such as 0xB8000000.
If it is possible to do this I would be grateful if someone could help me
please.
Alan
|
|
| Back to top |
|
 |
Raymond Martineau Guest
|
Posted: Thu Feb 24, 2005 11:06 pm Post subject: Re: Setting Pointer to Video memory |
|
|
On 24 Feb 2005 07:32:22 GMT, Alan Brown <rigelau (AT) yahoo (DOT) nospam.com.au>
wrote:
| Quote: | Subject: Setting Pointer to Video memory
Newsgroups: Optus:comp.lang.c++.moderated
Hi People,
[Sorry for the cross-posting - my post seems not to have reached the other
group.]
I am trying to create a Help Screen in a program. I want to swap out the
video memory, use the screen, then swap back the original contents of the
screen.
|
[...]
| Quote: | The above works. But I want to use 'memcopy' or 'memmove' instead. But I
am not able to set a pointer to an absolute address such as 0xB8000000.
|
The procedure for initializing an absolute address into a pointer (aside
from NULL) is system specific. For example, you might be able to use a
C-style or reinterpret_cast to convert an integer into a void pointer, but
other systems will not allow the user to directly access that memoey.
If a direct cast does not work, you will need to read the documentation
that came with your compiler (or at least try to find out how the your
compiler represents a pointer.)
|
|
| Back to top |
|
 |
Alan Brown Guest
|
Posted: Fri Feb 25, 2005 2:48 am Post subject: Re: Setting Pointer to Video memory |
|
|
[email]bk039 (AT) ncf (DOT) ca[/email] (Raymond Martineau) wrote in
news:ucns11hrt1dmgd2m54qr9bniif2m53klla (AT) 4ax (DOT) com:
| Quote: |
[Sorry for the cross-posting - my post seems not to have reached the
other group.]
I am trying to create a Help Screen in a program. I want to swap out
the video memory, use the screen, then swap back the original contents
of the screen.
[...]
The above works. But I want to use 'memcopy' or 'memmove' instead.
But I am not able to set a pointer to an absolute address such as
0xB8000000.
The procedure for initializing an absolute address into a pointer
(aside from NULL) is system specific. For example, you might be able
to use a C-style or reinterpret_cast to convert an integer into a void
pointer, but other systems will not allow the user to directly access
that memoey.
If a direct cast does not work, you will need to read the
documentation that came with your compiler (or at least try to find
out how the your compiler represents a pointer.)
|
Thanks for your reply.
I forgot to say that I am using Borland C++ 3.1 under Windows 98SE.
I will try what you suggest. I have no documentation for the compiler
other than the on-line help and some general reference manuals on C and C++
Since my code works OK there is not really a problem - I was looking for a
"neater" way of accessing Video memory.
Thanks again
Alan
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|