From: Dave Dribin Newsgroups: comp.os.msdos.djgpp Subject: Allegro 3.12: page fault in generate_optimized_palette() Date: 6 Nov 1999 06:06:48 GMT Organization: EnterAct L.L.C. Turbo-Elite News Server Lines: 94 Message-ID: <800gho$aut$1@eve.enteract.com> NNTP-Posting-Host: 207.229.143.41 User-Agent: tin/pre-1.4-19990624 ("Dawnrazor") (UNIX) (FreeBSD/3.3-STABLE (i386)) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello, I'm getting a page fault in generate_optimized_palette() using Allegro 3.12 (more info on what I'm trying to do below): ----- crash ----- Exiting due to signal SIGSEGV Page fault at eip=0009e991, error=0004 eax=000000a8 ebx=00000000 ecx=fffe1a34 edx=00251a34 esi=00270000 edi=0026fffc ebp=00171178 esp=0017116c program=C:\SRC\GLAUNCH\_gl32.exe cs: sel=0137 base=104c0000 limit=0026ffff ds: sel=013f base=104c0000 limit=0026ffff es: sel=013f base=104c0000 limit=0026ffff fs: sel=013f base=104c0000 limit=0026ffff gs: sel=014f base=00000000 limit=0010ffff ss: sel=013f base=104c0000 limit=0026ffff App stack: [001727cc..000f27cc] Exceptn stack: [000f26ac..000f076c] Call frame traceback EIPs: 0x0009e991 ___dj_movedata+37 0x000268f1 _generate_optimized_palette+2713, line 375 of quantize.c 0x00001749 show(char *)+245, line 47 of glmain32.cc 0x00001a8f _main+143, line 147 of glmain32.cc 0x00092306 ___crt1_startup+174 ----- Looking at ling 375 of my modified quantize.c, it's a memcpy(): ----- quantize.c + fprintf()'s ----- 367 for (i=0; iw, bmp->h); blit(bmp, bmp16, 0, 0, 0, 0, bmp->w, bmp->h); unselect_palette(); i = generate_optimized_palette(bmp16, pal, my_reserved_colors); set_palette(pal); blit(bmp16, bmp, 0, 0, 0, 0, bmp->w, bmp->h); /* Blit somewhere on screen... */ This works just fine and dandy..... until one of the colors I reserve is black! Then I get the page fault as above. Can I not reserve black? Any ideas? Is there an easier way to do this? Can I do it at all? :) Thanx for any help, -Dave