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.
Printable View
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.
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.
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!).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);
}
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) ?
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'...