MSM9203003: FNENI, FNCLEX Assembled Wrong After PROC USES

ID Number: Q81892

6.00 6.00a | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.0a

Summary:

PROBLEM ID: MSM9203003

SYMPTOMS

The Microsoft Macro Assembler (MASM) versions 6.0 and 6.0a

incorrectly assemble the FNENI or FNCLEX coprocessor instructions

if the instructions are used in a procedure declared with the PROC

USES directive. FNENI and FNCLEX used outsize of PROC USES

procedures assemble correctly.

RESOLUTION

Several methods can be used to work around this problem, including:

1. Using FENI or FCLEX instead of FNENI or FNCLEX.

2. Using a PROC without the USES directive.

3. Putting the opcode for FNENI or FNCLEX into the code directly.

The sample code below demonstrates this workaround. This could

also be done by setting up a macro that when invoked puts the

opcode into the code directly.

STATUS

Microsoft has confirmed this to be a problem in MASM versions 6.0

and 6.0a. We are researching this problem and will post new

information here as it becomes available.

More Information:

FENI enables interrupts by clearing the interrupt-enable mask in the

control word. Since the 80287, 80387, and 80486 coprocessors do not

have an interrupt-enable mask, this instruction is recognized but

ignored on these coprocessors. FENI is the wait version and FNENI is

the no-wait version.

FCLEX clears all coprocessor exception flags, the busy flag, and bit 7

in the status word. Bit 7 is the interrupt-request flag on the 8087

and the error-status flag on the 80287, 80387 and 80486 coprocessors.

FCLEX is the wait version and FNCLEX is the no-wait version.

If the following sample code is assembled, the FNENI and FNCLEX

instruction will generate the following code:

pop ax

iretd

pop ax

iret

Sample Code

-----------

; Assemble options needed: none

.MODEL small, c

.STACK

.CODE

.STARTUP

call func

.EXIT

func PROC USES ax

fneni ; This statement generates a pop ax and an iretd.

fnclex ; This statement generates a pop ax and an iret.

DW 0E0DBh ; This defines a FNENI statement.

DW 0E2DBh ; This defines a FNCLEX statement.

ret

func ENDP

END

Additional reference words: 6.00 6.00a