www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/02/20/12:41:55

Xref: news2.mv.net comp.os.msdos.djgpp:1270
Newsgroups: comp.os.msdos.djgpp
From: Carrot <st2edea AT doc DOT ntu DOT ac DOT uk>
Subject: Why the crash ?
Message-ID: <Pine.SUN.3.91.960220095423.24086A@chris>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019