TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Mike Bilow
from: Russ Parks
date: 1996-01-28 02:15:40
subject: CSet++ and Asm

Mike Bilow wrote in a message to Russ Parks:

MB> {at}PID: BilowMail0.2

 I see you write your own stuff too :-)

MB> Russ Parks wrote in a message to All:

 RP> The FSTCW requires writing a 16-bit word, but every time I try
 RP> it, I get an access violation/page fault. The problem isn't in
 RP> the function declaration or anything like that, because a
 RP> simple FLD1 returns 1.0...

 MB> This is a good idea for a test, since the only difference is
 MB> whether you touch memory or not.  Your problem is in the
 MB> linker, since you got an ASM pseudo-op out of order.  I'll
 MB> explain below.

 RP>   Here's the .ASM file (I'm using MASM 5.1)

 RP>         TempCw  DW  0        ;Temp storage for use with the
 RP>         OldCw   DW  0        ;80x87 control word
 RP> DATA32  ENDS
 RP>         ASSUME CS:CODE32, DS:DATA32
 RP> CODE32  SEGMENT

 MB> Move the ASSUME to here, after SEGMENT.

 I just tried it. Same exception is raised.

 MB> You are being blown away by the linker, which is causing the
 MB> segment grouping to compute funny addresses.

 I have to agree with you there...though all my asm on PC's has been under
DOS -- until now 

 MB> Since you are linking with C generated code, the linker has to
 MB> realize that the offset within your local segment (DATA32) is
 MB> different from that with the group of all segments sharing the
 MB> combine class ('DATA').  This is why you need GROUP and ASSUME
 MB> directives, since you cannot accept the assembler default.

  I've gotten around the problem for now, by using ENTER/LEAVE with offsets
from EBP as temp storage... not pretty, but it'll work in the interim, or
until I get over the flu :-)

 Thanx!!!


Russ

..."Eww!  He's giving himself two weird heads!" -- Calvin
--- EZQuote 4.0
* Origin: Linux: The choice of a GNU generation (1:170/200.12)
SEEN-BY: 50/99 270/101 620/243 711/401 409 410 413 430 808 809 934 955
SEEN-BY: 712/407 515 517 628 713/888 800/1 7877/2809
@PATH: 170/200 400 396/1 270/101 712/515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.