|
-
Jun 25th, 2000, 02:31 PM
#1
Thread Starter
Junior Member
This may seem simple, but would anyone be able to tell me how to write directly to memory in c (not c++), namely for SVGA graphics? Qbasic has it's "poke" and "peek" functions but I can't seem to find the equivalent in c.
-
Jun 26th, 2000, 01:42 AM
#2
Monday Morning Lunatic
to write directly to a specific memory location in c, you need something like the following code. DON'T RUN THIS!!!!! IT WILL SERIOUSLY KILL YOUR COMPUTER!!!!!!
sorry.
Code:
#include <stdio.h>
#include <stdlib.h>
void main() {
char* pcMyVariable;
char* pcMyString = "Here is a string";
pcMyVariable = 0x6552; // random memory address
strcpy(pcMyVariable, pcMyString);
}
obviously, you set the memory address to whatever is needed - if you need to write to video memory, there are ways to find the base address. i assume that you know how to set up the screen mode, and just need to write something. anyway, all you do is set the pointer to your memory location and write away. and then your program dies because you messed up (it happens to me a lot!).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 26th, 2000, 07:16 PM
#3
Thread Starter
Junior Member
That sounds cool, but unfortunately I am still stuck in the c data segment. I don't suppose c supports segment overrides (or perhaps a way to trick it like a far external char in video segment 0xA000) ?
-
Jun 27th, 2000, 12:10 AM
#4
Monday Morning Lunatic
make it a big enough address that it wraps round...there is a method floating round the Internet somewhere, but I
a) have never used it
b) never intend to use it
c) don't understand it
So I think you can see my problem.
Let's try something:
DOES ANYONE OUT THERE KNOW HOW TO GET AT VIDEO MEMORY FROM DOS!!!!!!!
Now to wait for the punters to 'flood in'...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|