From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Beginner Help Wanted (getkey() and VGA) Date: Mon, 03 Nov 1997 03:55:44 +0000 Organization: Two pounds of chaos and a pinch of salt Lines: 53 Message-ID: <345D4B40.2924@cs.com> References: <01bce79c$05750200$9c7e9ec2 AT jbportable> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp228.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Content-Transfer-Encoding: 8bit Precedence: bulk Johnny BARRAY wrote: > > #include > > void main() > { > while (1==1) > printf("%d ", getkey()); > } This code doesn't lock up on me, although it doesn't work the way you apparently want it to. Here are the bugs: 1) getkey() is defined in , which you aren't including. 2) main() must return an integer under ANSI C. void main() is illegal. 3) Because stdout in DJGPP is line-buffered, you don't actually see any output from the program until you break out of it. However, it doesn't lock up or crash; Ctrl-C exits just fine. > It's a test to see getkey() returned values. > Anyway my computer lock up when I run it from DOS 6.22. > When I press anykey (even Ctrl-C), nothing append. > > I can only reboot !!! I ran it from a Win95 DOS shell; I haven't tried from DOS 6.22 yet. But there's absolutely no reason for this code to lock. Are you _sure_ that Ctrl-C and Ctrl-Break don't work? Did you try pressing Enter after hitting Ctrl-C? > Another simple question : > What is the VGA addresse in v2 (not the same à V1 ??) The absolute address for video memory has not changed; it's still at 0xa0000. However, DJGPP v2 runs in protected mode, which means that you cannot simply write to any absolute memory address. Doing this causes your program to violate memory protection and crash. Please download and read the DJGPP FAQ (v2/faq210b.zip from SimTel or online at http://www.delorie.com/djgpp/v2faq/), and look in chapters 10 and 18 for precise instructions for accessing video memory and other hardware devices. -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | Plan: To find ANYONE willing to | http://www.cs.com/fighteer | | play Descent 2 on DWANGO! | Tagline: | ---------------------------------------------------------------------