www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/09/07:17:21

From: Tal Lavi <ranla AT post DOT tau DOT ac DOT il>
Newsgroups: comp.os.msdos.djgpp
Subject: MAJOR slowdowns in translating TP7 gfx code to DJGPP2: Suplement 2
Date: Wed, 09 Sep 1998 11:40:15 -0700
Organization: Tel Aviv University
Lines: 68
Message-ID: <35F6CB8F.1772@post.tau.ac.il>
NNTP-Posting-Host: slip-112.tau.ac.il
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I inlined my own div function.
Here it is, for your comments:

	typedef struct
	{
	  unsigned short quot;
	  unsigned short rem;
	} short_div_t;


	short_div_t short_div(unsigned short numberator, 
                              unsigned short denomonator)
	{
	  short_div_t short_div;
	  __asm__ __volatile__("
	    divw %%bx"
	  :"=a"(short_div.quot),"=d"(short_div.rem)
	  :"a"(numberator),"d"((unsigned short)0),"b"(denomonator)
	  :"ax","bx","dx"
	  );
	  return(short_div);
	}


Can I #define the inline asm command, instead of calling a real
function?
and does it worth my time?

when using the short_div, the whole thing runs a bit faaster, but not
nearly
enough(Bear in mind that I'm using _farns* functions on a double page
LFB,
it should be FASSST!).
But when I try to compile the file in order to profile it:

 	gcc -o ray.exe ray.c vesa64.c -O2 -ffast-math -pg

The running of the .exe is hanging my system!

With the same command, just without the -pg, it's fine!

I tried to profile without the optimizations, no difference, still
hanging.

Pressing Ctrl+C while the eternal black screen is on, does exit, and
does 
create a gmon.out file.
here it is, does it make sense?!?

Each sample counts as 0.055556 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  Ts/call  Ts/call  name    
100.00      0.06     0.06                             __dpmi_int
  0.00      0.06     0.00    43308     0.00     0.00  short_div
  0.00      0.06     0.00       84     0.00     0.00  CastRay
  0.00      0.06     0.00       83     0.00     0.00  VLine
  0.00      0.06     0.00       46     0.00     0.00  ConvertPtr
  0.00      0.06     0.00       46     0.00     0.00  GetModeInfo
  0.00      0.06     0.00        1     0.00     0.00  FlushPage
  0.00      0.06     0.00        1     0.00     0.00  SetVESAMode
  0.00      0.06     0.00        1     0.00     0.00  VESABegin
  0.00      0.06     0.00        1     0.00     0.00  main


P.S.

	If you have the time, check out another 
	message I posted here: "Making a keyboard handler".

- Raw text -


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