delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/15/11:51:43

From: Endlisnis <s257m AT unb DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: ? array[n] or array[n+1] ?
Date: Sat, 15 May 1999 00:43:05 -0400
Organization: BrunNet
Lines: 48
Message-ID: <373CFB59.3217FD59@unb.ca>
References: <37367f71 DOT 6271443 AT news DOT wanadoo DOT fr> <3736A098 DOT 55E268BE AT softhome DOT net> <373c0195 DOT 3902906 AT news DOT wanadoo DOT fr> <3737f542 DOT 0 AT nnrp1 DOT news DOT uk DOT psi DOT net> <3739F455 DOT 1818FDD7 AT unb DOT ca> <373a1915 DOT 3102234 AT noticias DOT iies DOT es> <7hfenm$k6m$1 AT news4 DOT svr DOT pol DOT co DOT uk> <373c4f0a DOT 7518034 AT noticias DOT iies DOT es> <373b6f4f DOT 1667132 AT noticias DOT iies DOT es>
NNTP-Posting-Host: ftnts2c9.brunnet.net
Mime-Version: 1.0
X-Mailer: Mozilla 4.51 [en] (Win95; U)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019