From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro: Minor nuiscances in 2.2 Date: 26 May 1997 13:36:27 GMT Organization: The National Capital FreeNet Lines: 75 Message-ID: <5mc3kr$a5h@freenet-news.carleton.ca> References: <5ma34v$bho AT freenet-news DOT carleton DOT ca> Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) NNTP-Posting-Host: freenet6.carleton.ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Shawn Hargreaves (Shawn AT talula DOT demon DOT co DOT uk) writes: > Paul Derbyshire writes: >>The first is that calling vsync() in text mode fails. (This seems like it >>should be expected). The problem is it fails rather unpredictably and > > I'm sorry, but I don't think that really qualifies as a bug! In fact, > almost any graphics function will crash if you call it while in text > mode. The vsync() routine is vectored through a pointer in the > GFX_DRIVER structure, but when gfx_driver is NULL this will end up > referencing an address somewhere down in low memory. To be precise, > you'll be calling whatever code is pointed to by the 32 bit int at > memory address #20, which is liable to do all sorts of horrible > things... > > The only graphics related functions that you can safely call from text > mode are the palette fades. I added a special case to deal with those, > because I wanted to be able to fade out the screen when starting a > program, but in the interests of efficiency I'm not going to add similar > checks to any other functions. It's up to you to make sure you are in a > suitable screen mode before you call them... Aha. It did look like it was jumping into never-never-land. The call sequence looked like this: crt0_startup+19 main+12 dua_execute+54 intro_sequence+77 0x00000133 (???) The highlighted line in intro_sequence being vsync(). Perhaps gfx_text should not set the driver to null, but a pointer to a RET... or does that raise hairy problems with other aspects of implementation? >>The second, is that if you have a mouse pointer up, then exit the program >>with something like >> >>set_gfx_mode (GFX_TEXT,80,25,0,0); >>exit(0); >> >>all you get is a silent hang... or so it seems, until you blind-type >>something like MODE CO80 or EXIT. > > Interesting :-) Can I have some source that reproduces this, please? Well, try this... it showed up in a large program I'm doing, but essentially, it did this: #include #include #include // Save me as mousecra.c and compile with gcc mousecra.c -o mousecra.exe // -lalleg, and run mousecra... int main (int argc, char *argv[]) { (void)argc;(void)argv; // Pre-empt warnings allegro_init(); install_timer(); install_keyboard(); // probably not important but it was there install_mouse(); set_gfx_mode (GFX_AUTODETECT,640,480,0,0); show_mouse(screen); set_gfx_mode (GFX_TEXT,80,25,0,0); clrscr(); gotoxy(1,1); printf ("Can you see this? Try MODE CO80 if not.\n"); return 0; } -- .*. Where feelings are concerned, answers are rarely simple [GeneDeWeese] -() < When I go to the theater, I always go straight to the "bag and mix" `*' bulk candy section...because variety is the spice of life... [me] Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh