The MASM Forum Archive 2004 to 2012

Project Support Forums => MASM32 => Topic started by: MusicalMike on November 11, 2005, 11:36:48 PM

Title: Posible Bug in MASM32 October Release
Post by: MusicalMike on November 11, 2005, 11:36:48 PM
Posible bug in october eddition image

the following code


.486                                     
.model flat, stdcall                     
option casemap :none                     

include windows.inc
include kernel32.inc
include user32.inc
include msvcrt.inc
   
includelib kernel32.lib
includelib user32.lib
includelib msvcrt.lib

.data
int1 dd 22
int2 dd 6
output db "The result is %f ", 00h

.code
Start:

finit
fld 43.65
fidiv int1
fld 76.34
fld 3.1
fmul st(0), st(1)
fadd st(0), st(2)
fld 12.43
fimul int2
fld 140.2
fld 94.21
fdivr
fsubr st(0), st(1)
fdivr st(0), st(2)
sub esp, 8
fstp offset [esp]
push offset output
call crt_printf
add esp, 12
push 5000
call Sleep
leave
   
End Start



produced this output durring assemble


Assembling: C:\WinAsm\Projects\Scratch Pad2\floatingpoint\tut1.asm
C:\WinAsm\Projects\Scratch Pad2\floatingpoint\tut1.asm(35) : fatal error A1016: Internal Assembler Error


Ps. Incase you are wondering what the point of this code is, the answer is, there is no point, I know of many other ways to do what I am trying to do that works fine. The above is a translation of tutorial code from a Wrox Professional Assembly Language Book.
Title: Re: Posible Bug in MASM32 October Release
Post by: hutch-- on November 11, 2005, 11:52:05 PM
Mike,

I don't know what this has to do with the MASM32 October version, it is a potential problem with ML.EXE. While ML covers most problems, it is not particularly hard to construct examples that will generate tis error, often if you redirect the /EP output to a file you will see the error type referenced to COFFEMIT.C at the bottom of the list.
Title: Re: Posible Bug in MASM32 October Release
Post by: MusicalMike on November 12, 2005, 01:11:03 AM
I wasn't saying that it was a problem with the october release, but was implying that it was a "problem" that was still present as the october release. Since I know many "better" ways to write the above code, I should probably say, I don't believe its worth investigating. Thanks
Title: Re: Posible Bug in MASM32 October Release
Post by: raymond on November 12, 2005, 04:24:39 AM
The use of code such as:

fld 43.65

has never been (and probably never will be) accepted by the MASM assembler (i.e. ML.EXE) which is part and parcel of the MASM32 package. Many macros have been posted to circumvent that "problem" which generally consist in initializing a variable in the data section and then accessing that variable with the fld instruction. It is certainly not a "bug".

(MusicalMike: You probably know how to code it correctly but this post is aimed to those who may not yet be familiar with the FPU set of instructions allowed by the MASM assembler.)

Raymond
Title: Re: Posible Bug in MASM32 October Release
Post by: MusicalMike on November 16, 2005, 08:37:28 PM
I know, but I didn't want to retype the whole .data section where I correctly labeled 80 bit blocks of memory containing the respective floating point values, but didn't want to retype it, and it was late, and I was too tired to think to copy/paste the code.