Mail Archives: djgpp/1999/05/15/11:51:43
Guillermo Rodriguez Garcia wrote:
> >There is no memory mapped IO in PCs,
> OK, this is not true. Still, I can't see how can you switch graphic
> modes by writing data to memory or to the HD.
Here is an example. DO NOT RUN THIS. Also, I have not tested it, but it
should show the general idea:
void Func()
{
asm (
"0:
movl $0x13, %ax;
int $0x10;
movl $0x3, %ax;
int $0x10;
jmp 0b;
");
}
int main(int argc, char *argv[])
{
unsigned a[4];
for(int i=-20; i<30; i++) a[i] = (unsigned)Func;
return 0;
}
I have not tested this (for obvious reasons), but this should, just by
overwriting the end (and beginning) of an array make the monitor start
switching between 80x25 text and 320x200x256 graphics. I didn't remember
whether the stack grew up or down from the return address, so I did both.
There might be some alignment issue which makes this not work, but that
doesn't really matter. The point is, any problem that exists with this code
could be easily fixed so this program started the monitor switching ... just
by writing into ram.
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT HotMail DOT com
ICQ: 32959047
- Raw text -