Xref: news2.mv.net comp.os.msdos.djgpp:1270 Newsgroups: comp.os.msdos.djgpp From: Carrot Subject: Why the crash ? Content-Type: TEXT/PLAIN; charset=US-ASCII Message-ID: Sender: news AT doc DOT ntu DOT ac DOT uk Organization: The Nottingham Trent University, DOC. Mime-Version: 1.0 Date: Tue, 20 Feb 1996 10:05:49 GMT Lines: 46 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Oh man. Somebody help me please.... I'm new to DJGPP and have started using inline assembly within my code. At the moment, I'm trying to convert my old graphics routines to DJGPP v2 and am experiencing segment problems when accessing VGA memory at 0xA0000 (mode 13h). Here's an example of the problem I'm getting... int DOS_SEG; void Clear_VGA() { DOS_SEG=_go32_conventional_mem_selector(); ASM_LENGTH=16000; asm(" pushw %es movw _DOS_SEG,%es movl $0xA0000,%edi movw $0,%eax movw _ASM_LENGTH,%cx rep stosl pop %es ") } Okay, if I call this function as a 'one-off' call it works fine. BUT, if I, say, put it in a loop for some reason (where it is called many times a second) it refuses to work or simply crashes. This also happens when calling some of my other functions as well (such as writing pixels direct to DOS VGA memory). Is there an easy way to get around this problem ? I know that the _far* functions are pretty good once compiled, but I want to improve my assembly ! Any help would be greatly appreciated. Cheers, Carrot