473,789 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("Scr een 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(LIGHT RED); // 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
Jul 23 '05 #1
2 2762
On 24 Feb 2005 07:32:22 GMT, Alan Brown <ri*****@yahoo. nospam.com.au>
wrote:
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 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_cas t 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.)


Jul 23 '05 #2
bk***@ncf.ca (Raymond Martineau) wrote in
news:uc******** *************** *********@4ax.c om:

[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_cas t 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
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1383
by: Frank Skare | last post by:
Hello! I'm trying to get the configuration from a video driver, the structure is unknown (defined by the driver). The API (ICGetState) wants a pointer to block of memory, unfortunately I'm a totally beginner to interop and unmanaged code. If nobody knows exactly how to do this I would be more than happy if at least somebody could
1
1724
by: b_naick | last post by:
I have an aspx page which embeds a video. Based on an input parameter id, the appropriate video is played. I've hard coded most the of "<object>" and "<embed"> paramters in the HTML. However, the video source needs to be read and populated based on database content.. How can I do this? My HTML is something like this . <OBJECT blah blah>
5
3172
by: Amogh | last post by:
Hi, My question is related to setting freed pointers to NULL. After freeing a pointer: 1) Should the freeing routine also be responsible for setting the pointer to null? 2) Or, should the client/user code be responsible for doing it? On what basis should a decision be made favouring either case ?
4
9459
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change the forms authentication to be a large value for that page also. TIA - Jeff.
2
7893
by: hzgt9b | last post by:
Using VS2003, VB.NET, BACKGROUND I have a window forms based application that will be distributed and executed directly from CD media. The app contains a TreeView control and a WebBroswer (AxSHDocVw.AxWebBrowse) control. The TreeView is populated with nodes that when clicked play an audio clip that is stored on the CD and navigate the browser control to a specified web URL (also stored on the CD). All the web URLs are html documents...
27
2216
by: rocco.rossi | last post by:
I've been trying to write a function capable of checking if a pointer value is set to NULL, and if it isn't, of deallocating and setting it's value to NULL regardless of the pointer's type. I thought "void ** " should do the trick, but I kept getting the following warning message from gcc: warning: passing argument 1 of 'free_var' from incompatible pointer type which obviously could be solved by doing an explicit cast to (void **)
4
1971
by: Ryan Knopp | last post by:
I'm having some bizarre problems with some of my memory allocation. I've ran it threw gdb and noticing my memory indexes aren't matching up. here's an example. I have commented within the code. static void getvideos(xmlTextReaderPtr, struct video**, int*); static struct video *getvideo(xmlTextReaderPtr); struct video **loadconfig(const char const *filename) { xmlTextReaderPtr reader;
3
8316
by: ee0jmt | last post by:
Hi all. Using VB.NET I am using a Frame grabber SDK that passes picturebox.handle to a function in the framegrabber dll and the result is that a video frame is displayed in the picture box. That bits fine. I now need to pass a pointer to that picturebox image to another sdk dll function. I thought that passing picturebox.handle.toint32 was the same as a pointer but I get the following error. Attempted to read or write protected...
25
320
by: Jrdman | last post by:
is it possible to use a pointer to see the data stored in a given address in the memory ? if no what's the appropriate way to do that? thanks.
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9506
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6761
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.