www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/06/08:17:35

From: Aaron Dwyer <adwyer AT galaxy DOT csc DOT calpoly DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Protection disabling & Asm
Date: Wed, 06 Nov 1996 02:28:29 -0800
Organization: Cal Poly, San Luis Obispo
Lines: 45
Message-ID: <3280684D.55B7@galaxy.csc.calpoly.edu>
NNTP-Posting-Host: p102-13-w.palomar.reshall.calpoly.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've been doing graphics for some years in Borland C++ 3.1...and I've
always wanted protected mode, so I finally got into DJGPP, well sort
of...still getting used to all the AT&T, and just protected mode in
general.

2 questions:

1.	Should I really regret turning off protection so I can write my
buffer to vidmem?  It's just a safety net, correct?  I won't be risking
a crash or an incompatibility as long as I can handle my memory
correctly, right?

2.	Check out this inline asm block:

   //sin(t)->st, cos(t)->ct

   asm (
      "flds %2\n"    //line 0
      "fsincos\n"    //line 1
      "fstps %1\n"   //line 2
      "fstps %0\n"   //line 3
	: "=g" (st), "=g" (ct)
        : "g" (t)
       );

	This will compile correctly only if I don't pass the -O option to the
compiler...in other words I can only compile without optimization. 
Otherwise, the compiler generates assembly language code with lines 0,
2, and 3 trying to move data between the FPU stack and the CPU registers
directly, i.e.  line 2 compiles to

fstps %ebx

which is obviously a no-no.  I'd like to use the fsincos function in my
programs, so is there any way around what appears to be a faulty
compile?  I've tried asm volatile, but that just makes it have the error
even without optimizations enabled.  I'm wondering if I made some stupid
mistake or if there's an easy fix to this. 
I wanted to submit a bug report but in the info pages it says not to
submit errors regarding inline asm.

Any information concerning either of these issues would be greatly
appreciated!!!

Aaron Dwyer  <adwyer AT galaxy DOT csc DOT calpoly DOT edu>

- Raw text -


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