Message-Id: <199809211535.QAA10414@rochefort.ns.easynet.net> Comments: Authenticated sender is From: "George Foot" To: Rylan Date: Sat, 19 Sep 1998 00:27:55 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: help! SIGILL?!? Reply-to: mert0407 AT sable DOT ox DOT ac DOT uk CC: djgpp AT delorie DOT com Precedence: bulk On 16 Sep 98 at 7:39, Rylan wrote: > I recently encountered a similar problem under Allegro while doing graphics > programming using NASM (a so called "demo") - I found that any compound > instructions such as LODS STOS etc. where a no no - Allegro didn't seem to > like me putting ANY descriptor other than the default one in DS - some of > the compound instructions use DS as an implied "segment" register and all > Allegro functions want valid descriptors (to Allegro, not DPMI "valid") in > DS - so I rewrote my code to use my own versions of the compound > instructions - LODSB becomes mov al,[es:si] inc esi - +- - try it and see if > the problem goes away. You can put whatever you like in any register while your code executes, but you must restore the values of most of the registers before you return, and they should contain particular values whenever you call gcc-compiled code (in particular, make sure the stack is sensible and that CS=DS=ES=SS). I think (but am not sure) that when a hardware interrupt occurs the segment registers are restored to the normal values automatically. Perhaps someone can confirm this. If they're not then it has major ramifications as far as functions like movedata are concerned... no, surely the registers are restored. What makes you think it's Allegro that doesn't like it when you change these registers? If you're calling Allegro functions then remember that they were compiled with gcc so you must preserve the four main segment registers. If you're referring to the "Shutting down Allegro" message, then remember that that is printed whenever the program crashes, just to let you know that the signal is being processed by Allegro's handler (which is there to get Allegro out of the way when the program exits). -- george DOT foot AT merton DOT oxford DOT ac DOT uk